<commit_before>var config;
var matchdep = require('matchdep');
var module;
var path = require('path');
var unwrap = require('unwrap');

config = {
    files: {
        build: 'lib/marionette.enhancedController.js',
        check: [
            'src/marionette.enhancedController.js',
            'Gruntfie.js'
        ],
        dest: 'dist/marionette.enhancedController.min.js',
        docs: 'docs'
    }
};

module.exports = function(grunt) {

    var defaultTasks;
    var pkg = grunt.file.readJSON('package.json');

    grunt.initConfig({
        pkg: pkg,
        semver: require('semver'),
        meta: {
            bundleBanner:
                '// marionette.enhancedController\n' +
                '// ----------------------------\n' +
                '// Brought to you by [Use All Five, Inc.](http://www.useallfive.com)\n' +
                '// ```\n' +
                '// Author: Justin Anastos <janastos@useallfive.com>\n' +
                '// Author URI: [http://www.useallfive.com](http://www.useallfive.com)\n' +
                '// Repository: https://github.com/UseAllFive/marionette.enhancedController\n' +
                '// ```\n' +
                '// Add `.show` method to a `Marionette.Controller` and provide loading views.\n' +
                '//\n' +
                '// Inspired by [Backbone Rails, Loading Views](http://www.backbonerails.com/screencasts/loading-views).' +
                '\n\n'
        },

        bowerRelease: {
            options: {
                endpoint: 'git@github.com:UseAllFive/marionette.enhancedController.git',
                main: 'lib/marionette.enhancedController.js'
            },
            deploy: {
                files: [{
                    expand: true,
                    cwd: './',
                    src: [
                        'lib/**/*',
                        'dist/**/*',
                        '.*'
                    ]
                }]
            }
        },

        bump: {
            options: {
                commitFiles: [
                    'package.json',
                    'bower.json'
                ],
                files: [
                    'package.json',
                    'bower.json'
                ],
                pushTo: 'origin',
                updateConfigs: ['pkg']
            }
        },

        clean: {
            dist: 'dist',
            docs: 'docs',
            lib: 'lib',
            tmp: 'tmp'
        },

        concat: {
            options: {
                banner: '<%= meta.bundleBanner %>'
            },
            bundle: {
                src: '<%= preprocess.bundle.dest %>',
                dest: 'lib/marionette.enhancedController.js'
            }
        },

        jshint: {
            options: {
                jshintrc: true
            },
            all: {
                files: {
                    src: config.files.check
                }
            }
        },

        jscs: {
            all: {
                files: {
                    src: config.files.check
                }
            }
        },

        groc: {
            options: {
                out: config.files.docs,
                strip: 'lib/'
            },
            all: {
                src: config.files.build
            },
            github: {
                options: {
                    github: true
                },
                src: config.files.build
            }
        },

        preprocess: {
            bundle: {
                src: 'src/marionette.enhancedController.js',
                dest: 'tmp/marionette.enhancedController.js'
            }
        },

        prompt: {
            bump: {
                options: {
                    questions: [
                        {
                            config: 'bump.increment',
                            type: 'list',
                            message: 'Bump version from ' + pkg.version.cyan + ' to:',
                            choices: [
                                {
                                    value: 'patch',
                                    name: 'Patch:  '.yellow +
                                        '<%= semver.inc(pkg.version, "patch") %>'.yellow +
                                        '   Backwards-compatible bug fixes.'
                                },
                                {
                                    value: 'minor',
                                    name: 'Minor:  '.yellow +
                                        '<%= semver.inc(pkg.version, "minor") %>'.yellow +
                                        '   Add functionality in a backwards-compatible manner.'
                                },
                                {
                                    value: 'major',
                                    name: 'Major:  '.yellow +
                                        '<%= semver.inc(pkg.version, "major") %>'.yellow +
                                        '   Incompatible API changes.'
                                }
                            ]
                        }
                    ]
                }
            }
        },

        template: {
            options: {
                data: {
                    version: '<%= pkg.version %>'
                }
            },
            bundle: {
                src: '<%= preprocess.bundle.dest %>',
                dest: '<%= preprocess.bundle.dest %>'
            }
        },

        unwrap: {
            spin: {
                src: './bower_components/spinjs/spin.js',
                dest: './tmp/spin.js'
            }
        },

        uglify: {
            all: {
                src: config.files.build,
                dest: config.files.dest
            }
        },

        watch: {
            options: {
                interrupt: true
            },
            js: {
                files: config.files.check,
                tasks: ['clean', 'uglify', 'groc:all']
            }
        }
    });

    // Load all npm dependencies.
    matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    // Taken from https://github.com/marionettejs/backbone.marionette/blob/v2.0.3/Gruntfile.js#L247
    grunt.registerMultiTask('unwrap', 'Unwrap UMD', function() {
        /*global __dirname: true */
        var done = this.async();
        var timesLeft = 0;

        this.files.forEach(function(file) {
            file.src.forEach(function(src) {
                timesLeft += 1;
                unwrap(path.resolve(__dirname, src), function(err, content) {
                    if (err) {
                        return grunt.log.error(err);
                    }
                    grunt.file.write(path.resolve(__dirname, file.dest), content);
                    grunt.log.ok(file.dest + ' created.');
                    timesLeft -= 1;
                    if (timesLeft <= 0) {
                        done();
                    }
                });
            });
        });
    });

    // Register tasks.
    defaultTasks = [
        'clean',
        'jshint',
        'jscs',
        'uglify'
    ];

     /**
     * Internal task to use the prompt settings to create a tag
     */
    grunt.registerTask('bump:prompt', function() {
        var increment = grunt.config('bump.increment');
        if (!increment) {
            grunt.fatal('bump.increment config not set!');
        }

        grunt.task.run('bump:' + increment);
    });

    grunt.registerTask('default', defaultTasks);
    grunt.registerTask('dev', defaultTasks.concat('watch'));
    grunt.registerTask('publish', 'Pack up all the files into a single file, minify, and publish to bower.', [
        'jshint',
        'jscs',
        'prompt:bump',
        'bump:prompt',
        'clean:lib',
        'clean:tmp',
        'unwrap',
        'preprocess',
        'concat',
        'uglify',
        'bowerRelease'
    ]);
};
<commit_msg>Add version number to packaged file and include minified in repo.<commit_after>var config;
var matchdep = require('matchdep');
var module;
var path = require('path');
var unwrap = require('unwrap');

config = {
    files: {
        build: 'lib/marionette.enhancedController.js',
        check: [
            'src/marionette.enhancedController.js',
            'Gruntfie.js'
        ],
        dist: 'dist/marionette.enhancedController.min.js',
        docs: 'docs'
    }
};

