<commit_before>/* jshint node:true */
"use strict";

module.exports = function (grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),
    // js minification
    uglify: {
      options: {
        mangle: true, // mangle var names
        mangleProperties: {
          regex: /^_/ // this will mangle all properties starting with an underscore
        },
        reserveDOMProperties: true, // do not mangle browser props
        compress: {
          drop_console: true, // remove console log statements
          drop_debugger: true, // remove debugger statements
          dead_code: true, // removes unreachable code
          unused: true, // remove unused code
          sequences: true,
          if_return: true,
          join_vars: true,
          keep_fargs: true,
          conditionals: true,
          evaluate: true
        },
        sourceMap: true,
        report: "min"
      },
      main: {
        options: {
          banner: "/*! <%= pkg.name %> <%= pkg.version %> | Copyright (c) <%= grunt.template.today('yyyy') %> Tim Ruffles | BSD 2 License */",
          sourceMapIn: "src/drag-drop-polyfill.js.map"
        },
        src: "src/drag-drop-polyfill.js",
        dest: "src/drag-drop-polyfill.min.js"
      },
      scroll: {
        options: {
          sourceMapIn: "src/drag-drop-polyfill-scroll-behaviour.js.map"
        },
        src: "src/drag-drop-polyfill-scroll-behaviour.js",
        dest: "src/drag-drop-polyfill-scroll-behaviour.min.js"
      }
    },
    // http server config for development and demo page
    connect: {
      // starts a server that will serve the development sources
      // instead of the release sources.
      dev: {
        options: {
          port: 8000,
          open: "http://localhost:8000/spec-compliance/",
          livereload: 35731,
          middleware: function (connect, options, middlewares) {

            // inject a custom middleware into the array of default middlewares
            middlewares.unshift(function (req, res, next) {

              // regex matching release file urls
              var redirectFrom = /\/release\//;
              // src url fragment
              var redirectTo = "/src/";

              if (redirectFrom.test(req.url)) {

                // modify url to point to src files
                var srcUrl = req.url.replace(redirectFrom, redirectTo);
                // unminified sources
                req.url = srcUrl.replace(".min", "");
              }

              next();
            });

            return middlewares;
          }
        }
      },
      // starts a server that will serve the demo page with release sources
      release: {
        options: {
          port: 8001,
          open: "http://localhost:8001/spec-compliance/"
        }
      }
    },
    // run tsc from grunt but use tsconfig.json
    ts: {
      build: {
        tsconfig: true
      }
    },
    tslint: {
      options: {
        // can be a configuration object or a filepath to tslint.json
        configuration: "tslint.json"
      },
      files: {
        src: [
          "src/*.ts",
          "!src/*.d.ts"
        ]
      }
    },
    clean: {
      release: ["release"]
    },
    copy: {
      // copy files from src to release folder
      release: {
        files: [
          // includes files within path
          {expand: true, cwd: "src", src: ["*.css", "*.d.ts", "*.js"], dest: "release/", filter: "isFile", flatten: true}
        ]
      }
    },
    // automatically recompile on changes
    watch: {
      ts: {
        files: ["src/**/*.ts", "!src/**/*.d.ts"],
        tasks: ["ts"],
        options: {
          debounceDelay: 250,
          atBegin: true,
          livereload: 35731
        }
      },
      resources: {
        files: ["src/**/*.css", "spec-compliance/**/*"],
        options: {
          debounceDelay: 500,
          livereload: 35731
        }
      }
    },
    // bump version, commit, tag
    bump: {
      options: {
        files: ["package.json", "bower.json"],
        updateConfigs: ["pkg"],
        commit: true,
        commitMessage: "Release v%VERSION%",
        commitFiles: ["package.json", "bower.json", "CHANGELOG.md", "release"],
        createTag: true,
        tagName: "v%VERSION%",
        tagMessage: "Version %VERSION%",
        push: true,
        pushTo: "origin",
        gitDescribeOptions: "--tags --always --abbrev=1 --dirty=-d",
        globalReplace: false,
        prereleaseName: "beta",
        metadata: "",
        regExp: false
      }
    }
  });

  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-connect");
  grunt.loadNpmTasks("grunt-contrib-clean");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-ts");
  grunt.loadNpmTasks("grunt-tslint");
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-bump');

  // compile, lint, minify, clean copy to release folder
  grunt.registerTask("prepare-release", "Prepare a release by building release files and bumping version", function (bump) {
    if (!bump) {
      grunt.log.error("You must specify the version bump! See https://github.com/vojtajina/grunt-bump/tree/v0.7.0");
      return;
    }
    grunt.task.run("bump-only:" + bump, "ts", "tslint", "uglify", "clean", "copy");
  });

  // serve release files
  grunt.registerTask("serve-release", "serve release files for checking that release files have no issues", ["connect:release", "watch:resources"]);

  // publish a prepared release
  grunt.registerTask("publish-release", ["bump-commit", "npm-publish"]);

  // default task for developers to start coding
  grunt.registerTask("default", ["connect:dev", "watch"]);
};
<commit_msg>changed order of prepare release subtasks to first check validity of source-code<commit_after>/* jshint node:true */
"use strict";

