<commit_before>module.exports = function(grunt) {
	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		autoprefixer: {
			options: {
			},
			no_dest: {
				src : 'public/css/cms.css'
			}
		},
		concat: {
			options: {
				separator: ';',
				process: function(src, filepath) {
				  return src.replace(/@VERSION/g, grunt.config.get('pkg.version'));
				}
			},
			dist: {
	  			src: [
					'bower_components/modernizr/modernizr.js',
					'src/js/string.js',
					'bower_components/jquery/dist/jquery.js',
					'bower_components/jquery-ui/jquery-ui.js',
					'src/js/jquery/ui.splitbutton.js',
					'src/js/jquery/ui.tree.js',
					'bower_components/jgrowl/jquery.jgrowl.js',
					'bower_components/tablesorter/jquery.tablesorter.js',
					'bower_components/datetimepicker/jquery.datetimepicker.js',
                                        'bower_components/jquery-file-upload/js/jquery.fileupload.js',
					'src/js/boom/plugins.js',
					'src/js/boom/config.js',
					'src/js/boom/loader.js',
					'src/js/boom/notification.js',
					'src/js/boom/core.js',
					'src/js/boom/history2.js',
					'src/js/boom/log.js',
					'src/js/boom/dialog.js',
					'src/js/boom/alert.js',
					'src/js/boom/confirmation.js',
					'bower_components/pushy/js/pushy.js',
					'src/js/boom/tagAutocomplete.js',
					'src/js/boom/page/status.js',
					'src/js/boom/page/page.js',
					'src/js/boom/page/settings.js',
					'src/js/boom/page/editor.js',
					'src/js/boom/page/toolbar.js',
					'src/js/boom/page/tree.js',
					'src/js/boom/page/url.js',
					'src/js/boom/page/tagEditor.js',
					'src/js/boom/page/tagSearch.js',
					'src/js/boom/page/tagAutocomplete.js',
					'src/js/boom/urlEditor.js',
					'src/js/boom/page/featureEditor.js',
					'src/js/boom/page/visibilityEditor.js',
					'src/js/boom/textEditor.js',
					'src/js/boom/chunk.js',
					'src/js/boom/chunk/chunk.js',
					'src/js/boom/chunk/text.js',
					'src/js/boom/chunk/linkset.js',
					'src/js/boom/chunk/feature.js',
					'src/js/boom/chunk/asset.js',
					'src/js/boom/chunk/slideshow.js',
					'src/js/boom/chunk/timestamp.js',
					'src/js/boom/chunk/tag.js',
					'src/js/boom/chunk/slideshow/editor.js',
					'src/js/boom/chunk/linkset/editor.js',
					'src/js/boom/chunk/asset/editor.js',
					'src/js/boom/chunk/pageTags.js',
					'src/js/boom/chunk/pageVisibility.js',
					'src/js/boom/page/title.js',
					'src/js/boom/link/link.js',
					'src/js/boom/link/picker.js',
					'src/js/boom/template/manager.js',
					'src/js/boom/asset/asset.js',
					'src/js/boom/asset/manager.js',
					'src/js/boom/asset/picker.js',
					'src/js/boom/asset/titleFilter.js',
					'src/js/boom/asset/uploader.js',
					'src/js/boom/asset/justify.js',
					'src/js/boom/asset/tagAutocomplete.js',
					'src/js/boom/asset/tagSearch.js',
					'src/js/boom/group/group.js',
					'src/js/boom/group/permissionsEditor.js',
					'src/js/boom/person.js',
					'src/js/boom/peopleManager.js',
					'bower_components/wysihtml/dist/wysihtml5x-toolbar.js',
					'src/js/wysihtml5/parser_rules/full.js',
					'src/js/wysihtml5/parser_rules/inline.js',
					'src/js/wysihtml5/commands/insertBoomAsset.js',
					'src/js/wysihtml5/commands/createBoomLink.js',
					'src/js/wysihtml5/commands/cta.js',
					'src/js/wysihtml5/commands/insertSuperscript.js',
					'src/js/wysihtml5/commands/insertSubscript.js',
					'src/js/jquery/jqpagination.js',
					'src/js/boom/page/manager.js'
				],
				dest: 'public/js/cms.js'
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> - v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n',
				sourceMap: true
			},
			build: {
				files: {
					'public/js/cms.js': 'public/js/cms.js'
				}
			}
		},
		less: {
			development: {
				options: {
					paths: ["src/css"]
				},
				files: {
					"public/css/cms.css": "src/css/cms.less"
				}
			},
			production: {
				options: {
					paths: ["src/css"]
				},
				files: {
					"public/css/cms.css": "src/css/cms.less"
				}
			}
		},
		cssmin: {
			options: {
				shorthandCompacting: false,
				roundingPrecision: -1
			},
			target: {
				files: {
					 'public/css/cms.css': [
						'bower_components/datetimepicker/jquery.datetimepicker.css',
						'bower_components/jquery-ui/themes/base/jquery-ui.css',
						'bower_components/jquery-ui/themes/base/autocomplete.css',
						'bower_components/jquery-ui/themes/base/tabs.css',
						'bower_components/jquery-ui/themes/base/sortable.css',
						'bower_components/jquery-ui/themes/base/core.css',
						'bower_components/jquery-ui/themes/base/button.css',
						'bower_components/jquery-ui/themes/base/draggable.css',
						'bower_components/jquery-ui/themes/base/dialog.css',
						'src/css/libraries/jqpagination.css',
						'public/css/cms.css'
					 ]
				}
			}
		},
		watch: {
			css: {
				files: '**/*.less',
				tasks: ['build']
			},
			js: {
				files: 'src/js/*.js',
				tasks: ['build']
			}
		}
	});

	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-autoprefixer');

	grunt.registerTask('build', ['less', 'concat:dist', 'autoprefixer:no_dest', 'cssmin']);
	grunt.registerTask('dist', ['less', 'cssmin', 'concat:dist', 'uglify']);
	grunt.registerTask('default',['watch']);
};
<commit_msg>Updated Gruntfile.js<commit_after>module.exports = function(grunt) {
	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		autoprefixer: {
			options: {
			},
			no_dest: {
				src : 'public/css/cms.css'
			}
		},
		concat: {
			options: {
				separator: ';',
				process: function(src, filepath) {
				  return src.replace(/@VERSION/g, grunt.config.get('pkg.version'));
				}
			},
			dist: {
	  			src: [
					'bower_components/modernizr/modernizr.js',
					'src/js/string.js',
					'bower_components/jquery/dist/jquery.js',
					'bower_components/jquery-ui/jquery-ui.js',
					'src/js/jquery/ui.splitbutton.js',
					'src/js/jquery/ui.tree.js',
					'bower_components/jgrowl/jquery.jgrowl.js',
					'bower_components/tablesorter/jquery.tablesorter.js',
					'bower_components/datetimepicker/jquery.datetimepicker.js',
                                        'bower_components/jquery-file-upload/js/jquery.fileupload.js',
					'src/js/boom/plugins.js',
					'src/js/boom/config.js',
					'src/js/boom/loader.js',
					'src/js/boom/notification.js',
					'src/js/boom/core.js',
					'src/js/boom/history2.js',
					'src/js/boom/log.js',
					'src/js/boom/dialog.js',
					'src/js/boom/alert.js',
					'src/js/boom/confirmation.js',
					'bower_components/pushy/js/pushy.js',
					'src/js/boom/tagAutocomplete.js',
					'src/js/boom/page/status.js',
					'src/js/boom/page/page.js',
					'src/js/boom/page/settings.js',
					'src/js/boom/page/editor.js',
					'src/js/boom/page/toolbar.js',
					'src/js/boom/page/tree.js',
					'src/js/boom/page/url.js',
					'src/js/boom/page/tagEditor.js',
					'src/js/boom/page/tagSearch.js',
					'src/js/boom/page/tagAutocomplete.js',
					'src/js/boom/urlEditor.js',
					'src/js/boom/page/featureEditor.js',
					'src/js/boom/page/visibilityEditor.js',
					'src/js/boom/textEditor.js',
					'src/js/boom/chunk.js',
					'src/js/boom/chunk/chunk.js',
					'src/js/boom/chunk/text.js',
					'src/js/boom/chunk/linkset.js',
					'src/js/boom/chunk/feature.js',
					'src/js/boom/chunk/asset.js',
					'src/js/boom/chunk/slideshow.js',
					'src/js/boom/chunk/timestamp.js',
					'src/js/boom/chunk/tag.js',
					'src/js/boom/chunk/slideshow/editor.js',
					'src/js/boom/chunk/linkset/editor.js',
					'src/js/boom/chunk/asset/editor.js',
					'src/js/boom/chunk/pageTags.js',
					'src/js/boom/chunk/pageVisibility.js',
					'src/js/boom/page/title.js',
					'src/js/boom/link/link.js',
					'src/js/boom/link/picker.js',
					'src/js/boom/template/manager.js',
					'src/js/boom/asset/asset.js',
					'src/js/boom/asset/manager.js',
					'src/js/boom/asset/picker.js',
					'src/js/boom/asset/titleFilter.js',
					'src/js/boom/asset/uploader.js',
					'src/js/boom/asset/justify.js',
					'src/js/boom/asset/tagAutocomplete.js',
					'src/js/boom/asset/tagSearch.js',
					'src/js/boom/group/group.js',
					'src/js/boom/group/permissionsEditor.js',
					'src/js/boom/person.js',
					'src/js/boom/peopleManager.js',
					'bower_components/wysihtml/dist/wysihtml5x-toolbar.js',
					'src/js/wysihtml5/parser_rules/full.js',
					'src/js/wysihtml5/parser_rules/inline.js',
					'src/js/wysihtml5/commands/insertBoomAsset.js',
					'src/js/wysihtml5/commands/createBoomLink.js',
					'src/js/wysihtml5/commands/cta.js',
					'src/js/wysihtml5/commands/insertSuperscript.js',
					'src/js/wysihtml5/commands/insertSubscript.js',
					'src/js/jquery/jqpagination.js',
					'src/js/boom/page/manager.js'
				],
				dest: 'public/js/cms.js'
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> - v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n',
				sourceMap: true
			},
			build: {
				files: {
					'public/js/cms.js': 'public/js/cms.js'
				}
			}
		},
		less: {
			production: {
				options: {
					paths: ["src/css"]
				},
				files: {
					"public/css/cms.css": "src/css/cms.less"
				}
			}
		},
		cssmin: {
			options: {
				shorthandCompacting: false,
				roundingPrecision: -1
			},
			target: {
				files: {
					 'public/css/cms.css': [
						'bower_components/datetimepicker/jquery.datetimepicker.css',
						'bower_components/jquery-ui/themes/base/jquery-ui.css',
						'bower_components/jquery-ui/themes/base/autocomplete.css',
						'bower_components/jquery-ui/themes/base/tabs.css',
						'bower_components/jquery-ui/themes/base/sortable.css',
						'bower_components/jquery-ui/themes/base/core.css',
						'bower_components/jquery-ui/themes/base/button.css',
						'bower_components/jquery-ui/themes/base/draggable.css',
						'bower_components/jquery-ui/themes/base/dialog.css',
						'src/css/libraries/jqpagination.css',
						'public/css/cms.css'
					 ]
				}
			}
		},
		watch: {
			css: {
				files: 'src/css/**/*.less',
				tasks: ['build-css']
			},
			js: {
				files: 'src/js/**/*.js',
				tasks: ['build-js']
			}
		}
	});

	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-autoprefixer');

	grunt.registerTask('build-css', ['less', 'autoprefixer:no_dest', 'cssmin']);
	grunt.registerTask('build-js', ['concat:dist']);
	grunt.registerTask('dist', ['build-css', 'build-js', 'uglify']);
	grunt.registerTask('default',['watch']);
};
<|endoftext|>


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

    var _ = grunt.util._;
    var path = require('path');

    var coreFiles = [
        'vendor/**/*.js',
        'template/_header.js',
        'src/**/*.js',
        'template/_footer.js'
    ];

    var plugins = grunt.option('plugins');
    // Create plugin paths and verify hey exist
    plugins = _.map(plugins ? plugins.split(',') : [], function (plugin) {
        var path = 'plugins/' + plugin + '.js';

        if(!grunt.file.exists(path))
            throw new Error("Plugin '" + plugin + "' not found in plugins directory.");

        return path;
    });

    // Taken from http://dzone.com/snippets/calculate-all-combinations
    var combine = function (a) {
        var fn = function (n, src, got, all) {
            if (n === 0) {
                all.push(got);
                return;
            }

            for (var j = 0; j < src.length; j++) {
                fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
            }
        };

        var all = [a];

        for (var i = 0; i < a.length; i++) {
            fn(i, a, [], all);
        }

        return all;
    };

    var pluginCombinations = combine(grunt.file.expand('plugins/*.js'));
    var pluginConcatFiles = _.reduce(pluginCombinations, function (dict, comb) {
        var key = _.map(comb, function (plugin) {
            return path.basename(plugin, '.js');
        });
        key.sort();

        var dest = path.join('build/', key.join(','), '/<%= pkg.name %>.js');
        dict[dest] = coreFiles.concat(comb);

        return dict;
    }, {});

    var gruntConfig = {
        pkg: grunt.file.readJSON('package.json'),
        aws: grunt.file.exists('aws.json') ? grunt.file.readJSON('aws.json'): {},

        clean: ['build'],
        concat: {
            options: {
                separator: '\n',
                banner: grunt.file.read('template/_copyright.js'),
                process: true
            },
            core: {
                src: coreFiles.concat(plugins),
                dest: 'build/<%= pkg.name %>.js'
            },
            all: {
                files: pluginConcatFiles
            }
        },

        uglify: {
            options: {
                sourceMap: function (dest) {
                    return path.join(path.dirname(dest),
                                     path.basename(dest, '.js')) +
                           '.map';
                },
                sourceMappingURL: function (dest) {
                    return path.basename(dest, '.js') + '.map';
                },
                preserveComments: 'some'
            },
            dist: {
                src: ['build/**/*.js'],
                ext: '.min.js',
                expand: true
            }
        },

        fixSourceMaps: {
            options: {
                srcBase: 'build',
                destBase: 'build'
            },
            all: ['build/**/*.map']
        },

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

        mocha: {
            all: {
                options: {
                    mocha: {
                        ignoreLeaks: true,
                        grep:        grunt.option('grep')
                    },
                    log:      true,
                    reporter: 'Dot',
                    run:      true
                },
                src: ['test/index.html'],
                nonull: true
            }
        },

        release: {
            options: {
                npm:           false,
                commitMessage: 'Release <%= version %>'
            }
        },

        s3: {
            options: {
                key: '<%= aws.key %>',
                secret: '<%= aws.secret %>',
                bucket: '<%= aws.bucket %>',
                access: 'public-read'
            },
            all: {
                upload: [{
                    src: 'build/**/*',
                    dest: 'build/<%= pkg.version %>/',
                    rel: 'build/'
                }]
            }
        }
    };

    grunt.initConfig(gruntConfig);

    // Custom Grunt tasks
    grunt.registerMultiTask('fixSourceMaps', function () {
        var options = this.options({
            destBase: '',
            srcBase: ''
        });

        this.files.forEach(function (f) {
            var result;
            var sources = f.src.filter(function (filepath) {
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.');
                    return false;
                } else {
                    return true;
                }
            }).forEach(function (filepath) {
                var sMap = grunt.file.readJSON(filepath);
                sMap.file = path.relative(options.destBase, sMap.file);
                sMap.sources = _.map(sMap.sources, path.relative.bind(path, options.srcBase));

                grunt.file.write(filepath, JSON.stringify(sMap));
                // Print a success message.
                grunt.log.writeln('File "' + filepath + '" fixed.');
            });
        });
    });

    // Grunt contrib tasks
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-jshint');

    // 3rd party Grunt tasks
    grunt.loadNpmTasks('grunt-mocha');
    grunt.loadNpmTasks('grunt-release');
    grunt.loadNpmTasks('grunt-s3');

    // Build tasks
    grunt.registerTask('build.core', ['clean', 'concat:core', 'uglify', 'fixSourceMaps']);
    grunt.registerTask('build.all', ['clean', 'concat:all', 'uglify', 'fixSourceMaps']);

    // Test task
    grunt.registerTask('test', ['jshint', 'mocha']);

    grunt.registerTask('publish', ['test', 'build.all', 's3']);
    grunt.registerTask('default', ['build.all']);
};
<commit_msg>Fix file paths in source maps for all directory levels<commit_after>module.exports = function(grunt) {
    "use strict";

    var _ = grunt.util._;
    var path = require('path');

    var coreFiles = [
        'vendor/**/*.js',
        'template/_header.js',
        'src/**/*.js',
        'template/_footer.js'
    ];

    var plugins = grunt.option('plugins');
    // Create plugin paths and verify hey exist
    plugins = _.map(plugins ? plugins.split(',') : [], function (plugin) {
        var path = 'plugins/' + plugin + '.js';

        if(!grunt.file.exists(path))
            throw new Error("Plugin '" + plugin + "' not found in plugins directory.");

        return path;
    });

    // Taken from http://dzone.com/snippets/calculate-all-combinations
    var combine = function (a) {
        var fn = function (n, src, got, all) {
            if (n === 0) {
                all.push(got);
                return;
            }

            for (var j = 0; j < src.length; j++) {
                fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
            }
        };

        var all = [a];

        for (var i = 0; i < a.length; i++) {
            fn(i, a, [], all);
        }

        return all;
    };

    var pluginCombinations = combine(grunt.file.expand('plugins/*.js'));
    var pluginConcatFiles = _.reduce(pluginCombinations, function (dict, comb) {
        var key = _.map(comb, function (plugin) {
            return path.basename(plugin, '.js');
        });
        key.sort();

        var dest = path.join('build/', key.join(','), '/<%= pkg.name %>.js');
        dict[dest] = coreFiles.concat(comb);

        return dict;
    }, {});

    var gruntConfig = {
        pkg: grunt.file.readJSON('package.json'),
        aws: grunt.file.exists('aws.json') ? grunt.file.readJSON('aws.json'): {},

        clean: ['build'],
        concat: {
            options: {
                separator: '\n',
                banner: grunt.file.read('template/_copyright.js'),
                process: true
            },
            core: {
                src: coreFiles.concat(plugins),
                dest: 'build/<%= pkg.name %>.js'
            },
            all: {
                files: pluginConcatFiles
            }
        },

        uglify: {
            options: {
                sourceMap: function (dest) {
                    return path.join(path.dirname(dest),
                                     path.basename(dest, '.js')) +
                           '.map';
                },
                sourceMappingURL: function (dest) {
                    return path.basename(dest, '.js') + '.map';
                },
                preserveComments: 'some'
            },
            dist: {
                src: ['build/**/*.js'],
                ext: '.min.js',
                expand: true
            }
        },

        fixSourceMaps: {
            all: ['build/**/*.map']
        },

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

        mocha: {
            all: {
                options: {
                    mocha: {
                        ignoreLeaks: true,
                        grep:        grunt.option('grep')
                    },
                    log:      true,
                    reporter: 'Dot',
                    run:      true
                },
                src: ['test/index.html'],
                nonull: true
            }
        },

        release: {
            options: {
                npm:           false,
                commitMessage: 'Release <%= version %>'
            }
        },

        s3: {
            options: {
                key: '<%= aws.key %>',
                secret: '<%= aws.secret %>',
                bucket: '<%= aws.bucket %>',
                access: 'public-read'
            },
            all: {
                upload: [{
                    src: 'build/**/*',
                    dest: 'build/<%= pkg.version %>/',
                    rel: 'build/'
                }]
            }
        }
    };

    grunt.initConfig(gruntConfig);

    // Custom Grunt tasks
    grunt.registerMultiTask('fixSourceMaps', function () {
        this.files.forEach(function (f) {
            var result;
            var sources = f.src.filter(function (filepath) {
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.');
                    return false;
                } else {
                    return true;
                }
            }).forEach(function (filepath) {
                var base = path.dirname(filepath);
                var sMap = grunt.file.readJSON(filepath);
                sMap.file = path.relative(base, sMap.file);
                sMap.sources = _.map(sMap.sources, path.relative.bind(path, base));

                grunt.file.write(filepath, JSON.stringify(sMap));
                // Print a success message.
                grunt.log.writeln('File "' + filepath + '" fixed.');
            });
        });
    });

    // Grunt contrib tasks
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-jshint');

    // 3rd party Grunt tasks
    grunt.loadNpmTasks('grunt-mocha');
    grunt.loadNpmTasks('grunt-release');
    grunt.loadNpmTasks('grunt-s3');

    // Build tasks
    grunt.registerTask('build.core', ['clean', 'concat:core', 'uglify', 'fixSourceMaps']);
    grunt.registerTask('build.all', ['clean', 'concat:all', 'uglify', 'fixSourceMaps']);

    // Test task
    grunt.registerTask('test', ['jshint', 'mocha']);

    grunt.registerTask('publish', ['test', 'build.all', 's3']);
    grunt.registerTask('default', ['build.all']);
};
<|endoftext|>


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

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

    concat: {
      options: {
        stripBanners: true,
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */',
      },
      dist: {
        src: [
          'app/js/app.js',
          'app/js/course_ctrl.js',
          'app/js/user_ctrl.js',
          'app/js/people_ctrl.js',
          'app/js/consult_ctrl.js',
          'app/js/admin_ctrl.js',
          'app/js/directives.js',
          'app/js/service.js'
        ],
        dest: 'build/cedek.js',
      }
    },

    jshint: {
      src: ['app/js/*.js'],
      concat: ['build/cedek.js'],
      options: {
        "node": true,
        "esnext": true,
        "bitwise": false,
        "curly": false,
        "eqeqeq": true,
        "eqnull": true,
        "immed": true,
        "latedef": true,
        "newcap": true,
        "noarg": true,
        "undef": true,
        "strict": true,
        "trailing": true,
        "smarttabs": true,
        globals: {
          'angular': true,
          '$': true,
          'document': true,
          'gnMenu': true
        }
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        files: {
          'public/js/cedek.min.js': ['build/cedek.js']
        }
      }
    },

    cssmin: {
      minify: {
        files: {
          'public/css/cedek.min.css': ['app/css/app.css']
        }
      }
    },

    html2js: {
      options: {
        base: 'app/pages/',
        module: 'templates',
        singleModule: true,
        htmlmin: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true,
          removeComments: true,
          removeEmptyAttributes: true,
          removeRedundantAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        }
      },
      main: {
        src: ['app/pages/**/*.html'],
        dest: 'public/js/templates.js'
      },
    },

    copy: {
      statics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: [
              'img/**',
            ],
            dest: 'public/'
          },
          {
            expand: true, cwd: 'bower_components/bootstrap/',
            src: [
              'fonts/*'
            ],
            dest: 'public/',
          },
          {
            expand: true, cwd: 'bower_components/',
            src: [
              'jquery/dist/jquery.min.js',
              'jquery/dist/jquery.min.map',
              'angular/angular.min.js',
              'angular/angular.min.js.map',
              'angular-route/angular-route.min.js',
              'angular-route/angular-route.min.js.map',
              'angular-resource/angular-resource.min.js',
              'angular-resource/angular-resource.min.js.map',
              'bootstrap/dist/js/bootstrap.min.js',
              'bootstrap/dist/css/bootstrap.min.css',
            ],
            dest: 'public/lib',
            flatten: true
          }
        ],
      },
      dynamics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: ['*.html'],
            dest: 'public/',
          }
        ],

        options: {
          process: function(content, srcpath){
            if(srcpath.match("index.html$")){
              grunt.log.writeln("Modificando los imports de js en " + srcpath);
              var retVal = content;
              // eliminamos los imports de nuestros js
              retVal = retVal.replace(/<script type="text\/javascript" src="js\/([\w\/]+?).js"><\/script>/g, "");
              // eliminamos los imports de nuestros css
              retVal = retVal.replace(/<link rel="stylesheet" type="text\/css" href="css\/([\w]+?).css"\/>/g, "");
              // sustituimos los comentarios por imports
              retVal = retVal.replace(/<!-- cedek.min.js -->/g, "<script type=\"text/javascript\" src=\"js/cedek.min.js\"></script>");
              retVal = retVal.replace(/<!-- templates.js -->/g, "<script type=\"text/javascript\" src=\"js/templates.js\"></script>");
              retVal = retVal.replace(/<!-- cedek.min.css -->/g, "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/cedek.min.css\"/>");

              // cambiamos a las versiones minimizadas de las librerias de tercero
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/css\/bootstrap.min.css/g, "lib\/bootstrap.min.css");

              retVal = retVal.replace(/lib\/(([\w-_ ]+)\/)+/g, "lib\/"); // movemos el path de las librerias de tercero desde app a lib

              retVal = retVal.replace(/..\/bower_components\/angular\/angular.min.js/g, "lib\/angular.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-route\/angular-route.min.js/g, "lib\/angular-route.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-resource\/angular-resource.min.js/g, "lib\/angular-resource.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-sanitize\/angular-sanitize.min.js/g, "lib\/angular-sanitize.min.js");
              retVal = retVal.replace(/..\/bower_components\/jquery\/dist\/jquery.min.js/g, "lib\/jquery.min.js");
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/js\/bootstrap.min.js/g, "lib\/bootstrap.min.js");

              return retVal;
            } else {
              return content;
            }
          }
        }
      },

      substitutePaths: {
        src: 'build/cedek.js',
        dest: 'build/cedek.js',
        options: {
          process: function(content, srcpath){
            return content.replace(/\/\/,'templates'/, ",'templates'").replace(/pages\//g, "");
          }
        }
      }
    },

    clean: {
      all: {
        src: ["build", "public"]
      }
    }

  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-html2js');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');

  // Tasks
  grunt.registerTask('resources', ['copy:statics', 'copy:dynamics', 'concat', 'copy:substitutePaths', 'cssmin', 'uglify']);
  grunt.registerTask('default', ['clean:all', 'jshint:src', 'resources', 'jshint:concat', 'html2js:main']);

};
<commit_msg>Add dependencies to Gruntfile<commit_after>module.exports = function(grunt) {

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

    concat: {
      options: {
        stripBanners: true,
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */',
      },
      dist: {
        src: [
          'app/js/app.js',
          'app/js/course_ctrl.js',
          'app/js/user_ctrl.js',
          'app/js/people_ctrl.js',
          'app/js/consult_ctrl.js',
          'app/js/admin_ctrl.js',
          'app/js/directives.js',
          'app/js/service.js'
        ],
        dest: 'build/cedek.js',
      }
    },

    jshint: {
      src: ['app/js/*.js'],
      concat: ['build/cedek.js'],
      options: {
        "node": true,
        "esnext": true,
        "bitwise": false,
        "curly": false,
        "eqeqeq": true,
        "eqnull": true,
        "immed": true,
        "latedef": true,
        "newcap": true,
        "noarg": true,
        "undef": true,
        "strict": true,
        "trailing": true,
        "smarttabs": true,
        globals: {
          'angular': true,
          '$': true,
          'document': true,
          'gnMenu': true
        }
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      build: {
        files: {
          'public/js/cedek.min.js': ['build/cedek.js']
        }
      }
    },

    cssmin: {
      minify: {
        files: {
          'public/css/cedek.min.css': ['app/css/app.css']
        }
      }
    },

    html2js: {
      options: {
        base: 'app/pages/',
        module: 'templates',
        singleModule: true,
        htmlmin: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true,
          removeComments: true,
          removeEmptyAttributes: true,
          removeRedundantAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        }
      },
      main: {
        src: ['app/pages/**/*.html'],
        dest: 'public/js/templates.js'
      },
    },

    copy: {
      statics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: [
              'img/**',
            ],
            dest: 'public/'
          },
          {
            expand: true, cwd: 'bower_components/bootstrap/',
            src: [
              'fonts/*'
            ],
            dest: 'public/',
          },
          {
            expand: true, cwd: 'bower_components/',
            src: [
              'jquery/dist/jquery.min.js',
              'jquery/dist/jquery.min.map',
              'angular/angular.min.js',
              'angular/angular.min.js.map',
              'angular-route/angular-route.min.js',
              'angular-route/angular-route.min.js.map',
              'angular-resource/angular-resource.min.js',
              'angular-resource/angular-resource.min.js.map',
              'angular-sanitize/angular-sanitize.min.js',
              'angular-sanitize/angular-sanitize.min.js.map',
              'notifyjs/dist/notify.min.js',
              'notifyjs/dist/styles/bootstrap/notify-bootstrap.js',
              'bootstrap/dist/js/bootstrap.min.js',
              'bootstrap/dist/css/bootstrap.min.css',
            ],
            dest: 'public/lib',
            flatten: true
          }
        ],
      },
      dynamics: {
        files: [
          {
            expand: true, cwd: 'app/',
            src: ['*.html'],
            dest: 'public/',
          }
        ],

        options: {
          process: function(content, srcpath){
            if(srcpath.match("index.html$")){
              grunt.log.writeln("Modificando los imports de js en " + srcpath);
              var retVal = content;
              // eliminamos los imports de nuestros js
              retVal = retVal.replace(/<script type="text\/javascript" src="js\/([\w\/]+?).js"><\/script>/g, "");
              // eliminamos los imports de nuestros css
              retVal = retVal.replace(/<link rel="stylesheet" type="text\/css" href="css\/([\w]+?).css"\/>/g, "");
              // sustituimos los comentarios por imports
              retVal = retVal.replace(/<!-- cedek.min.js -->/g, "<script type=\"text/javascript\" src=\"js/cedek.min.js\"></script>");
              retVal = retVal.replace(/<!-- templates.js -->/g, "<script type=\"text/javascript\" src=\"js/templates.js\"></script>");
              retVal = retVal.replace(/<!-- cedek.min.css -->/g, "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/cedek.min.css\"/>");

              // cambiamos a las versiones minimizadas de las librerias de tercero
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/css\/bootstrap.min.css/g, "lib\/bootstrap.min.css");

              retVal = retVal.replace(/lib\/(([\w-_ ]+)\/)+/g, "lib\/"); // movemos el path de las librerias de tercero desde app a lib

              retVal = retVal.replace(/..\/bower_components\/angular\/angular.min.js/g, "lib\/angular.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-route\/angular-route.min.js/g, "lib\/angular-route.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-resource\/angular-resource.min.js/g, "lib\/angular-resource.min.js");
              retVal = retVal.replace(/..\/bower_components\/angular-sanitize\/angular-sanitize.min.js/g, "lib\/angular-sanitize.min.js");
              retVal = retVal.replace(/..\/bower_components\/jquery\/dist\/jquery.min.js/g, "lib\/jquery.min.js");
              retVal = retVal.replace(/..\/bower_components\/bootstrap\/dist\/js\/bootstrap.min.js/g, "lib\/bootstrap.min.js");
              retVal = retVal.replace(/..\/bower_components\/notifyjs\/dist\/notify.min.js/g, "lib\/notify.min.js");
              retVal = retVal.replace(/..\/bower_components\/notifyjs\/dist\/styles\/bootstrap\/notify-bootstrap.js/g, "lib\/notify-bootstrap.js");

              return retVal;
            } else {
              return content;
            }
          }
        }
      },

      substitutePaths: {
        src: 'build/cedek.js',
        dest: 'build/cedek.js',
        options: {
          process: function(content, srcpath){
            return content.replace(/\/\/,'templates'/, ",'templates'").replace(/pages\//g, "");
          }
        }
      }
    },

    clean: {
      all: {
        src: ["build", "public"]
      }
    }

  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-html2js');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');

  // Tasks
  grunt.registerTask('resources', ['copy:statics', 'copy:dynamics', 'concat', 'copy:substitutePaths', 'cssmin', 'uglify']);
  grunt.registerTask('default', ['clean:all', 'jshint:src', 'resources', 'jshint:concat', 'html2js:main']);

};
<|endoftext|>