module.exports = function(grunt) {

    var defaultTasks;
    var pkg = grunt.file.readJSON('package.json');

    grunt.initConfig({
        pkg: pkg,
        semver: require('semver'),
        meta: {
            bundleBanner:
                '// marionette.enhancedController\n' +
                '// ----------------------------\n' +
                '// v<%= semver.inc(pkg.version, grunt.config("bump.increment")) %>\n' +
                '//\n' +
                '// Brought to you by [Use All Five, Inc.](http://www.useallfive.com)\n' +
                '// ```\n' +
                '// Author: Justin Anastos <janastos@useallfive.com>\n' +
                '// Author URI: [http://www.useallfive.com](http://www.useallfive.com)\n' +
                '// Repository: https://github.com/UseAllFive/marionette.enhancedController\n' +
                '// ```\n' +
                '// Add `.show` method to a `Marionette.Controller` and provide loading views.\n' +
                '//\n' +
                '// Inspired by [Backbone Rails, Loading Views](http://www.backbonerails.com/screencasts/loading-views).' +
                '\n\n'
        },

        bowerRelease: {
            options: {
                endpoint: 'git@github.com:UseAllFive/marionette.enhancedController.git',
                main: 'lib/marionette.enhancedController.js'
            },
            deploy: {
                files: [{
                    expand: true,
                    cwd: './',
                    src: [
                        'lib/**/*',
                        'dist/**/*',
                        '.*'
                    ]
                }]
            }
        },

        bump: {
            options: {
                commitFiles: [
                    'package.json',
                    'bower.json',
                    config.files.build,
                    config.files.dist
                ],
                files: [
                    'package.json',
                    'bower.json'
                ],
                push: true,
                pushTo: 'origin',
                updateConfigs: ['pkg']
            }
        },

        clean: {
            dist: 'dist',
            docs: 'docs',
            lib: 'lib',
            tmp: 'tmp'
        },

        concat: {
            options: {
                banner: '<%= meta.bundleBanner %>'
            },
            bundle: {
                src: '<%= preprocess.bundle.dest %>',
                dest: 'lib/marionette.enhancedController.js'
            }
        },

        jshint: {
            options: {
                jshintrc: true
            },
            all: {
                files: {
                    src: config.files.check
                }
            }
        },

        jscs: {
            all: {
                files: {
                    src: config.files.check
                }
            }
        },

        groc: {
            options: {
                out: config.files.docs,
                strip: 'lib/'
            },
            all: {
                src: config.files.build
            },
            github: {
                options: {
                    github: true
                },
                src: config.files.build
            }
        },

        preprocess: {
            bundle: {
                src: 'src/marionette.enhancedController.js',
                dest: 'tmp/marionette.enhancedController.js'
            }
        },

        prompt: {
            bump: {
                options: {
                    questions: [
                        {
                            config: 'bump.increment',
                            type: 'list',
                            message: 'Bump version from ' + pkg.version.cyan + ' to:',
                            choices: [
                                {
                                    value: 'patch',
                                    name: 'Patch:  '.yellow +
                                        '<%= semver.inc(pkg.version, "patch") %>'.yellow +
                                        '   Backwards-compatible bug fixes.'
                                },
                                {
                                    value: 'minor',
                                    name: 'Minor:  '.yellow +
                                        '<%= semver.inc(pkg.version, "minor") %>'.yellow +
                                        '   Add functionality in a backwards-compatible manner.'
                                },
                                {
                                    value: 'major',
                                    name: 'Major:  '.yellow +
                                        '<%= semver.inc(pkg.version, "major") %>'.yellow +
                                        '   Incompatible API changes.'
                                }
                            ]
                        }
                    ]
                }
            }
        },

        template: {
            options: {
                data: {
                    version: '<%= pkg.version %>'
                }
            },
            bundle: {
                src: '<%= preprocess.bundle.dest %>',
                dest: '<%= preprocess.bundle.dest %>'
            }
        },

        unwrap: {
            spin: {
                src: './bower_components/spinjs/spin.js',
                dest: './tmp/spin.js'
            }
        },

        uglify: {
            all: {
                src: config.files.build,
                dest: config.files.dist
            }
        },

        watch: {
            options: {
                interrupt: true
            },
            js: {
                files: config.files.check,
                tasks: ['clean', 'uglify', 'groc:all']
            }
        }
    });

    // Load all npm dependencies.
    matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    // Taken from https://github.com/marionettejs/backbone.marionette/blob/v2.0.3/Gruntfile.js#L247
    grunt.registerMultiTask('unwrap', 'Unwrap UMD', function() {
        /*global __dirname: true */
        var done = this.async();
        var timesLeft = 0;

        this.files.forEach(function(file) {
            file.src.forEach(function(src) {
                timesLeft += 1;
                unwrap(path.resolve(__dirname, src), function(err, content) {
                    if (err) {
                        return grunt.log.error(err);
                    }
                    grunt.file.write(path.resolve(__dirname, file.dest), content);
                    grunt.log.ok(file.dest + ' created.');
                    timesLeft -= 1;
                    if (timesLeft <= 0) {
                        done();
                    }
                });
            });
        });
    });

    // Register tasks.
    defaultTasks = [
        'clean',
        'jshint',
        'jscs',
        'uglify'
    ];

     /**
     * Internal task to use the prompt settings to create a tag
     */
    grunt.registerTask('bump:prompt', function() {
        var increment = grunt.config('bump.increment');

        if (!increment) {
            grunt.fatal('bump.increment config not set!');
        }

        grunt.task.run('bump:' + increment);
    });

    grunt.registerTask('default', defaultTasks);
    grunt.registerTask('dev', defaultTasks.concat('watch'));
    grunt.registerTask('publish', 'Pack up all the files into a single file, minify, and publish to bower.', [
        'jshint',
        'jscs',
        'prompt:bump',
        'clean:lib',
        'clean:tmp',
        'unwrap',
        'preprocess',
        'concat',
        'uglify',
        'bump:prompt',
        'bowerRelease'
    ]);
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

    // Config
    var sunset = {
        port: '2368'    // Ghost Port #
    };

    grunt.initConfig({

        sunset: sunset,

        pkg: grunt.file.readJSON('package.json'),
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
                '* http://<%= pkg.homepage %>/\n' +
                '* Copyright (c) <%= grunt.template.today("yyyy") %> ' +
                '<%= pkg.author.name %>; Licensed MIT */\n',

        // Watch files for changes for livereload and sass
        watch: {
            scripts: {
                files: 'assets/js/*.js',
                options:{
                    livereload: true
                }
            },
            html: {
                files: ['*.hbs', 'partials/*.hbs'],
                options: {
                    livereload: true
                }
            },
            livereload: {
                options: {
                    livereload: true
                },
                files: 'assets/css/*.css'
            }
        },

        // Add a banner to minified javascript.
        uglify: {
            options: {
                banner: '<%= banner %>',
                preserveComments: 'some'
            }
        },

        // Add a banner to minified css.
        cssmin: {
            options: {
                banner: '<%= banner %>',
                preserveComments: 'some'
            }
        },

        // Clean up for new build
        clean: {
            temp: ['.tmp'],
            production: ['production']
        },

        // Move files over for production release
        copy: {
            production: {
                files: [
                    {
                        src: ['helpers.js', 'slideshows.json', '*.hbs'],
                        dest: 'production/'
                    },
                    {
                        src: ['package-production.json'],
                        dest: 'production/package.json'
                    },
                    {
                        src: 'partials/*.hbs',
                        dest: 'production/'
                    },
                    {
                        src: ['assets/**/*', '!assets/css/**/*', '!assets/js/**/*'],
                        dest: 'production/'
                    }
                ]
            }
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: 'last 2 versions'
            },
            production: {
                files: [{
                    expand: true,
                    cwd: '.tmp/assets/css',
                    src: '{,*/}*.css',
                    dest: 'assets/css'
                }]
            }
        },

        // Rename files for browser caching purposes
        rev: {
            production: {
                files: {
                    src: [
                        'production/assets/css/vendor.css',
                        'production/assets/images/background/*.{gif,jpeg,jpg,png,svg}',
                        'production/assets/fonts/{,*/}*.*',
                        'production/assets/js/{,*/}*.js'
                    ]
                }
            }
        },

        // The following *-min tasks produce minified files in the release folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'assets/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: 'production/assets/images'
                }]
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'assets/images',
                    src: '{,*/}*.svg',
                    dest: 'production/assets/images'
                }]
            }
        },

        // Concat & minify assets
        useminPrepare: {
            html: '*.hbs',
            options: {
                dest: 'production'
            }

        },
        usemin: {
            html: 'production/*.hbs',
            css: ['production/assets/css/{,*/}*.css']
        },

        concurrent: {
            production: [
                'clean:production',
                'imagemin',
                'svgmin'
            ]
        },

        // Open ghost page for development
        open: {
            dev: {
                path: 'http://127.0.0.1:<%= sunset.port %>'
            }
        }

    });

    // livereload for development mode
    grunt.registerTask('start', [
        'autoprefixer',
        'open',
        'watch'
    ]);

    // Update assets
    grunt.registerTask('update', [
        'autoprefixer'
    ]);

    // Build release
    grunt.registerTask('build', [
        'clean',
        'concurrent:production',
        'autoprefixer',
        'useminPrepare',
        'concat',
        'uglify',
        'cssmin',
        'copy:production',
        'rev',
        'usemin',
        'clean:temp'
    ]);

    // Same as update
    grunt.registerTask('default', [
        'autoprefixer'
    ]);

    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-imagemin');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-open');
    grunt.loadNpmTasks('grunt-rev');
    grunt.loadNpmTasks('grunt-svgmin');
    grunt.loadNpmTasks('grunt-usemin');

}
<commit_msg>Prefixing more files<commit_after>'use strict';

