<commit_before>module.exports = function(grunt) {
    'use strict';

    // Project configuration.
    //neco
    grunt.initConfig({
        meta : {
            specs : ['spec/**/*.js'],
            src: 'src/**/*.js',
            example: 'example/**/*.js',
            files: ['Gruntfile.js', '<%= meta.src %>', '<%= meta.specs %>', '<%= meta.example %>'],
            bin : {
                coverage: 'bin/coverage'
            }
        },
        jasmine: {
            src: '<%= meta.src %>',
            options: {
                specs: '<%= meta.specs %>',
                template: require('grunt-template-jasmine-istanbul'),
                templateOptions: {
                    coverage: '<%= meta.bin.coverage %>/coverage.json',
                    report: [
                        {
                            type: 'html',
                            options: {
                                dir: '<%= meta.bin.coverage %>/html'
                            }
                        },
                        {
                            type: 'lcov',
                            options: {
                                dir: '<%= meta.bin.coverage %>/lcov'
                            }
                        }
                    ],
                    template: require('grunt-template-jasmine-requirejs'),
                    templateOptions: {
                        requireConfig: {
                            baseUrl: 'src/'
                        }
                    }
                }
            }
        },
        jshint: {
            all: '<%= meta.files %>',
            options: {
                jshintrc: '.jshintrc'
            }
        },
        watch: {
            files: '<%= meta.files %>',
            tasks: ['default']
        },
        requirejs: {
            standalone: {
                options: {
                    baseUrl: './src/',
                    name: '../bower_components/almond/almond',
                    include: ['verse'],
                    insertRequire: ['verse'],
                    out: 'build/verse.standalone.min.js',
                    findNestedDependencies: true,
                    mainConfigFile: 'src/main-config.js',
                    wrap: {
                        startFile: 'src/start.frag',
                        endFile: 'src/end.frag'
                    },
                    optimize: "uglify",
                    uglify: {
                        toplevel: true,
                        ascii_only: true,
                        beautify: false,
                        max_line_length: 1000,

                        //Skip the processor.ast_mangle() part of the uglify call (r.js 2.0.5+)
                        no_mangle: true
                    }
                }
            },
            amd: {
                options: {
                    baseUrl: './src/',
                    include: ['verse'],
                    insertRequire: ['verse'],
                    out: 'build/verse.amd.min.js',
                    wrap: true,
                    findNestedDependencies: true,
                    mainConfigFile: 'src/main-config.js',
                    optimize: "uglify",
                    uglify: {
                        toplevel: true,
                        ascii_only: true,
                        beautify: false,
                        max_line_length: 1000,

                        //Skip the processor.ast_mangle() part of the uglify call (r.js 2.0.5+)
                        no_mangle: true
                    }
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-requirejs');

    grunt.registerTask('test', ['jshint', 'jasmine']);

    grunt.registerTask('default', ['test']);

};
<commit_msg>Changed grunt-template-jasmine-istanbul config to run as on client side<commit_after>/* global requirejs, define */

module.exports = function(grunt) {
    'use strict';

    // Project configuration.
    //neco
    grunt.initConfig({
        meta: {
            package: grunt.file.readJSON('package.json'),
            specs: ['spec/**/*.js'],
            src: 'src/**/*.js',
            example: 'example/**/*.js',
            files: ['Gruntfile.js', '<%= meta.src %>', '<%= meta.specs %>', '<%= meta.example %>'],
            bin: {
                coverage: 'bin/coverage'
            }
        },
        jasmine: {
            src: '<%= meta.src %>',
            options: {
                specs: '<%= meta.specs %>',
                template: require('grunt-template-jasmine-istanbul'),
                templateOptions: {
                    coverage: '<%= meta.bin.coverage %>/coverage.json',
                    report: [{
                        type: 'html',
                        options: {
                            dir: '<%= meta.bin.coverage %>/html'
                        }
                    }, {
                        type: 'lcov',
                        options: {
                            dir: '<%= meta.bin.coverage %>/lcov'
                        }
                    }],
                    template: require('grunt-template-jasmine-requirejs'),
                    templateOptions: {
                        requireConfig: {
                            baseUrl: 'src/',
                            // 3. pass paths of the sources being instrumented as a configuration option
                            //    these paths should be the same as the jasmine task's src
                            //    unfortunately, grunt.config.get() doesn't work because the config is just being evaluated
                            config: {
                                instrumented: {
                                    src: grunt.file.expand('src/**/*.js')
                                }
                            },
                            // 4. use this callback to read the paths of the sources being instrumented and redirect requests to them appropriately
                            callback: function() {
                                define('instrumented', ['module'], function(module) {
                                    return module.config().src;
                                });
                                require(['instrumented'], function(instrumented) {
                                    var oldLoad = requirejs.load;
                                    requirejs.load = function(context, moduleName, url) {
                                        // normalize paths
                                        if (url.substring(0, 1) === '/') {
                                            url = url.substring(1);
                                        } else if (url.substring(0, 2) === './') {
                                            url = url.substring(2);
                                        }
                                        // redirect
                                        if (instrumented.indexOf(url) > -1) {
                                            url = './.grunt/grunt-contrib-jasmine/' + url;
                                        }
                                        return oldLoad.apply(this, [context, moduleName, url]);
                                    };
                                });
                            }
                        }
                    }
                }
            }
        },
        jshint: {
            all: '<%= meta.files %>',
            options: {
                jshintrc: '.jshintrc'
            }
        },
        watch: {
            files: '<%= meta.files %>',
            tasks: ['default']
        },
        requirejs: {
            standalone: {
                options: {
                    baseUrl: './src/',
                    name: '../bower_components/almond/almond',
                    include: ['verse'],
                    insertRequire: ['verse'],
                    out: 'build/verse.standalone.min.js',
                    findNestedDependencies: true,
                    mainConfigFile: 'src/main-config.js',
                    wrap: {
                        startFile: 'src/start.frag',
                        endFile: 'src/end.frag'
                    },
                    optimize: "uglify",
                    uglify: {
                        toplevel: true,
                        ascii_only: true,
                        beautify: false,
                        max_line_length: 1000,

                        //Skip the processor.ast_mangle() part of the uglify call (r.js 2.0.5+)
                        no_mangle: true
                    }
                }
            },
            amd: {
                options: {
                    baseUrl: './src/',
                    include: ['verse'],
                    insertRequire: ['verse'],
                    out: 'build/verse.amd.min.js',
                    wrap: true,
                    findNestedDependencies: true,
                    mainConfigFile: 'src/main-config.js',
                    optimize: "uglify",
                    uglify: {
                        toplevel: true,
                        ascii_only: true,
                        beautify: false,
                        max_line_length: 1000,

                        //Skip the processor.ast_mangle() part of the uglify call (r.js 2.0.5+)
                        no_mangle: true
                    }
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-requirejs');

    grunt.registerTask('test', ['jshint', 'jasmine']);

    grunt.registerTask('default', ['test']);

};
<|endoftext|>


<commit_before>var grunt = require("grunt");
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-istanbul');

grunt.initConfig({
	watch: {
		scripts: {
			files: ['src/**/*.js', '*.js', 'tests/*.js'
			],
			tasks: ['all'],
			options: {
				spawn: false
			}
		}
	},
	instrument: {
		files: ['src/**/*.js','tests/**/*.js'],
		options: {
			lazy: false,
			basePath: '.coverage'
		}
	},
	jshint: {
		all: ['src/**/*.js', '*.js', 'tests/**/*.js'],
		options:{
			esnext:true
		}
	},
	mochaTest: {
		test: {
			options: {
				reporter: 'spec',
				clearRequireCache:true
			},
			src: ['tests/**/*.js']
		},
		cov: {
			options: {
				reporter: 'spec',
				clearRequireCache:true
			},
			src: ['.coverage/tests/**/*.js']
		}
	},
	storeCoverage: {
		options: {
			dir: '.coverage/reports'
		}
	},
	makeReport: {
		src: '.coverage/reports/**/*.json',
		options: {
			type: 'html',
			dir: '.coverage/reports',
			print: 'both'
		}
	},
	release: {
		options: {
			bump: true,
			npm: true,
			changelog: 'CHANGELOG.md',
			changelogText: '### <%= version %> - ' + grunt.template.today('yyyy-mm-dd') + '\n',
			npmTag: "<%= version %>"
		}
	},
	exec: {
		express: 'node --debug examples/hello-express/index.js',
		hapi: 'node --debug examples/hello-hapi/index.js',
		restify: 'node --debug examples/hello-restify/index.js',
		koa: 'node --harmony-generators --debug examples/hello-koa/index.js'
	}

});
grunt.registerTask("cov-test", [ "instrument","mochaTest:cov", 'storeCoverage','makeReport']);
grunt.registerTask("test", ["mochaTest:test"]);
grunt.registerTask("coverage", ["jshint","cov-test"]);
grunt.registerTask("all", ["jshint", "test"]);
grunt.registerTask("default", ["all", "watch"]);
grunt.registerTask("prod", ["all", "release"]);

grunt.registerTask("example:express", 'exec:express');
grunt.registerTask("example:hapi", 'exec:hapi');
grunt.registerTask("example:restify", 'exec:restify');
grunt.registerTask("example:koa", 'exec:koa');
<commit_msg>update examples<commit_after>var grunt = require("grunt");
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-istanbul');

grunt.initConfig({
	watch: {
		scripts: {
			files: ['src/**/*.js', '*.js', 'tests/*.js'
			],
			tasks: ['all'],
			options: {
				spawn: false
			}
		}
	},
	instrument: {
		files: ['src/**/*.js','tests/**/*.js'],
		options: {
			lazy: false,
			basePath: '.coverage'
		}
	},
	jshint: {
		all: ['src/**/*.js', '*.js', 'tests/**/*.js'],
		options:{
			esnext:true
		}
	},
	mochaTest: {
		test: {
			options: {
				reporter: 'spec',
				clearRequireCache:true
			},
			src: ['tests/**/*.js']
		},
		cov: {
			options: {
				reporter: 'spec',
				clearRequireCache:true
			},
			src: ['.coverage/tests/**/*.js']
		}
	},
	storeCoverage: {
		options: {
			dir: '.coverage/reports'
		}
	},
	makeReport: {
		src: '.coverage/reports/**/*.json',
		options: {
			type: 'html',
			dir: '.coverage/reports',
			print: 'both'
		}
	},
	release: {
		options: {
			bump: true,
			npm: true,
			changelog: 'CHANGELOG.md',
			changelogText: '### <%= version %> - ' + grunt.template.today('yyyy-mm-dd') + '\n',
			npmTag: "<%= version %>"
		}
	},
	exec: {
		express: 'node --debug examples/hello-express/index.js'
	}

});
grunt.registerTask("cov-test", [ "instrument","mochaTest:cov", 'storeCoverage','makeReport']);
grunt.registerTask("test", ["mochaTest:test"]);
grunt.registerTask("coverage", ["jshint","cov-test"]);
grunt.registerTask("all", ["jshint", "test"]);
grunt.registerTask("default", ["all", "watch"]);
grunt.registerTask("prod", ["all", "release"]);

grunt.registerTask("example:express", 'exec:express');
<|endoftext|>


<commit_before>/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Load in the package information.
    pkg: grunt.file.readJSON("package.json"),

    // LESS CSS Compilation.
    // Compile the LESS source into the build directory.
    less: {
      production: {
        files: {
          "build/assets/status-page.css": "src/stylesheets/main.less",
        }
      }
    },

    // Source files into the build directory.
    copy: {
      main: {
        files: [
          // Copy the liquid template from src to the dist folder for push.
          { expand: true, flatten: true, src: "src/status-page.liquid", dest: "build/"},
          // Copy images over to the build and distribution folders.
          { expand: true, flatten: true, cwd: "src/images/", src: "**", dest: "build/assets/"}
        ]
      },
    },

    // Javascript validation.
    jshint: {
      // These are best practices taken as best practices from Bootstrap.
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        globals: {}
      },
      all: ["Gruntfile.js", "package.json", "fixtures/status-page.json"]
    },

    // Directory watching.
    watch: {
      theme: {
        files: 'src/**/*',
        tasks: ['deploy'],
        options: {
          interrupt: true,
        }
      }
    },

    // Release / Version of the theme.
    release: {
      options: {
        npmtag: false
      }
    },

    // Load in your sorry credentials.
    // NOTE: NEVER CHECK YOUR CREDENTIALS INTO YOUR REPOSITORY.
    sorry: grunt.file.readJSON('sorry.json'),

    // Sorry theme deployment.
    sorry_theme_deploy: {
      options: {
        username: '<%= sorry.username %>',
        password: '<%= sorry.password %>'
      },
      valid_theme: {
        expand: true,
        cwd: 'build/',
        src: ['**/*']
      }
    },

  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks("grunt-contrib-less");
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-sorry-theme-deploy');
  grunt.loadNpmTasks('grunt-release');

  // Default task(s).
  grunt.registerTask("build", ["jshint", "less", "copy"]);
  grunt.registerTask("deploy", ["build", "sorry_theme_deploy"]);

};<commit_msg>Disabled release to npm.<commit_after>/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Load in the package information.
    pkg: grunt.file.readJSON("package.json"),

    // LESS CSS Compilation.
    // Compile the LESS source into the build directory.
    less: {
      production: {
        files: {
          "build/assets/status-page.css": "src/stylesheets/main.less",
        }
      }
    },

    // Source files into the build directory.
    copy: {
      main: {
        files: [
          // Copy the liquid template from src to the dist folder for push.
          { expand: true, flatten: true, src: "src/status-page.liquid", dest: "build/"},
          // Copy images over to the build and distribution folders.
          { expand: true, flatten: true, cwd: "src/images/", src: "**", dest: "build/assets/"}
        ]
      },
    },

    // Javascript validation.
    jshint: {
      // These are best practices taken as best practices from Bootstrap.
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        globals: {}
      },
      all: ["Gruntfile.js", "package.json", "fixtures/status-page.json"]
    },

    // Directory watching.
    watch: {
      theme: {
        files: 'src/**/*',
        tasks: ['deploy'],
        options: {
          interrupt: true,
        }
      }
    },

    // Release / Version of the theme.
    release: {
      options: {
        npm: false
      }
    },

    // Load in your sorry credentials.
    // NOTE: NEVER CHECK YOUR CREDENTIALS INTO YOUR REPOSITORY.
    sorry: grunt.file.readJSON('sorry.json'),

    // Sorry theme deployment.
    sorry_theme_deploy: {
      options: {
        username: '<%= sorry.username %>',
        password: '<%= sorry.password %>'
      },
      valid_theme: {
        expand: true,
        cwd: 'build/',
        src: ['**/*']
      }
    },

  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks("grunt-contrib-less");
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-sorry-theme-deploy');
  grunt.loadNpmTasks('grunt-release');

  // Default task(s).
  grunt.registerTask("build", ["jshint", "less", "copy"]);
  grunt.registerTask("deploy", ["build", "sorry_theme_deploy"]);

};<|endoftext|>


<commit_before>module.exports = function(grunt) {

  'use strict';

  grunt.initConfig({

	pkg:    grunt.file.readJSON('package.json'),
	pulsar: grunt.file.readJSON('pulsar.json'),

	browserify: {
		dev: {
			files: {
				'dist/js/bundle.js': ['js/index.js'],
				'dist/js/test.js': ['tests/js/index.js']
			},
			options: {
                browserifyOptions: {
                    standalone: 'pulsar'
                }
            }
		},
		dist: {
			files: {
				'dist/js/bundle.js': ['js/index.js'],
				'dist/js/test.js': ['tests/js/index.js']
			},
			options: {
				browserifyOptions: {
                    standalone: 'pulsar'
                },
				transform: ['uglifyify']
			}
		}
	},

	phpunit: {
		classes: {
			dir: 'tests/unit/'
		},
		options: {
			bin: 'vendor/bin/phpunit',
			bootstrap: 'tests/unit/bootstrap.php',
			colors: true
		}
	},

	sass: {
		dev: {
			options: {
				style: 'nested',
				sourceMap: true
			},
			files: [{
				cwd:    'stylesheets/',
				dest:   'css/',
				expand: true,
				ext:    '.css',
				extDot: 'first',
				src:    '*.scss'
			}]
		},
		dist_modern: {
			options: {
				outputStyle: 'compressed'
			},
			files: [{
				cwd:    'stylesheets/',
				dest:   'dist/css/',
				expand: true,
				flatten: true,
				ext:    '.css',
				extDot: 'first',
				src:    ['pulsar.scss', 'documentation.scss']
			}]
		},
		dist_ie: {
			options: {
				outputStyle: 'nested'
			},
			files: [{
				cwd:    'stylesheets/',
				dest:   'dist/css/',
				expand: true,
				flatten: true,
				ext:    '.css',
				extDot: 'first',
				src:    'pulsar-ie*.scss'
			}]
		},
	},

	autoprefixer: {
		dev: {
			options: {
				browsers: ['last 2 version', 'ie 7', 'ie 8', 'ie 9']
			},
			expand: true,
			src:    'css/*.css'
		}
	},

	watch: {
		css: {
			files: ['stylesheets/**/*.scss'],
			tasks: ['sass:dev', 'autoprefixer'],
			options: {
				livereload: true,
			},
		},
		js: {
			files: ['js/**/*.js', 'tests/js/**/*', 'package.json'],
			tasks: ['browserify']
		}
	},

	jshint: {
		options: {
		jshintrc: '.jshintrc'
		},
		all: ['js/**/*.js']
	},

	mocha: {
		test: {
			src: ['tests/**/*.html'],
			options: {
				reporter: 'Nyan',
				run: true
			}
		},
	},

	uglify: {
		concat: {
			options: {
				banner: '<%= pkg.banner %>',
				beautify: true
			},
			files: {
				'dist/js/<%= pkg.name %>.js': ['js/**/*.js']
			}
			},
			minify: {
			options: {
				banner: '<%= pkg.banner %>',
				compress: true,
				report: 'min'
			},
			files: {
				'dist/js/<%= pkg.name %>.min.js': ['js/**/*.js']
			}
		}
	},

	asciify: {
		banner:{
		text: '<%= pkg.name %>',
		options: {
			font: 'univers',
			log: true
		}
		},
	},

	copy: {
      dist: {
        files: [{
                expand: true,
                cwd: '',
                src: [
                    'fonts/**/*',
                    'images/**/*',
                    'libs/**/*',
                    'views/pulsar/**/*',
                    'src/**/*'
                ],
                dest: 'dist/'
            }]
        }
    },

	clean: {
		dist: ['dist'],
		smoketest: ['tmp/failures/*']
	},

	bump: {
		options: {
		updateConfigs: ['pkg'],
		files: ['pulsar.json', 'package.json', 'composer.json', 'bower.json', 'VERSION'],
		commit: true,
		commitMessage: 'Release v%VERSION%',
		commitFiles: ['-a'],
		createTag: true,
		tagName: '%VERSION%',
		push: true,
		pushTo: 'origin'
		}
	},

	exec: {
		phantomcss: {
		cmd: 'phantomjs tests/css/testsuite.js'
		},
		updateComposer: {
		cmd: 'sudo php composer.phar update'
		},
		updateBrew: {
		cmd: 'brew update && brew upgrade'
		},
		updateBower: {
		cmd: 'bower update'
		},
		updateGems: {
		cmd: 'sudo gem update'
		},
		updateNpm: {
		cmd: 'sudo npm install'
		}
	}

  });

  grunt.config.set('leadingIndent.indentation', 'spaces');
  grunt.config.set('leadingIndent.files', {
	src : [
		'docs/**/*.md',
		'docs/**/*.php',
		'css/**/*',
		'js/**/*',
		'lexicon/**/*',
		'src/**/*',
		'stylesheets/**/*',
		'tests/**/*',
		'views/**/*'
	]
  });

 grunt.registerTask('default', ['sass:dev', 'browserify', 'watch']);

 grunt.registerTask('post-merge', ['sass:dev', 'browserify']);

 grunt.registerTask('build', [
 	'sass:dist_modern',
 	'sass:dist_ie',
 	'browserify:dist',
 	'copy:dist'
 ]);

 grunt.registerTask('pre-commit', [
	'asciify',
	'phpunit',
	'copy:readme'
  ]);

  grunt.registerTask('smoketest', [
	'clean:smoketest',
	'exec:phantomcss'
  ]);

  grunt.registerTask('update', [
	'exec:updateComposer',
	'exec:updateBrew',
	'exec:updateBower',
	'exec:updateGems',
	'exec:updateNpm'
  ]);

  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

};
<commit_msg>indentation<commit_after>module.exports = function(grunt) {

  'use strict';

  grunt.initConfig({

    pkg:    grunt.file.readJSON('package.json'),
    pulsar: grunt.file.readJSON('pulsar.json'),

    browserify: {
        dev: {
            files: {
                'dist/js/bundle.js': ['js/index.js'],
                'dist/js/test.js': ['tests/js/index.js']
            },
            options: {
                browserifyOptions: {
                    standalone: 'pulsar'
                }
            }
        },
        dist: {
            files: {
                'dist/js/bundle.js': ['js/index.js'],
                'dist/js/test.js': ['tests/js/index.js']
            },
            options: {
                browserifyOptions: {
                    standalone: 'pulsar'
                },
                transform: ['uglifyify']
            }
        }
    },

    phpunit: {
        classes: {
            dir: 'tests/unit/'
        },
        options: {
            bin: 'vendor/bin/phpunit',
            bootstrap: 'tests/unit/bootstrap.php',
            colors: true
        }
    },

    sass: {
        dev: {
            options: {
                style: 'nested',
                sourceMap: true
            },
            files: [{
                cwd:    'stylesheets/',
                dest:   'css/',
                expand: true,
                ext:    '.css',
                extDot: 'first',
                src:    '*.scss'
            }]
        },
        dist_modern: {
            options: {
                outputStyle: 'compressed'
            },
            files: [{
                cwd:    'stylesheets/',
                dest:   'dist/css/',
                expand: true,
                flatten: true,
                ext:    '.css',
                extDot: 'first',
                src:    ['pulsar.scss', 'documentation.scss']
            }]
        },
        dist_ie: {
            options: {
                outputStyle: 'nested'
            },
            files: [{
                cwd:    'stylesheets/',
                dest:   'dist/css/',
                expand: true,
                flatten: true,
                ext:    '.css',
                extDot: 'first',
                src:    'pulsar-ie*.scss'
            }]
        },
    },

    autoprefixer: {
        dev: {
            options: {
                browsers: ['last 2 version', 'ie 7', 'ie 8', 'ie 9']
            },
            expand: true,
            src:    'css/*.css'
        }
    },

    watch: {
        css: {
            files: ['stylesheets/**/*.scss'],
            tasks: ['sass:dev', 'autoprefixer'],
            options: {
                livereload: true,
            },
        },
        js: {
            files: ['js/**/*.js', 'tests/js/**/*', 'package.json'],
            tasks: ['browserify']
        }
    },

    jshint: {
        options: {
        jshintrc: '.jshintrc'
        },
        all: ['js/**/*.js']
    },

    mocha: {
        test: {
            src: ['tests/**/*.html'],
            options: {
                reporter: 'Nyan',
                run: true
            }
        },
    },

    uglify: {
        concat: {
            options: {
                banner: '<%= pkg.banner %>',
                beautify: true
            },
            files: {
                'dist/js/<%= pkg.name %>.js': ['js/**/*.js']
            }
            },
            minify: {
            options: {
                banner: '<%= pkg.banner %>',
                compress: true,
                report: 'min'
            },
            files: {
                'dist/js/<%= pkg.name %>.min.js': ['js/**/*.js']
            }
        }
    },

    asciify: {
        banner:{
        text: '<%= pkg.name %>',
        options: {
            font: 'univers',
            log: true
        }
        },
    },

    copy: {
      dist: {
        files: [{
                expand: true,
                cwd: '',
                src: [
                    'fonts/**/*',
                    'images/**/*',
                    'libs/**/*',
                    'views/pulsar/**/*',
                    'src/**/*'
                ],
                dest: 'dist/'
            }]
        }
    },

    clean: {
        dist: ['dist'],
        smoketest: ['tmp/failures/*']
    },

    bump: {
        options: {
        updateConfigs: ['pkg'],
        files: ['pulsar.json', 'package.json', 'composer.json', 'bower.json', 'VERSION'],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['-a'],
        createTag: true,
        tagName: '%VERSION%',
        push: true,
        pushTo: 'origin'
        }
    },

    exec: {
        phantomcss: {
        cmd: 'phantomjs tests/css/testsuite.js'
        },
        updateComposer: {
        cmd: 'sudo php composer.phar update'
        },
        updateBrew: {
        cmd: 'brew update && brew upgrade'
        },
        updateBower: {
        cmd: 'bower update'
        },
        updateGems: {
        cmd: 'sudo gem update'
        },
        updateNpm: {
        cmd: 'sudo npm install'
        }
    }

  });

  grunt.config.set('leadingIndent.indentation', 'spaces');
  grunt.config.set('leadingIndent.files', {
    src : [
        'docs/**/*.md',
        'docs/**/*.php',
        'css/**/*',
        'js/**/*',
        'lexicon/**/*',
        'src/**/*',
        'stylesheets/**/*',
        'tests/**/*',
        'views/**/*'
    ]
  });

 grunt.registerTask('default', ['sass:dev', 'browserify', 'watch']);

 grunt.registerTask('post-merge', ['sass:dev', 'browserify']);

 grunt.registerTask('build', [
    'sass:dist_modern',
    'sass:dist_ie',
    'browserify:dist',
    'copy:dist'
 ]);

 grunt.registerTask('pre-commit', [
    'asciify',
    'phpunit',
    'copy:readme'
  ]);

  grunt.registerTask('smoketest', [
    'clean:smoketest',
    'exec:phantomcss'
  ]);

  grunt.registerTask('update', [
    'exec:updateComposer',
    'exec:updateBrew',
    'exec:updateBower',
    'exec:updateGems',
    'exec:updateNpm'
  ]);

  // load all grunt tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

};
<|endoftext|>


<commit_before>/**
 * Grunt build file for Doppio.
 * Bootstraps ourselves from JavaScript into TypeScript.
 */
var Grunttasks, glob = require('glob'), ts_files = [], ts_files_to_compile = [],
    fs = require('fs'),
    child_process = require('child_process'),
    path = require('path'),
    ts_path = path.resolve('node_modules', '.bin', 'tsc'),
    result,
    ignoreCompileErrors = process.argv.indexOf('--grunt-ignore-compile-errors') !== -1;

/**
 * For a given TypeScript file, checks if we should recompile it based on
 * modification time.
 */
function shouldRecompile(file) {
  var jsFile = file.slice(0, file.length - 2) + 'js';
  // Recompile if a JS version doesn't exist, OR if the TS version has a
  // greater modification time.
  return !fs.existsSync(jsFile) || fs.statSync(file).mtime.getTime() > fs.statSync(jsFile).mtime.getTime();
}

ts_files = glob.sync('tasks/*.ts');
ts_files.push('Grunttasks.ts');

// Node glob returns *nix-style path separators.
// Let's resolve every path to convert to the current system's
// separators.
ts_files.forEach(function(e, i) {
  e = path.resolve(e);
  if (shouldRecompile(e)) {
    ts_files_to_compile.push(e);
    console.log("Recompiling " + e + "...");
  }
});

// Run!
if (ts_files_to_compile.length > 0) {
  ts_files_to_compile.push('typings/tsd.d.ts');
  result = child_process.spawnSync(ts_path, ['--noImplicitAny', '--module', 'commonjs'].concat(ts_files_to_compile));
  if (!ignoreCompileErrors && result.status !== 0) {
    throw new Error("Compilation error: " + result.stdout + "\n" + result.stderr);
  }
}

Grunttasks = require('./Grunttasks');
module.exports = Grunttasks.setup;
<commit_msg>Fix `grunt` in Windows.<commit_after>/**
 * Grunt build file for Doppio.
 * Bootstraps ourselves from JavaScript into TypeScript.
 */
var Grunttasks, glob = require('glob'), ts_files = [], ts_files_to_compile = [],
    fs = require('fs'),
    child_process = require('child_process'),
    path = require('path'),
    ts_path = path.resolve('node_modules', '.bin', 'tsc' + (process.platform === "win32" ? ".cmd" : "")),
    result,
    ignoreCompileErrors = process.argv.indexOf('--grunt-ignore-compile-errors') !== -1;

/**
 * For a given TypeScript file, checks if we should recompile it based on
 * modification time.
 */
function shouldRecompile(file) {
  var jsFile = file.slice(0, file.length - 2) + 'js';
  // Recompile if a JS version doesn't exist, OR if the TS version has a
  // greater modification time.
  return !fs.existsSync(jsFile) || fs.statSync(file).mtime.getTime() > fs.statSync(jsFile).mtime.getTime();
}

ts_files = glob.sync('tasks/*.ts');
ts_files.push('Grunttasks.ts');

// Node glob returns *nix-style path separators.
// Let's resolve every path to convert to the current system's
// separators.
ts_files.forEach(function(e, i) {
  e = path.resolve(e);
  if (shouldRecompile(e)) {
    ts_files_to_compile.push(e);
    console.log("Recompiling " + e + "...");
  }
});

// Run!
if (ts_files_to_compile.length > 0) {
  ts_files_to_compile.push('typings/tsd.d.ts');
  result = child_process.spawnSync(ts_path, ['--noImplicitAny', '--module', 'commonjs'].concat(ts_files_to_compile));
  if (!ignoreCompileErrors && result.status !== 0) {
    throw new Error("Compilation error: " + result.stdout + "\n" + result.stderr);
  }
}

Grunttasks = require('./Grunttasks');
module.exports = Grunttasks.setup;
<|endoftext|>


<commit_before>/*
 * grunt-aws-api-swagger-export
 *
 *
 * Copyright (c) 2017 Jason Pecsek
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    jshint: {
      all: [
        'Gruntfile.js',
        'tasks/*.js',
        '<%= nodeunit.tests %>'
      ],
      options: {
        jshintrc: '.jshintrc'
      }
    }

    // Configuration to be run (and then tested).
    aws_api_swagger_export: {

		options: {
			auth: {
				accessKeyId: "XXXXXXX",
				secretAccessKey: "XXXXXXX",
				region: "XXXXXXX",
				apiVersion: '2015-07-09' //optional
			},
			path: {

				exportType : 'swagger', // required
				// Each API is assigned an ID. Found in API Gateway Console header
				// by selecting API.
				restApiId : 'XXXXXXX', // required
				stageName : 'XXXXXXX', // required
				accepts : 'application/json'
			},
			output: {
				fileName: 'XXX.json'
			}
		}
    }

  });

  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  grunt.registerTask('default', ['aws_api_swagger_export']);

};
<commit_msg>Missing comma<commit_after>/*
 * grunt-aws-api-swagger-export
 *
 *
 * Copyright (c) 2017 Jason Pecsek
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    jshint: {
      all: [
        'Gruntfile.js',
        'tasks/*.js',
        '<%= nodeunit.tests %>'
      ],
      options: {
        jshintrc: '.jshintrc'
      }
    },

    // Configuration to be run (and then tested).
    aws_api_swagger_export: {

		options: {
			auth: {
				accessKeyId: "XXXXXXX",
				secretAccessKey: "XXXXXXX",
				region: "XXXXXXX",
				apiVersion: '2015-07-09' //optional
			},
			path: {

				exportType : 'swagger', // required
				// Each API is assigned an ID. Found in API Gateway Console header
				// by selecting API.
				restApiId : 'XXXXXXX', // required
				stageName : 'XXXXXXX', // required
				accepts : 'application/json'
			},
			output: {
				fileName: 'XXX.json'
			}
		}
    }

  });

  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  grunt.registerTask('default', ['aws_api_swagger_export']);

};
<|endoftext|>


<commit_before>/*
 * System Runtime
 *
 * https://designfirst.io/systemruntime/
 *
 * Copyright 2019 Erwan Carriou
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

module.exports = grunt => {
  // load tasks
  require('load-grunt-tasks')(grunt);

  // init configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    watch: grunt.file.readJSON('tasks/watch.json'),
    clean: grunt.file.readJSON('tasks/clean.json'),
    eslint: grunt.file.readJSON('tasks/eslint.json'),
    mocha_istanbul: grunt.file.readJSON('tasks/mocha_istanbul.json'),
    karma: grunt.file.readJSON('tasks/karma.json'),
    browserify: grunt.file.readJSON('tasks/browserify.json'),
    uglify: grunt.file.readJSON('tasks/uglify.json'),
    concat: grunt.file.readJSON('tasks/concat.json'),
    json_merge: grunt.file.readJSON('tasks/json_merge.json')
  });

  // dev
  grunt.registerTask('dev', [
    'watch'
  ]);

  // test
  grunt.registerTask('test', [
    'eslint',
    'json_merge',
    'concat:system',
    'mocha_istanbul:coverage',
    'karma:release'
  ]);

  // build
  grunt.registerTask('build', [
    'clean',
    'json_merge',
    'concat:system',
    'browserify:debug',
    'browserify:release',
    'uglify:release',
    'concat:license'
  ]);

  // coveralls
  grunt.registerTask('coveralls', [
    'json_merge',
    'concat:system',
    'mocha_istanbul:coveralls'
  ]);

  if (process.env.TRAVIS) {
    grunt.event.on('coverage', (lcov, done) => {
      require('coveralls').handleInput(lcov, (err) => {
        if (err) {
          return done(err);
        }
        done();
      });
    });
  }
};
<commit_msg>update scripts<commit_after>/*
 * System Runtime
 *
 * https://designfirst.io/systemruntime/
 *
 * Copyright 2019 Erwan Carriou
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

module.exports = grunt => {
  // load tasks
  require('load-grunt-tasks')(grunt);

  // init configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    watch: grunt.file.readJSON('tasks/watch.json'),
    clean: grunt.file.readJSON('tasks/clean.json'),
    eslint: grunt.file.readJSON('tasks/eslint.json'),
    mocha_istanbul: grunt.file.readJSON('tasks/mocha_istanbul.json'),
    karma: grunt.file.readJSON('tasks/karma.json'),
    browserify: grunt.file.readJSON('tasks/browserify.json'),
    uglify: grunt.file.readJSON('tasks/uglify.json'),
    concat: grunt.file.readJSON('tasks/concat.json'),
    json_merge: grunt.file.readJSON('tasks/json_merge.json')
  });

  // dev
  grunt.registerTask('dev', [
    'watch'
  ]);

  // test
  grunt.registerTask('test', [
    'eslint',
    'mocha_istanbul:coverage',
    'karma:release'
  ]);

  // build
  grunt.registerTask('build', [
    'clean',
    'json_merge',
    'concat:system',
    'browserify:debug',
    'browserify:release',
    'uglify:release',
    'concat:license'
  ]);

  // coveralls
  grunt.registerTask('coveralls', [
    'mocha_istanbul:coveralls'
  ]);

  if (process.env.TRAVIS) {
    grunt.event.on('coverage', (lcov, done) => {
      require('coveralls').handleInput(lcov, (err) => {
        if (err) {
          return done(err);
        }
        done();
      });
    });
  }
};
<|endoftext|>


<commit_before>const http = require('http');

const PORT = 3000;

async function requestHandler(request, response) {
  response.end('Hello world!');
}

const server = http.createServer(requestHandler);

server.listen(PORT, (err) => {
  if (err) {
    return console.log('something bad happened', err)
  }
  console.log(`deploying server is listening on ${PORT}`)
});
<commit_msg>[watchu] example hello world server updated<commit_after>const http = require('http');

const PORT = 3000;

async function requestHandler(request, response) {
  response.end('Hello world! from another version');
}

const server = http.createServer(requestHandler);

server.listen(PORT, (err) => {
  if (err) {
    return console.log('something bad happened', err)
  }
  console.log(`deploying server is listening on ${PORT}`)
});
<|endoftext|>


<commit_before>module.exports = function(grunt) {
    'use strict';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        jshint: {
            all: {
                src: ['histery.js', 'Gruntfile.js'],
                options: {
                    jshintrc: '.jshintrc'
                }
            }
        },

        uglify: {
            options: {
                preserveComments: 'some',
                report: 'gzip'
            },
            build: {
                src: 'histery.js',
                dest: 'histery.min.js'
            }
        },

        qunit: {
            all: {
                options: {
                    urls: ['http://localhost:3000/']
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-qunit');

    var webserver;

    grunt.registerTask('testInit', function() {
        var express = require('express');
        webserver = express();
        webserver.get(new RegExp('^/histery.js'), function(req, res) { res.sendfile('histery.js'); });
        webserver.get(new RegExp('^/qunit.css'), function(req, res) { res.sendfile('node_modules/qunitjs/qunit/qunit.css'); });
        webserver.get(new RegExp('^/qunit.js'), function(req, res) { res.sendfile('node_modules/qunitjs/qunit/qunit.js'); });
        webserver.get(new RegExp('^/jquery.js'), function(req, res) { res.sendfile('node_modules/jquery-browser/lib/jquery.js'); });
        webserver.get(new RegExp('^/test.js'), function(req, res) { res.sendfile('test/test.js'); });
        webserver.get(new RegExp('^/'), function(req, res) { res.sendfile('test/index.html'); });
        webserver = webserver.listen(3000);
        grunt.log.writeln('Listening on port 3000');
    });
    grunt.registerTask('testCleanup', function() {
        grunt.log.writeln('Shutting down server on port 3000');
        webserver.close();
    });
    grunt.registerTask('test', ['testInit', 'qunit', 'testCleanup']);

    grunt.registerTask('default', ['jshint', 'uglify', 'test']);
};
<commit_msg>No need for regexps here.<commit_after>module.exports = function(grunt) {
    'use strict';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        jshint: {
            all: {
                src: ['histery.js', 'Gruntfile.js'],
                options: {
                    jshintrc: '.jshintrc'
                }
            }
        },

        uglify: {
            options: {
                preserveComments: 'some',
                report: 'gzip'
            },
            build: {
                src: 'histery.js',
                dest: 'histery.min.js'
            }
        },

        qunit: {
            all: {
                options: {
                    urls: ['http://localhost:3000/']
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-qunit');

    var webserver;

    grunt.registerTask('testInit', function() {
        var express = require('express');
        webserver = express();
        webserver.get('/histery.js', function(req, res) { res.sendfile('histery.js'); });
        webserver.get('/qunit.css', function(req, res) { res.sendfile('node_modules/qunitjs/qunit/qunit.css'); });
        webserver.get('/qunit.js', function(req, res) { res.sendfile('node_modules/qunitjs/qunit/qunit.js'); });
        webserver.get('/jquery.js', function(req, res) { res.sendfile('node_modules/jquery-browser/lib/jquery.js'); });
        webserver.get('/test.js', function(req, res) { res.sendfile('test/test.js'); });
        webserver.get('/', function(req, res) { res.sendfile('test/index.html'); });
        webserver = webserver.listen(3000);
        grunt.log.writeln('Listening on port 3000');
    });
    grunt.registerTask('testCleanup', function() {
        grunt.log.writeln('Shutting down server on port 3000');
        webserver.close();
    });
    grunt.registerTask('test', ['testInit', 'qunit', 'testCleanup']);

    grunt.registerTask('default', ['jshint', 'uglify', 'test']);
};
<|endoftext|>


<commit_before>import Users from 'meteor/vulcan:users';
import { schemaDefaultValue } from '../../collectionUtils';

//
// Votes. From the user's perspective, they have a vote-state for each voteable
// entity (post/comment), which is either neutral (the default), upvote,
// downvote, big-upvote or big-downvote.
//
// When you vote and then change it, three things happen. A new vote is created
// for the new vote state (unless that's neutral). First, the old vote has
// 'cancelled' set to true. Second, an "unvote" is created, also with cancelled
// set to true, but with the timestamp corresponding to the moment you changed
// the vote. The power of an unvote is the opposite of the power of the vote
// that was reversed.
//

const schema = {
  _id: {
    type: String,
    canRead: ['guests'],
  },

  // The id of the document that was voted on
  documentId: {
    type: String,
    canRead: ['guests'],
  },

  // The name of the collection the document belongs to
  collectionName: {
    type: String,
    canRead: ['guests'],
  },

  // The id of the user that voted
  userId: {
    type: String,
    canRead: Users.owns,
  },

  // The ID of the author of the document that was voted on
  authorId: {
    type: String,
    denormalized: true, // Can be inferred from documentId
    canRead: ['guests'],
  },

  // The type of vote, eg smallDownvote, bigUpvote. If this is an unvote, then
  // voteType is the type of the vote that was reversed.
  voteType: {
    type: String,
    canRead: ['guests'],
  },

  // The vote power - that is, the effect this vote had on the comment/post's
  // score. Positive for upvotes, negative for downvotes, based on whether it's
  // a regular or strong vote and on the voter's karma at the time the vote was
  // made. If this is an unvote, then the opposite: negative for undoing an
  // upvote, positive for undoing a downvote.
  power: {
    type: Number,
    optional: true,
    canRead: Users.owns,

    // Can be inferred from userId+voteType+votedAt (votedAt necessary because
    // the user's vote power may have changed over time)
    denormalized: true,
  },

  // Whether this vote has been cancelled (by un-voting or switching to a
  // different vote type) or is itself an unvote/cancellation.
  cancelled: {
    type: Boolean,
    canRead: ['guests'],
    ...schemaDefaultValue(false),
  },

  // Whether this is an unvote.
  isUnvote: {
    type: Boolean,
    canRead: ['guests'],
    ...schemaDefaultValue(false),
  },

  // Time this vote was cast. If this is an unvote, the time the vote was
  // reversed.
  votedAt: {
    type: Date,
    optional: true,
    canRead: Users.owns,
  }

};

export default schema;
<commit_msg>Add foreignKey type metadata to new vote fields<commit_after>import Users from 'meteor/vulcan:users';
import { schemaDefaultValue } from '../../collectionUtils';

//
// Votes. From the user's perspective, they have a vote-state for each voteable
// entity (post/comment), which is either neutral (the default), upvote,
// downvote, big-upvote or big-downvote.
//
// When you vote and then change it, three things happen. A new vote is created
// for the new vote state (unless that's neutral). First, the old vote has
// 'cancelled' set to true. Second, an "unvote" is created, also with cancelled
// set to true, but with the timestamp corresponding to the moment you changed
// the vote. The power of an unvote is the opposite of the power of the vote
// that was reversed.
//

const schema = {
  _id: {
    type: String,
    canRead: ['guests'],
  },

  // The id of the document that was voted on
  documentId: {
    type: String,
    canRead: ['guests'],
    // No explicit foreign-key relation because which collection this is depends on collectionName
  },

  // The name of the collection the document belongs to
  collectionName: {
    type: String,
    canRead: ['guests'],
  },

  // The id of the user that voted
  userId: {
    type: String,
    canRead: Users.owns,
    foreignKey: 'Users',
  },

  // The ID of the author of the document that was voted on
  authorId: {
    type: String,
    denormalized: true, // Can be inferred from documentId
    canRead: ['guests'],
    foreignKey: 'Users',
  },

  // The type of vote, eg smallDownvote, bigUpvote. If this is an unvote, then
  // voteType is the type of the vote that was reversed.
  voteType: {
    type: String,
    canRead: ['guests'],
  },

  // The vote power - that is, the effect this vote had on the comment/post's
  // score. Positive for upvotes, negative for downvotes, based on whether it's
  // a regular or strong vote and on the voter's karma at the time the vote was
  // made. If this is an unvote, then the opposite: negative for undoing an
  // upvote, positive for undoing a downvote.
  power: {
    type: Number,
    optional: true,
    canRead: Users.owns,

    // Can be inferred from userId+voteType+votedAt (votedAt necessary because
    // the user's vote power may have changed over time)
    denormalized: true,
  },

  // Whether this vote has been cancelled (by un-voting or switching to a
  // different vote type) or is itself an unvote/cancellation.
  cancelled: {
    type: Boolean,
    canRead: ['guests'],
    ...schemaDefaultValue(false),
  },

  // Whether this is an unvote.
  isUnvote: {
    type: Boolean,
    canRead: ['guests'],
    ...schemaDefaultValue(false),
  },

  // Time this vote was cast. If this is an unvote, the time the vote was
  // reversed.
  votedAt: {
    type: Date,
    optional: true,
    canRead: Users.owns,
  }

};

export default schema;
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {
  // show elapsed time at the end
  require('time-grunt')(grunt);
  // load all grunt tasks
  require('load-grunt-tasks')(grunt);

  var package = {
    path: 'packages/ember-oauth2'
    dist: 'dist'
  }

  grunt.initConfig({
    jasmine: {
      pivotal: {
        src: '<%= package.path %>/lib/*.js'
        options: {
          specs: '<%= package.path %>/specs/*.spec.js'
          helpers: '<%= package.path %>/helpers/*.js'
        }
      }
    }
  });
}
<commit_msg>config Grunt<commit_after>'use strict';

module.exports = function(grunt) {
  // show elapsed time at the end
  require('time-grunt')(grunt);
  // load all grunt tasks
  require('load-grunt-tasks')(grunt);

  var package = {
    dir: 'packages/ember-oauth2'
    lib: 'packages/ember-oauth2/lib/*.js'
    dist: 'dist'
  }

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json');
    jasmine: {
      pivotal: {
        src: '<%= package.lib %>'
        options: {
          specs: '<%= package.dir %>/specs/*.spec.js'
          helpers: '<%= package.dir %>/helpers/*.js'
        }
      }
    }
    uglify: {
      options: {
        // the banner is inserted at the top of the output
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
        //
      }
      dist: {
        files: {
          '<%= package.dist %>/<%= pkg.name %>.min.js': ['<%= package.lib %>']
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.registerTask('default', ['jshint', 'uglify', 'jasmine']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  var pkg = grunt.file.readJSON('package.json');
  var betaVersion = pkg.version.toString() + "." + (Math.floor(Date.now() / 60000) - 24365210);

  grunt.initConfig({
    pkg: pkg,

    copy: {
      // Copy all files to a staging directory
      main: {
        cwd: 'app/',
        src: '**',
        dest: 'build/extension/',
        expand: true
      },
      beta_icons: {
        cwd: 'beta-icons/',
        src: '**',
        dest: 'build/extension/',
        expand: true
      }
    },

    compress: {
      // Zip up the extension
      main: {
        options: {
          archive: 'build/dim-extension.zip'
        },
        files: [
          { expand: true, cwd: 'build/extension/', src: ['**'], dest: '/', filter: 'isFile'},
        ]
      }
    },

    // Clean out generated extension files
    clean: ["build/extension", "build/dim-extension.zip"],

    replace: {
      // Replace all instances of $DIM_VERSION with the version number from package.json
      main_version: {
        src: ['build/extension/**/*.{json,html,js}'],
        overwrite: true,
        replacements: [{
          from: '$DIM_VERSION',
          to: pkg.version.toString()
        }]
      },
      // Replace all instances of $DIM_VERSION or the current version number (from package.json)
      // with a beta version based on the current time.
      beta_version: {
        src: ['build/extension/**/*.{json,html,js}'],
        overwrite: true,
        replacements: [{
          from: '$DIM_VERSION',
          to: betaVersion
        }, {
          from: pkg.version.toString(),
          to: betaVersion
        }]
      }
    },

    sass: {
        dist: {
          files: {
            'app/styles/main.css': 'app/scss/main.scss'
          }
        }
      },

      postcss: {
        options: {
          processors: [
            require('autoprefixer')()
          ]
        },
        dist: {
         src: 'app/styles/main.css',
         dest: 'app/styles/main.css'
        }
      },

      watch:{
        scripts:{
          files:['app/scss/*.scss'],
          tasks:['css'],
          options:{spawn:false}
        }
      },

    // See https://github.com/c301/grunt-webstore-upload
    webstore_upload: {
      "accounts": {
        // This is set up by environment variables from Travis. To
        // push locally, create a file with these variables defined
        // and source it before running "grunt publish:beta". E.g.:
        //
        // ./beta_credentials:
        //
        // export CHROME_CLIENT_ID="foo"
        // export CHROME_SECRET="bar"
        // export CHROME_REFRESH_TOKEN="baz"
        //
        // Then run "source ./beta_credentials; grunt publish-beta"
        //
        // To set up these variables to be available in Travis:
        // travis encrypt CHROME_CLIENT_ID=super_secret --add env.matrix
        // travis encrypt CHROME_SECRET=super_secret --add env.matrix
        // travis encrypt CHROME_REFRESH_TOKEN=super_secret --add env.matrix
        "default": { //account under this section will be used by default
          publish: true, //publish item right after uploading. default false
          client_id: process.env.CHROME_CLIENT_ID,
          client_secret: process.env.CHROME_SECRET,
          refresh_token: process.env.CHROME_REFRESH_TOKEN
        }
      },
      "extensions": {
        "beta": {
          //required
          appID: "mkiipknpfaacbjdagdeppdacpgpdjklc",
          publish: true,
          //required, we can use dir name and upload most recent zip file
          zip: "build/dim-extension.zip"
        }
      }
    }
  });

  grunt.registerTask('css', ['sass', 'postcss']);

  grunt.loadNpmTasks('grunt-webstore-upload');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-text-replace');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-postcss');
  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('update_beta_manifest', function() {
    var manifest = grunt.file.readJSON('build/extension/manifest.json');
    manifest.name = manifest.name + " Beta";
    manifest.version = betaVersion;
    grunt.file.write('build/extension/manifest.json', JSON.stringify(manifest));
  });

  grunt.registerTask('log_beta_version', function() {
    grunt.log.ok("New Beta version is " + betaVersion);
  });

  // Builds the Beta extension and publishes
  grunt.registerTask('publish_beta', ['clean',
                                      'css',
                                      'copy:main',
                                      'copy:beta_icons',
                                      'replace:beta_version',
                                      'update_beta_manifest',
                                      'compress',
                                      'webstore_upload:beta',
                                      'log_beta_version']);

  // Builds a release-able extension in build/dim-extension.zip
  grunt.registerTask('build_extension', ['clean',
                                      'css',
                                      'copy:main',
                                      'replace:main_version',
                                      'compress']);

};
<commit_msg>Fix beta version in about page.<commit_after>module.exports = function(grunt) {
  var pkg = grunt.file.readJSON('package.json');
  var betaVersion = pkg.version.toString() + "." + (Math.floor(Date.now() / 60000) - 24365210);

  grunt.initConfig({
    pkg: pkg,

    copy: {
      // Copy all files to a staging directory
      main: {
        cwd: 'app/',
        src: '**',
        dest: 'build/extension/',
        expand: true
      },
      beta_icons: {
        cwd: 'beta-icons/',
        src: '**',
        dest: 'build/extension/',
        expand: true
      }
    },

    compress: {
      // Zip up the extension
      main: {
        options: {
          archive: 'build/dim-extension.zip'
        },
        files: [
          { expand: true, cwd: 'build/extension/', src: ['**'], dest: '/', filter: 'isFile'},
        ]
      }
    },

    // Clean out generated extension files
    clean: ["build/extension", "build/dim-extension.zip"],

    replace: {
      // Replace all instances of $DIM_VERSION with the version number from package.json
      main_version: {
        src: ['build/extension/**/*.{json,html,js}'],
        overwrite: true,
        replacements: [{
          from: '$DIM_VERSION',
          to: pkg.version.toString()
        }]
      },
      // Replace all instances of $DIM_VERSION or the current version number (from package.json)
      // with a beta version based on the current time.
      beta_version: {
        src: ['build/extension/**/*.{json,html,js}'],
        overwrite: true,
        replacements: [{
          from: pkg.version.toString(),
          to: betaVersion
        }, {
          from: '$DIM_VERSION',
          to: betaVersion
        }]
      }
    },

    sass: {
        dist: {
          files: {
            'app/styles/main.css': 'app/scss/main.scss'
          }
        }
      },

      postcss: {
        options: {
          processors: [
            require('autoprefixer')()
          ]
        },
        dist: {
         src: 'app/styles/main.css',
         dest: 'app/styles/main.css'
        }
      },

      watch:{
        scripts:{
          files:['app/scss/*.scss'],
          tasks:['css'],
          options:{spawn:false}
        }
      },

    // See https://github.com/c301/grunt-webstore-upload
    webstore_upload: {
      "accounts": {
        // This is set up by environment variables from Travis. To
        // push locally, create a file with these variables defined
        // and source it before running "grunt publish:beta". E.g.:
        //
        // ./beta_credentials:
        //
        // export CHROME_CLIENT_ID="foo"
        // export CHROME_SECRET="bar"
        // export CHROME_REFRESH_TOKEN="baz"
        //
        // Then run "source ./beta_credentials; grunt publish-beta"
        //
        // To set up these variables to be available in Travis:
        // travis encrypt CHROME_CLIENT_ID=super_secret --add env.matrix
        // travis encrypt CHROME_SECRET=super_secret --add env.matrix
        // travis encrypt CHROME_REFRESH_TOKEN=super_secret --add env.matrix
        "default": { //account under this section will be used by default
          publish: true, //publish item right after uploading. default false
          client_id: process.env.CHROME_CLIENT_ID,
          client_secret: process.env.CHROME_SECRET,
          refresh_token: process.env.CHROME_REFRESH_TOKEN
        }
      },
      "extensions": {
        "beta": {
          //required
          appID: "mkiipknpfaacbjdagdeppdacpgpdjklc",
          publish: true,
          //required, we can use dir name and upload most recent zip file
          zip: "build/dim-extension.zip"
        }
      }
    }
  });

  grunt.registerTask('css', ['sass', 'postcss']);

  grunt.loadNpmTasks('grunt-webstore-upload');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-text-replace');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-postcss');
  grunt.loadNpmTasks('grunt-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('update_beta_manifest', function() {
    var manifest = grunt.file.readJSON('build/extension/manifest.json');
    manifest.name = manifest.name + " Beta";
    manifest.version = betaVersion;
    grunt.file.write('build/extension/manifest.json', JSON.stringify(manifest));
  });

  grunt.registerTask('log_beta_version', function() {
    grunt.log.ok("New Beta version is " + betaVersion);
  });

  // Builds the Beta extension and publishes
  grunt.registerTask('publish_beta', ['clean',
                                      'css',
                                      'copy:main',
                                      'copy:beta_icons',
                                      'replace:beta_version',
                                      'update_beta_manifest',
                                      'compress',
                                      'webstore_upload:beta',
                                      'log_beta_version']);

  // Builds a release-able extension in build/dim-extension.zip
  grunt.registerTask('build_extension', ['clean',
                                      'css',
                                      'copy:main',
                                      'replace:main_version',
                                      'compress']);

};
<|endoftext|>