<commit_before>/* globals module */

module.exports = function(grunt) {

  // Project configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {

      licenseFile : 'license.txt',

      depFiles : [
        'third-party/underscore.js',
        'third-party/events.js',
        'third-party/requestAnimationFrame.js'
      ],

      srcFiles : [
        'src/two.js',
        'src/vector.js',
        'src/anchor.js',
        'src/matrix.js',
        'src/renderer/svg.js',
        'src/renderer/canvas.js',
        'src/renderer/webgl.js',
        'src/shape.js',
        'src/polygon.js',
        'src/group.js'
      ]
    },

    watch: {
      scripts: {
        files: ['src/**/*.js', "tests/*.js"],
        tasks: ['jshint', 'concat']
      }
    },

    jshint: {
      options: {
        laxbreak: true,
        undef: true,
        browser: true,
        predef: [ "_", "Backbone", "Two", "requestAnimationFrame", "module", "define"]
      },
      all: ['Gruntfile.js', 'src/**/*.js']
    },

    concat: {
      options: {
        separator: '\n'
      },
      clean : {
        src: [
          "<%= meta.licenseFile %>",
          "<%= meta.srcFiles %>"
        ],
        dest: 'build/two.clean.js'
      },
      dist: {
        src: [
          '<%= meta.licenseFile %>',
          '<%= meta.depFiles %>',
          '<%= meta.srcFiles %>'
        ],
        dest: 'build/<%= pkg.name %>'
      }
    },

    connect: {
      server: {
        options: {
          keepalive: true,
          port: 3000
        }
      }
    },

    uglify: {
       release: {
         src: ['build/two.js'],
        dest: 'build/two.min.js'
       }
    },

    closureCompiler:  {

      options: {
        compilerFile: 'third-party/google_closure_compiler-r2388.jar',

        // set to true if you want to check if files were modified
        // before starting compilation (can save some time in large sourcebases)
        checkModified: true,

        // Set Closure Compiler Directives here
        compilerOpts: {
           language_in: 'ECMASCRIPT3'
        }
      },

      main: {
        src: 'build/two.js',
        dest: 'build/two.min.js'
      }
    }

  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-closure-tools');

  // Default task
  grunt.registerTask('default', ['jshint' , 'concat', 'closureCompiler']);

  // Uglify fallback
  grunt.registerTask('build-uglify', ['jshint' , 'concat', 'uglify']);
};
<commit_msg>Suppress a stylistic 'error', JSHint now runs without any complaints.<commit_after>/* globals module */