module.exports = function(grunt) {

    // Config
    var sunset = {
        port: '2368'    // Ghost Port #
    };

    grunt.initConfig({

        sunset: sunset,

        pkg: grunt.file.readJSON('package.json'),
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
                '* http://<%= pkg.homepage %>/\n' +
                '* Copyright (c) <%= grunt.template.today("yyyy") %> ' +
                '<%= pkg.author.name %>; Licensed MIT */\n',

        // Watch files for changes for livereload and sass
        watch: {
            scripts: {
                files: 'assets/js/*.js',
                options:{
                    livereload: true
                }
            },
            html: {
                files: ['*.hbs', 'partials/*.hbs'],
                options: {
                    livereload: true
                }
            },
            livereload: {
                options: {
                    livereload: true
                },
                files: 'assets/css/*.css'
            }
        },

        // Add a banner to minified javascript.
        uglify: {
            options: {
                banner: '<%= banner %>',
                preserveComments: 'some'
            }
        },

        // Add a banner to minified css.
        cssmin: {
            options: {
                banner: '<%= banner %>',
                preserveComments: 'some'
            }
        },

        // Clean up for new build
        clean: {
            temp: ['.tmp'],
            production: ['production']
        },

        // Move files over for production release
        copy: {
            production: {
                files: [
                    {
                        src: ['helpers.js', 'slideshows.json', '*.hbs'],
                        dest: 'production/'
                    },
                    {
                        src: ['package-production.json'],
                        dest: 'production/package.json'
                    },
                    {
                        src: 'partials/*.hbs',
                        dest: 'production/'
                    },
                    {
                        src: ['assets/**/*', '!assets/css/**/*', '!assets/js/**/*'],
                        dest: 'production/'
                    }
                ]
            }
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: 'last 2 versions'
            },
            production: {
                files: [{
                    expand: true,
                    cwd: '.tmp/assets/css',
                    src: '{,*/}*.css',
                    dest: 'assets/css'
                }]
            }
        },

        // Rename files for browser caching purposes
        rev: {
            production: {
                files: {
                    src: [
                        'production/assets/css/*.css',
                        'production/assets/images/background/*.{gif,jpeg,jpg,png,svg}',
                        'production/assets/fonts/{,*/}*.*',
                        'production/assets/js/{,*/}*.js'
                    ]
                }
            }
        },

        // The following *-min tasks produce minified files in the release folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'assets/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: 'production/assets/images'
                }]
            }
        },

        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'assets/images',
                    src: '{,*/}*.svg',
                    dest: 'production/assets/images'
                }]
            }
        },

        // Concat & minify assets
        useminPrepare: {
            html: '*.hbs',
            options: {
                dest: 'production'
            }

        },
        usemin: {
            html: 'production/*.hbs',
            css: ['production/assets/css/{,*/}*.css']
        },

        concurrent: {
            production: [
                'clean:production',
                'imagemin',
                'svgmin'
            ]
        },

        // Open ghost page for development
        open: {
            dev: {
                path: 'http://127.0.0.1:<%= sunset.port %>'
            }
        }

    });

    // livereload for development mode
    grunt.registerTask('start', [
        'autoprefixer',
        'open',
        'watch'
    ]);

    // Update assets
    grunt.registerTask('update', [
        'autoprefixer'
    ]);

    // Build release
    grunt.registerTask('build', [
        'clean',
        'concurrent:production',
        'autoprefixer',
        'useminPrepare',
        'concat',
        'uglify',
        'cssmin',
        'copy:production',
        'rev',
        'usemin',
        'clean:temp'
    ]);

    // Same as update
    grunt.registerTask('default', [
        'autoprefixer'
    ]);

    grunt.loadNpmTasks('grunt-autoprefixer');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-imagemin');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-open');
    grunt.loadNpmTasks('grunt-rev');
    grunt.loadNpmTasks('grunt-svgmin');
    grunt.loadNpmTasks('grunt-usemin');

}
<|endoftext|>


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

  var path = require("path");
  var cwd = process.cwd();

  var tsJSON = {
    dev: {
      src: ["chartographer.ts", "typings/d3/d3.d.ts", "bower_components/plottable/plottable.d.ts"],
      outDir: ".",
      options: {
        target: 'es5',
        noImplicitAny: false,
        sourceMap: false,
        declaration: true,
        compiler: "./node_modules/grunt-ts/customcompiler/tsc",
        removeComments: false
      }
    }
  };

  // poor man's deep copy
  var deepCopy = function(x) {
    return JSON.parse(JSON.stringify(x));
  };

  tsJSON.dev_release = deepCopy(tsJSON.dev);
  delete tsJSON.dev_release.options.compiler;

  var bumpJSON = {
    options: {
      files: ['package.json', 'bower.json'],
      updateConfigs: ['pkg'],
      commit: false,
      createTag: false,
      push: false
    }
  };
  var configJSON = {
    pkg: grunt.file.readJSON("package.json"),
    bump: bumpJSON,
    concat: {
      header: {
        src: ["license_header.txt", "chartographer.js"],
        dest: "chartographer.js",
      }
    },
    sed: {
      version_number: {
        pattern: "@VERSION",
        replacement: "<%= pkg.version %>",
        path: "chartographer.js"
      }
    },
    ts: tsJSON,
    tslint: {
      options: {
        configuration: grunt.file.readJSON("tslint.json")
      },
      files: ["*.ts"]
    },
    jshint: {
      files: ['Gruntfile.js', 'quicktests/**/*.js'],
      options: {
          "curly": true,
          "eqeqeq": true,
          "evil": true,
          "indent": 2,
          "latedef": true,
          "globals": {
            "jQuery": true,
            "d3": true,
            "window": true,
            "console": true,
            "$": true,
            "makeRandomData": true,
            "setTimeout": true,
            "document": true,
            "Plottable": true
          },
          "strict": true,
          "eqnull": true
      }
    },
    watch: {
      "options": {
        livereload: 35731
      },
      "rebuild": {
        "tasks": ["dev-compile"],
        "files": ["*.ts"]
      }
    },
    connect: {
      server: {
        options: {
          port: 9998,
          hostname: "*",
          base: "",
          livereload: 35731
        }
      }
    },
    clean: {
      tscommand: ["tscommand*.tmp.txt"]
    },
    uglify: {
      main: {
        files: {'chartographer.min.js': ['chartographer.js']}
      }
    }
  };

  // project configuration
  grunt.initConfig(configJSON);

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

  grunt.registerTask("default", "launch");
  function makeDevCompile(release) {
    return [
      release ? "ts:dev_release" : "ts:dev",
      "concat:header",
      "sed",
      "clean:tscommand"
    ];
  }

  grunt.registerTask("dev-compile", makeDevCompile(false));
  grunt.registerTask("release-compile", makeDevCompile(true));

  grunt.registerTask("release:patch", ["bump:patch", "dist-compile"]);
  grunt.registerTask("release:minor", ["bump:minor", "dist-compile"]);
  grunt.registerTask("release:major", ["bump:major", "dist-compile"]);

  grunt.registerTask("dist-compile", [
                                  "release-compile",
                                  "tslint",
                                  "uglify",
                                  ]);

  grunt.registerTask("launch", ["connect", "dev-compile", "watch"]);
};
<commit_msg>Fix amusing infinite loop of recompillation on typing change<commit_after>module.exports = function(grunt) {
  "use strict";

  var path = require("path");
  var cwd = process.cwd();

  var tsJSON = {
    dev: {
      src: ["chartographer.ts", "typings/d3/d3.d.ts", "bower_components/plottable/plottable.d.ts"],
      outDir: ".",
      options: {
        target: 'es5',
        noImplicitAny: false,
        sourceMap: false,
        declaration: true,
        compiler: "./node_modules/grunt-ts/customcompiler/tsc",
        removeComments: false
      }
    }
  };

  // poor man's deep copy
  var deepCopy = function(x) {
    return JSON.parse(JSON.stringify(x));
  };

  tsJSON.dev_release = deepCopy(tsJSON.dev);
  delete tsJSON.dev_release.options.compiler;

  var bumpJSON = {
    options: {
      files: ['package.json', 'bower.json'],
      updateConfigs: ['pkg'],
      commit: false,
      createTag: false,
      push: false
    }
  };
  var configJSON = {
    pkg: grunt.file.readJSON("package.json"),
    bump: bumpJSON,
    concat: {
      header: {
        src: ["license_header.txt", "chartographer.js"],
        dest: "chartographer.js",
      }
    },
    sed: {
      version_number: {
        pattern: "@VERSION",
        replacement: "<%= pkg.version %>",
        path: "chartographer.js"
      }
    },
    ts: tsJSON,
    tslint: {
      options: {
        configuration: grunt.file.readJSON("tslint.json")
      },
      files: ["*.ts"]
    },
    jshint: {
      files: ['Gruntfile.js', 'quicktests/**/*.js'],
      options: {
          "curly": true,
          "eqeqeq": true,
          "evil": true,
          "indent": 2,
          "latedef": true,
          "globals": {
            "jQuery": true,
            "d3": true,
            "window": true,
            "console": true,
            "$": true,
            "makeRandomData": true,
            "setTimeout": true,
            "document": true,
            "Plottable": true
          },
          "strict": true,
          "eqnull": true
      }
    },
    watch: {
      "options": {
        livereload: 35731
      },
      "rebuild": {
        "tasks": ["dev-compile"],
        "files": ["chartographer.ts"]
      }
    },
    connect: {
      server: {
        options: {
          port: 9998,
          hostname: "*",
          base: "",
          livereload: 35731
        }
      }
    },
    clean: {
      tscommand: ["tscommand*.tmp.txt"]
    },
    uglify: {
      main: {
        files: {'chartographer.min.js': ['chartographer.js']}
      }
    }
  };

  // project configuration
  grunt.initConfig(configJSON);

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

  grunt.registerTask("default", "launch");
  function makeDevCompile(release) {
    return [
      release ? "ts:dev_release" : "ts:dev",
      "concat:header",
      "sed",
      "clean:tscommand"
    ];
  }

  grunt.registerTask("dev-compile", makeDevCompile(false));
  grunt.registerTask("release-compile", makeDevCompile(true));

  grunt.registerTask("release:patch", ["bump:patch", "dist-compile"]);
  grunt.registerTask("release:minor", ["bump:minor", "dist-compile"]);
  grunt.registerTask("release:major", ["bump:major", "dist-compile"]);

  grunt.registerTask("dist-compile", [
                                  "release-compile",
                                  "tslint",
                                  "uglify",
                                  ]);

  grunt.registerTask("launch", ["connect", "dev-compile", "watch"]);
};
<|endoftext|>


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

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

    grunt.initConfig({

        // watch for changes and trigger compass, jshint, uglify and livereload
        watch: {
            js: {
                files: ['jquery-handlebars.js'],
                tasks: ['uglify','jshint'],
                options: {
                    livereload: true,
                },
            }
        },

        // uglify to concat & minify
        uglify: {
            js: {
                files: {
                    'jquery-handlebars.min.js': 'jquery-handlebars.js',
                },
                options: {
                    compress: {
                        comparisons: true,
                        conditionals: true,
                        dead_code: true,
                        drop_console: true,
                        unsafe: true,
                        unused: true
                    }
                }
            }
        },

        jshint: {
            all: ['jquery-handlebars.js']
        }

    });

    // register task
    grunt.registerTask('default', ['watch']);
};
<commit_msg>Added explicit options to JSHint<commit_after>
module.exports = function(grunt) {

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

    grunt.initConfig({

        // watch for changes and trigger compass, jshint, uglify and livereload
        watch: {
            js: {
                files: ['jquery-handlebars.js'],
                tasks: ['uglify','jshint'],
                options: {
                    livereload: true,
                },
            }
        },

        // uglify to concat & minify
        uglify: {
            js: {
                files: {
                    'jquery-handlebars.min.js': 'jquery-handlebars.js',
                },
                options: {
                    compress: {
                        comparisons: true,
                        conditionals: true,
                        dead_code: true,
                        drop_console: true,
                        unsafe: true,
                        unused: true
                    }
                }
            }
        },

        jshint: {
            all: ['jquery-handlebars.js'],
            options: {
                curly: true,
                eqeqeq: true,
                eqnull: true,
                notypeof: true,
                undef: true,
                browser: true,
                globals: {
                  jQuery: true
                }
            }
        }

    });

    // register task
    grunt.registerTask('default', ['watch']);
};
<|endoftext|>