<commit_before>import * as React from 'react';
import PropTypes from 'prop-types';
import { TransitionGroup } from 'react-transition-group';
import clsx from 'clsx';
import { keyframes } from '@material-ui/system';
import styled from '../styles/styled';
import useThemeProps from '../styles/useThemeProps';
import Ripple from './Ripple';
import touchRippleClasses from './touchRippleClasses';

const DURATION = 550;
export const DELAY_RIPPLE = 80;

const enterKeyframe = keyframes`
  0% {
    transform: scale(0);
    opacity: 0.1;
  }

  100% {
    transform: scale(1);
    opacity: 0.3;
  }
`;

const exitKeyframe = keyframes`
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
`;

const pulsateKeyframe = keyframes`
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.92);
  }

  100% {
    transform: scale(1);
  }
`;

export const TouchRippleRoot = styled('span', {
  name: 'MuiTouchRipple',
  slot: 'Root',
  skipSx: true,
})({
  overflow: 'hidden',
  pointerEvents: 'none',
  position: 'absolute',
  zIndex: 0,
  top: 0,
  right: 0,
  bottom: 0,
  left: 0,
  borderRadius: 'inherit',
});

// This `styled()` function invokes keyframes. `styled-components` only supports keyframes
// in string templates. Do not convert these styles in JS object as it will break.
export const TouchRippleRipple = styled(Ripple, {
  name: 'MuiTouchRipple',
  slot: 'Ripple',
})`
  opacity: 0;
  position: absolute;

  &.${touchRippleClasses.rippleVisible} {
    opacity: 0.3;
    transform: scale(1);
    animation-name: ${enterKeyframe};
    animation-duration: ${DURATION}ms;
    animation-timing-function: ${({ theme }) => theme.transitions.easing.easeInOut};
  }

  &.${touchRippleClasses.ripplePulsate} {
    animation-duration: ${({ theme }) => theme.transitions.duration.shorter}ms;
  }

  & .${touchRippleClasses.child} {
    opacity: 1;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: currentColor;
  }

  & .${touchRippleClasses.childLeaving} {
    opacity: 0;
    animation-name: ${exitKeyframe};
    animation-duration: ${DURATION}ms;
    animation-timing-function: ${({ theme }) => theme.transitions.easing.easeInOut};
  }

  & .${touchRippleClasses.childPulsate} {
    position: absolute;
    left: 0;
    top: 0;
    animation-name: ${pulsateKeyframe};
    animation-duration: 2500ms;
    animation-timing-function: ${({ theme }) => theme.transitions.easing.easeInOut};
    animation-iteration-count: infinite;
    animation-delay: 200ms;
  }
`;