module.exports = function(grunt) {

  // Project configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {

      licenseFile : 'license.txt',

      depFiles : [
        'third-party/underscore.js',
        'third-party/events.js',
        'third-party/requestAnimationFrame.js'
      ],

      srcFiles : [
        'src/two.js',
        'src/vector.js',
        'src/anchor.js',
        'src/matrix.js',
        'src/renderer/svg.js',
        'src/renderer/canvas.js',
        'src/renderer/webgl.js',
        'src/shape.js',
        'src/polygon.js',
        'src/group.js'
      ]
    },

    watch: {
      scripts: {
        files: ['src/**/*.js', "tests/*.js"],
        tasks: ['jshint', 'concat']
      }
    },

    jshint: {
      options: {
        laxbreak: true,
        undef: true,
        browser: true,
        '-W009': true,
        predef: [ "_", "Backbone", "Two", "requestAnimationFrame", "module", "define"]
      },
      all: ['Gruntfile.js', 'src/**/*.js']
    },

    concat: {
      options: {
        separator: '\n'
      },
      clean : {
        src: [
          "<%= meta.licenseFile %>",
          "<%= meta.srcFiles %>"
        ],
        dest: 'build/two.clean.js'
      },
      dist: {
        src: [
          '<%= meta.licenseFile %>',
          '<%= meta.depFiles %>',
          '<%= meta.srcFiles %>'
        ],
        dest: 'build/<%= pkg.name %>'
      }
    },

    connect: {
      server: {
        options: {
          keepalive: true,
          port: 3000
        }
      }
    },

    uglify: {
       release: {
         src: ['build/two.js'],
        dest: 'build/two.min.js'
       }
    },

    closureCompiler:  {

      options: {
        compilerFile: 'third-party/google_closure_compiler-r2388.jar',

        // set to true if you want to check if files were modified
        // before starting compilation (can save some time in large sourcebases)
        checkModified: true,

        // Set Closure Compiler Directives here
        compilerOpts: {
           language_in: 'ECMASCRIPT3'
        }
      },

      main: {
        src: 'build/two.js',
        dest: 'build/two.min.js'
      }
    }

  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-closure-tools');

  // Default task
  grunt.registerTask('default', ['jshint' , 'concat', 'closureCompiler']);

  // Uglify fallback
  grunt.registerTask('build-uglify', ['jshint' , 'concat', 'uglify']);
};
<|endoftext|>