module.exports = function (grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON("package.json"),
    // js minification
    uglify: {
      options: {
        mangle: true, // mangle var names
        mangleProperties: {
          regex: /^_/ // this will mangle all properties starting with an underscore
        },
        reserveDOMProperties: true, // do not mangle browser props
        compress: {
          drop_console: true, // remove console log statements
          drop_debugger: true, // remove debugger statements
          dead_code: true, // removes unreachable code
          unused: true, // remove unused code
          sequences: true,
          if_return: true,
          join_vars: true,
          keep_fargs: true,
          conditionals: true,
          evaluate: true
        },
        sourceMap: true,
        report: "min"
      },
      main: {
        options: {
          banner: "/*! <%= pkg.name %> <%= pkg.version %> | Copyright (c) <%= grunt.template.today('yyyy') %> Tim Ruffles | BSD 2 License */",
          sourceMapIn: "src/drag-drop-polyfill.js.map"
        },
        src: "src/drag-drop-polyfill.js",
        dest: "src/drag-drop-polyfill.min.js"
      },
      scroll: {
        options: {
          sourceMapIn: "src/drag-drop-polyfill-scroll-behaviour.js.map"
        },
        src: "src/drag-drop-polyfill-scroll-behaviour.js",
        dest: "src/drag-drop-polyfill-scroll-behaviour.min.js"
      }
    },
    // http server config for development and demo page
    connect: {
      // starts a server that will serve the development sources
      // instead of the release sources.
      dev: {
        options: {
          port: 8000,
          open: "http://localhost:8000/spec-compliance/",
          livereload: 35731,
          middleware: function (connect, options, middlewares) {

            // inject a custom middleware into the array of default middlewares
            middlewares.unshift(function (req, res, next) {

              // regex matching release file urls
              var redirectFrom = /\/release\//;
              // src url fragment
              var redirectTo = "/src/";

              if (redirectFrom.test(req.url)) {

                // modify url to point to src files
                var srcUrl = req.url.replace(redirectFrom, redirectTo);
                // unminified sources
                req.url = srcUrl.replace(".min", "");
              }

              next();
            });

            return middlewares;
          }
        }
      },
      // starts a server that will serve the demo page with release sources
      release: {
        options: {
          port: 8001,
          open: "http://localhost:8001/spec-compliance/"
        }
      }
    },
    // run tsc from grunt but use tsconfig.json
    ts: {
      build: {
        tsconfig: true
      }
    },
    tslint: {
      options: {
        // can be a configuration object or a filepath to tslint.json
        configuration: "tslint.json"
      },
      files: {
        src: [
          "src/*.ts",
          "!src/*.d.ts"
        ]
      }
    },
    clean: {
      release: ["release"]
    },
    copy: {
      // copy files from src to release folder
      release: {
        files: [
          // includes files within path
          {expand: true, cwd: "src", src: ["*.css", "*.d.ts", "*.js"], dest: "release/", filter: "isFile", flatten: true}
        ]
      }
    },
    // automatically recompile on changes
    watch: {
      ts: {
        files: ["src/**/*.ts", "!src/**/*.d.ts"],
        tasks: ["ts"],
        options: {
          debounceDelay: 250,
          atBegin: true,
          livereload: 35731
        }
      },
      resources: {
        files: ["src/**/*.css", "spec-compliance/**/*"],
        options: {
          debounceDelay: 500,
          livereload: 35731
        }
      }
    },
    // bump version, commit, tag
    bump: {
      options: {
        files: ["package.json", "bower.json"],
        updateConfigs: ["pkg"],
        commit: true,
        commitMessage: "Release v%VERSION%",
        commitFiles: ["package.json", "bower.json", "CHANGELOG.md", "release"],
        createTag: true,
        tagName: "v%VERSION%",
        tagMessage: "Version %VERSION%",
        push: true,
        pushTo: "origin",
        gitDescribeOptions: "--tags --always --abbrev=1 --dirty=-d",
        globalReplace: false,
        prereleaseName: "beta",
        metadata: "",
        regExp: false
      }
    }
  });

  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-connect");
  grunt.loadNpmTasks("grunt-contrib-clean");
  grunt.loadNpmTasks("grunt-contrib-copy");
  grunt.loadNpmTasks("grunt-contrib-watch");
  grunt.loadNpmTasks("grunt-ts");
  grunt.loadNpmTasks("grunt-tslint");
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-bump');

  // compile, lint, minify, clean copy to release folder
  grunt.registerTask("prepare-release", "Prepare a release by building release files and bumping version", function (bump) {
    if (!bump) {
      grunt.log.error("You must specify the version bump! See https://github.com/vojtajina/grunt-bump/tree/v0.7.0");
      return;
    }
    grunt.task.run("ts", "tslint", "bump-only:" + bump, "uglify", "clean", "copy");
  });

  // serve release files
  grunt.registerTask("serve-release", "serve release files for checking that release files have no issues", ["connect:release", "watch:resources"]);

  // publish a prepared release
  grunt.registerTask("publish-release", ["bump-commit", "npm-publish"]);

  // default task for developers to start coding
  grunt.registerTask("default", ["connect:dev", "watch"]);
};
<|endoftext|>


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

    // Project configuration
    grunt.initConfig({
        // Metadata
        pkg: grunt.file.readJSON('package.json'),
        fragments: './build/fragments/',
        banner: '/*!\n' +
                ' * Knockout JavaScript library v<%= pkg.version %>\n' +
                ' * (c) Steven Sanderson - <%= pkg.homepage %>\n' +
                ' * License: <%= pkg.licenses[0].type %> (<%= pkg.licenses[0].url %>)\n' +
                ' */\n\n',

        checktrailingspaces: {
            main: {
                src: [
                    "**/*.{js,html,css,bat,ps1,sh}",
                    "!build/output/**",
                    "!node_modules/**"
                ],
                filter: 'isFile'
            }
        },
        build: {
            debug: './build/output/knockout-latest.debug.js',
            min: './build/output/knockout-latest.js'
        },
        dist: {
            debug: './dist/knockout.debug.js',
            min: './dist/knockout.js'
        },
        test: {
            phantomjs: 'spec/runner.phantom.js',
            node: 'spec/runner.node.js'
        }
    });

    grunt.registerTask('clean', 'Clean up output files.', function (target) {
        var output = grunt.config('build');
        var files = [ output.debug, output.min ];
        var options = { force: (target == 'force') };
        _.forEach(files, function (file) {
            if (grunt.file.exists(file))
                grunt.file.delete(file, options);
        });
        return !this.errorCount;
    });

    var trailingSpaceRegex = /[ ]$/;
    grunt.registerMultiTask('checktrailingspaces', 'checktrailingspaces', function() {
        var matches = [];
        this.files[0].src.forEach(function(filepath) {
            var content = grunt.file.read(filepath),
                lines = content.split(/\r*\n/);
            lines.forEach(function(line, index) {
                if (trailingSpaceRegex.test(line)) {
                    matches.push([filepath, (index+1), line].join(':'));
                }
            });
        });
        if (matches.length) {
            grunt.log.error("The following files have trailing spaces that need to be cleaned up:");
            grunt.log.writeln(matches.join('\n'));
            return false;
        }
    });

    function getReferencedSources(sourceReferencesFilename) {
        // Returns the array of filenames referenced by a file like source-references.js
        var result;
        global.knockoutDebugCallback = function(sources) { result = sources; };
        eval(grunt.file.read(sourceReferencesFilename));
        return result;
    }

    function getCombinedSources() {
        var fragments = grunt.config('fragments'),
            sourceFilenames = [
                fragments + 'extern-pre.js',
                fragments + 'amd-pre.js',
                getReferencedSources(fragments + 'source-references.js'),
                fragments + 'amd-post.js',
                fragments + 'extern-post.js'
            ],
            flattenedSourceFilenames = Array.prototype.concat.apply([], sourceFilenames),
            combinedSources = flattenedSourceFilenames.map(function(filename) {
                return grunt.file.read('./' + filename);
            }).join('');

        return combinedSources.replace('##VERSION##', grunt.config('pkg.version'));
    }

    function buildDebug(output) {
        var source = [];
        source.push(grunt.config('banner'));
        source.push('(function(){\n');
        source.push('var DEBUG=true;\n');
        source.push(getCombinedSources());
        source.push('})();\n');
        grunt.file.write(output, source.join('').replace(/\r\n/g, '\n'));
    }

    function buildMin(output, done) {
        var cc = require('closure-compiler');
        var options = {
            compilation_level: 'ADVANCED_OPTIMIZATIONS',
            output_wrapper: '(function() {%output%})();'
        };
        grunt.log.write('Compiling...');
        cc.compile('/**@const*/var DEBUG=false;' + getCombinedSources(), options, function (err, stdout, stderr) {
            if (err) {
                grunt.log.error(err);
                done(false);
            } else {
                grunt.log.ok();
                grunt.file.write(output, (grunt.config('banner') + stdout).replace(/\r\n/g, '\n'));
                done(true);
            }
        });
    }

    grunt.registerMultiTask('build', 'Build', function() {
        if (!this.errorCount) {
            var output = this.data;
            if (this.target === 'debug') {
                buildDebug(output);
            } else if (this.target === 'min') {
                buildMin(output, this.async());
            }
        }
        return !this.errorCount;
    });

    grunt.registerMultiTask('test', 'Run tests', function () {
        var done = this.async();
        grunt.util.spawn({ cmd: this.target, args: [this.data] },
            function (error, result, code) {
                if (code === 127 /*not found*/) {
                    grunt.verbose.error(result.stderr);
                    // ignore this error
                    done(true);
                } else {
                    grunt.log.writeln(result.stdout);
                    if (error)
                        grunt.log.error(result.stderr);
                    done(!error);
                }
            }
        );
    });

    grunt.registerTask('dist', function() {
        var version = grunt.config('pkg.version'),
            buildConfig = grunt.config('build'),
            distConfig = grunt.config('dist');
        grunt.file.copy(buildConfig.debug, distConfig.debug);
        grunt.file.copy(buildConfig.min, distConfig.min);

        console.log('To publish, run:');
        console.log('    git add bower.json');
        console.log('    git add -f ' + distConfig.debug);
        console.log('    git add -f ' + distConfig.min);
        console.log('    git checkout head');
        console.log('    git commit -m \'Version ' + version + ' for distribution\'');
        console.log('    git tag -a v' + version + ' -m \'Add tag v' + version + '\'');
        console.log('    git checkout master');
        console.log('    git push origin --tags');
    });

    // Default task.
    grunt.registerTask('default', ['clean', 'checktrailingspaces', 'build', 'test']);
};
<commit_msg>Change attribution in banner<commit_after>/*global module:false*/
module.exports = function(grunt) {
    var _ = grunt.util._;

    // Project configuration
    grunt.initConfig({
        // Metadata
        pkg: grunt.file.readJSON('package.json'),
        fragments: './build/fragments/',
        banner: '/*!\n' +
                ' * Knockout JavaScript library v<%= pkg.version %>\n' +
                ' * (c) The Knockout.js team - <%= pkg.homepage %>\n' +
                ' * License: <%= pkg.licenses[0].type %> (<%= pkg.licenses[0].url %>)\n' +
                ' */\n\n',

        checktrailingspaces: {
            main: {
                src: [
                    "**/*.{js,html,css,bat,ps1,sh}",
                    "!build/output/**",
                    "!node_modules/**"
                ],
                filter: 'isFile'
            }
        },
        build: {
            debug: './build/output/knockout-latest.debug.js',
            min: './build/output/knockout-latest.js'
        },
        dist: {
            debug: './dist/knockout.debug.js',
            min: './dist/knockout.js'
        },
        test: {
            phantomjs: 'spec/runner.phantom.js',
            node: 'spec/runner.node.js'
        }
    });

    grunt.registerTask('clean', 'Clean up output files.', function (target) {
        var output = grunt.config('build');
        var files = [ output.debug, output.min ];
        var options = { force: (target == 'force') };
        _.forEach(files, function (file) {
            if (grunt.file.exists(file))
                grunt.file.delete(file, options);
        });
        return !this.errorCount;
    });

    var trailingSpaceRegex = /[ ]$/;
    grunt.registerMultiTask('checktrailingspaces', 'checktrailingspaces', function() {
        var matches = [];
        this.files[0].src.forEach(function(filepath) {
            var content = grunt.file.read(filepath),
                lines = content.split(/\r*\n/);
            lines.forEach(function(line, index) {
                if (trailingSpaceRegex.test(line)) {
                    matches.push([filepath, (index+1), line].join(':'));
                }
            });
        });
        if (matches.length) {
            grunt.log.error("The following files have trailing spaces that need to be cleaned up:");
            grunt.log.writeln(matches.join('\n'));
            return false;
        }
    });

    function getReferencedSources(sourceReferencesFilename) {
        // Returns the array of filenames referenced by a file like source-references.js
        var result;
        global.knockoutDebugCallback = function(sources) { result = sources; };
        eval(grunt.file.read(sourceReferencesFilename));
        return result;
    }

    function getCombinedSources() {
        var fragments = grunt.config('fragments'),
            sourceFilenames = [
                fragments + 'extern-pre.js',
                fragments + 'amd-pre.js',
                getReferencedSources(fragments + 'source-references.js'),
                fragments + 'amd-post.js',
                fragments + 'extern-post.js'
            ],
            flattenedSourceFilenames = Array.prototype.concat.apply([], sourceFilenames),
            combinedSources = flattenedSourceFilenames.map(function(filename) {
                return grunt.file.read('./' + filename);
            }).join('');

        return combinedSources.replace('##VERSION##', grunt.config('pkg.version'));
    }

    function buildDebug(output) {
        var source = [];
        source.push(grunt.config('banner'));
        source.push('(function(){\n');
        source.push('var DEBUG=true;\n');
        source.push(getCombinedSources());
        source.push('})();\n');
        grunt.file.write(output, source.join('').replace(/\r\n/g, '\n'));
    }

    function buildMin(output, done) {
        var cc = require('closure-compiler');
        var options = {
            compilation_level: 'ADVANCED_OPTIMIZATIONS',
            output_wrapper: '(function() {%output%})();'
        };
        grunt.log.write('Compiling...');
        cc.compile('/**@const*/var DEBUG=false;' + getCombinedSources(), options, function (err, stdout, stderr) {
            if (err) {
                grunt.log.error(err);
                done(false);
            } else {
                grunt.log.ok();
                grunt.file.write(output, (grunt.config('banner') + stdout).replace(/\r\n/g, '\n'));
                done(true);
            }
        });
    }

    grunt.registerMultiTask('build', 'Build', function() {
        if (!this.errorCount) {
            var output = this.data;
            if (this.target === 'debug') {
                buildDebug(output);
            } else if (this.target === 'min') {
                buildMin(output, this.async());
            }
        }
        return !this.errorCount;
    });

    grunt.registerMultiTask('test', 'Run tests', function () {
        var done = this.async();
        grunt.util.spawn({ cmd: this.target, args: [this.data] },
            function (error, result, code) {
                if (code === 127 /*not found*/) {
                    grunt.verbose.error(result.stderr);
                    // ignore this error
                    done(true);
                } else {
                    grunt.log.writeln(result.stdout);
                    if (error)
                        grunt.log.error(result.stderr);
                    done(!error);
                }
            }
        );
    });

    grunt.registerTask('dist', function() {
        var version = grunt.config('pkg.version'),
            buildConfig = grunt.config('build'),
            distConfig = grunt.config('dist');
        grunt.file.copy(buildConfig.debug, distConfig.debug);
        grunt.file.copy(buildConfig.min, distConfig.min);

        console.log('To publish, run:');
        console.log('    git add bower.json');
        console.log('    git add -f ' + distConfig.debug);
        console.log('    git add -f ' + distConfig.min);
        console.log('    git checkout head');
        console.log('    git commit -m \'Version ' + version + ' for distribution\'');
        console.log('    git tag -a v' + version + ' -m \'Add tag v' + version + '\'');
        console.log('    git checkout master');
        console.log('    git push origin --tags');
    });

    // Default task.
    grunt.registerTask('default', ['clean', 'checktrailingspaces', 'build', 'test']);
};
<|endoftext|>


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

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            beforeconcat: ['Gruntfile.js', 'src/**/*.js', 'src/**/*.json', 'test/**/*.js'],
            afterconcat: ['build/<%= pkg.name %>.js']
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'mochaTest']
        },
        clean: {
            build: {
                src: ['build']
            },
            dist: {
                src: ['build', 'dist/**/*']
            },
            coverage: {
                src: ['coverage/**']
            }
        },
        concat: {
            options: {
                // define a string to put between each file in the concatenated output
                separator: ';'
            },
            dist: {
                // the files to concatenate (exclue example)
                src: ['src/**/*.js', '!src/conversionTables/*.js', '!src/example.js'],
                // the location of the resulting JS file
                dest: 'build/<%= pkg.name %>.js'
            }
        },
        mochaTest: {
            test: {
                options: {
                    reporter: 'spec',
                    captureFile: 'coverage/results.txt', // Optionally capture the reporter output to a file
                    quiet: false, // Optionally suppress output to standard out (defaults to false)
                    clearRequireCache: false, // Optionally clear the require cache before running tests (defaults to false)
                    noFail: false // Optionally set to not fail on failed tests (will still fail on other errors)
                },
                src: ['test/**/*.js']
            }
        },
        mocha_istanbul: {
            coverage: {
                src: ['test/**/*.js'],
                // a folder works nicely
                options: {
                    coverage: true, // this will make the grunt.event.on('coverage') event listener to be triggered
                    check: {
                        lines: 75,
                        statements: 75
                    },
                    root: './src', // define where the cover task should consider the root of libraries that are covered by tests
                    reportFormats: ['lcov']
                }
                // },
                // coveralls: {
                //     src: ['test'], // multiple folders also works
                //     options: {
                //         coverage:true, // this will make the grunt.event.on('coverage') event listener to be triggered
                //         check: {
                //             lines: 75,
                //             statements: 75
                //         },
                //         root: './src', // define where the cover task should consider the root of libraries that are covered by tests
                //         reportFormats: ['lcov']
                //     }
            }
        },
        istanbul_check_coverage: {
            default: {
                options: {
                    coverageFolder: 'coverage', // will check both coverage folders and merge the coverage results
                    check: {
                        lines: 80,
                        statements: 80
                    }
                }
            }
        },
        coveralls: {
            // Options relevant to all targets
            options: {
                // When true, grunt-coveralls will only print a warning rather than
                // an error, to prevent CI builds from failing unnecessarily (e.g. if
                // coveralls.io is down). Optional, defaults to false.
                force: false
            },
            your_target: {
                // LCOV coverage file (can be string, glob or array)
                src: 'coverage/*.info',
                options: {
                    // Any options for just this target
                }
            },
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy - mm - dd ") %> */\n'
            },
            build: {
                src: 'build/<%= pkg.name %>.js',
                dest: 'dist/<%= pkg.name %>.min.js'
            }
        },
        copy: {
            conversionTables: {
                expand: true,
                cwd: 'src/conversionTables',
                src: '*.js',
                dest: 'dist/conversionTables',
            },
            main: {
                expand: true,
                cwd: 'build',
                src: '*.js',
                dest: 'dist',
            },
        },
        release: {
            options: {
                bump: 'false', //only from version is changed
            }
        },
        documentation: {
            default: {
                files: [{
                    'expand': true,
                    'cwd': 'src',
                    'src': ['**/*.js']
                }],
                options: {
                    destination: 'docs'
                }
            }
        }
    });

    grunt.event.on('coverage', function(lcovFileContents, done) {
        // Check below on the section 'The coverage event'
        done();
    });

    //load the dependencies
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-coveralls');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-release');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-documentation');

    //set the tasks / taskmaps
    grunt.registerTask('reportCoveralls', ['clean:coverage', 'mocha_istanbul:coverage', 'coveralls']);
    grunt.registerTask('coverage', ['clean:coverage', 'mocha_istanbul:coverage']);
    grunt.registerTask('ci-build', ['clean:coverage', 'clean:dist', 'jshint:beforeconcat', 'mochaTest', 'documentation', 'reportCoveralls', 'concat', 'jshint:afterconcat', 'uglify', 'copy:main', 'copy:conversionTables']);
    grunt.registerTask('build', ['clean:dist', 'jshint:beforeconcat', 'mochaTest', 'documentation', 'concat', 'jshint:afterconcat', 'uglify', 'copy:main', 'copy:conversionTables']);
    grunt.registerTask('test', ['clean:coverage', 'jshint', 'mochaTest', 'coverage']);
    grunt.registerTask('watch', ['watch']);
    grunt.registerTask('releaseToNPM', ['release']);

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

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

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            beforeconcat: ['Gruntfile.js', 'src/**/*.js', 'src/**/*.json', 'test/**/*.js'],
            afterconcat: ['build/<%= pkg.name %>.js']
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'mochaTest']
        },
        clean: {
            build: {
                src: ['build']
            },
            dist: {
                src: ['build', 'dist/**/*']
            },
            coverage: {
                src: ['coverage/**']
            }
        },
        concat: {
            options: {
                // define a string to put between each file in the concatenated output
                separator: ';'
            },
            dist: {
                // the files to concatenate (exclue example)
                src: ['src/**/*.js', '!src/conversionTables/*.js', '!src/example.js'],
                // the location of the resulting JS file
                dest: 'build/<%= pkg.name %>.js'
            }
        },
        mochaTest: {
            test: {
                options: {
                    reporter: 'spec',
                    captureFile: 'coverage/results.txt', // Optionally capture the reporter output to a file
                    quiet: false, // Optionally suppress output to standard out (defaults to false)
                    clearRequireCache: false, // Optionally clear the require cache before running tests (defaults to false)
                    noFail: false // Optionally set to not fail on failed tests (will still fail on other errors)
                },
                src: ['test/**/*.js']
            }
        },
        mocha_istanbul: {
            coverage: {
                src: ['test/**/*.js'],
                // a folder works nicely
                options: {
                    coverage: true, // this will make the grunt.event.on('coverage') event listener to be triggered
                    check: {
                        lines: 75,
                        statements: 75
                    },
                    root: './src', // define where the cover task should consider the root of libraries that are covered by tests
                    reportFormats: ['lcov']
                }
                // },
                // coveralls: {
                //     src: ['test'], // multiple folders also works
                //     options: {
                //         coverage:true, // this will make the grunt.event.on('coverage') event listener to be triggered
                //         check: {
                //             lines: 75,
                //             statements: 75
                //         },
                //         root: './src', // define where the cover task should consider the root of libraries that are covered by tests
                //         reportFormats: ['lcov']
                //     }
            }
        },
        istanbul_check_coverage: {
            default: {
                options: {
                    coverageFolder: 'coverage', // will check both coverage folders and merge the coverage results
                    check: {
                        lines: 80,
                        statements: 80
                    }
                }
            }
        },
        coveralls: {
            // Options relevant to all targets
            options: {
                // When true, grunt-coveralls will only print a warning rather than
                // an error, to prevent CI builds from failing unnecessarily (e.g. if
                // coveralls.io is down). Optional, defaults to false.
                force: false
            },
            your_target: {
                // LCOV coverage file (can be string, glob or array)
                src: 'coverage/*.info',
                options: {
                    // Any options for just this target
                }
            },
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy - mm - dd ") %> */\n'
            },
            build: {
                src: 'build/<%= pkg.name %>.js',
                dest: 'dist/<%= pkg.name %>.min.js'
            }
        },
        copy: {
            conversionTables: {
                expand: true,
                cwd: 'src/conversionTables',
                src: '*.js',
                dest: 'dist/conversionTables',
            },
            main: {
                expand: true,
                cwd: 'build',
                src: '*.js',
                dest: 'dist',
            },
        },
        release: {
            options: {
                bump: 'false', //only from version is changed
            }
        },
        documentation: {
            default: {
                files: [{
                    'expand': true,
                    'cwd': 'src',
                    'src': ['**/*.js']
                }],
                options: {
                    destination: 'docs'
                }
            }
        }
    });

    grunt.event.on('coverage', function(lcovFileContents, done) {
        // Check below on the section 'The coverage event'
        done();
    });

    //load the dependencies
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-coveralls');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-release');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-documentation');

    //set the tasks / taskmaps
    grunt.registerTask('reportCoveralls', ['clean:coverage', 'mocha_istanbul:coverage', 'coveralls']);
    grunt.registerTask('coverage', ['clean:coverage', 'mocha_istanbul:coverage']);
    grunt.registerTask('ci-build', ['clean:coverage', 'clean:dist', 'jshint:beforeconcat', 'mochaTest', 'documentation', 'reportCoveralls', 'concat', 'jshint:afterconcat', 'uglify', 'copy:main', 'copy:conversionTables']);
    grunt.registerTask('build', ['clean:dist', 'jshint:beforeconcat', 'mochaTest', 'documentation', 'concat', 'jshint:afterconcat', 'uglify', 'copy:main', 'copy:conversionTables']);
    grunt.registerTask('test', ['clean:coverage', 'jshint', 'mochaTest', 'coverage']);
    grunt.registerTask('watch', ['watch']);
    grunt.registerTask('releaseToNPM', ['build', 'test', 'reportCoveralls', 'release']);

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

};<|endoftext|>