/**
 * @ignore - internal component.
 *
 * TODO v5: Make private
 */
const TouchRipple = React.forwardRef(function TouchRipple(inProps, ref) {
  const props = useThemeProps({ props: inProps, name: 'MuiTouchRipple' });

  const { center: centerProp = false, classes = {}, className, ...other } = props;
  const [ripples, setRipples] = React.useState([]);
  const nextKey = React.useRef(0);
  const rippleCallback = React.useRef(null);

  React.useEffect(() => {
    if (rippleCallback.current) {
      rippleCallback.current();
      rippleCallback.current = null;
    }
  }, [ripples]);

  // Used to filter out mouse emulated events on mobile.
  const ignoringMouseDown = React.useRef(false);
  // We use a timer in order to only show the ripples for touch "click" like events.
  // We don't want to display the ripple for touch scroll events.
  const startTimer = React.useRef(null);

  // This is the hook called once the previous timeout is ready.
  const startTimerCommit = React.useRef(null);
  const container = React.useRef(null);

  React.useEffect(() => {
    return () => {
      clearTimeout(startTimer.current);
    };
  }, []);

  const startCommit = React.useCallback(
    (params) => {
      const { pulsate, rippleX, rippleY, rippleSize, cb } = params;

      setRipples((oldRipples) => [
        ...oldRipples,
        <TouchRippleRipple
          key={nextKey.current}
          classes={{
            ripple: clsx(classes.ripple, touchRippleClasses.ripple),
            rippleVisible: clsx(classes.rippleVisible, touchRippleClasses.rippleVisible),
            ripplePulsate: clsx(classes.ripplePulsate, touchRippleClasses.ripplePulsate),
            child: clsx(classes.child, touchRippleClasses.child),
            childLeaving: clsx(classes.childLeaving, touchRippleClasses.childLeaving),
            childPulsate: clsx(classes.childPulsate, touchRippleClasses.childPulsate),
          }}
          timeout={DURATION}
          pulsate={pulsate}
          rippleX={rippleX}
          rippleY={rippleY}
          rippleSize={rippleSize}
        />,
      ]);
      nextKey.current += 1;
      rippleCallback.current = cb;
    },
    [classes],
  );

  const start = React.useCallback(
    (event = {}, options = {}, cb) => {
      const {
        pulsate = false,
        center = centerProp || options.pulsate,
        fakeElement = false, // For test purposes
      } = options;

      if (event.type === 'mousedown' && ignoringMouseDown.current) {
        ignoringMouseDown.current = false;
        return;
      }

      if (event.type === 'touchstart') {
        ignoringMouseDown.current = true;
      }

      const element = fakeElement ? null : container.current;
      const rect = element
        ? element.getBoundingClientRect()
        : {
            width: 0,
            height: 0,
            left: 0,
            top: 0,
          };

      // Get the size of the ripple
      let rippleX;
      let rippleY;
      let rippleSize;

      if (
        center ||
        (event.clientX === 0 && event.clientY === 0) ||
        (!event.clientX && !event.touches)
      ) {
        rippleX = Math.round(rect.width / 2);
        rippleY = Math.round(rect.height / 2);
      } else {
        const { clientX, clientY } = event.touches ? event.touches[0] : event;
        rippleX = Math.round(clientX - rect.left);
        rippleY = Math.round(clientY - rect.top);
      }

      if (center) {
        rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);

        // For some reason the animation is broken on Mobile Chrome if the size if even.
        if (rippleSize % 2 === 0) {
          rippleSize += 1;
        }
      } else {
        const sizeX =
          Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
        const sizeY =
          Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
        rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
      }

      // Touche devices
      if (event.touches) {
        // check that this isn't another touchstart due to multitouch
        // otherwise we will only clear a single timer when unmounting while two
        // are running
        if (startTimerCommit.current === null) {
          // Prepare the ripple effect.
          startTimerCommit.current = () => {
            startCommit({ pulsate, rippleX, rippleY, rippleSize, cb });
          };
          // Delay the execution of the ripple effect.
          startTimer.current = setTimeout(() => {
            if (startTimerCommit.current) {
              startTimerCommit.current();
              startTimerCommit.current = null;
            }
          }, DELAY_RIPPLE); // We have to make a tradeoff with this value.
        }
      } else {
        startCommit({ pulsate, rippleX, rippleY, rippleSize, cb });
      }
    },
    [centerProp, startCommit],
  );

  const pulsate = React.useCallback(() => {
    start({}, { pulsate: true });
  }, [start]);

  const stop = React.useCallback((event, cb) => {
    clearTimeout(startTimer.current);

    // The touch interaction occurs too quickly.
    // We still want to show ripple effect.
    if (event.type === 'touchend' && startTimerCommit.current) {
      startTimerCommit.current();
      startTimerCommit.current = null;
      startTimer.current = setTimeout(() => {
        stop(event, cb);
      });
      return;
    }

    startTimerCommit.current = null;

    setRipples((oldRipples) => {
      if (oldRipples.length > 0) {
        return oldRipples.slice(1);
      }
      return oldRipples;
    });
    rippleCallback.current = cb;
  }, []);

  React.useImperativeHandle(
    ref,
    () => ({
      pulsate,
      start,
      stop,
    }),
    [pulsate, start, stop],
  );

  return (
    <TouchRippleRoot
      className={clsx(classes.root, touchRippleClasses.root, className)}
      ref={container}
      {...other}
    >
      <TransitionGroup component={null} exit>
        {ripples}
      </TransitionGroup>
    </TouchRippleRoot>
  );
});