<commit_before>
var sys = require( 'sys' );
var exec = require( 'child_process' ).exec;
var escodegen = require( 'escodegen' );
var esprima = require( 'esprima' );

var chipperRewrite = require( '../chipper/ast/chipperRewrite.js' );

/*global module:false*/
module.exports = function( grunt ) {
  'use strict';

  // print this immediately, so it is clear what project grunt is building
  grunt.log.writeln( 'Scenery' );

  var onBuildRead = function( name, path, contents ) {
    return chipperRewrite.chipperRewrite( contents, esprima, escodegen );
  };

  // Project configuration.
  grunt.initConfig( {
    pkg: '<json:package.json>',

    requirejs: {
      // unminified, with has.js
      development: {
        options: {
          almond: true,
          mainConfigFile: "js/config.js",
          out: "build/development/scenery.js",
          name: "config",
          optimize: 'none',
          wrap: {
            startFile: [ "js/wrap-start.frag", "../sherpa/has.js" ],
            endFile: [ "js/wrap-end.frag" ]
          }
        }
      },

      // with has.js
      standalone: {
        options: {
          almond: true,
          mainConfigFile: "js/production-config.js",
          out: "build/standalone/scenery.min.js",
          name: "production-config",
          optimize: 'uglify2',
          generateSourceMaps: true,
          preserveLicenseComments: false,
          wrap: {
            startFile: [ "js/wrap-start.frag", "../sherpa/has.js" ],
            endFile: [ "js/wrap-end.frag" ]
          },
          uglify2: {
            compress: {
              global_defs: {
                assert: false,
                assertSlow: false,
                sceneryLayerLog: false,
                sceneryEventLog: false,
                sceneryAccessibilityLog: false,
                phetAllocation: false
              },
              dead_code: true
            }
          },
          onBuildRead: onBuildRead
        }
      },

      // without has.js
      production: {
        options: {
          almond: true,
          mainConfigFile: "js/production-config.js",
          out: "build/production/scenery.min.js",
          name: "production-config",
          optimize: 'uglify2',
          generateSourceMaps: true,
          preserveLicenseComments: false,
          wrap: {
            startFile: [ "js/wrap-start.frag" ],
            endFile: [ "js/wrap-end.frag" ]
          },
          uglify2: {
            compress: {
              global_defs: {
                assert: false,
                assertSlow: false,
                sceneryLayerLog: false,
                sceneryEventLog: false,
                sceneryAccessibilityLog: false,
                phetAllocation: false
              },
              dead_code: true
            }
          },
          onBuildRead: onBuildRead
        }
      }
    },

    jshint: {
      all: [
        'Gruntfile.js', 'js/**/*.js', '../kite/js/**/*.js', '../dot/js/**/*.js', '../phet-core/js/**/*.js', '../assert/js/**/*.js'
      ],
      scenery: [
        'js/**/*.js'
      ],
      // reference external JSHint options in jshint-options.js
      options: require( '../chipper/grunt/jshint-options' )
    }
  } );

  // default task ('grunt')
  grunt.registerTask( 'default', [ 'jshint:all', 'development', 'standalone', 'production' ] );

  // linter on scenery subset only ('grunt lint')
  grunt.registerTask( 'lint', [ 'jshint:scenery' ] );

  // compilation targets. invoke only one like ('grunt development')
  grunt.registerTask( 'production', [ 'requirejs:production' ] );
  grunt.registerTask( 'standalone', [ 'requirejs:standalone' ] );
  grunt.registerTask( 'development', [ 'requirejs:development' ] );

  grunt.registerTask( 'snapshot', [ 'standalone', '_createSnapshot' ] );

  // creates a performance snapshot for profiling changes
  grunt.registerTask( '_createSnapshot', 'Description', function( arg ) {
    var done = this.async();

    exec( 'git log -1 --date=short', function( error, stdout, stderr ) {
      if ( error ) { throw error; }

      var sha = /commit (.*)$/m.exec( stdout )[1];
      var date = /Date: *(\d+)-(\d+)-(\d+)$/m.exec( stdout );
      var year = date[1].slice( 2, 4 );
      var month = date[2];
      var day = date[3];

      var suffix = '-' + year + month + day + '-' + sha.slice( 0, 10 ) + '.js';

      grunt.file.copy( 'build/standalone/scenery.min.js', 'snapshots/scenery-min' + suffix );
      grunt.file.copy( 'tests/benchmarks/js/perf-current.js', 'snapshots/perf' + suffix );

      grunt.log.writeln( 'Copied standalone js to snapshots/scenery-min' + suffix );
      grunt.log.writeln( 'Copied perf js to       snapshots/perf' + suffix );

      done();
    } );
  } );

  // dependencies
  grunt.loadNpmTasks( 'grunt-requirejs' );
  grunt.loadNpmTasks( 'grunt-contrib-jshint' );
};
<commit_msg>Removing unused var in gruntfile<commit_after>
var exec = require( 'child_process' ).exec;
var escodegen = require( 'escodegen' );
var esprima = require( 'esprima' );