<commit_before>// Generated on 2014-02-13 using generator-angular 0.7.1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

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

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: true
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    'bower-install': {
      app: {
        html: '<%= yeoman.app %>/index.html',
        ignorePath: '<%= yeoman.app %>/'
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/styles/{,*/}*.css',
            '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/styles/fonts/*'
          ]
        }
      }
    },

    // 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: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>'
      }
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'bower_components/**/*',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'bower-install',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', function () {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve']);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'bower-install',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>Removed grunt jshint task, added karma on every js file<commit_after>// Generated on 2014-02-13 using generator-angular 0.7.1
'use strict';

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {

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

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['karma'],
        options: {
          livereload: true
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/scripts/{,*/}*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    'bower-install': {
      app: {
        html: '<%= yeoman.app %>/index.html',
        ignorePath: '<%= yeoman.app %>/'
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    rev: {
      dist: {
        files: {
          src: [
            '<%= yeoman.dist %>/scripts/{,*/}*.js',
            '<%= yeoman.dist %>/styles/{,*/}*.css',
            '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= yeoman.dist %>/styles/fonts/*'
          ]
        }
      }
    },

    // 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: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>'
      }
    },

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'bower_components/**/*',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'bower-install',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
  });

  grunt.registerTask('server', function () {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve']);
  });

  grunt.registerTask('test', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'bower-install',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'rev',
    'usemin',
    'htmlmin'
  ]);

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


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

    var path = require('path');

    // load the package JSON file
    var pkg = grunt.file.readJSON('package.json');

    // get the project paths
    var sourceDir = 'src/',
        projectDir = sourceDir + pkg.name + '/';

    // get the release paths
    var releaseDir = 'release/',
        releaseFilesDir = releaseDir + 'files/';

    // load information about the assembly
    var assembly = grunt.file.readJSON(projectDir + 'Properties/AssemblyInfo.json');

    // get the version of the package
    var version = assembly.informationalVersion ? assembly.informationalVersion : assembly.version;

    grunt.initConfig({
        pkg: pkg,
        clean: {
            files: [
                releaseFilesDir + '**/*.*'
            ]
        },
        copy: {
            bacon: {
                files: [
                    {
                        expand: true,
                        cwd: projectDir + 'obj/Release/',
                        src: [
                            pkg.name + '.dll',
                            pkg.name + '.xml'
                        ],
                        dest: releaseFilesDir + 'bin/'
                    }
                ]
            }
        },
        zip: {
            release: {
                cwd: releaseFilesDir,
                src: [
                    releaseFilesDir + '**/*.*'
                ],
                dest: releaseDir + 'zip/' + pkg.name + '.v' + version + '.zip'
            }
        },
        umbracoPackage: {
            dist: {
                src: releaseFilesDir,
                dest: releaseDir + 'umbraco/',
                options: {
                    name: pkg.name,
                    version: version,
                    url: pkg.url,
                    license: pkg.license.name,
                    licenseUrl: pkg.license.url,
                    author: pkg.author.name,
                    authorUrl: pkg.author.url,
                    readme: pkg.readme,
                    outputName: pkg.name + '.v' + version + '.zip'
                }
            }
        },
        nugetpack: {
            dist: {
                src: projectDir + pkg.name + '.csproj',
                dest: releaseDir + 'nuget/',
				options: {
					properties: 'Platform=AnyCPU;Configuration=Release'
				}
            }
        }
    });

    grunt.loadNpmTasks('grunt-umbraco-package');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-nuget');
    grunt.loadNpmTasks('grunt-zip');

    grunt.registerTask('dev', ['copy', 'zip', 'umbracoPackage', 'nugetpack']);

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

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

    var path = require('path');

    // load the package JSON file
    var pkg = grunt.file.readJSON('package.json');

    // get the project paths
    var sourceDir = 'src/',
        projectDir = sourceDir + pkg.name + '/';

    // get the release paths
    var releaseDir = 'release/',
        releaseFilesDir = releaseDir + 'files/';

    // load information about the assembly
    var assembly = grunt.file.readJSON(projectDir + 'Properties/AssemblyInfo.json');

    // get the version of the package
    var version = assembly.informationalVersion ? assembly.informationalVersion : assembly.version;

    grunt.initConfig({
        pkg: pkg,
        clean: {
            files: [
                releaseFilesDir + '**/*.*'
            ]
        },
        copy: {
            bacon: {
                files: [
                    {
                        expand: true,
                        cwd: projectDir + 'obj/Release/',
                        src: [
                            pkg.name + '.dll',
                            pkg.name + '.xml'
                        ],
                        dest: releaseFilesDir + 'bin/'
                    },
					 {
                        expand: true,
                        cwd: projectDir + 'bin/Release/',
                        src: [
								'IKVM*.dll',
								'Tika*.dll'
                        ],
                        dest: releaseFilesDir + 'bin/'
                    }
                ]
            }
        },
        zip: {
            release: {
                cwd: releaseFilesDir,
                src: [
                    releaseFilesDir + '**/*.*',

                ],
                dest: releaseDir + 'zip/' + pkg.name + '.v' + version + '.zip'
            }
        },
        umbracoPackage: {
            dist: {
                src: releaseFilesDir,
                dest: releaseDir + 'umbraco/',
                options: {
                    name: pkg.name,
                    version: version,
                    url: pkg.url,
                    license: pkg.license.name,
                    licenseUrl: pkg.license.url,
                    author: pkg.author.name,
                    authorUrl: pkg.author.url,
                    readme: pkg.readme,
                    outputName: pkg.name + '.v' + version + '.zip'
                }
            }
        },
        nugetpack: {
            dist: {
                src: projectDir + pkg.name + '.csproj',
                dest: releaseDir + 'nuget/',
				options: {
					properties: 'Platform=AnyCPU;Configuration=Release'
				}
            }
        }
    });

    grunt.loadNpmTasks('grunt-umbraco-package');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-nuget');
    grunt.loadNpmTasks('grunt-zip');

    grunt.registerTask('dev', ['copy', 'zip', 'umbracoPackage', 'nugetpack']);

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

};<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    jshint: {
      files: [
        'app/**/*.js',
        'admin/**/*.js',
        'test/**/*.js',
        'shared/**/*.js',
        'server/**/*.js'
      ],
      options: {
        globals: {
          window: true,
          document: true,
          navigator: true,
          console: true,
          module: true,
          require: true,
          FastClick: true,
          $: true,
          Backbone: true,
          Parse: true,
          Handlebars: true,
          _: true,
          google: true,
          parseAppKey: true,
          parseJSKey: true
        },
        undef: true,
        debug: true,
        '-W030': true
      }
    },

    // A simple Grunt invoker for mocha tests
    simplemocha: {
      options: {
        timeout: 3000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'list'
      },

      all: {
        src: 'test/**/*.js'
      }
    },

    // run the 'default' task when any watched files change
    watch: {
      files: [
        'Gruntfile.js',
        'app/**/*',
        'admin/**/*',
        'shared/**/*',
        'server/**/*',
        'vendor/**/*',
        'test/**/*'
      ],
      tasks: ['default']
    },

    sass: {
      // generate app-specific css file
      // sass performs both the processing and concatenation steps for css
      app: {
        src: 'app/css/app.scss',
        dest: 'tmp/linksf.css'
      },

      admin: {
        src: 'admin/css/admin.scss',
        dest: 'tmp/linksf_admin.css'
      }
    },

    // Browserify
    browserify: {
      options: {
        // We want `.hbs` files to be `require`able. We use the hbsfy transform
        // to precompile Handlebars templates and let us require the compiled
        // JavaScript functions.
        transform: ['hbsfy']
      },
      app: {
        // The entry point where Browserify will begin searching the AST for `require` calls
        src: 'app/js/app.js',

        // The built file
        dest: 'tmp/app.js',

        options: {
          // We want alias mappings because we'd rather
          // `require('views/index_view')` than `require('./views/index_view.js')`
          //
          // There is a tradeoff for convenient here - all aliased files are exported
          // into the built app.js file, even if they're never explicitly
          // `require`d from the entry point tree.
          aliasMappings: [
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'shared/lib' },
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'cloud/lib' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'shared/models' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'cloud/models' },
            { cwd: 'shared/js/collections', src: '*.js',  dest: 'shared/collections' },
            { cwd: 'shared/js/views',       src: '*.js',  dest: 'shared/views' },
            { cwd: 'shared/js/templates',   src: '*.hbs', dest: 'shared/templates' },
            { cwd: 'app/js/lib',            src: '*.js',  dest: 'lib' },
            { cwd: 'app/js/models',         src: '*.js',  dest: 'models' },
            { cwd: 'app/js/collections',    src: '*.js',  dest: 'collections' },
            { cwd: 'app/js/routers',        src: '*.js',  dest: 'routers' },
            { cwd: 'app/js/templates',      src: '*.hbs', dest: 'templates' },
            { cwd: 'app/js/views',          src: '*.js',  dest: 'views' }
          ]
        }
      },
      // See browserify:app above
      admin: {
        src: 'admin/js/admin.js',
        dest: 'tmp/admin.js',
        options: {
          aliasMappings: [
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'shared/lib' },
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'cloud/lib' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'shared/models' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'cloud/models' },
            { cwd: 'shared/js/collections', src: '*.js',  dest: 'shared/collections' },
            { cwd: 'shared/js/views',       src: '*.js',  dest: 'shared/views' },
            { cwd: 'shared/js/templates',   src: '*.hbs', dest: 'shared/templates' },
            { cwd: 'admin/js/lib',          src: '*.js',  dest: 'lib' },
            { cwd: 'admin/js/models',       src: '*.js',  dest: 'models' },
            { cwd: 'admin/js/collections',  src: '*.js',  dest: 'collections' },
            { cwd: 'admin/js/routers',      src: '*.js',  dest: 'routers' },
            { cwd: 'admin/js/templates',    src: '*.hbs', dest: 'templates' },
            { cwd: 'admin/js/views',        src: '*.js',  dest: 'views' }
          ]
        }
      }
    },

    // Minify css files
    cssmin: {
      app: {
        src: 'tmp/linksf.css',
        dest: 'tmp/linksf.css'
      },
      admin: {
        src: 'tmp/linksf_admin.css',
        dest: 'tmp/linksf_admin.css'
      },
    },

    // Concatenate files together.
    concat: {
      // Not a target, just a variable that we can interpolate in elsewhere.
      shared_js: [
        'vendor/js/jquery-2.0.3.js',
        'vendor/js/jquery.serialize-object.js',
        'vendor/js/underscore.js',
        'vendor/js/backbone-1.0.0.js',
        'vendor/js/parse-1.2.12.js'
      ],

      shared_js_minified: [
        'vendor/js/jquery-2.0.3.min.js',
        'vendor/js/jquery.serialize-object.min.js',
        'vendor/js/underscore.min.js',
        'vendor/js/backbone-1.0.0.min.js',
        'vendor/js/parse-1.2.12.min.js'
      ],

      // App also uses the vendored fastclick library
      app: {
        src: [
          '<%= concat.shared_js %>',
          'vendor/js/bootstrap-button.js',
          'vendor/js/fastclick.js',
          'tmp/app.js'
        ],
        dest: 'tmp/linksf.js'
      },

      // Concat minified files
      app_min: {
        src: [
          '<%= concat.shared_js_minified %>',
          'vendor/js/bootstrap-button.min.js',
          'vendor/js/fastclick.min.js',
          'tmp/app.min.js'
        ],
        dest: 'tmp/linksf.js'
      },

      // Admin uses backbone filters for authentication and autosize for text entry
      admin: {
        src: [
          '<%= concat.shared_js %>',
          'vendor/js/backbone_filters.js',
          'vendor/js/jquery.autosize.js',
          'vendor/js/bootstrap.js',
          'tmp/admin.js'
        ],
        dest: 'tmp/linksf_admin.js'
      },

      admin_min: {
        src: [
          '<%= concat.shared_js_minified %>',
          'vendor/js/backbone_filters.min.js',
          'vendor/js/jquery.autosize.min.js',
          'vendor/js/bootstrap.min.js',
          'tmp/admin.min.js'
        ],
        dest: 'tmp/linksf_admin.js'
      }
    },

    uglify: {
      options: {
        mangle: false,
        preserveComments: false,
        report: 'min'
      },

      vendor: {
        files: {
          // These libraries are not distributed with minified versions, so we
          // minify them ourselves.
          'vendor/js/jquery.serialize-object.min.js': 'vendor/js/jquery.serialize-object.js',
          'vendor/js/backbone_filters.min.js': 'vendor/js/backbone_filters.js',
          'vendor/js/bootstrap-button.min.js': 'vendor/js/bootstrap-button.js'
        }
      },
      app: {files: {'tmp/app.min.js': 'tmp/app.js'}},
      admin: {files: {'tmp/admin.min.js': 'tmp/admin.js'}}
    },

    clean: {
      build: {
        src: 'build/*',
        filter: function(filepath) { return filepath !== 'build/.gitkeep'; }
      }
    },

    cachebuster: {
      dist: {
        files: {
          src: [
            'tmp/linksf.js',
            'tmp/linksf.css',
            'tmp/linksf_admin.js',
            'tmp/linksf_admin.css'
          ],
        },
        options: {
          complete: function(hashes) {
            // ugly but the only way to tag each file with a key
            var keyMap = {
                'tmp/linksf.js': 'linksf_js',
                'tmp/linksf.css': 'linksf_css',
                'tmp/linksf_admin.js': 'linksf_admin_js',
                'tmp/linksf_admin.css': 'linksf_admin_css'
               },
               context = {},
               Handlebars = require('handlebars'),
               template,
               output;

            context.parseAppKey = process.env.PARSE_APP_KEY;
            context.parseJSKey  = process.env.PARSE_JS_KEY;

            // extract into separate grunt check task
            if ( !context.PARSE_APP_KEY || !context.PARSE_JS_KEY ) {
              console.log('Need PARSE_APP_KEY and PARSE_JS_KEY in your environment.')
              process.exit();
            }
            //

            Object.keys(hashes).forEach(function(key) {
              var matches = key.match(/^tmp\/(.*)(\..*)$/),
                  outputFile = 'build/' + matches[1] + '-' + hashes[key] + matches[2];

              grunt.file.copy(key, outputFile);
              context[keyMap[key]] = outputFile;
            });

            template = Handlebars.compile(grunt.file.read('app/index.html'));
            output = template(context);
            grunt.file.write('index.html', output);

            template = Handlebars.compile(grunt.file.read('admin/admin.html'));
            output = template(context);
            grunt.file.write('admin.html', output);
          }
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-simple-mocha');
  grunt.loadNpmTasks('grunt-cachebuster');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-clean');

  grunt.registerTask('build:development', [
    'clean',
    'jshint',
    'simplemocha',
    'sass',
    'browserify',
    'concat:app',
    'concat:admin',
    'cachebuster'
  ]);

  grunt.registerTask('build:production', [
    'clean',
    'jshint',
    'simplemocha',
    'sass',
    'cssmin',
    'browserify',
    'uglify',
    'concat:app_min',
    'concat:admin_min',
    'cachebuster'
  ]);

  grunt.registerTask('default', [
    'build:development'
  ]);

  grunt.registerTask('release', [
    'build:production'
  ]);
};
<commit_msg>name parts of outputFile for immediacy<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    jshint: {
      files: [
        'app/**/*.js',
        'admin/**/*.js',
        'test/**/*.js',
        'shared/**/*.js',
        'server/**/*.js'
      ],
      options: {
        globals: {
          window: true,
          document: true,
          navigator: true,
          console: true,
          module: true,
          require: true,
          FastClick: true,
          $: true,
          Backbone: true,
          Parse: true,
          Handlebars: true,
          _: true,
          google: true,
          parseAppKey: true,
          parseJSKey: true
        },
        undef: true,
        debug: true,
        '-W030': true
      }
    },

    // A simple Grunt invoker for mocha tests
    simplemocha: {
      options: {
        timeout: 3000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'list'
      },

      all: {
        src: 'test/**/*.js'
      }
    },

    // run the 'default' task when any watched files change
    watch: {
      files: [
        'Gruntfile.js',
        'app/**/*',
        'admin/**/*',
        'shared/**/*',
        'server/**/*',
        'vendor/**/*',
        'test/**/*'
      ],
      tasks: ['default']
    },

    sass: {
      // generate app-specific css file
      // sass performs both the processing and concatenation steps for css
      app: {
        src: 'app/css/app.scss',
        dest: 'tmp/linksf.css'
      },

      admin: {
        src: 'admin/css/admin.scss',
        dest: 'tmp/linksf_admin.css'
      }
    },

    // Browserify
    browserify: {
      options: {
        // We want `.hbs` files to be `require`able. We use the hbsfy transform
        // to precompile Handlebars templates and let us require the compiled
        // JavaScript functions.
        transform: ['hbsfy']
      },
      app: {
        // The entry point where Browserify will begin searching the AST for `require` calls
        src: 'app/js/app.js',

        // The built file
        dest: 'tmp/app.js',

        options: {
          // We want alias mappings because we'd rather
          // `require('views/index_view')` than `require('./views/index_view.js')`
          //
          // There is a tradeoff for convenient here - all aliased files are exported
          // into the built app.js file, even if they're never explicitly
          // `require`d from the entry point tree.
          aliasMappings: [
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'shared/lib' },
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'cloud/lib' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'shared/models' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'cloud/models' },
            { cwd: 'shared/js/collections', src: '*.js',  dest: 'shared/collections' },
            { cwd: 'shared/js/views',       src: '*.js',  dest: 'shared/views' },
            { cwd: 'shared/js/templates',   src: '*.hbs', dest: 'shared/templates' },
            { cwd: 'app/js/lib',            src: '*.js',  dest: 'lib' },
            { cwd: 'app/js/models',         src: '*.js',  dest: 'models' },
            { cwd: 'app/js/collections',    src: '*.js',  dest: 'collections' },
            { cwd: 'app/js/routers',        src: '*.js',  dest: 'routers' },
            { cwd: 'app/js/templates',      src: '*.hbs', dest: 'templates' },
            { cwd: 'app/js/views',          src: '*.js',  dest: 'views' }
          ]
        }
      },
      // See browserify:app above
      admin: {
        src: 'admin/js/admin.js',
        dest: 'tmp/admin.js',
        options: {
          aliasMappings: [
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'shared/lib' },
            { cwd: 'shared/js/lib',         src: '*.js',  dest: 'cloud/lib' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'shared/models' },
            { cwd: 'shared/js/models',      src: '*.js',  dest: 'cloud/models' },
            { cwd: 'shared/js/collections', src: '*.js',  dest: 'shared/collections' },
            { cwd: 'shared/js/views',       src: '*.js',  dest: 'shared/views' },
            { cwd: 'shared/js/templates',   src: '*.hbs', dest: 'shared/templates' },
            { cwd: 'admin/js/lib',          src: '*.js',  dest: 'lib' },
            { cwd: 'admin/js/models',       src: '*.js',  dest: 'models' },
            { cwd: 'admin/js/collections',  src: '*.js',  dest: 'collections' },
            { cwd: 'admin/js/routers',      src: '*.js',  dest: 'routers' },
            { cwd: 'admin/js/templates',    src: '*.hbs', dest: 'templates' },
            { cwd: 'admin/js/views',        src: '*.js',  dest: 'views' }
          ]
        }
      }
    },

    // Minify css files
    cssmin: {
      app: {
        src: 'tmp/linksf.css',
        dest: 'tmp/linksf.css'
      },
      admin: {
        src: 'tmp/linksf_admin.css',
        dest: 'tmp/linksf_admin.css'
      },
    },

    // Concatenate files together.
    concat: {
      // Not a target, just a variable that we can interpolate in elsewhere.
      shared_js: [
        'vendor/js/jquery-2.0.3.js',
        'vendor/js/jquery.serialize-object.js',
        'vendor/js/underscore.js',
        'vendor/js/backbone-1.0.0.js',
        'vendor/js/parse-1.2.12.js'
      ],

      shared_js_minified: [
        'vendor/js/jquery-2.0.3.min.js',
        'vendor/js/jquery.serialize-object.min.js',
        'vendor/js/underscore.min.js',
        'vendor/js/backbone-1.0.0.min.js',
        'vendor/js/parse-1.2.12.min.js'
      ],

      // App also uses the vendored fastclick library
      app: {
        src: [
          '<%= concat.shared_js %>',
          'vendor/js/bootstrap-button.js',
          'vendor/js/fastclick.js',
          'tmp/app.js'
        ],
        dest: 'tmp/linksf.js'
      },

      // Concat minified files
      app_min: {
        src: [
          '<%= concat.shared_js_minified %>',
          'vendor/js/bootstrap-button.min.js',
          'vendor/js/fastclick.min.js',
          'tmp/app.min.js'
        ],
        dest: 'tmp/linksf.js'
      },

      // Admin uses backbone filters for authentication and autosize for text entry
      admin: {
        src: [
          '<%= concat.shared_js %>',
          'vendor/js/backbone_filters.js',
          'vendor/js/jquery.autosize.js',
          'vendor/js/bootstrap.js',
          'tmp/admin.js'
        ],
        dest: 'tmp/linksf_admin.js'
      },

      admin_min: {
        src: [
          '<%= concat.shared_js_minified %>',
          'vendor/js/backbone_filters.min.js',
          'vendor/js/jquery.autosize.min.js',
          'vendor/js/bootstrap.min.js',
          'tmp/admin.min.js'
        ],
        dest: 'tmp/linksf_admin.js'
      }
    },

    uglify: {
      options: {
        mangle: false,
        preserveComments: false,
        report: 'min'
      },

      vendor: {
        files: {
          // These libraries are not distributed with minified versions, so we
          // minify them ourselves.
          'vendor/js/jquery.serialize-object.min.js': 'vendor/js/jquery.serialize-object.js',
          'vendor/js/backbone_filters.min.js': 'vendor/js/backbone_filters.js',
          'vendor/js/bootstrap-button.min.js': 'vendor/js/bootstrap-button.js'
        }
      },
      app: {files: {'tmp/app.min.js': 'tmp/app.js'}},
      admin: {files: {'tmp/admin.min.js': 'tmp/admin.js'}}
    },

    clean: {
      build: {
        src: 'build/*',
        filter: function(filepath) { return filepath !== 'build/.gitkeep'; }
      }
    },

    cachebuster: {
      dist: {
        files: {
          src: [
            'tmp/linksf.js',
            'tmp/linksf.css',
            'tmp/linksf_admin.js',
            'tmp/linksf_admin.css'
          ],
        },
        options: {
          complete: function(hashes) {
            // ugly but the only way to tag each file with a key
            var keyMap = {
                'tmp/linksf.js': 'linksf_js',
                'tmp/linksf.css': 'linksf_css',
                'tmp/linksf_admin.js': 'linksf_admin_js',
                'tmp/linksf_admin.css': 'linksf_admin_css'
               },
               context = {},
               Handlebars = require('handlebars'),
               template,
               output;

            context.parseAppKey = process.env.PARSE_APP_KEY;
            context.parseJSKey  = process.env.PARSE_JS_KEY;

            // extract into separate grunt check task
            if ( !context.PARSE_APP_KEY || !context.PARSE_JS_KEY ) {
              console.log('Need PARSE_APP_KEY and PARSE_JS_KEY in your environment.')
              process.exit();
            }
            //

            Object.keys(hashes).forEach(function(key) {
              var matches = key.match(/^tmp\/(.*)(\..*)$/),
                  filename = matches[1],
                  extension = matches[2],
                  outputFile = 'build/' + filename + '-' + hashes[key] + extension;

              grunt.file.copy(key, outputFile);
              context[keyMap[key]] = outputFile;
            });

            template = Handlebars.compile(grunt.file.read('app/index.html'));
            output = template(context);
            grunt.file.write('index.html', output);

            template = Handlebars.compile(grunt.file.read('admin/admin.html'));
            output = template(context);
            grunt.file.write('admin.html', output);
          }
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-simple-mocha');
  grunt.loadNpmTasks('grunt-cachebuster');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-clean');

  grunt.registerTask('build:development', [
    'clean',
    'jshint',
    'simplemocha',
    'sass',
    'browserify',
    'concat:app',
    'concat:admin',
    'cachebuster'
  ]);

  grunt.registerTask('build:production', [
    'clean',
    'jshint',
    'simplemocha',
    'sass',
    'cssmin',
    'browserify',
    'uglify',
    'concat:app_min',
    'concat:admin_min',
    'cachebuster'
  ]);

  grunt.registerTask('default', [
    'build:development'
  ]);

  grunt.registerTask('release', [
    'build:production'
  ]);
};
<|endoftext|>


<commit_before>'use strict';

var path = require('path');

module.exports = function(grunt) {

  var options = {

    configPath: path.join(process.cwd(), 'lib', 'tasks'),

    init: true,

    data: {
      app: './app/assets',
      build: './public/assets'
    },

    loadGruntTasks: {
      pattern: 'grunt-*',
      config: require('./package.json'),
      scope: 'dependencies'
    }

  };

  require('load-grunt-tasks')(grunt);
  require('load-grunt-config')(grunt, options);

  grunt.registerTask('default', ['stylus', 'symlink']);
  grunt.registerTask('serve', ['stylus', 'symlink', 'concurrent']);
  grunt.registerTask('build', [
    'clean',
    'stylus',
    'cssmin',
    'copy',
    'uglify',
    'imagemin'
  ]);

};
<commit_msg>added svgmin task to gruntfile<commit_after>'use strict';

var path = require('path');

module.exports = function(grunt) {

  var options = {

    configPath: path.join(process.cwd(), 'lib', 'tasks'),

    init: true,

    data: {
      app: './app/assets',
      build: './public/assets'
    },

    loadGruntTasks: {
      pattern: 'grunt-*',
      config: require('./package.json'),
      scope: 'dependencies'
    }

  };

  require('load-grunt-tasks')(grunt);
  require('load-grunt-config')(grunt, options);

  grunt.registerTask('default', ['stylus', 'symlink']);
  grunt.registerTask('serve', ['stylus', 'symlink', 'concurrent']);
  grunt.registerTask('build', [
    'clean',
    'stylus',
    'cssmin',
    'copy',
    'uglify',
    'imagemin',
    'svgmin'
  ]);

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

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

  // configurable paths
  var yeomanConfig = {
    app: 'src',
    dist: 'dist',
    name: 'pull-to-refresh'
  };

  grunt.initConfig({
    yeoman: yeomanConfig,
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/**\n' +
      ' * <%= pkg.description %>\n' +
      ' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
      ' * @link <%= pkg.homepage %>\n' +
      ' * @author <%= pkg.author %>\n' +
      ' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
      ' */\n'
    },
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      }
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/{,*/}*.js'
      ]
    },
    karma: {
      options: {
        configFile: 'test/karma.conf.js',
        browsers: ['Chrome'] // PhantomJS
      },
      unit: {
        singleRun: true
      },
      server: {
        autoWatch: true
      }
    },
    less: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.css': '<%= yeoman.app %>/<%= yeoman.name %>.less'
        }
      }
    },
    cssmin: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.min.css': '<%= yeoman.dist %>/<%= yeoman.name %>.css'
        }
      }
    },
    ngmin: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.js': '<%= yeoman.app %>/<%= yeoman.name %>.js'
        }
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.min.js': '<%= yeoman.dist %>/<%= yeoman.name %>.js'
        }
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json']
      },
      dist: {
        options: {
          commit: false,
          push: false,
          createTag: false
        }
      },
      push: {
        options: {
          bump: false,
          commitMessage: 'feat(release): bump v<%= pkg.version %>',
          tagMessage: 'feat(release): bump v<%= pkg.version %>',
          commitFiles: ['-a'],
          pushTo: 'github'
        }
      }
    }
  });

  grunt.registerTask('test', [
    'karma:unit'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'less:dist',
    'cssmin:dist',
    'ngmin:dist',
    'uglify:dist'
  ]);

  grunt.registerTask('release', [
    'bump:dist',
    'build'
  ]);

  grunt.registerTask('push', [
    // 'bump:dist',
    // 'build',
    'bump:push'
  ]);

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

};
<commit_msg>feat(release): bump v0.2.1<commit_after>'use strict';