<commit_before>module.exports = function( grunt ) {
  'use strict';
  grunt.loadNpmTasks('grunt-haml')
  //
  // Grunt configuration:
  //
  // https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
  //
  grunt.initConfig({

    // Project configuration
    // ---------------------

    // specify an alternate install location for Bower
    bower: {
      dir: 'app/components'
    },

   haml: {
      index: {
        src: "app/index.haml",
        dest: "app/index.html"
      }
    },

    // Coffee to JS compilation
    coffee: {
      compile: {
        files: {
          'temp/scripts/*.js': 'app/scripts/**/*.coffee'
        },
        options: {
          basePath: 'app/scripts'
        }
      }
    },

    // compile .scss/.sass to .css using Compass
    compass: {
      dist: {
        // http://compass-style.org/help/tutorials/configuration-reference/#configuration-properties
        options: {
          css_dir: 'temp/styles',
          sass_dir: 'app/styles',
          images_dir: 'app/images',
          javascripts_dir: 'temp/scripts',
          force: true
        }
      }
    },

    // generate application cache manifest
    manifest:{
      dest: ''
    },

    // headless testing through PhantomJS
    mocha: {
      all: ['test/**/*.html']
    },

    // default watch configuration
    watch: {
      haml: {
          files: [
            'app/*.haml'
          ],
          tasks: 'haml'
      },
      coffee: {
        files: 'app/scripts/**/*.coffee',
        tasks: 'coffee reload'
      },
      compass: {
        files: [
          'app/styles/**/*.{scss,sass}'
        ],
        tasks: 'compass reload'
      },
      reload: {
        files: [
          'app/*.html',
          'app/styles/**/*.css',
          'app/scripts/**/*.js',
          'app/images/**/*'
        ],
        tasks: 'reload'
      }
    },

    // default lint configuration, change this to match your setup:
    // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#lint-built-in-task
    lint: {
      files: [
        'Gruntfile.js',
        'app/scripts/**/*.js',
        'spec/**/*.js'
      ]
    },

    // specifying JSHint options and globals
    // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#specifying-jshint-options-and-globals
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        browser: true
      },
      globals: {
        jQuery: true
      }
    },

    // Build configuration
    // -------------------

    // the staging directory used during the process
    staging: 'temp',
    // final build output
    output: 'dist',

    mkdirs: {
      staging: 'app/'
    },

    // Below, all paths are relative to the staging directory, which is a copy
    // of the app/ directory. Any .gitignore, .ignore and .buildignore file
    // that might appear in the app/ tree are used to ignore these values
    // during the copy process.

    // concat css/**/*.css files, inline @import, output a single minified css
    css: {
      'styles/main.css': ['styles/**/*.css']
    },

    // renames JS/CSS to prepend a hash of their contents for easier
    // versioning
    rev: {
      js: 'scripts/**/*.js',
      css: 'styles/**/*.css',
      img: 'images/**'
    },

    // usemin handler should point to the file containing
    // the usemin blocks to be parsed
    'usemin-handler': {
      html: 'index.html'
    },

    // update references in HTML/CSS to revved files
    usemin: {
      html: ['**/*.html'],
      css: ['**/*.css']
    },

    // HTML minification
    html: {
      files: ['**/*.html']
    },

    // Optimizes JPGs and PNGs (with jpegtran & optipng)
    img: {
      dist: '<config:rev.img>'
    },

    // rjs configuration. You don't necessarily need to specify the typical
    // `path` configuration, the rjs task will parse these values from your
    // main module, using http://requirejs.org/docs/optimization.html#mainConfigFile
    //
    // name / out / mainConfig file should be used. You can let it blank if
    // you're using usemin-handler to parse rjs config from markup (default
    // setup)
    rjs: {
      // no minification, is done by the min task
      optimize: 'none',
      baseUrl: './scripts',
      wrap: true,
      name: 'main'
    },

    // While Yeoman handles concat/min when using
    // usemin blocks, you can still use them manually
    concat: {
      dist: ''
    },

    min: {
      dist: ''
    }
  });

  // Alias the `test` task to run the `mocha` task instead
  grunt.registerTask('test', 'server:phantom mocha');

};
<commit_msg>removes haml<commit_after>module.exports = function( grunt ) {
  'use strict';
  //
  // Grunt configuration:
  //
  // https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
  //
  grunt.initConfig({

    // Project configuration
    // ---------------------

    // specify an alternate install location for Bower
    bower: {
      dir: 'app/components'
    },

    // Coffee to JS compilation
    coffee: {
      compile: {
        files: {
          'temp/scripts/*.js': 'app/scripts/**/*.coffee'
        },
        options: {
          basePath: 'app/scripts'
        }
      }
    },

    // compile .scss/.sass to .css using Compass
    compass: {
      dist: {
        // http://compass-style.org/help/tutorials/configuration-reference/#configuration-properties
        options: {
          css_dir: 'temp/styles',
          sass_dir: 'app/styles',
          images_dir: 'app/images',
          javascripts_dir: 'temp/scripts',
          force: true
        }
      }
    },

    // generate application cache manifest
    manifest:{
      dest: ''
    },

    // headless testing through PhantomJS
    mocha: {
      all: ['test/**/*.html']
    },

    // default watch configuration
    watch: {
      coffee: {
        files: 'app/scripts/**/*.coffee',
        tasks: 'coffee reload'
      },
      compass: {
        files: [
          'app/styles/**/*.{scss,sass}'
        ],
        tasks: 'compass reload'
      },
      reload: {
        files: [
          'app/*.html',
          'app/styles/**/*.css',
          'app/scripts/**/*.js',
          'app/images/**/*'
        ],
        tasks: 'reload'
      }
    },

    // default lint configuration, change this to match your setup:
    // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#lint-built-in-task
    lint: {
      files: [
        'Gruntfile.js',
        'app/scripts/**/*.js',
        'spec/**/*.js'
      ]
    },

    // specifying JSHint options and globals
    // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md#specifying-jshint-options-and-globals
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        browser: true
      },
      globals: {
        jQuery: true
      }
    },

    // Build configuration
    // -------------------

    // the staging directory used during the process
    staging: 'temp',
    // final build output
    output: 'dist',

    mkdirs: {
      staging: 'app/'
    },

    // Below, all paths are relative to the staging directory, which is a copy
    // of the app/ directory. Any .gitignore, .ignore and .buildignore file
    // that might appear in the app/ tree are used to ignore these values
    // during the copy process.

    // concat css/**/*.css files, inline @import, output a single minified css
    css: {
      'styles/main.css': ['styles/**/*.css']
    },

    // renames JS/CSS to prepend a hash of their contents for easier
    // versioning
    rev: {
      js: 'scripts/**/*.js',
      css: 'styles/**/*.css',
      img: 'images/**'
    },

    // usemin handler should point to the file containing
    // the usemin blocks to be parsed
    'usemin-handler': {
      html: 'index.html'
    },

    // update references in HTML/CSS to revved files
    usemin: {
      html: ['**/*.html'],
      css: ['**/*.css']
    },

    // HTML minification
    html: {
      files: ['**/*.html']
    },

    // Optimizes JPGs and PNGs (with jpegtran & optipng)
    img: {
      dist: '<config:rev.img>'
    },

    // rjs configuration. You don't necessarily need to specify the typical
    // `path` configuration, the rjs task will parse these values from your
    // main module, using http://requirejs.org/docs/optimization.html#mainConfigFile
    //
    // name / out / mainConfig file should be used. You can let it blank if
    // you're using usemin-handler to parse rjs config from markup (default
    // setup)
    rjs: {
      // no minification, is done by the min task
      optimize: 'none',
      baseUrl: './scripts',
      wrap: true,
      name: 'main'
    },

    // While Yeoman handles concat/min when using
    // usemin blocks, you can still use them manually
    concat: {
      dist: ''
    },

    min: {
      dist: ''
    }
  });

  // Alias the `test` task to run the `mocha` task instead
  grunt.registerTask('test', 'server:phantom mocha');

};
<|endoftext|>


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

    var fs = require('fs');
    var _ = require('lodash');

    var awsConfig = {
        accessKey: false,
        secretKey: false,
        region: false,
        s3Bucket: false
    };

    // Breaks out the keys and also gives us a nice reference of what
    // needs to be in here without being able to be changed.
    var awsConfigKeys = _.keys(awsConfig);

    // Take inputs for the awsConfig, prefixed with 'aws.'.
    // For example accessKey can be inputted with '--aws.accessKey=accessKey'
    _.each(awsConfigKeys, function(awsConfigKey){
        var optionKey = 'aws.' + awsConfigKey;
        var optionValue = grunt.option(optionKey);
        if (optionValue) {
            // Use the original key to update it.
            awsConfig[awsConfigKey] = optionValue;
        }
    });

    grunt.file.move = function(from,to) {
        grunt.log.writeln('Moved '+from.cyan+' to '+to.cyan);
        grunt.file.copy(from,to);
        grunt.file.delete(from);
    };

    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-version');
    grunt.loadNpmTasks('grunt-aws');
    grunt.loadNpmTasks('grunt-fastly');
    grunt.loadNpmTasks('grunt-git');

    grunt.initConfig({
        aws: awsConfig,
        version: {
            options: {
                pkg: grunt.file.readJSON('package.json')
            },
            eloqua: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/eloqua/*.js']
            },
            soundjs: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/soundjs/*.js']
            },
            marketo: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/marketo/*.js']
            }
        },
        watch: {
            js : {
                files: ['./src/**/*.js'],
                tasks: ['compileJS'],
                options: {
                    spawn: false,
                    debounceDelay: 250,
                    interrupt: true
                }
            }
        },
        requirejs: {
            compile_eloqua_plugin: {
                options: {
                    baseUrl: './src/eloqua',
                    include: ['eloqua'],
                    optimize: 'none',
                    out: './dist/plugins/eloqua/main.js',
                    skipSemiColonInsertion: true
                }
            },
            compile_marketo_plugin: {
                options: {
                    baseUrl: './src/marketo',
                    include: ['marketo'],
                    optimize: 'none',
                    out: './dist/plugins/marketo/main.js',
                    skipSemiColonInsertion: true
                }
            },
            compile_soundjs_plugin: {
                options: {
                    baseUrl: './src/soundjs',
                    include: ['soundjs'],
                    optimize: 'none',
                    out: './dist/plugins/soundjs/main.js',
                    skipSemiColonInsertion: true
                }
            }
        },
        md5: {
            release: {
                src:['dist/plugins/**/*.*']
            }
        },
        s3: {
            releaseNonGzip: {
                options: {
                    accessKeyId: "<%= aws.accessKey %>",
                    secretAccessKey: "<%= aws.secretKey %>",
                    region: "<%= aws.region %>",
                    bucket: "<%= aws.s3Bucket %>",
                    access: 'public-read',
                    // This flag auto gzips all files it uploads,
                    // since we handle it ourselves we disable it.
                    gzip: false,
                    cache: false, // Always upload, even if it's the same etag
                    headers: {
                        CacheControl: 86400 * 30 // 1 month
                    }
                },
                cwd: "./dist/plugins/",
                src: ["**/*.*"]
            },
        },
        gittag: {
            tagRelease: {
                options: {
                    cwd: './',
                    verbose: true,
                    tag: String(grunt.file.readJSON('package.json').version)
                }
            }
        },
        gitpush: {
            pushReleaseTag: {
                options: {
                    cwd: './',
                    verbose: true,
                    tags: true
                }
            }
        },
        fastly: {
            options: {
                key: grunt.option('fastly.key')
            },
            plugins: {
                options: {
                    urls: [],
                    host: grunt.option('fastly.host')
                }
            }
        }

    });

    /**
     * This is kind of a hack, because we want to dynamically invalidate fastly based on the files we
     * have created in a directory, we have to set them AFTER they are created.  This updates the config
     * in order to invalidate the correct files.
     */
    grunt.registerTask('updateFastlyOptions', 'Update the Fastly Inputs', function() {
        var fastly = grunt.config.get('fastly');

        /**
         * This reads all the files we are releasing (both major and specific versions)
         * We technically only need to invalidate the major version since there was a file there before
         * but since this is easy to do and may help if someone ever mistags, we invalidate all.
         */
        fastly.plugins.options.urls = fs.readdirSync('./dist/').map(function(value, key, array) {
            return '/' + value;
        });

        grunt.log.writeln('Purging cache for host ' + fastly.plugins.options.host);
        grunt.log.writeln('Purging cache for urls ' + fastly.plugins.options.urls);

        // Set the config back.
        grunt.config.set('fastly', fastly);
    });

    grunt.registerTask('clean','Cleans build artifacts',function(){
        grunt.file.delete('dist/');
        grunt.log.writeln('Removed '+'dist/'.green);
    });

    grunt.registerTask('rename','Renames build artifacts to include version number',function(){
        // If pushing to develop or a feature branch, codeship sends in the branch name so that builds can
        // be pushed to S3 with the branch name included to assist multi-branch development
        var branchFileModifier = '';
        if(grunt.option('branch')) {
            branchFileModifier = '-' + grunt.option('branch').replace('/', '-');
        }

        var version = String(grunt.file.readJSON('package.json').version);
        var versionArray = version.split('.');
        if (versionArray.length < 3) {
            grunt.fail.warn('Version should be specified in Major.Minor.Patch (1.0.0)');
        }
        var majorVersion = versionArray[0];

        var plugins = ['eloqua', 'soundjs'];
        _.each(plugins, function(type){
            /**
             * Output files for specific Version (when version = 1.3.0)
             * These should never overwrite files in our s3 bucket, always should be unique.
             * Code changes require update to version.
             *
             * plugins/eloqua/main-1.0.0.js
             * plugins/eloqua/main-1.0.0.gz.js
             */
            grunt.file.move('dist/plugins/' + type + '/main.js', 'dist/plugins/' + type + '/main' + branchFileModifier + '-' + version + '.js');

            /**
             * Output files for Major Version (when version = 1.3.0 -- majorVersion = 1)
             * These replace the existing major release version.  The concept is that customers
             * can use v1 and we can update it with non-breaking changes without them having to update their
             * source.
             *
             * plugins/eloqua/main-v1.js
             * plugins/eloqua/main-v1.gz.js
             */
            grunt.file.copy('dist/plugins/' + type + '/main' + branchFileModifier + '-' + version + '.js', 'dist/plugins/' + type + '/main' + branchFileModifier + '-v' + majorVersion + '.js');

        });
    });

    grunt.registerMultiTask('md5', 'Generates MD5 for build artifacts', function() {
        _.each(this.files, function(file) {
            if (typeof file.src === 'undefined') {
                grunt.fail.warn('Files object doesn\'t exist');
            }

            var srcFiles = grunt.file.expand(file.src);

            _.each(srcFiles, function(srcFile) {
                try {
                    var srcCode = grunt.file.read(srcFile);
                    var md5 = require('crypto').createHash('md5').update(srcCode).digest('hex');
                    grunt.log.writeln(srcFile+' '+md5.green);
                } catch(err) {
                    grunt.log.error(err);
                    grunt.fail.warn('Fail to generate an MD5 file name');
                }
            });
        });
    });

    /**
     * Checks to make sure the AWS Credentials have been passed in.
     * This allows us to check right away to make sure we can complete this task.
     */
    grunt.registerTask('awsInputCheck', 'Checks to make sure we have the correct AWS Inputs', function() {
        var aws = grunt.config.get('aws');

        var hasAllKeys = true;
        // Loop through the array of values here and make sure they are all set.
        _.each(awsConfigKeys, function(key) {

            if (!awsConfig[key]) {
                grunt.log.error('Missing input [' + key + '] Please use --aws.' + key + '=<value>');
                hasAllKeys = false;
            }
        });

        if (!hasAllKeys) {
            grunt.fail.warn('Missing required AWS Inputs');
        }

    });

    grunt.registerTask('compileJS',
        "Resolves all requirejs dependencies and compiles javascript into file for the embedded and standalone SDKs",
        [
            'requirejs',
            'version'
        ]
    );

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

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

    grunt.registerTask('test',[
        'clean',
        'compileJS'
    ]);

    // Should only be run via CodeShip.
    // Does everything the regular 'release' task does EXCEPT tagging the repo
    // Codeship should be setup to push this to a dev bucket
    grunt.registerTask('dev-release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'rename',
        // Show the md5 of the files
        'md5',
        // Push to S3
        's3:releaseNonGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);

    // Should only be run via CodeShip.
    grunt.registerTask('release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'rename',
        // Show the md5 of the files
        'md5',
        // Create the tag from the version.  Will fail if already exists.
        'gittag:tagRelease',
        // Push the tag to github
        'gitpush:pushReleaseTag',
        // Push to S3
        's3:releaseNonGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);
};
<commit_msg>adding marketo to a really list of plugins<commit_after>module.exports = function(grunt) {

    var fs = require('fs');
    var _ = require('lodash');

    var awsConfig = {
        accessKey: false,
        secretKey: false,
        region: false,
        s3Bucket: false
    };

    // Breaks out the keys and also gives us a nice reference of what
    // needs to be in here without being able to be changed.
    var awsConfigKeys = _.keys(awsConfig);

    // Take inputs for the awsConfig, prefixed with 'aws.'.
    // For example accessKey can be inputted with '--aws.accessKey=accessKey'
    _.each(awsConfigKeys, function(awsConfigKey){
        var optionKey = 'aws.' + awsConfigKey;
        var optionValue = grunt.option(optionKey);
        if (optionValue) {
            // Use the original key to update it.
            awsConfig[awsConfigKey] = optionValue;
        }
    });

    grunt.file.move = function(from,to) {
        grunt.log.writeln('Moved '+from.cyan+' to '+to.cyan);
        grunt.file.copy(from,to);
        grunt.file.delete(from);
    };

    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-version');
    grunt.loadNpmTasks('grunt-aws');
    grunt.loadNpmTasks('grunt-fastly');
    grunt.loadNpmTasks('grunt-git');

    grunt.initConfig({
        aws: awsConfig,
        version: {
            options: {
                pkg: grunt.file.readJSON('package.json')
            },
            eloqua: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/eloqua/*.js']
            },
            soundjs: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/soundjs/*.js']
            },
            marketo: {
                options: {
                    prefix: '@version *'
                },
                src: ['dist/plugins/marketo/*.js']
            }
        },
        watch: {
            js : {
                files: ['./src/**/*.js'],
                tasks: ['compileJS'],
                options: {
                    spawn: false,
                    debounceDelay: 250,
                    interrupt: true
                }
            }
        },
        requirejs: {
            compile_eloqua_plugin: {
                options: {
                    baseUrl: './src/eloqua',
                    include: ['eloqua'],
                    optimize: 'none',
                    out: './dist/plugins/eloqua/main.js',
                    skipSemiColonInsertion: true
                }
            },
            compile_marketo_plugin: {
                options: {
                    baseUrl: './src/marketo',
                    include: ['marketo'],
                    optimize: 'none',
                    out: './dist/plugins/marketo/main.js',
                    skipSemiColonInsertion: true
                }
            },
            compile_soundjs_plugin: {
                options: {
                    baseUrl: './src/soundjs',
                    include: ['soundjs'],
                    optimize: 'none',
                    out: './dist/plugins/soundjs/main.js',
                    skipSemiColonInsertion: true
                }
            }
        },
        md5: {
            release: {
                src:['dist/plugins/**/*.*']
            }
        },
        s3: {
            releaseNonGzip: {
                options: {
                    accessKeyId: "<%= aws.accessKey %>",
                    secretAccessKey: "<%= aws.secretKey %>",
                    region: "<%= aws.region %>",
                    bucket: "<%= aws.s3Bucket %>",
                    access: 'public-read',
                    // This flag auto gzips all files it uploads,
                    // since we handle it ourselves we disable it.
                    gzip: false,
                    cache: false, // Always upload, even if it's the same etag
                    headers: {
                        CacheControl: 86400 * 30 // 1 month
                    }
                },
                cwd: "./dist/plugins/",
                src: ["**/*.*"]
            },
        },
        gittag: {
            tagRelease: {
                options: {
                    cwd: './',
                    verbose: true,
                    tag: String(grunt.file.readJSON('package.json').version)
                }
            }
        },
        gitpush: {
            pushReleaseTag: {
                options: {
                    cwd: './',
                    verbose: true,
                    tags: true
                }
            }
        },
        fastly: {
            options: {
                key: grunt.option('fastly.key')
            },
            plugins: {
                options: {
                    urls: [],
                    host: grunt.option('fastly.host')
                }
            }
        }

    });

    /**
     * This is kind of a hack, because we want to dynamically invalidate fastly based on the files we
     * have created in a directory, we have to set them AFTER they are created.  This updates the config
     * in order to invalidate the correct files.
     */
    grunt.registerTask('updateFastlyOptions', 'Update the Fastly Inputs', function() {
        var fastly = grunt.config.get('fastly');

        /**
         * This reads all the files we are releasing (both major and specific versions)
         * We technically only need to invalidate the major version since there was a file there before
         * but since this is easy to do and may help if someone ever mistags, we invalidate all.
         */
        fastly.plugins.options.urls = fs.readdirSync('./dist/').map(function(value, key, array) {
            return '/' + value;
        });

        grunt.log.writeln('Purging cache for host ' + fastly.plugins.options.host);
        grunt.log.writeln('Purging cache for urls ' + fastly.plugins.options.urls);

        // Set the config back.
        grunt.config.set('fastly', fastly);
    });

    grunt.registerTask('clean','Cleans build artifacts',function(){
        grunt.file.delete('dist/');
        grunt.log.writeln('Removed '+'dist/'.green);
    });

    grunt.registerTask('rename','Renames build artifacts to include version number',function(){
        // If pushing to develop or a feature branch, codeship sends in the branch name so that builds can
        // be pushed to S3 with the branch name included to assist multi-branch development
        var branchFileModifier = '';
        if(grunt.option('branch')) {
            branchFileModifier = '-' + grunt.option('branch').replace('/', '-');
        }

        var version = String(grunt.file.readJSON('package.json').version);
        var versionArray = version.split('.');
        if (versionArray.length < 3) {
            grunt.fail.warn('Version should be specified in Major.Minor.Patch (1.0.0)');
        }
        var majorVersion = versionArray[0];

        var plugins = ['eloqua', 'marketo', 'soundjs'];
        _.each(plugins, function(type){
            /**
             * Output files for specific Version (when version = 1.3.0)
             * These should never overwrite files in our s3 bucket, always should be unique.
             * Code changes require update to version.
             *
             * plugins/eloqua/main-1.0.0.js
             * plugins/eloqua/main-1.0.0.gz.js
             */
            grunt.file.move('dist/plugins/' + type + '/main.js', 'dist/plugins/' + type + '/main' + branchFileModifier + '-' + version + '.js');

            /**
             * Output files for Major Version (when version = 1.3.0 -- majorVersion = 1)
             * These replace the existing major release version.  The concept is that customers
             * can use v1 and we can update it with non-breaking changes without them having to update their
             * source.
             *
             * plugins/eloqua/main-v1.js
             * plugins/eloqua/main-v1.gz.js
             */
            grunt.file.copy('dist/plugins/' + type + '/main' + branchFileModifier + '-' + version + '.js', 'dist/plugins/' + type + '/main' + branchFileModifier + '-v' + majorVersion + '.js');

        });
    });

    grunt.registerMultiTask('md5', 'Generates MD5 for build artifacts', function() {
        _.each(this.files, function(file) {
            if (typeof file.src === 'undefined') {
                grunt.fail.warn('Files object doesn\'t exist');
            }

            var srcFiles = grunt.file.expand(file.src);

            _.each(srcFiles, function(srcFile) {
                try {
                    var srcCode = grunt.file.read(srcFile);
                    var md5 = require('crypto').createHash('md5').update(srcCode).digest('hex');
                    grunt.log.writeln(srcFile+' '+md5.green);
                } catch(err) {
                    grunt.log.error(err);
                    grunt.fail.warn('Fail to generate an MD5 file name');
                }
            });
        });
    });

    /**
     * Checks to make sure the AWS Credentials have been passed in.
     * This allows us to check right away to make sure we can complete this task.
     */
    grunt.registerTask('awsInputCheck', 'Checks to make sure we have the correct AWS Inputs', function() {
        var aws = grunt.config.get('aws');

        var hasAllKeys = true;
        // Loop through the array of values here and make sure they are all set.
        _.each(awsConfigKeys, function(key) {

            if (!awsConfig[key]) {
                grunt.log.error('Missing input [' + key + '] Please use --aws.' + key + '=<value>');
                hasAllKeys = false;
            }
        });

        if (!hasAllKeys) {
            grunt.fail.warn('Missing required AWS Inputs');
        }

    });

    grunt.registerTask('compileJS',
        "Resolves all requirejs dependencies and compiles javascript into file for the embedded and standalone SDKs",
        [
            'requirejs',
            'version'
        ]
    );

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

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

    grunt.registerTask('test',[
        'clean',
        'compileJS'
    ]);

    // Should only be run via CodeShip.
    // Does everything the regular 'release' task does EXCEPT tagging the repo
    // Codeship should be setup to push this to a dev bucket
    grunt.registerTask('dev-release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'rename',
        // Show the md5 of the files
        'md5',
        // Push to S3
        's3:releaseNonGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);

    // Should only be run via CodeShip.
    grunt.registerTask('release',[
        // Make sure we have the s3 credentials needed to release this.
        'awsInputCheck',
        // Remove working files and created files.
        'clean',
        // Version and create the files in the /dist folder
        'compileJS',
        'rename',
        // Show the md5 of the files
        'md5',
        // Create the tag from the version.  Will fail if already exists.
        'gittag:tagRelease',
        // Push the tag to github
        'gitpush:pushReleaseTag',
        // Push to S3
        's3:releaseNonGzip',
        // Invalidate the Files on Fastly
        'updateFastlyOptions',
        'fastly'
    ]);
};
<|endoftext|>


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

  "use strict";

  grunt.initConfig({
    meta: {
      pkg: grunt.file.readJSON("package.json"),
      srcFiles: [
        "src/d3-layer.js",
        "src/d3-chart.js"
      ]
    },
    watch: {
      scripts: {
        files: ["src/**/*.js", "test/tests/*.js"],
        tasks: ["jshint"]
      }
    },
    jshint: {
      options: {
        curly: true,
        undef: true
      },
      chart: {
        options: {
          browser: true
        },
        files: {
          src: "<%= meta.srcFiles %>"
        }
      },
      test: {
        options: {
          globals: {
            d3: true,
            assert: true,
            chai: true,
            setup: true,
            suite: true,
            test: true,
            sinon: true
          }
        },
        files: {
          src: ["test/tests/*.js"]
        }
      },
      grunt: {
        options: {
          node: true
        },
        files: {
          src: ["Gruntfile.js"]
        }
      }
    },
    concat: {
      options: {
        banner: "/*! <%= meta.pkg.name %> - v<%= meta.pkg.version %>\n" +
          " *  License: <%= meta.pkg.license %>\n" +
          " *  Date: <%= grunt.template.today('yyyy-mm-dd') %>\n" +
          " */\n"
      },
      dist: {
        files: {
          "dist/d3.chart.js": "<%= meta.srcFiles %>"
        }
      },
      release: {
        files: {
          "d3.chart.js": "<%= meta.srcFiles %>"
        }
      }
    },
    uglify: {
      options: {
        // Preserve banner
        preserveComments: "some"
      },
      dist: {
        files: {
          "dist/d3.chart.min.js": "dist/d3.chart.js"
        }
      },
      release: {
        files: {
          "d3.chart.min.js": "dist/d3.chart.js"
        }
      }
    }
  });

  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-watch");

  grunt.registerTask("default", ["jshint", "concat:dist", "uglify:dist"]);
  grunt.registerTask("release", ["jshint", "concat", "uglify"]);
};
<commit_msg>Permit global `teardown` function in tests<commit_after>module.exports = function(grunt) {

  "use strict";

  grunt.initConfig({
    meta: {
      pkg: grunt.file.readJSON("package.json"),
      srcFiles: [
        "src/d3-layer.js",
        "src/d3-chart.js"
      ]
    },
    watch: {
      scripts: {
        files: ["src/**/*.js", "test/tests/*.js"],
        tasks: ["jshint"]
      }
    },
    jshint: {
      options: {
        curly: true,
        undef: true
      },
      chart: {
        options: {
          browser: true
        },
        files: {
          src: "<%= meta.srcFiles %>"
        }
      },
      test: {
        options: {
          globals: {
            d3: true,
            assert: true,
            chai: true,
            setup: true,
            teardown: true,
            suite: true,
            test: true,
            sinon: true
          }
        },
        files: {
          src: ["test/tests/*.js"]
        }
      },
      grunt: {
        options: {
          node: true
        },
        files: {
          src: ["Gruntfile.js"]
        }
      }
    },
    concat: {
      options: {
        banner: "/*! <%= meta.pkg.name %> - v<%= meta.pkg.version %>\n" +
          " *  License: <%= meta.pkg.license %>\n" +
          " *  Date: <%= grunt.template.today('yyyy-mm-dd') %>\n" +
          " */\n"
      },
      dist: {
        files: {
          "dist/d3.chart.js": "<%= meta.srcFiles %>"
        }
      },
      release: {
        files: {
          "d3.chart.js": "<%= meta.srcFiles %>"
        }
      }
    },
    uglify: {
      options: {
        // Preserve banner
        preserveComments: "some"
      },
      dist: {
        files: {
          "dist/d3.chart.min.js": "dist/d3.chart.js"
        }
      },
      release: {
        files: {
          "d3.chart.min.js": "dist/d3.chart.js"
        }
      }
    }
  });

  grunt.loadNpmTasks("grunt-contrib-jshint");
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks("grunt-contrib-watch");

  grunt.registerTask("default", ["jshint", "concat:dist", "uglify:dist"]);
  grunt.registerTask("release", ["jshint", "concat", "uglify"]);
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-ts');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-open');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    ts: {
      options: {
        removeComments: false,
      },
      default: {
        src: ['client/*.ts'],
        outDir: 'ImprovedInitiative.Client',
        options: {
          module: 'amd',
          target: 'es5'
        }
      },
      server: {
        src: ['server/*.ts'],
        outDir: '.',
        options: {
          module: 'commonjs',
          target: 'es5'
        }
      },
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'ImprovedInitiative.Client/client.min.js': ['ImprovedInitiative.Client/*.js']
        }
      },
      socketio: {
        files: {
          'node_modules/socket.io-client/socket.io.min.js': ['node_modules/socket.io-client/socket.io.js']
        }
      }
    },
    less: {
      development: {
        options: {
          paths: ["."]
        },
        files: {
          "improved-initiative.less.css": "improved-initiative.less"
        }
      }
    },
    concat: {
      js: {
        src: [
          'node_modules/knockout/build/output/knockout-latest.debug.js',
          'node_modules/knockout-mapping/dist/knockout.mapping.js',
          'node_modules/jquery/dist/jquery.js',
          'node_modules/awesomplete/awesomplete.js',
          'node_modules/mousetrap/mousetrap.js',
          'node_modules/socket.io-client/socket.io.js',
          'node_modules/browser-filesaver/FileSaver.js',
          'node_modules/markdown-it/dist/markdown-it.js',
          'ImprovedInitiative.Client/*.js'
        ],
        dest: 'public/js/ImprovedInitiative.js'
      },
      js_min: {
        src: [
          'node_modules/knockout/build/output/knockout-latest.js',
          'node_modules/knockout-mapping/dist/knockout.mapping.min.js',
          'node_modules/jquery/dist/jquery.min.js',
          'node_modules/awesomplete/awesomplete.min.js',
          'node_modules/mousetrap/mousetrap.min.js',
          'node_modules/socket.io-client/socket.io.min.js',
          'node_modules/browser-filesaver/FileSaver.min.js',
          'node_modules/markdown-it/dist/markdown-it.min.js',
          'ImprovedInitiative.Client/client.min.js'
        ],
        dest: 'public/js/ImprovedInitiative.js'
      },
      css: {
        src: [
          'node_modules/awesomplete/awesomplete.css',
          'improved-initiative.less.css'
        ],
        dest: 'public/css/improved-initiative.css'
      }
    },
    watch: {
      ts: {
        files: '**/*.ts',
        tasks: ['ts', 'concat:js']
      },
      lesscss: {
        files: '**/*.less',
        tasks: ['less', 'concat:css']
      }
    },
    copy: {
      main: {
        files: [
          { expand: true, cwd: 'node_modules/font-awesome/fonts/', src: ['**'], dest: 'public/fonts/' }
        ]
      }
    }
  });

  grunt.registerTask('build_dev', ['ts:default', 'ts:server', 'less', 'concat:js', 'concat:css']);
  grunt.registerTask('build_min', ['ts:default', 'ts:server', 'uglify', 'less', 'concat:js_min', 'concat:css']);
  grunt.registerTask('default', ['build_dev', 'watch']);
  grunt.registerTask('postinstall', ['copy', 'build_min']);
};<commit_msg>Move minified client target<commit_after>module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-ts');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-open');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    ts: {
      options: {
        removeComments: false,
      },
      default: {
        src: ['client/*.ts'],
        outDir: 'ImprovedInitiative.Client',
        options: {
          module: 'amd',
          target: 'es5'
        }
      },
      server: {
        src: ['server/*.ts'],
        outDir: '.',
        options: {
          module: 'commonjs',
          target: 'es5'
        }
      },
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'client.min.js': ['ImprovedInitiative.Client/*.js']
        }
      },
      socketio: {
        files: {
          'node_modules/socket.io-client/socket.io.min.js': ['node_modules/socket.io-client/socket.io.js']
        }
      }
    },
    less: {
      development: {
        options: {
          paths: ["."]
        },
        files: {
          "improved-initiative.less.css": "improved-initiative.less"
        }
      }
    },
    concat: {
      js: {
        src: [
          'node_modules/knockout/build/output/knockout-latest.debug.js',
          'node_modules/knockout-mapping/dist/knockout.mapping.js',
          'node_modules/jquery/dist/jquery.js',
          'node_modules/awesomplete/awesomplete.js',
          'node_modules/mousetrap/mousetrap.js',
          'node_modules/socket.io-client/socket.io.js',
          'node_modules/browser-filesaver/FileSaver.js',
          'node_modules/markdown-it/dist/markdown-it.js',
          'ImprovedInitiative.Client/*.js'
        ],
        dest: 'public/js/ImprovedInitiative.js'
      },
      js_min: {
        src: [
          'node_modules/knockout/build/output/knockout-latest.js',
          'node_modules/knockout-mapping/dist/knockout.mapping.min.js',
          'node_modules/jquery/dist/jquery.min.js',
          'node_modules/awesomplete/awesomplete.min.js',
          'node_modules/mousetrap/mousetrap.min.js',
          'node_modules/socket.io-client/socket.io.min.js',
          'node_modules/browser-filesaver/FileSaver.min.js',
          'node_modules/markdown-it/dist/markdown-it.min.js',
          'client.min.js'
        ],
        dest: 'public/js/ImprovedInitiative.js'
      },
      css: {
        src: [
          'node_modules/awesomplete/awesomplete.css',
          'improved-initiative.less.css'
        ],
        dest: 'public/css/improved-initiative.css'
      }
    },
    watch: {
      ts: {
        files: '**/*.ts',
        tasks: ['ts', 'concat:js']
      },
      lesscss: {
        files: '**/*.less',
        tasks: ['less', 'concat:css']
      }
    },
    copy: {
      main: {
        files: [
          { expand: true, cwd: 'node_modules/font-awesome/fonts/', src: ['**'], dest: 'public/fonts/' }
        ]
      }
    }
  });

  grunt.registerTask('build_dev', ['ts:default', 'ts:server', 'less', 'concat:js', 'concat:css']);
  grunt.registerTask('build_min', ['ts:default', 'ts:server', 'uglify', 'less', 'concat:js_min', 'concat:css']);
  grunt.registerTask('default', ['build_dev', 'watch']);
  grunt.registerTask('postinstall', ['copy', 'build_min']);
};<|endoftext|>