TouchRipple.propTypes = {
  /**
   * If `true`, the ripple starts at the center of the component
   * rather than at the point of interaction.
   */
  center: PropTypes.bool,
  /**
   * Override or extend the styles applied to the component.
   * See [CSS API](#css) below for more details.
   */
  classes: PropTypes.object,
  /**
   * @ignore
   */
  className: PropTypes.string,
};

export default TouchRipple;
<commit_msg>[core] Fix typo in code comment (#27818)<commit_after>import * as React from 'react';
import PropTypes from 'prop-types';
import { TransitionGroup } from 'react-transition-group';
import clsx from 'clsx';
import { keyframes } from '@material-ui/system';
import styled from '../styles/styled';
import useThemeProps from '../styles/useThemeProps';
import Ripple from './Ripple';
import touchRippleClasses from './touchRippleClasses';

const DURATION = 550;
export const DELAY_RIPPLE = 80;

const enterKeyframe = keyframes`
  0% {
    transform: scale(0);
    opacity: 0.1;
  }

  100% {
    transform: scale(1);
    opacity: 0.3;
  }
`;

const exitKeyframe = keyframes`
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
`;

const pulsateKeyframe = keyframes`
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.92);
  }

  100% {
    transform: scale(1);
  }
`;

export const TouchRippleRoot = styled('span', {
  name: 'MuiTouchRipple',
  slot: 'Root',
  skipSx: true,
})({
  overflow: 'hidden',
  pointerEvents: 'none',
  position: 'absolute',
  zIndex: 0,
  top: 0,
  right: 0,
  bottom: 0,
  left: 0,
  borderRadius: 'inherit',
});

// This `styled()` function invokes keyframes. `styled-components` only supports keyframes
// in string templates. Do not convert these styles in JS object as it will break.
export const TouchRippleRipple = styled(Ripple, {
  name: 'MuiTouchRipple',
  slot: 'Ripple',
})`
  opacity: 0;
  position: absolute;

  &.${touchRippleClasses.rippleVisible} {
    opacity: 0.3;
    transform: scale(1);
    animation-name: ${enterKeyframe};
    animation-duration: ${DURATION}ms;
    animation-timing-function: ${({ theme }) => theme.transitions.easing.easeInOut};
  }

  &.${touchRippleClasses.ripplePulsate} {
    animation-duration: ${({ theme }) => theme.transitions.duration.shorter}ms;
  }

  & .${touchRippleClasses.child} {
    opacity: 1;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: currentColor;
  }

  & .${touchRippleClasses.childLeaving} {
    opacity: 0;
    animation-name: ${exitKeyframe};
    animation-duration: ${DURATION}ms;
    animation-timing-function: ${({ theme }) => theme.transitions.easing.easeInOut};
  }

  & .${touchRippleClasses.childPulsate} {
    position: absolute;
    left: 0;
    top: 0;
    animation-name: ${pulsateKeyframe};
    animation-duration: 2500ms;
    animation-timing-function: ${({ theme }) => theme.transitions.easing.easeInOut};
    animation-iteration-count: infinite;
    animation-delay: 200ms;
  }
`;

/**
 * @ignore - internal component.
 *
 * TODO v5: Make private
 */
const TouchRipple = React.forwardRef(function TouchRipple(inProps, ref) {
  const props = useThemeProps({ props: inProps, name: 'MuiTouchRipple' });

  const { center: centerProp = false, classes = {}, className, ...other } = props;
  const [ripples, setRipples] = React.useState([]);
  const nextKey = React.useRef(0);
  const rippleCallback = React.useRef(null);

  React.useEffect(() => {
    if (rippleCallback.current) {
      rippleCallback.current();
      rippleCallback.current = null;
    }
  }, [ripples]);

  // Used to filter out mouse emulated events on mobile.
  const ignoringMouseDown = React.useRef(false);
  // We use a timer in order to only show the ripples for touch "click" like events.
  // We don't want to display the ripple for touch scroll events.
  const startTimer = React.useRef(null);

  // This is the hook called once the previous timeout is ready.
  const startTimerCommit = React.useRef(null);
  const container = React.useRef(null);

  React.useEffect(() => {
    return () => {
      clearTimeout(startTimer.current);
    };
  }, []);

  const startCommit = React.useCallback(
    (params) => {
      const { pulsate, rippleX, rippleY, rippleSize, cb } = params;

      setRipples((oldRipples) => [
        ...oldRipples,
        <TouchRippleRipple
          key={nextKey.current}
          classes={{
            ripple: clsx(classes.ripple, touchRippleClasses.ripple),
            rippleVisible: clsx(classes.rippleVisible, touchRippleClasses.rippleVisible),
            ripplePulsate: clsx(classes.ripplePulsate, touchRippleClasses.ripplePulsate),
            child: clsx(classes.child, touchRippleClasses.child),
            childLeaving: clsx(classes.childLeaving, touchRippleClasses.childLeaving),
            childPulsate: clsx(classes.childPulsate, touchRippleClasses.childPulsate),
          }}
          timeout={DURATION}
          pulsate={pulsate}
          rippleX={rippleX}
          rippleY={rippleY}
          rippleSize={rippleSize}
        />,
      ]);
      nextKey.current += 1;
      rippleCallback.current = cb;
    },
    [classes],
  );

  const start = React.useCallback(
    (event = {}, options = {}, cb) => {
      const {
        pulsate = false,
        center = centerProp || options.pulsate,
        fakeElement = false, // For test purposes
      } = options;

      if (event.type === 'mousedown' && ignoringMouseDown.current) {
        ignoringMouseDown.current = false;
        return;
      }

      if (event.type === 'touchstart') {
        ignoringMouseDown.current = true;
      }

      const element = fakeElement ? null : container.current;
      const rect = element
        ? element.getBoundingClientRect()
        : {
            width: 0,
            height: 0,
            left: 0,
            top: 0,
          };

      // Get the size of the ripple
      let rippleX;
      let rippleY;
      let rippleSize;

      if (
        center ||
        (event.clientX === 0 && event.clientY === 0) ||
        (!event.clientX && !event.touches)
      ) {
        rippleX = Math.round(rect.width / 2);
        rippleY = Math.round(rect.height / 2);
      } else {
        const { clientX, clientY } = event.touches ? event.touches[0] : event;
        rippleX = Math.round(clientX - rect.left);
        rippleY = Math.round(clientY - rect.top);
      }

      if (center) {
        rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);

        // For some reason the animation is broken on Mobile Chrome if the size is even.
        if (rippleSize % 2 === 0) {
          rippleSize += 1;
        }
      } else {
        const sizeX =
          Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
        const sizeY =
          Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
        rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
      }

      // Touche devices
      if (event.touches) {
        // check that this isn't another touchstart due to multitouch
        // otherwise we will only clear a single timer when unmounting while two
        // are running
        if (startTimerCommit.current === null) {
          // Prepare the ripple effect.
          startTimerCommit.current = () => {
            startCommit({ pulsate, rippleX, rippleY, rippleSize, cb });
          };
          // Delay the execution of the ripple effect.
          startTimer.current = setTimeout(() => {
            if (startTimerCommit.current) {
              startTimerCommit.current();
              startTimerCommit.current = null;
            }
          }, DELAY_RIPPLE); // We have to make a tradeoff with this value.
        }
      } else {
        startCommit({ pulsate, rippleX, rippleY, rippleSize, cb });
      }
    },
    [centerProp, startCommit],
  );

  const pulsate = React.useCallback(() => {
    start({}, { pulsate: true });
  }, [start]);

  const stop = React.useCallback((event, cb) => {
    clearTimeout(startTimer.current);

    // The touch interaction occurs too quickly.
    // We still want to show ripple effect.
    if (event.type === 'touchend' && startTimerCommit.current) {
      startTimerCommit.current();
      startTimerCommit.current = null;
      startTimer.current = setTimeout(() => {
        stop(event, cb);
      });
      return;
    }

    startTimerCommit.current = null;

    setRipples((oldRipples) => {
      if (oldRipples.length > 0) {
        return oldRipples.slice(1);
      }
      return oldRipples;
    });
    rippleCallback.current = cb;
  }, []);

  React.useImperativeHandle(
    ref,
    () => ({
      pulsate,
      start,
      stop,
    }),
    [pulsate, start, stop],
  );

  return (
    <TouchRippleRoot
      className={clsx(classes.root, touchRippleClasses.root, className)}
      ref={container}
      {...other}
    >
      <TransitionGroup component={null} exit>
        {ripples}
      </TransitionGroup>
    </TouchRippleRoot>
  );
});