module.exports = function (grunt) {

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

  // configurable paths
  var yeomanConfig = {
    app: 'src',
    dist: 'dist',
    name: 'pull-to-refresh'
  };

  grunt.initConfig({
    yeoman: yeomanConfig,
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/**\n' +
      ' * <%= pkg.description %>\n' +
      ' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
      ' * @link <%= pkg.homepage %>\n' +
      ' * @author <%= pkg.author %>\n' +
      ' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
      ' */\n'
    },
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '<%= yeoman.dist %>/*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      }
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.app %>/{,*/}*.js'
      ]
    },
    karma: {
      options: {
        configFile: 'test/karma.conf.js',
        browsers: ['Chrome'] // PhantomJS
      },
      unit: {
        singleRun: true
      },
      server: {
        autoWatch: true
      }
    },
    less: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.css': '<%= yeoman.app %>/<%= yeoman.name %>.less'
        }
      }
    },
    cssmin: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.min.css': '<%= yeoman.dist %>/<%= yeoman.name %>.css'
        }
      }
    },
    ngmin: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.js': '<%= yeoman.app %>/<%= yeoman.name %>.js'
        }
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= yeoman.name %>.min.js': '<%= yeoman.dist %>/<%= yeoman.name %>.js'
        }
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json']
      },
      dist: {
        options: {
          commit: false,
          push: false,
          createTag: false
        }
      },
      push: {
        options: {
          bump: false,
          commitMessage: 'feat(release): bump v<%= pkg.version %>',
          tagName: 'v<%= pkg.version %>',
          tagMessage: 'feat(release): bump v<%= pkg.version %>',
          commitFiles: ['-a'],
          pushTo: 'github'
        }
      }
    }
  });

  grunt.registerTask('test', [
    'karma:unit'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'less:dist',
    'cssmin:dist',
    'ngmin:dist',
    'uglify:dist'
  ]);

  grunt.registerTask('release', [
    'bump:dist',
    'build'
  ]);

  grunt.registerTask('push', [
    // 'bump:dist',
    // 'build',
    'bump:push'
  ]);

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

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    grunt.initConfig({

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

        clean: ['dist'],

        copy: {
            all: {
                expand: true,
                cwd: 'app/',
                src: ['*.css', '*.html', '/iamges/**/*', '!Gruntfile.js'],
                dest: 'dist/',
                flatten: true,
                filter: 'isFile'
            }
        },

        browserify: {
            all: {
                src: 'app/*.js',
                dest: 'dist/app.js'
            },
            options: {
                transform: ['debowerify'],
                debug: true
            }
        },

        watch: {
            options: {
                livereload: true
            },

            html: {
                files: '<%= copy.all.src %>'
            },

            js: {
                files: '<%= browserify.all.src %>',
                tasks: ['browserify']
            },

            assets: {
                files: ['*.css', 'images/**/*', 'img/**/*', '!Gruntfile.js'],
                tasks: ['copy']
            }
        },

        jshint: {
          options: {
            jshintrc: true
          },
          all: ['Gruntfile.js', 'server.js', 'app/*.js']
        },

        express: {
            dev: {
                options: {
                    background: true,
                    script: 'server.js'
                }
            }
        }

    });

    grunt.registerTask('server', ['express:dev', 'build', 'watch']);
    grunt.registerTask('serve', ['server']);
    grunt.registerTask('test', ['jshint']);
    grunt.registerTask('build', ['clean', 'browserify', 'copy']);

};<commit_msg>fixed typo in gruntfile<commit_after>'use strict';