<commit_before>/* jshint node:true */

var postcssProcessors = [
    require('autoprefixer')({
        browsers: ['last 2 versions','iOS 7']
    })
];

module.exports = function(grunt) {

    grunt.initConfig({

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

        // uglify js
        uglify: {
            js: {
                files: {
                    'dist/<%= pkg.name %>.min.js': [ 'src/lib/<%= pkg.name %>.js' ]
                }
            }
        },

        less: {
            development: {
                options: {
                    paths: ['']
                },
                files: [
                    {
                        src: ['src/lib/*.less', '!{fonts, variable, mixins}*.less'],
                        dest: 'dist/<%= pkg.name %>.css',
                    },
                    {
                        src: ['src/page/**.less', '!{fonts, variable, mixins}*.less'],
                        dest: 'page/page.css',
                    }
                ]
            }
        },

        // copy files
        copy: {
            lib: {
                expand: true,
                cwd: 'src/lib/',
                src: [
                    '*.js',
                    '*.css',
                    '*.less'
                ],
                dest: 'dist/'
            },
            page: {
                expand: true,
                cwd: 'src/page/',
                src: [
                    '*.js',
                    '*.css'
                ],
                dest: 'page/'
            },
            fontawesome: {
                expand: true,
                cwd: 'bower_components/fontawesome/',
                src: [
                    'css/font-awesome.min.css',
                    'fonts/*.*'
                ],
                dest: 'page/vendor/fontawesome/'
            },
            pure: {
                expand: true,
                cwd: 'bower_components/pure/',
                src: [
                    'pure-min.css',
                    'grids-responsive-min.css',
                ],
                dest: 'page/vendor/pure/'
            },
            vendors: {
                expand: true,
                cwd: 'src/page/',
                src: 'vendor/*.js',
                dest: 'page/'
            }
        },

        // jshint: specify your preferred options in 'globals'
        // http://jshint.com/docs/options/
        jshint: {
            files: ['Gruntfile.js', 'src/**/*.js', '!src/page/vendor/*.js'],
            options: {
                jshintrc: true
            }
        },

        // jasmine
        mochaTest: {
            test: {
                options: {
                    reporter: 'spec',
                },
                src: ['src/lib/**/test/**/*.js']
            }
        },

        // postcss
        postcss: {
            dist: {
                options: {
                    processors: postcssProcessors
                },
                src: 'dist/*.css'
            },
            page: {
                options: {
                    processors: postcssProcessors
                },
                src: 'page/*.css'
            }
        },

        // configure watch task
        watch: {
            files: ['<%= jshint.files %>', 'lib/*.less', 'page/**/*.less', '*.html'],
            tasks: [
                'jshint',
                'less',
                'postcss',
                'uglify',
                'copy',
                'postcss'
            ]
        },
    }); // end grunt.initConfig

    ////
    // grunt tasks
    ////

    // requirements
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-postcss');

    // custom tasks (mind the order of your tasks!), just comment out what you don't need
    grunt.registerTask(
        'default',
        'Compiles all of the assets and copies the files to the build directory.', [
            'jshint',
            'mochaTest',
            'less',
            'uglify',
            'copy',
            'postcss'
        ]
    );

}; // end module.exports
<commit_msg>fixed watch files<commit_after>/* jshint node:true */