TouchRipple.propTypes = {
  /**
   * If `true`, the ripple starts at the center of the component
   * rather than at the point of interaction.
   */
  center: PropTypes.bool,
  /**
   * Override or extend the styles applied to the component.
   * See [CSS API](#css) below for more details.
   */
  classes: PropTypes.object,
  /**
   * @ignore
   */
  className: PropTypes.string,
};

export default TouchRipple;
<|endoftext|>


<commit_before>module.exports = function(grunt) {
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		sass: {
			build: {
				options: {
					style: 'compact',
					sourcemap: 'none'
				},
				files: [{
					expand: true,
					cwd: 'sass/',
					src: ['*.scss'],
					dest: 'css/',
					ext: '.css'
				}]
			}
		},
		compass: {
			build: {
				options: {
					//basePath: '',
					config: 'config.rb'
				}
			}
		},
		watch: {
			styles: {
				files: ['sass/**/*.scss'],
				tasks: ['sass'] // or 'compass'
			}
		}
	});

	// Load the plugins
	grunt.loadNpmTasks('grunt-contrib-sass');
	//grunt.loadNpmTasks('grunt-contrib-compass');
	grunt.loadNpmTasks('grunt-contrib-watch');

	// Default task(s).
	grunt.registerTask('default', ['sass']); // or 'compass'
};
<commit_msg>Improved paths in Gruntfile.js, switched to Compass as default<commit_after>module.exports = function(grunt) {
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		dirs: {
			web: ''
		},

		/*sass: {
			build: {
				options: {
					style: 'compact',
					sourcemap: 'none'
				},
				files: {
					'<%= dirs.web %>css/styles.css' : '<%= dirs.web %>sass/styles.scss',
					'<%= dirs.web %>css/desktop.css': '<%= dirs.web %>sass/desktop.scss'
				}
			}
		},*/
		compass: {
			build: {
				options: {
					basePath: '<%= dirs.web %>',
					config: '<%= dirs.web %>config.rb'
				}
			}
		},
		watch: {
			styles: {
				files: ['<%= compass.web %>sass/**/*.scss'],
				tasks: ['compass'] // or 'sass'
			}
		}
	});

	// Load the plugins
	// grunt.loadNpmTasks('grunt-contrib-sass');
	grunt.loadNpmTasks('grunt-contrib-compass');
	grunt.loadNpmTasks('grunt-contrib-watch');

	// Default task(s).
	grunt.registerTask('default', ['compass']); // or 'sass'
};
<|endoftext|>