module.exports = function (grunt) {

    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    grunt.initConfig({

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

        clean: ['dist'],

        copy: {
            all: {
                expand: true,
                cwd: 'app/',
                src: ['*.css', '*.html', '/images/**/*', '!Gruntfile.js'],
                dest: 'dist/',
                flatten: true,
                filter: 'isFile'
            }
        },

        browserify: {
            all: {
                src: 'app/*.js',
                dest: 'dist/app.js'
            },
            options: {
                transform: ['debowerify'],
                debug: true
            }
        },

        watch: {
            options: {
                livereload: true
            },

            html: {
                files: '<%= copy.all.src %>'
            },

            js: {
                files: '<%= browserify.all.src %>',
                tasks: ['browserify']
            },

            assets: {
                files: ['*.css', 'images/**/*', 'img/**/*', '!Gruntfile.js'],
                tasks: ['copy']
            }
        },

        jshint: {
          options: {
            jshintrc: true
          },
          all: ['Gruntfile.js', 'server.js', 'app/*.js']
        },

        express: {
            dev: {
                options: {
                    background: true,
                    script: 'server.js'
                }
            }
        }

    });

    grunt.registerTask('server', ['express:dev', 'build', 'watch']);
    grunt.registerTask('serve', ['server']);
    grunt.registerTask('test', ['jshint']);
    grunt.registerTask('build', ['clean', 'browserify', 'copy']);

};<|endoftext|>