var chipperRewrite = require( '../chipper/ast/chipperRewrite.js' );

/*global module:false*/
module.exports = function( grunt ) {
  'use strict';

  // print this immediately, so it is clear what project grunt is building
  grunt.log.writeln( 'Scenery' );

  var onBuildRead = function( name, path, contents ) {
    return chipperRewrite.chipperRewrite( contents, esprima, escodegen );
  };

  // Project configuration.
  grunt.initConfig( {
    pkg: '<json:package.json>',

    requirejs: {
      // unminified, with has.js
      development: {
        options: {
          almond: true,
          mainConfigFile: "js/config.js",
          out: "build/development/scenery.js",
          name: "config",
          optimize: 'none',
          wrap: {
            startFile: [ "js/wrap-start.frag", "../sherpa/has.js" ],
            endFile: [ "js/wrap-end.frag" ]
          }
        }
      },

      // with has.js
      standalone: {
        options: {
          almond: true,
          mainConfigFile: "js/production-config.js",
          out: "build/standalone/scenery.min.js",
          name: "production-config",
          optimize: 'uglify2',
          generateSourceMaps: true,
          preserveLicenseComments: false,
          wrap: {
            startFile: [ "js/wrap-start.frag", "../sherpa/has.js" ],
            endFile: [ "js/wrap-end.frag" ]
          },
          uglify2: {
            compress: {
              global_defs: {
                assert: false,
                assertSlow: false,
                sceneryLayerLog: false,
                sceneryEventLog: false,
                sceneryAccessibilityLog: false,
                phetAllocation: false
              },
              dead_code: true
            }
          },
          onBuildRead: onBuildRead
        }
      },

      // without has.js
      production: {
        options: {
          almond: true,
          mainConfigFile: "js/production-config.js",
          out: "build/production/scenery.min.js",
          name: "production-config",
          optimize: 'uglify2',
          generateSourceMaps: true,
          preserveLicenseComments: false,
          wrap: {
            startFile: [ "js/wrap-start.frag" ],
            endFile: [ "js/wrap-end.frag" ]
          },
          uglify2: {
            compress: {
              global_defs: {
                assert: false,
                assertSlow: false,
                sceneryLayerLog: false,
                sceneryEventLog: false,
                sceneryAccessibilityLog: false,
                phetAllocation: false
              },
              dead_code: true
            }
          },
          onBuildRead: onBuildRead
        }
      }
    },

    jshint: {
      all: [
        'Gruntfile.js', 'js/**/*.js', '../kite/js/**/*.js', '../dot/js/**/*.js', '../phet-core/js/**/*.js', '../assert/js/**/*.js'
      ],
      scenery: [
        'js/**/*.js'
      ],
      // reference external JSHint options in jshint-options.js
      options: require( '../chipper/grunt/jshint-options' )
    }
  } );

  // default task ('grunt')
  grunt.registerTask( 'default', [ 'jshint:all', 'development', 'standalone', 'production' ] );

  // linter on scenery subset only ('grunt lint')
  grunt.registerTask( 'lint', [ 'jshint:scenery' ] );

  // compilation targets. invoke only one like ('grunt development')
  grunt.registerTask( 'production', [ 'requirejs:production' ] );
  grunt.registerTask( 'standalone', [ 'requirejs:standalone' ] );
  grunt.registerTask( 'development', [ 'requirejs:development' ] );

  grunt.registerTask( 'snapshot', [ 'standalone', '_createSnapshot' ] );

  // creates a performance snapshot for profiling changes
  grunt.registerTask( '_createSnapshot', 'Description', function( arg ) {
    var done = this.async();

    exec( 'git log -1 --date=short', function( error, stdout, stderr ) {
      if ( error ) { throw error; }

      var sha = /commit (.*)$/m.exec( stdout )[1];
      var date = /Date: *(\d+)-(\d+)-(\d+)$/m.exec( stdout );
      var year = date[1].slice( 2, 4 );
      var month = date[2];
      var day = date[3];

      var suffix = '-' + year + month + day + '-' + sha.slice( 0, 10 ) + '.js';

      grunt.file.copy( 'build/standalone/scenery.min.js', 'snapshots/scenery-min' + suffix );
      grunt.file.copy( 'tests/benchmarks/js/perf-current.js', 'snapshots/perf' + suffix );

      grunt.log.writeln( 'Copied standalone js to snapshots/scenery-min' + suffix );
      grunt.log.writeln( 'Copied perf js to       snapshots/perf' + suffix );

      done();
    } );
  } );

  // dependencies
  grunt.loadNpmTasks( 'grunt-requirejs' );
  grunt.loadNpmTasks( 'grunt-contrib-jshint' );
};
<|endoftext|>


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

  grunt.initConfig({

    clean: {
      dist: ['css/main.min.css', 'css/main.min.css.map', 'js/main.min.js']
    },

    concat: {
      dist: {
        src: [
          'bower_components/jquery/dist/jquery.min.js',
          'bower_components/bootstrap/js/*.js',
          'assets/js/*.js',
          'assets/js/**/*.js'
        ],
        dest: 'js/main.min.js'
      }
    },

    uglify: {
      dist: {
        files: {
          'js/main.min.js': 'js/main.min.js'
        }
      }
    },

    less: {
      dev: {
        files: {
          'css/main.min.css': [
            'assets/less/import.less'
          ]
        },
        options: {
          compress: false,
          sourceMap: true,
          sourceMapRootpath: '/',
          sourceMapURL: 'main.min.css.map'
        }
      },
      build: {
        files: {
          'css/main.min.css': [
            'assets/less/import.less'
          ]
        },
        options: {
          compress: true,
          soureMap: false,
          plugins: [
            new (require('less-plugin-autoprefix'))({browsers: ["last 2 versions"]})
          ]
        }
      }
    },

    watch: {
      less: {
        files: [
          'assets/less/*.less',
          'assets/less/**/*.less'
        ],
        tasks: ['less:dev']
      },
      js: {
        files: [
          'assets/js/*.js',
          'assets/js/**/*.js'
        ],
        tasks: ['concat']
      }
    }
  });

  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });

  grunt.registerTask('dev', ['clean', 'less:dev', 'concat'])
  grunt.registerTask('build', ['clean', 'less:build', 'concat', 'uglify'])
  grunt.registerTask('default', ['dev'])

};<commit_msg>fix popover need tooltip bug<commit_after>module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({

    clean: {
      dist: ['css/main.min.css', 'css/main.min.css.map', 'js/main.min.js']
    },

    concat: {
      dist: {
        src: [
          'bower_components/jquery/dist/jquery.min.js',
          'bower_components/bootstrap/js/transition.js',
          'bower_components/bootstrap/js/alert.js',
          'bower_components/bootstrap/js/button.js',
          'bower_components/bootstrap/js/carousel.js',
          'bower_components/bootstrap/js/collapse.js',
          'bower_components/bootstrap/js/dropdown.js',
          'bower_components/bootstrap/js/modal.js',
          'bower_components/bootstrap/js/tooltip.js',
          'bower_components/bootstrap/js/popover.js',
          'bower_components/bootstrap/js/scrollspy.js',
          'bower_components/bootstrap/js/tab.js',
          'assets/js/*.js',
          'assets/js/**/*.js'
        ],
        dest: 'js/main.min.js'
      }
    },

    uglify: {
      dist: {
        files: {
          'js/main.min.js': 'js/main.min.js'
        }
      }
    },

    less: {
      dev: {
        files: {
          'css/main.min.css': [
            'assets/less/import.less'
          ]
        },
        options: {
          compress: false,
          sourceMap: true,
          sourceMapRootpath: '/',
          sourceMapURL: 'main.min.css.map'
        }
      },
      build: {
        files: {
          'css/main.min.css': [
            'assets/less/import.less'
          ]
        },
        options: {
          compress: true,
          soureMap: false,
          plugins: [
            new (require('less-plugin-autoprefix'))({browsers: ["last 2 versions"]})
          ]
        }
      }
    },

    watch: {
      less: {
        files: [
          'assets/less/*.less',
          'assets/less/**/*.less'
        ],
        tasks: ['less:dev']
      },
      js: {
        files: [
          'assets/js/*.js',
          'assets/js/**/*.js'
        ],
        tasks: ['concat']
      }
    }
  });

  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });

  grunt.registerTask('dev', ['clean', 'less:dev', 'concat'])
  grunt.registerTask('build', ['clean', 'less:build', 'concat', 'uglify'])
  grunt.registerTask('default', ['dev'])

};
<|endoftext|>