var postcssProcessors = [
    require('autoprefixer')({
        browsers: ['last 2 versions','iOS 7']
    })
];

module.exports = function(grunt) {

    grunt.initConfig({

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

        // uglify js
        uglify: {
            js: {
                files: {
                    'dist/<%= pkg.name %>.min.js': [ 'src/lib/<%= pkg.name %>.js' ]
                }
            }
        },

        less: {
            development: {
                options: {
                    paths: ['']
                },
                files: [
                    {
                        src: ['src/lib/*.less', '!{fonts, variable, mixins}*.less'],
                        dest: 'dist/<%= pkg.name %>.css',
                    },
                    {
                        src: ['src/page/**.less', '!{fonts, variable, mixins}*.less'],
                        dest: 'page/page.css',
                    }
                ]
            }
        },

        // copy files
        copy: {
            lib: {
                expand: true,
                cwd: 'src/lib/',
                src: [
                    '*.js',
                    '*.css',
                    '*.less'
                ],
                dest: 'dist/'
            },
            page: {
                expand: true,
                cwd: 'src/page/',
                src: [
                    '*.js',
                    '*.css'
                ],
                dest: 'page/'
            },
            fontawesome: {
                expand: true,
                cwd: 'bower_components/fontawesome/',
                src: [
                    'css/font-awesome.min.css',
                    'fonts/*.*'
                ],
                dest: 'page/vendor/fontawesome/'
            },
            pure: {
                expand: true,
                cwd: 'bower_components/pure/',
                src: [
                    'pure-min.css',
                    'grids-responsive-min.css',
                ],
                dest: 'page/vendor/pure/'
            },
            vendors: {
                expand: true,
                cwd: 'src/page/',
                src: 'vendor/*.js',
                dest: 'page/'
            }
        },

        // jshint: specify your preferred options in 'globals'
        // http://jshint.com/docs/options/
        jshint: {
            files: ['Gruntfile.js', 'src/**/*.js', '!src/page/vendor/*.js'],
            options: {
                jshintrc: true
            }
        },

        // jasmine
        mochaTest: {
            test: {
                options: {
                    reporter: 'spec',
                },
                src: ['src/lib/**/test/**/*.js']
            }
        },

        // postcss
        postcss: {
            dist: {
                options: {
                    processors: postcssProcessors
                },
                src: 'dist/*.css'
            },
            page: {
                options: {
                    processors: postcssProcessors
                },
                src: 'page/*.css'
            }
        },

        // configure watch task
        watch: {
            files: ['<%= jshint.files %>', 'src/**/*.less', '*.html'],
            tasks: [
                'jshint',
                'less',
                'postcss',
                'uglify',
                'copy',
                'postcss'
            ]
        },
    }); // end grunt.initConfig

    ////
    // grunt tasks
    ////

    // requirements
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-postcss');

    // custom tasks (mind the order of your tasks!), just comment out what you don't need
    grunt.registerTask(
        'default',
        'Compiles all of the assets and copies the files to the build directory.', [
            'jshint',
            'mochaTest',
            'less',
            'uglify',
            'copy',
            'postcss'
        ]
    );

}; // end module.exports
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

  grunt.initConfig({
    jasmine: {
      all: {
        src: [
          'src/**/*.js',
        ],
        options: {
          'vendor': 'lib/**/*.js',
          'specs': 'spec/**/*.js'
        }
      }
    },
    watch: {
      files: ['src/**/*.js', 'spec/**/*.js'],
      tasks: ['jasmine:all']
    }
  });

  // Register tasks.
  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');

  // Default task.
  grunt.registerTask('default', 'watch');

};<commit_msg>add connect grunt task<commit_after>'use strict';

module.exports = function(grunt) {

  grunt.initConfig({
    jasmine: {
      all: {
        src: [
          'src/**/*.js',
        ],
        options: {
          'vendor': 'lib/**/*.js',
          'specs': 'spec/**/*.js'
        }
      }
    },
    watch: {
      files: ['src/**/*.js', 'spec/**/*.js'],
      tasks: ['jasmine:all']
    },
    connect: {
      server: {
        options: {
          port: 3000,
          base: '.'
        }
      }
    }
  });

  // Register tasks.
  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');

  // Default task.
  grunt.registerTask('default', ['connect', 'watch']);

};<|endoftext|>