<commit_before>/*global module:false*/
module.exports = function (grunt) {
    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        exec: {
            removeDocs: "rm -rf docs/*",
            createDocs: 'coddoc -f multi-html -d ./lib --dir ./docs'
        },

        jshint: {
            file: "./lib/*.js",
            options: {
                jshintrc: '.jshintrc'
            }
        },

        it: {
            all: {
                src: 'test/**/*.test.js',
                options: {
                    timeout: 3000, // not fully supported yet
                    reporter: 'spec'
                }
            }
        },
        'gh-pages': {
            options: {
                base: 'docs'
            },
            src: ['**']
        }
    });

    // Default task.
    grunt.registerTask('default', ['jshint', 'it', "exec"]);
    grunt.loadNpmTasks('grunt-it');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-gh-pages');

    grunt.registerTask("benchmark", "run benchmarks", function () {
        var done = this.async();
        require("./benchmark/benchmark")(function (err) {
            if (err) {
                grunt.log.error(err.stack);
                done(false)
            } else {
                grunt.log.ok("Done running benchmarks");
                done();
            }
        });
    });

};
<commit_msg>Fix grunt errors in node > 6<commit_after>/*global module:false*/
module.exports = function (grunt) {
    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        exec: {
            removeDocs: "rm -rf docs/*",
            createDocs: 'coddoc -f multi-html -d ./lib --dir ./docs'
        },

        jshint: {
            file: "./lib/*.js",
            options: {
                jshintrc: '.jshintrc',
                reporterOutput: '',
            }
        },

        it: {
            all: {
                src: 'test/**/*.test.js',
                options: {
                    timeout: 3000, // not fully supported yet
                    reporter: 'spec'
                }
            }
        },
        'gh-pages': {
            options: {
                base: 'docs'
            },
            src: ['**']
        }
    });

    // Default task.
    grunt.registerTask('default', ['jshint', 'it', "exec"]);
    grunt.loadNpmTasks('grunt-it');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-gh-pages');

    grunt.registerTask("benchmark", "run benchmarks", function () {
        var done = this.async();
        require("./benchmark/benchmark")(function (err) {
            if (err) {
                grunt.log.error(err.stack);
                done(false)
            } else {
                grunt.log.ok("Done running benchmarks");
                done();
            }
        });
    });

};
<|endoftext|>