<commit_before>/* global module:false */
module.exports = function(grunt) {
	var port = grunt.option('port') || 8000;
	// Project configuration
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			banner:
				'/*!\n' +
				' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
				' * http://lab.hakim.se/reveal-js\n' +
				' * MIT licensed\n' +
				' *\n' +
				' * Copyright (C) 2015 Hakim El Hattab, http://hakim.se\n' +
				' */'
		},

		qunit: {
			files: [ 'test/*.html' ]
		},

		uglify: {
			options: {
				banner: '<%= meta.banner %>\n'
			},
			build: {
				src: 'js/reveal.js',
				dest: 'js/reveal.min.js'
			}
		},

		sass: {
			core: {
				files: {
					'css/reveal.css': 'css/reveal.scss',
				}
			},
			themes: {
				files: {
					'css/theme/black.css': 'css/theme/source/black.scss',
					'css/theme/white.css': 'css/theme/source/white.scss',
					'css/theme/league.css': 'css/theme/source/league.scss',
					'css/theme/beige.css': 'css/theme/source/beige.scss',
					'css/theme/night.css': 'css/theme/source/night.scss',
					'css/theme/serif.css': 'css/theme/source/serif.scss',
					'css/theme/simple.css': 'css/theme/source/simple.scss',
					'css/theme/sky.css': 'css/theme/source/sky.scss',
					'css/theme/moon.css': 'css/theme/source/moon.scss',
					'css/theme/solarized.css': 'css/theme/source/solarized.scss',
					'css/theme/blood.css': 'css/theme/source/blood.scss',
					'css/theme/lvh.css': 'css/theme/source/lvh.scss'
				}
			}
		},

		autoprefixer: {
			dist: {
				src: 'css/reveal.css'
			}
		},

		cssmin: {
			compress: {
				files: {
					'css/reveal.min.css': [ 'css/reveal.css' ]
				}
			}
		},

		jshint: {
			options: {
				curly: false,
				eqeqeq: true,
				immed: true,
				latedef: true,
				newcap: true,
				noarg: true,
				sub: true,
				undef: true,
				eqnull: true,
				browser: true,
				expr: true,
				globals: {
					head: false,
					module: false,
					console: false,
					unescape: false,
					define: false,
					exports: false
				}
			},
			files: [ 'Gruntfile.js', 'js/reveal.js' ]
		},

		connect: {
			server: {
				options: {
					port: port,
					base: '.',
					livereload: true,
					open: true
				}
			}
		},

		zip: {
			'reveal-js-presentation.zip': [
				'index.html',
				'css/**',
				'js/**',
				'lib/**',
				'images/**',
				'plugin/**'
			]
		},

		watch: {
            options: {
                livereload: true
            },
			js: {
				files: [ 'Gruntfile.js', 'js/reveal.js' ],
				tasks: 'js'
			},
			theme: {
				files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
				tasks: 'css-themes'
			},
			css: {
				files: [ 'css/reveal.scss' ],
				tasks: 'css-core'
			},
            html: {
                files: [ 'index.html']
            }
		}

	});

	// Dependencies
	grunt.loadNpmTasks( 'grunt-contrib-qunit' );
	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
	grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );
	grunt.loadNpmTasks( 'grunt-contrib-watch' );
	grunt.loadNpmTasks( 'grunt-sass' );
	grunt.loadNpmTasks( 'grunt-contrib-connect' );
	grunt.loadNpmTasks( 'grunt-autoprefixer' );
	grunt.loadNpmTasks( 'grunt-zip' );

	// Default task
	grunt.registerTask( 'default', [ 'css', 'js' ] );

	// JS task
	grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] );

	// Theme CSS
	grunt.registerTask( 'css-themes', [ 'sass:themes' ] );

	// Core framework CSS
	grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] );

	// All CSS
	grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );

	// Package presentation to archive
	grunt.registerTask( 'package', [ 'default', 'zip' ] );

	// Serve presentation locally
	grunt.registerTask( 'serve', [ 'connect', 'watch' ] );

	// Run tests
	grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );

};
<commit_msg>Use .. as path<commit_after>/* global module:false */
module.exports = function(grunt) {
	var port = grunt.option('port') || 8000;
	// Project configuration
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			banner:
				'/*!\n' +
				' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
				' * http://lab.hakim.se/reveal-js\n' +
				' * MIT licensed\n' +
				' *\n' +
				' * Copyright (C) 2015 Hakim El Hattab, http://hakim.se\n' +
				' */'
		},

		qunit: {
			files: [ 'test/*.html' ]
		},

		uglify: {
			options: {
				banner: '<%= meta.banner %>\n'
			},
			build: {
				src: 'js/reveal.js',
				dest: 'js/reveal.min.js'
			}
		},

		sass: {
			core: {
				files: {
					'css/reveal.css': 'css/reveal.scss',
				}
			},
			themes: {
				files: {
					'css/theme/black.css': 'css/theme/source/black.scss',
					'css/theme/white.css': 'css/theme/source/white.scss',
					'css/theme/league.css': 'css/theme/source/league.scss',
					'css/theme/beige.css': 'css/theme/source/beige.scss',
					'css/theme/night.css': 'css/theme/source/night.scss',
					'css/theme/serif.css': 'css/theme/source/serif.scss',
					'css/theme/simple.css': 'css/theme/source/simple.scss',
					'css/theme/sky.css': 'css/theme/source/sky.scss',
					'css/theme/moon.css': 'css/theme/source/moon.scss',
					'css/theme/solarized.css': 'css/theme/source/solarized.scss',
					'css/theme/blood.css': 'css/theme/source/blood.scss',
					'css/theme/lvh.css': 'css/theme/source/lvh.scss'
				}
			}
		},

		autoprefixer: {
			dist: {
				src: 'css/reveal.css'
			}
		},

		cssmin: {
			compress: {
				files: {
					'css/reveal.min.css': [ 'css/reveal.css' ]
				}
			}
		},

		jshint: {
			options: {
				curly: false,
				eqeqeq: true,
				immed: true,
				latedef: true,
				newcap: true,
				noarg: true,
				sub: true,
				undef: true,
				eqnull: true,
				browser: true,
				expr: true,
				globals: {
					head: false,
					module: false,
					console: false,
					unescape: false,
					define: false,
					exports: false
				}
			},
			files: [ 'Gruntfile.js', 'js/reveal.js' ]
		},

		connect: {
			server: {
				options: {
					port: port,
					base: '..',
					livereload: true,
					open: true
				}
			}
		},

		zip: {
			'reveal-js-presentation.zip': [
				'index.html',
				'css/**',
				'js/**',
				'lib/**',
				'images/**',
				'plugin/**'
			]
		},

		watch: {
            options: {
                livereload: true
            },
			js: {
				files: [ 'Gruntfile.js', 'js/reveal.js' ],
				tasks: 'js'
			},
			theme: {
				files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
				tasks: 'css-themes'
			},
			css: {
				files: [ 'css/reveal.scss' ],
				tasks: 'css-core'
			},
            html: {
                files: [ 'index.html']
            }
		}

	});

	// Dependencies
	grunt.loadNpmTasks( 'grunt-contrib-qunit' );
	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
	grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );
	grunt.loadNpmTasks( 'grunt-contrib-watch' );
	grunt.loadNpmTasks( 'grunt-sass' );
	grunt.loadNpmTasks( 'grunt-contrib-connect' );
	grunt.loadNpmTasks( 'grunt-autoprefixer' );
	grunt.loadNpmTasks( 'grunt-zip' );

	// Default task
	grunt.registerTask( 'default', [ 'css', 'js' ] );

	// JS task
	grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] );

	// Theme CSS
	grunt.registerTask( 'css-themes', [ 'sass:themes' ] );

	// Core framework CSS
	grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] );

	// All CSS
	grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );

	// Package presentation to archive
	grunt.registerTask( 'package', [ 'default', 'zip' ] );

	// Serve presentation locally
	grunt.registerTask( 'serve', [ 'connect', 'watch' ] );

	// Run tests
	grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );

};
<|endoftext|>


<commit_before>//Gruntfile
'use strict';

module.exports = function (grunt) {

    require('load-grunt-tasks')(grunt);

    //Initializing the configuration object
    grunt.initConfig({
        // Task configuration
        // Task configuration
        clean: {
            options: {
                "no-write": false, // Change to true for testing
                force: true
            },
            build: [
                'public/assets/**/*',
                'cache/*',
                'logs/*',
                'coverage/*',
                '!**/README.md'
            ],
            templatewrapper: [
                'templates/include/*'
            ]
        },
        php: {
            dist: {
                options: {
                    hostname: '127.0.0.1',
                    port: 8080,
                    base: 'public',
                    keepalive: false,
                    open: false
                }
            }
        },
        composer: {
            options: {
                usePhp: false,
                cwd: '.',
                flags: ['ignore-platform-reqs']
            }
        },
        browserSync: {
            dist: {
                bsFiles: {
                    src: [
                        'public/assets/stylesheets/*.css',
                        'public/assets/javascript/*.js',
                        'public/*.php',
                        'public/**/*.php',
                        'templates/*.html',
                        'templates/**/*.html'
                    ]
                },
                options: {
                    proxy: '<%= php.dist.options.hostname %>:<%= php.dist.options.port %>',
                    watchTask: true,
                    notify: true,
                    open: true,
                    logLevel: 'silent',
                    ghostMode: {
                        clicks: true,
                        scroll: true,
                        links: true,
                        forms: true
                    }
                }
            }
        },
        imagemin: {
            images: {
                options: {
                    optimizationLevel: 4,
                    progressive: true,
                    interlaced: true
                },
                files: [{
                        expand: true,
                        cwd: 'assets/images/',
                        src: ['**/*.{png,jpg,gif}'],
                        dest: 'public/assets/images/'
                    }]
            }
        },
        sass: {
            dist: {
                options: {
                    style: 'compressed'
                },
                files: [{
                    expand: true,
                    cwd: 'assets/stylesheets',
                    src: ['*.scss'],
                    // dest: './public/assets/stylesheets',
                    dest: '.tmp/sass/assets/stylesheets',
                    ext: '.css'
                }]
            }
        },
        copy: {
            fonts: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: 'assets/bower_components/bootstrap-sass/assets/fonts/bootstrap',
                        src: '**',
                        dest: 'public/assets/fonts'
                    },
                    {
                        expand: true,
                        cwd: 'assets/bower_components/components-font-awesome',
                        src: 'fonts/*',
                        dest: 'public/assets'
                    }
                ]
            },
            templatewrapper: {
                files: [
                    {
                        expand: true,
                        cwd: 'assets/templates/include',
                        src: '**',
                        dest: 'templates/include'
                    }
                ]
            }
        },
        concat: {
            options: {
                separator: ';',
            },
            main_js: {
                src: ['./assets/javascript/main.js'],
                dest: './public/assets/javascript/main.js'
            }
        },
        uglify: {
            options: {
                mangle: true
            },
            main_js: {
                files: {
                    './public/assets/javascript/main.js': './public/assets/javascript/main.js'
                }
            }
        },
        phpunit: {
            classes: {
                dir: 'tests/'   //location of the tests
            },
            options: {
                bin: 'vendor/bin/phpunit',
                colors: true,
                coverageHtml: 'coverage'
            }
        },
        // Automatically inject Bower components into the app
        wiredep: {
            options: {
                cwd: ''
            },
            app: {
                src: [
                    './assets/templates/include/header.html',
                    './assets/templates/include/footer.html'
                ],
                ignorePath:  /\.\.\/\.\.\//,
                exclude: [  'bower_components/components-font-awesome/css/font-awesome.css' ]
            }
        },
        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            html: [
                './assets/templates/include/header.html',
                './assets/templates/include/footer.html'
            ],
            options: {
                dest: './public',
                flow: {
                    html: {
                        steps: {
                            js: ['concat', 'uglifyjs'],
                            css: ['cssmin']
                        },
                        post: {}
                    }
                }
            }
        },
        // Performs rewrites based on filerev and the useminPrepare configuration
        usemin: {
            html: [
                'templates/include/header.html',
                'templates/include/footer.html'
            ],
            css: ['public/assets/stylesheets/{,*/}*.css'],
            options: {
                assetsDirs: ['public/assets','public/assets/images','public/assets/fonts','public/assets/stylesheets','public/assets/javascript']
            }
        },
        watch: {
            main_js: {
                files: [
                    //watched files
                    './assets/javascript/main.js'
                ],
                tasks: ['concat:main_js', 'uglify:frontend'], //tasks to run
                options: {
                    livereload: true                        //reloads the browser
                }
            },
            sass: {
                files: ['./assets/stylesheets/*.scss', './assets/stylesheets/**/*.scss'], //watched files
                tasks: ['sass'], //tasks to run
                options: {
                    livereload: true                        //reloads the browser
                }
            },
            tests: {
                files: ['public/src/*.php'], //the task will run only when you save files in this location
                tasks: ['phpunit']
            },
            composer_json: {
                files: [
                    'composer.json',
                    'composer.lock'
                ],
                tasks: ['composer:update']
            }
        }
    });

    // Task definition
    grunt.registerTask('default', ['build']);
    grunt.registerTask('build', [
        'composer:update',
        'phpunit',
        'clean:build',
        'wiredep',
        'useminPrepare',
        'imagemin',
        'copy:fonts',
        'sass',
        'cssmin',
        'concat:generated',
        'uglify:generated',
        'clean:templatewrapper',
        'copy:templatewrapper',
        'usemin'
    ]);
    grunt.registerTask('serve', [
        'build',
        'php:dist', // Start PHP Server
        'browserSync:dist', // Using the php instance as a proxy
        'watch'             // Any other watch tasks you want to run
    ]);
};
<commit_msg>Tweaked this in favor of more dynamic functioning<commit_after>//Gruntfile
'use strict';

module.exports = function (grunt) {

    require('load-grunt-tasks')(grunt);

    //Initializing the configuration object
    grunt.initConfig({
        // Task configuration
        // Task configuration
        clean: {
            options: {
                "no-write": false, // Change to true for testing
                force: true
            },
            build: [
                'public/assets/**/*',
                'cache/*',
                'logs/*',
                'coverage/*',
                '!**/README.md'
            ],
            templatewrapper: [
                'templates/include/*'
            ]
        },
        php: {
            dist: {
                options: {
                    hostname: '127.0.0.1',
                    port: 8080,
                    base: 'public',
                    keepalive: false,
                    open: false
                }
            }
        },
        composer: {
            options: {
                usePhp: false,
                cwd: '.',
                flags: ['ignore-platform-reqs']
            }
        },
        browserSync: {
            dist: {
                bsFiles: {
                    src: [
                        'public/assets/stylesheets/*.css',
                        'public/assets/javascript/*.js',
                        'public/*.php',
                        'public/**/*.php',
                        'templates/*.html',
                        'templates/**/*.html'
                    ]
                },
                options: {
                    proxy: '<%= php.dist.options.hostname %>:<%= php.dist.options.port %>',
                    watchTask: true,
                    notify: true,
                    open: true,
                    logLevel: 'silent',
                    ghostMode: {
                        clicks: true,
                        scroll: true,
                        links: true,
                        forms: true
                    }
                }
            }
        },
        imagemin: {
            images: {
                options: {
                    optimizationLevel: 4,
                    progressive: true,
                    interlaced: true
                },
                files: [{
                        expand: true,
                        cwd: 'assets/images/',
                        src: ['**/*.{png,jpg,gif}'],
                        dest: 'public/assets/images/'
                    }]
            }
        },
        sass: {
            dist: {
                options: {
                    style: 'compressed'
                },
                files: [{
                    expand: true,
                    cwd: 'assets/stylesheets',
                    src: ['*.scss'],
                    // dest: './public/assets/stylesheets',
                    dest: '.tmp/sass/assets/stylesheets',
                    ext: '.css'
                }]
            }
        },
        copy: {
            fonts: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: 'assets/bower_components/bootstrap-sass/assets/fonts/bootstrap',
                        src: '**',
                        dest: 'public/assets/fonts'
                    },
                    {
                        expand: true,
                        cwd: 'assets/bower_components/components-font-awesome',
                        src: 'fonts/*',
                        dest: 'public/assets'
                    }
                ]
            },
            templatewrapper: {
                files: [
                    {
                        expand: true,
                        cwd: 'assets/templates/include',
                        src: '**',
                        dest: 'templates/include'
                    }
                ]
            }
        },
        concat: {
            options: {
                separator: ';',
            },
            main_js: {
                src: ['./assets/javascript/main.js'],
                dest: './public/assets/javascript/main.js'
            }
        },
        uglify: {
            options: {
                mangle: true
            },
            main_js: {
                files: {
                    './public/assets/javascript/main.js': './public/assets/javascript/main.js'
                }
            }
        },
        phpunit: {
            classes: {
                dir: 'tests/'   //location of the tests
            },
            options: {
                bin: 'vendor/bin/phpunit',
                colors: true,
                coverageHtml: 'coverage'
            }
        },
        // Automatically inject Bower components into the app
        wiredep: {
            options: {
                cwd: ''
            },
            app: {
                src: [
                    './assets/templates/include/header.html',
                    './assets/templates/include/footer.html'
                ],
                ignorePath:  /\.\.\/\.\.\//,
                exclude: [  'bower_components/components-font-awesome/css/font-awesome.css' ]
            }
        },
        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            html: [
                './assets/templates/include/header.html',
                './assets/templates/include/footer.html'
            ],
            options: {
                dest: './public',
                flow: {
                    html: {
                        steps: {
                            js: ['concat', 'uglifyjs'],
                            css: ['cssmin']
                        },
                        post: {}
                    }
                }
            }
        },
        // Performs rewrites based on filerev and the useminPrepare configuration
        usemin: {
            html: [
                'templates/include/header.html',
                'templates/include/footer.html'
            ],
            css: ['public/assets/stylesheets/{,*/}*.css'],
            options: {
                assetsDirs: ['public/assets','public/assets/images','public/assets/fonts','public/assets/stylesheets','public/assets/javascript']
            }
        },
        watch: {
            js: {
                files: ['./assets/javascript/{,*/}*.js'],
                tasks: ['useminPrepare','concat:generated','uglify:generated'],
                options: {
                  livereload: true                        //reloads the browser
                }
            },
            sass: {
                files: ['./assets/stylesheets/*.scss', './assets/stylesheets/**/*.scss'], //watched files
                tasks: ['sass'], //tasks to run
                options: {
                    livereload: true                        //reloads the browser
                }
            },
            tests: {
                files: ['app/src/*.php'], //the task will run only when you save files in this location
                tasks: ['phpunit']
            },
            composer_json: {
                files: [
                    'composer.json',
                    'composer.lock'
                ],
                tasks: ['composer:update']
            }
        }
    });

    // Task definition
    grunt.registerTask('default', ['build']);
    grunt.registerTask('build', [
        'composer:update',
        'phpunit',
        'clean:build',
        'wiredep',
        'useminPrepare',
        'imagemin',
        'copy:fonts',
        'sass',
        'cssmin',
        'concat:generated',
        'uglify:generated',
        'clean:templatewrapper',
        'copy:templatewrapper',
        'usemin'
    ]);
    grunt.registerTask('serve', [
        'build',
        'php:dist', // Start PHP Server
        'browserSync:dist', // Using the php instance as a proxy
        'watch'             // Any other watch tasks you want to run
    ]);
};
<|endoftext|>


<commit_before>/**
 * Created by bantonides on 11/27/13.
 */
module.exports = function(grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    /**
     * We read in our `package.json` file so we can access the package name and
     * version. It's already there, so we don't repeat ourselves here.
     */
    pkg: grunt.file.readJSON('package.json'),
    sass: {
      dist: {
        files: {
          'public/assets/css/app.css': 'public/assets/css/app.scss'
        }
      }
    },
    watch: {
      css: {
        files: '**/*.scss',
        tasks: ['sass'],
        options: {
          livereload: true
        }
      },
      html: {
        files: '**/*.html',
        options: {
          livereload: true
        }
      },
      js: {
        files: 'public/**/*.js',
        tasks: ['gjslint']
      }

    },
    gjslint: {
      options: {
        flags: [
          '--disable 220', //ignore error code 220 from gjslint
          '--max_line_length 120'//,
          //'--jslint_error all'
        ],
        reporter: {
          name: 'console'
        }
      },
      all: {
        src: ['*.js',
          'public/assets/js/app/**/*.js']
      }
    },
    // start the app, instead of typing `node app.js`
    nodemon: {
      dev: {
        options: {
          file: 'app.js',
          ignoredFiles: ['public/**', '.sass-cache/**', '.git/**', 'newrelic_agent.log', 'sessions/*']
        }
      },
      prod_like: {
        options: {
          file: 'app.js',
          ignoredFiles: ['*']
        }
      }
    },
    bower: {
      install: {
        // copy dependent packages from bower.json
      }
    },
    replace: {
      auth0: {
        src: ['public/assets/js/app/config.js.template'],
        dest: 'public/assets/js/app/config.js',
        replacements: [{
          from: 'AUTH0_CLIENT_ID',
          to: process.env.AUTH0_CLIENT_ID
        },
        {
          from: 'AUTH0_DOMAIN',
          to: process.env.AUTH0_DOMAIN
        },
        {
          from: 'AUTH0_AUDIENCE',
          to: process.env.AUTH0_AUDIENCE
        },
        {
          from: 'AUTH0_REDIRECT_URI',
          to: process.env.AUTH0_REDIRECT_URI
        }]
      }
    },
    // Run blocking grunt tasks concurrently
    concurrent: {
      dev_configure: {
        options: {
          logConcurrentOutput: true
        },
        tasks: ['bower:install', 'replace:auth0']
      },
      dev_run: {
        options: {
          logConcurrentOutput: true
        },
        tasks: ['watch', 'nodemon:dev']
      },
      prod_like_configure: {
        tasks: ['sass', 'replace:auth0']
      },
      prod_like_run: {
        tasks: ['nodemon:prod_like']
      }
    }
  });

  grunt.loadNpmTasks('grunt-bower-task');

  grunt.registerTask('default', ['concurrent:dev_configure','concurrent:dev_run']);
  grunt.registerTask('staging', ['concurrent:prod_like_configure','concurrent:prod_like_run'])
  grunt.registerTask('production', ['concurrent:prod_like_configure','concurrent:prod_like_run'])
};
<commit_msg>stop gjslint, too noisy<commit_after>/**
 * Created by bantonides on 11/27/13.
 */
module.exports = function(grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    /**
     * We read in our `package.json` file so we can access the package name and
     * version. It's already there, so we don't repeat ourselves here.
     */
    pkg: grunt.file.readJSON('package.json'),
    sass: {
      dist: {
        files: {
          'public/assets/css/app.css': 'public/assets/css/app.scss'
        }
      }
    },
    watch: {
      css: {
        files: '**/*.scss',
        tasks: ['sass'],
        options: {
          livereload: true
        }
      },
      html: {
        files: '**/*.html',
        options: {
          livereload: true
        }
      },
      js: {
        files: 'public/**/*.js'
      }

    },
    gjslint: {
      options: {
        flags: [
          '--disable 220', //ignore error code 220 from gjslint
          '--max_line_length 120'//,
          //'--jslint_error all'
        ],
        reporter: {
          name: 'console'
        }
      },
      all: {
        src: ['*.js',
          'public/assets/js/app/**/*.js']
      }
    },
    // start the app, instead of typing `node app.js`
    nodemon: {
      dev: {
        options: {
          file: 'app.js',
          ignoredFiles: ['public/**', '.sass-cache/**', '.git/**', 'newrelic_agent.log', 'sessions/*']
        }
      },
      prod_like: {
        options: {
          file: 'app.js',
          ignoredFiles: ['*']
        }
      }
    },
    bower: {
      install: {
        // copy dependent packages from bower.json
      }
    },
    replace: {
      auth0: {
        src: ['public/assets/js/app/config.js.template'],
        dest: 'public/assets/js/app/config.js',
        replacements: [{
          from: 'AUTH0_CLIENT_ID',
          to: process.env.AUTH0_CLIENT_ID
        },
        {
          from: 'AUTH0_DOMAIN',
          to: process.env.AUTH0_DOMAIN
        },
        {
          from: 'AUTH0_AUDIENCE',
          to: process.env.AUTH0_AUDIENCE
        },
        {
          from: 'AUTH0_REDIRECT_URI',
          to: process.env.AUTH0_REDIRECT_URI
        }]
      }
    },
    // Run blocking grunt tasks concurrently
    concurrent: {
      dev_configure: {
        options: {
          logConcurrentOutput: true
        },
        tasks: ['bower:install', 'replace:auth0']
      },
      dev_run: {
        options: {
          logConcurrentOutput: true
        },
        tasks: ['watch', 'nodemon:dev']
      },
      prod_like_configure: {
        tasks: ['sass', 'replace:auth0']
      },
      prod_like_run: {
        tasks: ['nodemon:prod_like']
      }
    }
  });

  grunt.loadNpmTasks('grunt-bower-task');

  grunt.registerTask('default', ['concurrent:dev_configure','concurrent:dev_run']);
  grunt.registerTask('staging', ['concurrent:prod_like_configure','concurrent:prod_like_run'])
  grunt.registerTask('production', ['concurrent:prod_like_configure','concurrent:prod_like_run'])
};
<|endoftext|>