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

  /**
   * read optional JSON from filepath
   * @param {String} filepath
   * @return {Object}
   */
  var readOptionalJSON = function (filepath) {
    var data = {};
    try {
      data = grunt.file.readJSON(filepath);
      // The concatenated file won't pass onevar
      // But our modules can
      delete data.onever;
    } catch (e) { }
    return data;
  };

  var customLaunchers = {
    /*
    'SL_IE8': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '8.0',
      platform: 'windows XP'
    },
    */
    'SL_IE9': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '9.0',
      platform: 'windows 7'
    },
    'SL_IE10': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '10.0',
      platform: 'windows 8'
    },
    'SL_IE11': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '11.0',
      platform: 'windows 8.1'
    },
    'SL_EDGE': {
      base: 'SauceLabs',
      browserName: 'microsoftedge',
      version: '20',
      platform: 'windows 10'
    },
    'SL_CHROME': {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '43',
      platform: 'windows 8'
    },
    'SL_FIREFOX': {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '38',
      platform: 'windows 8'
    },
    'SL_SAFARI': {
      base: 'SauceLabs',
      browserName: 'safari',
      version: '8.0',
      platform: 'OS X 10.10'
    }
  };

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

    // bulid source(grunt-build.js).
    build: {
      all: {
        baseUrl: 'src/js',        // base url
        startFile: 'intro.js',    // intro part
        endFile: 'outro.js',      // outro part
        outFile: 'dist/summernote.js' // out file
      }
    },

    // for javascript convention.
    jshint: {
      all: {
        src: [
          'src/**/*.js',
          'plugin/**/*.js',
          'lang/**/*.js',
          'Gruntfile.js',
          'test/**/*.js',
          '!test/coverage/**/*.js',
          'build/*.js'
        ],
        options: {
          jshintrc: true
        }
      },
      dist: {
        src: 'dist/summernote.js',
        options: readOptionalJSON('.jshintrc')
      }
    },

    jscs: {
      src: ['*.js', 'src/**/*.js', 'test/**/*.js', 'plugin/**/*.js'],
      gruntfile: 'Gruntfile.js',
      build: 'build'
    },

    // uglify: minify javascript
    uglify: {
      options: {
        banner: '/*! Summernote v<%=pkg.version%> | (c) 2013-2015 Alan Hong and other contributors | MIT license */\n'
      },
      all: {
        files: [
          { 'dist/summernote.min.js': ['dist/summernote.js'] },
          {
            expand: true,
            cwd: 'dist/lang',
            src: '**/*.js',
            dest: 'dist/lang',
            ext: '.min.js'
          },
          {
            expand: true,
            cwd: 'dist/plugin',
            src: '**/*.js',
            dest: 'dist/plugin',
            ext: '.min.js'
          }
        ]
      }
    },

    // recess: minify stylesheets
    recess: {
      dist: {
        options: { compile: true, compress: true },
        files: [
          {
            'dist/summernote.css': ['src/less/summernote.less']
          },
          {
            expand: true,
            cwd: 'dist/plugin',
            src: '**/*.css',
            dest: 'dist/plugin',
            ext: '.min.css'
          }
        ]
      }
    },

    // compress: summernote-{{version}}-dist.zip
    compress: {
      main: {
        options: {
          archive: function () {
            return 'dist/summernote-{{version}}-dist.zip'.replace(
              '{{version}}',
              grunt.config('pkg.version')
            );
          }
        },
        files: [{
          expand: true,
          src: [
            'dist/*.js',
            'dist/*.css',
            'dist/font/*'
          ]
        }, {
          src: ['plugin/**/*.js', 'plugin/**/*.css', 'lang/**/*.js'],
          dest: 'dist/'
        }]
      }
    },

    // connect configuration.
    connect: {
      all: {
        options: {
          port: 3000
        }
      }
    },

    // watch source code change
    watch: {
      all: {
        files: ['src/less/*.less', 'src/js/**/*.js', 'test/unit/**/*.js'],
        tasks: ['recess', 'lint'],
        options: {
          livereload: true
        }
      }
    },

    // Meteor commands to test and publish package
    exec: {
      'meteor-test': {
        command: 'meteor/runtests.sh'
      },
      'meteor-publish': {
        command: 'meteor/publish.sh'
      }
    },

    karma: {
      options: {
        configFile: './test/karma.conf.js'
      },
      all: {
        // Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS, IE
        browsers: ['PhantomJS'],
        reporters: ['progress']
      },
      dist: {
        singleRun: true,
        browsers: ['PhantomJS']
      },
      travis: {
        singleRun: true,
        browsers: ['PhantomJS'],
        reporters: ['progress', 'coverage']
      },
      saucelabs: {
        reporters: ['saucelabs'],
        sauceLabs: {
          testName: '[Travis] unit tests for summernote',
          startConnect: false,
          tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
          build: process.env.TRAVIS_BUILD_NUMBER,
          tags: [process.env.TRAVIS_BRANCH, process.env.TRAVIS_PULL_REQUEST]
        },
        captureTimeout: 120000,
        customLaunchers: customLaunchers,
        browsers: Object.keys(customLaunchers),
        singleRun: true
      }
    },

    coveralls: {
      options: {
        force: false
      },
      travis: {
        src: 'test/coverage/**/lcov.info'
      }
    },
    clean: {
      dist: ['dist/**/*']
    },
    copy: {
      dist: {
        files: [
          { src: 'lang/*', dest: 'dist/' },
          { src: 'plugin/**/*', dest: 'dist/' },
          { expand: true, cwd: 'src/icons/dist/font/', src: ['**', '!*.html'], dest: 'dist/font/' },
          { src: 'src/icons/dist/summernote.css', dest: 'src/icons/dist/summernote.less' }
        ]
      }
    },
    webfont: {
      icons: {
        src: 'src/icons/*.svg',
        dest: 'src/icons/dist/font',
        destCss: 'src/icons/dist/',
        options: {
          font: 'summernote',
          template: 'src/icons/templates/summernote.css'
        }
      }
    }
  });

  // load all tasks from the grunt plugins used in this file
  require('load-grunt-tasks')(grunt);

  // load all grunts/*.js
  grunt.loadTasks('grunts');

  // server: run server for development
  grunt.registerTask('server', ['connect', 'watch']);

  // lint
  grunt.registerTask('lint', ['jshint', 'jscs']);

  // test: unit test on test folder
  grunt.registerTask('test', ['lint', 'karma:all']);

  // test: unit test on travis
  grunt.registerTask('test-travis', ['lint', 'karma:travis']);

  // test: saucelabs test
  grunt.registerTask('saucelabs-test', ['karma:saucelabs']);

  // dist: make dist files
  grunt.registerTask('dist', [
    'clean:dist',
    'build', 'webfont', 'lint', 'karma:dist',
    'copy:dist', 'uglify', 'recess', 'compress'
  ]);

  // default: server
  grunt.registerTask('default', ['server']);

  // Meteor tasks
  grunt.registerTask('meteor-test', 'exec:meteor-test');
  grunt.registerTask('meteor-publish', 'exec:meteor-publish');
  grunt.registerTask('meteor', ['meteor-test', 'meteor-publish']);
};
<commit_msg>replace edge with ie13 and ie14<commit_after>module.exports = function (grunt) {
  'use strict';

  /**
   * read optional JSON from filepath
   * @param {String} filepath
   * @return {Object}
   */
  var readOptionalJSON = function (filepath) {
    var data = {};
    try {
      data = grunt.file.readJSON(filepath);
      // The concatenated file won't pass onevar
      // But our modules can
      delete data.onever;
    } catch (e) { }
    return data;
  };

  var customLaunchers = {
    /*
    'SL_IE8': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '8.0',
      platform: 'windows XP'
    },
    */
    'SL_IE9': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '9.0',
      platform: 'windows 7'
    },
    'SL_IE10': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '10.0',
      platform: 'windows 8'
    },
    'SL_IE11': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '11.0',
      platform: 'windows 8.1'
    },
    'SL_IE13': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '13',
      platform: 'windows 10'
    },
    'SL_IE14': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '14',
      platform: 'windows 10'
    },
    'SL_CHROME': {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: '43',
      platform: 'windows 8'
    },
    'SL_FIREFOX': {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: '38',
      platform: 'windows 8'
    },
    'SL_SAFARI': {
      base: 'SauceLabs',
      browserName: 'safari',
      version: '8.0',
      platform: 'OS X 10.10'
    }
  };

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

    // bulid source(grunt-build.js).
    build: {
      all: {
        baseUrl: 'src/js',        // base url
        startFile: 'intro.js',    // intro part
        endFile: 'outro.js',      // outro part
        outFile: 'dist/summernote.js' // out file
      }
    },

    // for javascript convention.
    jshint: {
      all: {
        src: [
          'src/**/*.js',
          'plugin/**/*.js',
          'lang/**/*.js',
          'Gruntfile.js',
          'test/**/*.js',
          '!test/coverage/**/*.js',
          'build/*.js'
        ],
        options: {
          jshintrc: true
        }
      },
      dist: {
        src: 'dist/summernote.js',
        options: readOptionalJSON('.jshintrc')
      }
    },

    jscs: {
      src: ['*.js', 'src/**/*.js', 'test/**/*.js', 'plugin/**/*.js'],
      gruntfile: 'Gruntfile.js',
      build: 'build'
    },

    // uglify: minify javascript
    uglify: {
      options: {
        banner: '/*! Summernote v<%=pkg.version%> | (c) 2013-2015 Alan Hong and other contributors | MIT license */\n'
      },
      all: {
        files: [
          { 'dist/summernote.min.js': ['dist/summernote.js'] },
          {
            expand: true,
            cwd: 'dist/lang',
            src: '**/*.js',
            dest: 'dist/lang',
            ext: '.min.js'
          },
          {
            expand: true,
            cwd: 'dist/plugin',
            src: '**/*.js',
            dest: 'dist/plugin',
            ext: '.min.js'
          }
        ]
      }
    },

    // recess: minify stylesheets
    recess: {
      dist: {
        options: { compile: true, compress: true },
        files: [
          {
            'dist/summernote.css': ['src/less/summernote.less']
          },
          {
            expand: true,
            cwd: 'dist/plugin',
            src: '**/*.css',
            dest: 'dist/plugin',
            ext: '.min.css'
          }
        ]
      }
    },

    // compress: summernote-{{version}}-dist.zip
    compress: {
      main: {
        options: {
          archive: function () {
            return 'dist/summernote-{{version}}-dist.zip'.replace(
              '{{version}}',
              grunt.config('pkg.version')
            );
          }
        },
        files: [{
          expand: true,
          src: [
            'dist/*.js',
            'dist/*.css',
            'dist/font/*'
          ]
        }, {
          src: ['plugin/**/*.js', 'plugin/**/*.css', 'lang/**/*.js'],
          dest: 'dist/'
        }]
      }
    },

    // connect configuration.
    connect: {
      all: {
        options: {
          port: 3000
        }
      }
    },

    // watch source code change
    watch: {
      all: {
        files: ['src/less/*.less', 'src/js/**/*.js', 'test/unit/**/*.js'],
        tasks: ['recess', 'lint'],
        options: {
          livereload: true
        }
      }
    },

    // Meteor commands to test and publish package
    exec: {
      'meteor-test': {
        command: 'meteor/runtests.sh'
      },
      'meteor-publish': {
        command: 'meteor/publish.sh'
      }
    },

    karma: {
      options: {
        configFile: './test/karma.conf.js'
      },
      all: {
        // Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS, IE
        browsers: ['PhantomJS'],
        reporters: ['progress']
      },
      dist: {
        singleRun: true,
        browsers: ['PhantomJS']
      },
      travis: {
        singleRun: true,
        browsers: ['PhantomJS'],
        reporters: ['progress', 'coverage']
      },
      saucelabs: {
        reporters: ['saucelabs'],
        sauceLabs: {
          testName: '[Travis] unit tests for summernote',
          startConnect: false,
          tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
          build: process.env.TRAVIS_BUILD_NUMBER,
          tags: [process.env.TRAVIS_BRANCH, process.env.TRAVIS_PULL_REQUEST]
        },
        captureTimeout: 120000,
        customLaunchers: customLaunchers,
        browsers: Object.keys(customLaunchers),
        singleRun: true
      }
    },

    coveralls: {
      options: {
        force: false
      },
      travis: {
        src: 'test/coverage/**/lcov.info'
      }
    },
    clean: {
      dist: ['dist/**/*']
    },
    copy: {
      dist: {
        files: [
          { src: 'lang/*', dest: 'dist/' },
          { src: 'plugin/**/*', dest: 'dist/' },
          { expand: true, cwd: 'src/icons/dist/font/', src: ['**', '!*.html'], dest: 'dist/font/' },
          { src: 'src/icons/dist/summernote.css', dest: 'src/icons/dist/summernote.less' }
        ]
      }
    },
    webfont: {
      icons: {
        src: 'src/icons/*.svg',
        dest: 'src/icons/dist/font',
        destCss: 'src/icons/dist/',
        options: {
          font: 'summernote',
          template: 'src/icons/templates/summernote.css'
        }
      }
    }
  });

  // load all tasks from the grunt plugins used in this file
  require('load-grunt-tasks')(grunt);

  // load all grunts/*.js
  grunt.loadTasks('grunts');

  // server: run server for development
  grunt.registerTask('server', ['connect', 'watch']);

  // lint
  grunt.registerTask('lint', ['jshint', 'jscs']);

  // test: unit test on test folder
  grunt.registerTask('test', ['lint', 'karma:all']);

  // test: unit test on travis
  grunt.registerTask('test-travis', ['lint', 'karma:travis']);

  // test: saucelabs test
  grunt.registerTask('saucelabs-test', ['karma:saucelabs']);

  // dist: make dist files
  grunt.registerTask('dist', [
    'clean:dist',
    'build', 'webfont', 'lint', 'karma:dist',
    'copy:dist', 'uglify', 'recess', 'compress'
  ]);

  // default: server
  grunt.registerTask('default', ['server']);

  // Meteor tasks
  grunt.registerTask('meteor-test', 'exec:meteor-test');
  grunt.registerTask('meteor-publish', 'exec:meteor-publish');
  grunt.registerTask('meteor', ['meteor-test', 'meteor-publish']);
};
<|endoftext|>


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

		jshint: {
			all: [
				'Gruntfile.js',
				'tasks/**/*.js',
				'tests/**/*.js'
			],
			options: {
				'boss': true,
				'curly': true,
				'eqeqeq': true,
				'eqnull': true,
				'expr': true,
				'globals': {
					'module': true,
					'require': true,
					'exports': true,
					'__dirname': true,
					'window': true
				},
				'immed': true,
				'noarg': true,
				'onevar': true,
				'quotmark': 'single',
				'smarttabs': true,
				'trailing': true,
				'undef': true,
				'unused': true
			}
		},

		nodeunit: {
			all: ['tests/test_*.js']
		},

		lintspaces: {
			newline_okay: {
				src: ['tests/files/newline_okay.txt'],
				options: {
					newline: true
				}
			},
			newline_missing: {
				src: ['tests/files/newline_missing.txt'],
				options: {
					newline: true
				}
			},
			newlines_toomuch: {
				src: ['tests/files/newline_toomuch.txt'],
				options: {
					newline: true
				}
			},
			trailingspaces: {
				src: ['tests/files/trailingspaces.txt'],
				options: {
					trailingspaces: true
				}
			},
			indentation_tabs: {
				src: ['tests/files/indentation_tabs.txt'],
				options: {
					indentation: 'tabs'
				}
			},
			indentation_spaces: {
				src: ['tests/files/indentation_spaces.txt'],
				options: {
					indentation: 'spaces'
				}
			},
			indentation_spaces_3: {
				src: ['tests/files/indentation_spaces.txt'],
				options: {
					indentation: 'spaces',
					spaces: 3
				}
			},
			comments_pattern: {
				src: ['tests/files/comments/comments.js'],
				options: {
					indentation: 'tabs',
					ignores: [
						/'''[\s\S]*?'''/g, //Python
						/\/\*[\s\S]*?\*\//g //C, JavaScript, Java, AS3 etc.
					]
				}
			},
			comments_buildin_js: {
				src: ['tests/files/comments/comments.js'],
				options: {
					indentation: 'tabs',
					ignores: ['js-comments']
				}
			},
			comments_buildin_py: {
				src: ['tests/files/comments/comments.py'],
				options: {
					indentation: 'spaces',
					spaces: 4,
					ignores: ['python-comments']
				}
			},
			comments_buildin_xml: {
				src: ['tests/files/comments/comments.xml'],
				options: {
					indentation: 'tabs',
					ignores: ['xml-comments']
				}
			},
			directory: {
				src: ['tests/files'],
				options: {
					indentation: 'tabs'
				}
			}
		}
	});

	// load tasks
	grunt.loadTasks('tasks');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-nodeunit');

	// define tasks
	grunt.registerTask('test', [
		'nodeunit'
	]);

	grunt.registerTask('validate', [
		'jshint'
	]);

	grunt.registerTask('default', [
		'validate',
		'test'
	]);
};
<commit_msg>Add selftest to validation task<commit_after>module.exports = function(grunt) {
	// project configuration
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),

		jshint: {
			all: [
				'Gruntfile.js',
				'tasks/**/*.js',
				'tests/**/*.js'
			],
			options: {
				'boss': true,
				'curly': true,
				'eqeqeq': true,
				'eqnull': true,
				'expr': true,
				'globals': {
					'module': true,
					'require': true,
					'exports': true,
					'__dirname': true,
					'window': true
				},
				'immed': true,
				'noarg': true,
				'onevar': true,
				'quotmark': 'single',
				'smarttabs': true,
				'trailing': true,
				'undef': true,
				'unused': true
			}
		},

		nodeunit: {
			all: ['tests/test_*.js']
		},

		lintspaces: {
			self: {
				src: [
					'Gruntfile.js',
					'tasks/**/*.js'
				],
				options: {
					newline: true,
					trailingspaces: true,
					indentation: 'tabs'
				}
			},
			newline_okay: {
				src: ['tests/files/newline_okay.txt'],
				options: {
					newline: true
				}
			},
			newline_missing: {
				src: ['tests/files/newline_missing.txt'],
				options: {
					newline: true
				}
			},
			newlines_toomuch: {
				src: ['tests/files/newline_toomuch.txt'],
				options: {
					newline: true
				}
			},
			trailingspaces: {
				src: ['tests/files/trailingspaces.txt'],
				options: {
					trailingspaces: true
				}
			},
			indentation_tabs: {
				src: ['tests/files/indentation_tabs.txt'],
				options: {
					indentation: 'tabs'
				}
			},
			indentation_spaces: {
				src: ['tests/files/indentation_spaces.txt'],
				options: {
					indentation: 'spaces'
				}
			},
			indentation_spaces_3: {
				src: ['tests/files/indentation_spaces.txt'],
				options: {
					indentation: 'spaces',
					spaces: 3
				}
			},
			comments_pattern: {
				src: ['tests/files/comments/comments.js'],
				options: {
					indentation: 'tabs',
					ignores: [
						/'''[\s\S]*?'''/g, //Python
						/\/\*[\s\S]*?\*\//g //C, JavaScript, Java, AS3 etc.
					]
				}
			},
			comments_buildin_js: {
				src: ['tests/files/comments/comments.js'],
				options: {
					indentation: 'tabs',
					ignores: ['js-comments']
				}
			},
			comments_buildin_py: {
				src: ['tests/files/comments/comments.py'],
				options: {
					indentation: 'spaces',
					spaces: 4,
					ignores: ['python-comments']
				}
			},
			comments_buildin_xml: {
				src: ['tests/files/comments/comments.xml'],
				options: {
					indentation: 'tabs',
					ignores: ['xml-comments']
				}
			},
			directory: {
				src: ['tests/files'],
				options: {
					indentation: 'tabs'
				}
			}
		}
	});

	// load tasks
	grunt.loadTasks('tasks');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-nodeunit');

	// define tasks
	grunt.registerTask('test', [
		'nodeunit'
	]);

	grunt.registerTask('validate', [
		'jshint',
		'lintspaces:self'
	]);

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


<commit_before>/*
 * class
 * https://github.com/crossjs/class
 *
 * Copyright (c) 2014 crossjs
 * Licensed under the MIT license.
 */

module.exports = function(grunt) {

  'use strict';

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

  grunt.initConfig({

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

    jshint: {
      files: ['src/*.js'],
      options: {
        jshintrc: true
      }
    },

    qunit: {
      options: {
        '--web-security': 'no',
        coverage: {
          src: ['src/*.js'],
          instrumentedFiles: 'temp/',
          lcovReport: 'report/',
          linesThresholdPct: 85
        }
      },
      all: ['test/*.html']
    },

    coveralls: {
      options: {
        force: true
      },
      all: {
        src: 'report/*.info'
      }
    },

    yuidoc: {
      compile: {
        name: '<%= pkg.name %>',
        description: '<%= pkg.description %>',
        version: '<%= pkg.version %>',
        options: {
          paths: 'src',
          outdir: 'doc',
          themedir: 'vendor/yuidoc-bootstrap'
        }
      }
    },

    clean: {
      pages: {
        files: {
          src: ['gh-pages/**/*', '!gh-pages/.git*']
        }
      },
      doc: {
        files: {
          src: ['doc/**']
        }
      },
      dist: {
        files: {
          src: ['dist/**/*']
        }
      },
      build: {
        files: {
          src: ['.build/**']
        }
      }
    },

    copy: {
      doc: {
        files: [{
          expand: true,
          cwd: 'doc/',
          src: ['**'],
          dest: 'gh-pages/'
        }]
      },
      sea: {
        files: [{
          expand: true,
          cwd: 'dist/',
          src: ['**'],
          dest: 'sea-modules/<%= pkg.family %>/<%= pkg.name %>/<%= pkg.version %>/'
        }]
      }
    },

    transport: {
      options: {
        debug: true,
        idleading: '<%= pkg.family %>/<%= pkg.name %>/<%= pkg.version %>/',
        alias: '<%= pkg.spm.alias %>'
      },
      dist: {
        files: [{
          expand: true,
          cwd: 'src/',
          src: ['*.js'],
          dest: '.build/'
        }]
      }
    },

    concat: {
      options: {
        debug: true,
        include: 'relative'
      },
      src: {
        files: [{
          expand: true,
          cwd: '.build/',
          src: ['*.js'],
          dest: 'dist/'
        }]
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %>-<%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %> */\n',
        beautify: {
          'ascii_only': true
        },
        // mangle: true,
        compress: {
          'global_defs': {
            'DEBUG': false
          },
          'dead_code': true
        }
      },
      dist: {
        files: [{
          expand: true,
          cwd: 'dist/',
          src: ['*.js', '!*-debug.js'],
          dest: 'dist/'
        }]
      }
    }

  });

  grunt.registerTask('build', ['clean:dist', 'transport', 'concat', 'clean:build', 'uglify']);

  grunt.registerTask('demo', ['copy:sea']);

  grunt.registerTask('doc', ['yuidoc', 'clean:pages', 'copy:doc', 'clean:doc']);

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

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

};
<commit_msg>更新 Grunt 脚本<commit_after>/*
 * class
 * https://github.com/crossjs/class
 *
 * Copyright (c) 2014 crossjs
 * Licensed under the MIT license.
 */

module.exports = function(grunt) {

  'use strict';

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

  grunt.initConfig({

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

    idleading: '<%= pkg.family %>/<%= pkg.name %>/<%= pkg.version %>/',

    sea: 'sea-modules/<%= idleading %>',

    jshint: {
      files: ['src/*.js'],
      options: {
        jshintrc: true
      }
    },

    qunit: {
      options: {
        '--web-security': 'no',
        coverage: {
          src: ['src/*.js'],
          instrumentedFiles: 'temp/',
          lcovReport: 'report/',
          linesThresholdPct: 85
        }
      },
      all: ['test/*.html']
    },

    coveralls: {
      options: {
        force: true
      },
      all: {
        src: 'report/*.info'
      }
    },

    yuidoc: {
      compile: {
        name: '<%= pkg.name %>',
        description: '<%= pkg.description %>',
        version: '<%= pkg.version %>',
        options: {
          paths: 'src',
          outdir: 'doc',
          themedir: 'vendor/yuidoc-bootstrap'
        }
      }
    },

    clean: {
      pages: {
        files: {
          src: ['gh-pages/**/*', '!gh-pages/.git*']
        }
      },
      doc: {
        files: {
          src: ['doc/**']
        }
      },
      dist: {
        files: {
          src: ['dist/**/*']
        }
      },
      build: {
        files: {
          src: ['.build/**']
        }
      },
      sea: {
        files: {
          src: ['<%= sea %>**']
        }
      }
    },

    copy: {
      doc: {
        files: [{
          expand: true,
          cwd: 'doc/',
          src: ['**'],
          dest: 'gh-pages/'
        }]
      },
      sea: {
        files: [{
          expand: true,
          cwd: 'dist/',
          src: ['**'],
          dest: '<%= sea %>'
        }]
      }
    },

    transport: {
      options: {
        debug: true,
        idleading: '<%= idleading %>',
        alias: '<%= pkg.spm.alias %>'
      },
      dist: {
        files: [{
          expand: true,
          cwd: 'src/',
          src: ['*.js'],
          dest: '.build/'
        }]
      }
    },

    concat: {
      options: {
        debug: true,
        include: 'relative'
      },
      src: {
        files: [{
          expand: true,
          cwd: '.build/',
          src: ['*.js'],
          dest: 'dist/'
        }]
      }
    },

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %>-<%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %> */\n',
        beautify: {
          'ascii_only': true
        },
        // mangle: true,
        compress: {
          'global_defs': {
            'DEBUG': false
          },
          'dead_code': true
        }
      },
      dist: {
        files: [{
          expand: true,
          cwd: 'dist/',
          src: ['*.js', '!*-debug.js'],
          dest: 'dist/'
        }]
      }
    }

  });

  grunt.registerTask('build', ['clean:dist', 'transport', 'concat', 'clean:build', 'uglify']);

  grunt.registerTask('demo', ['copy:sea']);

  grunt.registerTask('doc', ['yuidoc', 'clean:pages', 'copy:doc', 'clean:doc']);

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

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

};
<|endoftext|>


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

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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            options: {
                reporter: require('jshint-stylish'),
                curly: true,
                eqeqeq: true,
                eqnull: true,
                browser: false,
                globals: {
                    // Node
                    "require"   : false,
                    "module"    : false,
                    "process"   : false,
                    // Mocha
                    "describe"  : false,
                    "it"        : false,
                    "before"    : false,
                    "beforeEach": false,
                    "after"     : false,
                    "afterEach" : false
                },
                ignores: [
                    'node_modules'
                ]
            },
            all: [
                'app.js',
                '{adapter,cli,config,controllers,helpers,models,services,test,validator}/**/*.js'
            ]
        },
        watch: {
            default: {
                files: ['**/*.js'],
                tasks: ['jshint']
            }
        }
    });

    // Default task(s).
    grunt.registerTask('default', ['jshint']);
    grunt.registerTask('dev', ['jshint', 'watch']);
};<commit_msg>chore(grunt): Remove folders from grunt watch's list<commit_after>module.exports = function(grunt) {

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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            options: {
                reporter: require('jshint-stylish'),
                curly: true,
                eqeqeq: true,
                eqnull: true,
                browser: false,
                globals: {
                    // Node
                    "require"   : false,
                    "module"    : false,
                    "process"   : false,
                    // Mocha
                    "describe"  : false,
                    "it"        : false,
                    "before"    : false,
                    "beforeEach": false,
                    "after"     : false,
                    "afterEach" : false
                },
                ignores: [
                    'node_modules'
                ]
            },
            all: [
                'app.js',
                '{cli,config,controllers,helpers,models,services,test,validator}/**/*.js'
            ]
        },
        watch: {
            default: {
                files: ['**/*.js', '!**/node_modules/**'],
                tasks: ['jshint']
            }
        }
    });

    // Default task(s).
    grunt.registerTask('default', ['jshint']);
    grunt.registerTask('dev', ['jshint', 'watch']);
};<|endoftext|>


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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/* <%= pkg.description %>, v<%= pkg.version %> <%= pkg.homepage %>\n' +
                'Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, <%= pkg.license.type %> license ' +
                '<%= pkg.license.url %>*/\n'
        },
        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                forin: true,
                indent: 2,
                latedef: false,
                newcap: true,
                noarg: true,
                noempty: true,
                white: false,
                sub: true,
                undef: true,
                unused: true,
                loopfunc: true,
                expr: true,
                evil: true,
                eqnull: true
            }
        },
        shell: {
            composer: {
                command: 'php composer.phar update',
                stdout: true,
                stderr: true
            },
            bower: {
                command: 'bower install',
                stdout: true,
                stderr: true
            }
        },
        concat: {
            options: {
                separator: '\n'
            },
            dist: {
                src: [
                    './bower_components/jquery-ui/ui/minified/jquery.ui.core.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.widget.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.mouse.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.position.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.draggable.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.droppable.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.selectable.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.autocomplete.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.datepicker.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.menu.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.progressbar.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.slider.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.tooltip.min.js'
                ],
                dest: 'bower_components/jquery-ui/jquery.ui.custom.min.js'
            }
        },
        copy: {
            bower: {
                files: [
                    {src: [
                        './bower_components/bootstrap/dist/js/bootstrap.min.js',
                        './bower_components/bootstrap/dist/css/bootstrap.css'
                    ], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/d3/d3.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/lodash/dist/lodash.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/highcharts.com/js/highcharts.src.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/jquery/jquery.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: [
                        './bower_components/jquery-ui/themes/smoothness/*.min.css',
                        './bower_components/jquery-ui/themes/smoothness/*.theme.css'
                    ], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/jquery-ui/jquery.ui.custom.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/jquery.tablesorter/js/jquery.tablesorter.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/bootstrap/dist/fonts/*'], dest: './public/fonts/', filter: 'isFile', expand: true, flatten: true}
                ]
            }
        }
    });

    // load tasks
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-shell');

    // Default task(s).
    grunt.registerTask('default', ['shell', 'concat', 'copy']);
};
<commit_msg>do bower update instead of install<commit_after>module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/* <%= pkg.description %>, v<%= pkg.version %> <%= pkg.homepage %>\n' +
                'Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, <%= pkg.license.type %> license ' +
                '<%= pkg.license.url %>*/\n'
        },
        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                forin: true,
                indent: 2,
                latedef: false,
                newcap: true,
                noarg: true,
                noempty: true,
                white: false,
                sub: true,
                undef: true,
                unused: true,
                loopfunc: true,
                expr: true,
                evil: true,
                eqnull: true
            }
        },
        shell: {
            composer: {
                command: 'php composer.phar update',
                stdout: true,
                stderr: true
            },
            bower: {
                command: 'bower update',
                stdout: true,
                stderr: true
            }
        },
        concat: {
            options: {
                separator: '\n'
            },
            dist: {
                src: [
                    './bower_components/jquery-ui/ui/minified/jquery.ui.core.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.widget.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.mouse.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.position.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.draggable.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.droppable.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.selectable.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.autocomplete.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.datepicker.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.menu.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.progressbar.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.slider.min.js',
                    './bower_components/jquery-ui/ui/minified/jquery.ui.tooltip.min.js'
                ],
                dest: 'bower_components/jquery-ui/jquery.ui.custom.min.js'
            }
        },
        copy: {
            bower: {
                files: [
                    {src: [
                        './bower_components/bootstrap/dist/js/bootstrap.min.js',
                        './bower_components/bootstrap/dist/css/bootstrap.css'
                    ], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/d3/d3.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/lodash/dist/lodash.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/highcharts.com/js/highcharts.src.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/jquery/jquery.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: [
                        './bower_components/jquery-ui/themes/smoothness/*.min.css',
                        './bower_components/jquery-ui/themes/smoothness/*.theme.css'
                    ], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/jquery-ui/jquery.ui.custom.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/jquery.tablesorter/js/jquery.tablesorter.min.js'], dest: './public/vendor/', filter: 'isFile', expand: true, flatten: true},
                    {src: ['./bower_components/bootstrap/dist/fonts/*'], dest: './public/fonts/', filter: 'isFile', expand: true, flatten: true}
                ]
            }
        }
    });

    // load tasks
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-shell');

    // Default task(s).
    grunt.registerTask('default', ['shell', 'concat', 'copy']);
};
<|endoftext|>


<commit_before>var sourceFiles = [
    'src/Utils.js',
    'src/RandomColor.js',
    'src/Plugin.js',
];

module.exports = function(grunt) {

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

        buildDir: 'build',
        bundleName: '<%= pkg.name %>',

        uglify: {
            options: {
                banner: [
                    '/**',
                    ' * Package:    <%= pkg.name %>',
                    ' * Build:      <%= grunt.template.today("yyyy-mm-dd") %>',
                    ' * Version:    <%= pkg.version %>',
                    ' */\n'
                ].join('\n'),
                enclose: { 'window.jQuery': '$' }
            },
            js: {
                options: {
                    mangle: false,
                    beautify: true,
                    compress: false
                },
                src: sourceFiles,
                dest: '<%= buildDir %>/<%= bundleName %>.js'
            },
            jsmin: {
                options: {
                    mangle: {
                        except: ['jQuery', '$']
                    },
                    compress: true
                },
                src: sourceFiles,
                dest: '<%= buildDir %>/<%= bundleName %>.min.js'
            }
        }
    });

    // Load the plugin that provides the "uglify" task.
    grunt.loadNpmTasks('grunt-contrib-uglify');

    // Default task(s).
    grunt.registerTask('default', []);
    grunt.registerTask('dist', ['uglify']);
};
<commit_msg>Add the new entities to the Gruntfile<commit_after>var sourceFiles = [
    'src/Utils.js',
    'src/RandomColor.js',
    'src/AreaCoordinates.js',
    'src/DrawingFrame.js',
    'src/Plugin.js',
];

module.exports = function(grunt) {

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

        buildDir: 'build',
        bundleName: '<%= pkg.name %>',

        uglify: {
            options: {
                banner: [
                    '/**',
                    ' * Package:    <%= pkg.name %>',
                    ' * Build:      <%= grunt.template.today("yyyy-mm-dd") %>',
                    ' * Version:    <%= pkg.version %>',
                    ' */\n'
                ].join('\n'),
                enclose: { 'window.jQuery': '$' }
            },
            js: {
                options: {
                    mangle: false,
                    beautify: true,
                    compress: false
                },
                src: sourceFiles,
                dest: '<%= buildDir %>/<%= bundleName %>.js'
            },
            jsmin: {
                options: {
                    mangle: {
                        except: ['jQuery', '$']
                    },
                    compress: true
                },
                src: sourceFiles,
                dest: '<%= buildDir %>/<%= bundleName %>.min.js'
            }
        }
    });

    // Load the plugin that provides the "uglify" task.
    grunt.loadNpmTasks('grunt-contrib-uglify');

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


<commit_before>"use strict";

module.exports = function (grunt) {
    grunt.initConfig({
        eslint: {
            src: ["./src/**/*.js", "./tests/**/*.js", "./*.js"]
        },
        jshint: {
            src: ["./src/**/*.js", "./tests/**/*.js", "./*.js"],
            buildScripts: ["Gruntfile.js"],
            options: {
                jshintrc: true
            }
        },
        jsonlint: {
            src: ["src/**/*.json", "tests/**/*.json", "./*.json"]
        }
    });

    grunt.loadNpmTasks("grunt-jsonlint");
    grunt.loadNpmTasks("grunt-shell");

    // grunt.loadNpmTasks("gruntify-eslint");
    grunt.loadNpmTasks("grunt-eslint");

    grunt.registerTask("lint", "Apply jshint and jsonlint", ["eslint", "jsonlint"]);
};
<commit_msg>GPII-1829: Removed unused Grunt configuration options.<commit_after>"use strict";

module.exports = function (grunt) {
    grunt.initConfig({
        eslint: {
            src: ["./src/**/*.js", "./tests/**/*.js", "./*.js"]
        },
        jsonlint: {
            src: ["src/**/*.json", "tests/**/*.json", "./*.json"]
        }
    });

    grunt.loadNpmTasks("grunt-jsonlint");

    grunt.loadNpmTasks("grunt-eslint");

    grunt.registerTask("lint", "Apply jshint and jsonlint", ["eslint", "jsonlint"]);
};
<|endoftext|>


<commit_before>#!/usr/bin/env node
/*!
 * -----------
 * SCGDB®-Data
 * -----------
 * Data of SCGDB — A manually curated dedicated schizosaccharomyces comparative genome database.
 * ______________________________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * ______________________________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ______________________________________________________________________________________________
 *
 * @date      : 18-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * ______________________________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "SCGDB®-Data".
 * ______________________________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";

// To load required Node module.
// -----------------------------
var os         = require('os');
var fs         = require('fs');

// To load required NPM modules.
// -----------------------------
var chalk      = require('chalk');
<commit_msg>Initial commit<commit_after>#!/usr/bin/env node
/*!
 * -----------
 * SCGDB®-Data
 * -----------
 * Data of SCGDB — A manually curated dedicated schizosaccharomyces comparative genome database.
 * ______________________________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * ______________________________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ______________________________________________________________________________________________
 *
 * @date      : 18-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * ______________________________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "SCGDB®-Data".
 * ______________________________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";

// To load required Node module.
// -----------------------------
var os         = require('os');
var fs         = require('fs');

// To load required NPM modules.
// -----------------------------
var chalk      = require('chalk');
var glob       = require('glob');
<|endoftext|>


<commit_before>'use strict';

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

    jshint: {
      all: ['Gruntfile.js', 'lib/**/*.js'],
      options: grunt.file.readJSON('.jshint')
    },

    shell: {
      build: {
        command: [
          'component',
          'build',
          '-o browser',
          '-n dyslexer'
        ].join(' '),
        options: { stdout: true, stderr: true }
      }
    },
    watch: {
      files: ['spec/*.js', 'lib/**/*.js'],
      tasks: ['test']
    },
    mocha_phantomjs: {
      all: ['spec/runner.html']
    }
  });
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-mocha-phantomjs');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.registerTask('build', ['jshint', 'shell:build']);
  grunt.registerTask('test', ['build', 'mocha_phantomjs']);
  grunt.registerTask('default', ['build']);
};
<commit_msg>update<commit_after>'use strict';

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

    jshint: {
      all: ['Gruntfile.js', 'lib/**/*.js'],
      options: grunt.file.readJSON('.jshint')
    },

    shell: {
      build: {
        command: [
          'component',
          'build',
          '-o browser',
          '-n dyslexer'
        ].join(' '),
        options: { stdout: true, stderr: true }
      }
    },
    watch: {
      files: ['spec/*.js', 'lib/**/*.js'],
      tasks: ['test']
    },
    mocha_phantomjs: {
      all: ['spec/runner.html']
    }
  });
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-mocha-phantomjs');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.registerTask('build', ['jshint', 'shell:build']);
  grunt.registerTask('test', ['build', 'mocha_phantomjs']);
  grunt.registerTask('default', ['build']);
};
<|endoftext|>


<commit_before>var files = require('./files').files,
	path = require("path"),
	spawn = require('child_process').spawn;

module.exports = function(grunt) {
	grunt.initConfig({
				pkg : grunt.file.readJSON('package.json'),
				bower : {
					install : {
						options : {
							targetDir : "bower_modules",
							cleanup : true,
							layout : function(type, component) {
								var renamedType = type;
								if (type == 'js')
									renamedType = 'javascripts';
								else if (type == 'css')
									renamedType = 'stylesheets';

								return path.join(component, renamedType);
							}
						}
					}
				},
				jison : {
					l : {
						options: { moduleType: 'js' },
						files: {'src/compiler/lparser.js' : 'src/compiler/lgrammar.jison'}
					}
				},
				build : {
					l2js : {
						dest : "dist/l2js-v<%= pkg.version %>.js",
						src : wrap(files.src, "build")

					}
				},
				tests : {
					unit : 'karma.config.js',
				},
				uglify : {
					l2js : {
						files : {
							"dist/l2js-v<%= pkg.version %>.min.js" : [ "dist/l2js-v<%= pkg.version %>.js" ]
						},
						options : {
							preserveComments : false,
							sourceMap : "dist/l2js-v<%= pkg.version %>.min.map",
							sourceMappingURL : "dist/l2js-v<%= pkg.version %>.min.map",
							report : "min",
							beautify : {
								ascii_only : true
							},
							banner : "/*! L2JS v<%= pkg.version %> | "
									+ "Copyright 2014, 2014 Tomáš Konrády (tomas.konrady@uhk.cz). | "
									+ "MIT licence */",
							compress : {
								hoist_funs : false,
								loops : false,
								unused : false
							}
						}
					}
				},

				clean : {
					build : [ 'dist' ]
				},

				compress : {
					build : {
						options : {
							archive : 'dist/l2js-v<%= pkg.version %>.zip',
							mode : 'zip'
						},
						src : [ '**' ],
						cwd : 'dist',
						expand : true,
						dot : true,
						dest : 'l2js-v<%= pkg.version %>/'
					}
				},
			});

	function _toUpperFirstLetter(string) {
	    return string.charAt(0).toUpperCase() + string.slice(1);
	}

	function build(config, success) {
		var files = grunt.file.expand(config.src);

		// concat
		var src = files.map(function(filepath) {
			return processFile(grunt.file.read(filepath));
		}).join(grunt.util.normalizelf('\n'));

		// process
		var processed = processSource(src, grunt.config("pkg").version);

		// write
		grunt.file.write(config.dest, processed);
		grunt.log.ok('File ' + config.dest + ' created.');

		success();
	}

	/**
	 * Process contacted source. Fills metadata in the banner and removes
	 * multiple used 'use strict' expression.
	 *
	 * @param src
	 *            Contacted source
	 * @param version
	 *            Version of source
	 */
	function processSource(src, version) {
		// Fills in metadata to header of code
		var processed = src.replace(/@VERSION/, version).replace(/@DATE/,
				new Date().toISOString());

		processed = singleStrict(processed, '\n\n');
		return processed;
	}

	/**
	 * Removes closure declarations
	 *
	 * @param src
	 *            Source of single file
	 */
	function processFile(src) {
		var closureRegexStart = /window\.l2js.*\(l2js\)\s*\{/;
		var closureRegexEnd = /\}\(window.l2js\);\s*$/;

		var processed = src.replace(closureRegexStart, "\n")
				.replace(closureRegexEnd, "\n");
		return processed;
	}

	/**
	 * Adds prefix a suffix to the array files.
	 *
	 * @param name
	 *            Name of prefix/suffix combination
	 */
	function wrap(files, name) {
		files.unshift('src/' + name + '.prefix.js');
		files.push('src/' + name + '.suffix.js');
		return files;
	}

	function singleStrict(src, insert) {
		return src
		// remove all file-specific strict mode flags
		.replace(/\s*("|')use strict("|');\s*/g, insert)
		// add single strict mode flag
		.replace(/(\(function\([^)]*\)\s*\{)/, "$1'use strict';");
	}

	function startKarma(config, singleRun, done) {
		var browsers = grunt.option('browsers');
		var reporters = grunt.option('reporters');
		var noColor = grunt.option('no-colors');
		var port = grunt.option('port');
		var p = spawn('node', [ 'node_modules/karma/bin/karma', 'start',
				config, singleRun ? '--single-run=true' : '',
				reporters ? '--reporters=' + reporters : '',
				browsers ? '--browsers=' + browsers : '',
				noColor ? '--no-colors' : '', port ? '--port=' + port : '' ]);

		p.stdout.pipe(process.stdout);
		p.stderr.pipe(process.stderr);

		p.on('exit', function(code) {
			if (code !== 0) {
				grunt.fail.warn("Karma test(s) failed. Exit code: " + code);
			}
			done();
		});
	}

	/**
	 * Generate application module from JISON generated parser
	 */
	function processGrammarFile(filepath, success) {
		var src = grunt.file.read(filepath);
		var names = filepath.match(/[\\\/]([^\.]+)\.js$/, filepath)[1].split("/");
		var _lastInd =  names.length-1;
		names[_lastInd] = _toUpperFirstLetter(names[_lastInd]);
		var name = names.join(".");

		src = src.replace(/var\s*parser\s*=\s*\(function\(\)\{/g, 'window.l2js && function(l2js) {'+ "\n" +'l2js.' + name + ' = (function(){');
		src = src.replace(/\}\)\(\);$/g, '})();'+ "\n" +'}(window.l2js);');

		grunt.file.write(filepath, src);
		success();
	}

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

	grunt.registerMultiTask('tests', '**Use `grunt test` instead**',
			function() {
				startKarma(this.data, true, this.async());
			});

	grunt.registerMultiTask("build", function() {
		build(this.data, this.async);
	});

	grunt.registerTask('wrapparsers', 'wrap jison parsers to app format',
	function() {
		grunt.util.async.forEach(files.parsers, processGrammarFile, this.async());
	});

	grunt.registerTask('buildall', 'buildall the JS files in parallel',
			function() {
				grunt.log.writeln("Starting build all components...");
				var builds = grunt.config('build');
				builds = Object.keys(builds).map(function(key) {
					return builds[key];
				});
				grunt.util.async.forEach(builds, build, this.async());
			});

	grunt.registerTask('uglifyall', 'uglify all the tasks it parallel',
			function() {
				grunt.log.writeln("Starting uglify all tasks...");
				var profiles = grunt.config('uglify'), tasks = Object
						.keys(profiles);

				grunt.util.async.forEach(tasks, function(task, success) {
					grunt.task.run("uglify:" + task);
					success();
				}, this.async());

			});
	grunt.registerTask('package', [ "bower", "clean", "grammar", "buildall", "test",
			"uglifyall", "compress" ]);
	grunt.registerTask('dev', [ "clean", "buildall" ]);
	grunt.registerTask('grammar', [ 'jison', 'wrapparsers' ]);
	grunt.registerTask('test', [ 'tests:unit' ]);
	grunt.registerTask('default', [ 'package' ]);
};<commit_msg>formatting<commit_after>var files = require('./files').files, path = require("path"), spawn = require('child_process').spawn;

module.exports = function(grunt) {
	grunt.initConfig({
		pkg : grunt.file.readJSON('package.json'),
		bower : {
			install : {
				options : {
					targetDir : "bower_modules",
					cleanup : true,
					layout : function(type, component) {
						var renamedType = type;
						if (type == 'js')
							renamedType = 'javascripts';
						else if (type == 'css')
							renamedType = 'stylesheets';

						return path.join(component, renamedType);
					}
				}
			}
		},
		jison : {
			l : {
				options : {
					moduleType : 'js'
				},
				files : {
					'src/compiler/lparser.js' : 'src/compiler/lgrammar.jison'
				}
			}
		},
		build : {
			l2js : {
				dest : "dist/l2js-v<%= pkg.version %>.js",
				src : wrap(files.src, "build")

			}
		},
		tests : {
			unit : 'karma.config.js',
		},
		uglify : {
			l2js : {
				files : {
					"dist/l2js-v<%= pkg.version %>.min.js" : ["dist/l2js-v<%= pkg.version %>.js"]
				},
				options : {
					preserveComments : false,
					sourceMap : "dist/l2js-v<%= pkg.version %>.min.map",
					sourceMappingURL : "dist/l2js-v<%= pkg.version %>.min.map",
					report : "min",
					beautify : {
						ascii_only : true
					},
					banner : "/*! L2JS v<%= pkg.version %> | " + "Copyright 2014, 2014 Tomáš Konrády (tomas.konrady@uhk.cz). | " + "MIT licence */",
					compress : {
						hoist_funs : false,
						loops : false,
						unused : false
					}
				}
			}
		},

		clean : {
			build : ['dist']
		},

		compress : {
			build : {
				options : {
					archive : 'dist/l2js-v<%= pkg.version %>.zip',
					mode : 'zip'
				},
				src : ['**'],
				cwd : 'dist',
				expand : true,
				dot : true,
				dest : 'l2js-v<%= pkg.version %>/'
			}
		},
	});

	function _toUpperFirstLetter(string) {
		return string.charAt(0).toUpperCase() + string.slice(1);
	}

	function build(config, success) {
		var files = grunt.file.expand(config.src);

		// concat
		var src = files.map(function(filepath) {
			return processFile(grunt.file.read(filepath));
		}).join(grunt.util.normalizelf('\n'));

		// process
		var processed = processSource(src, grunt.config("pkg").version);

		// write
		grunt.file.write(config.dest, processed);
		grunt.log.ok('File ' + config.dest + ' created.');

		success();
	}

	/**
	 * Process contacted source. Fills metadata in the banner and removes
	 * multiple used 'use strict' expression.
	 *
	 * @param src
	 *            Contacted source
	 * @param version
	 *            Version of source
	 */
	function processSource(src, version) {
		// Fills in metadata to header of code
		var processed = src.replace(/@VERSION/, version).replace(/@DATE/, new Date().toISOString());

		processed = singleStrict(processed, '\n\n');
		return processed;
	}

	/**
	 * Removes closure declarations
	 *
	 * @param src
	 *            Source of single file
	 */
	function processFile(src) {
		var closureRegexStart = /window\.l2js.*\(l2js\)\s*\{/;
		var closureRegexEnd = /\}\(window.l2js\);\s*$/;

		var processed = src.replace(closureRegexStart, "\n").replace(closureRegexEnd, "\n");
		return processed;
	}

	/**
	 * Adds prefix a suffix to the array files.
	 *
	 * @param name
	 *            Name of prefix/suffix combination
	 */
	function wrap(files, name) {
		files.unshift('src/' + name + '.prefix.js');
		files.push('src/' + name + '.suffix.js');
		return files;
	}

	function singleStrict(src, insert) {
		return src
		// remove all file-specific strict mode flags
		.replace(/\s*("|')use strict("|');\s*/g, insert)
		// add single strict mode flag
		.replace(/(\(function\([^)]*\)\s*\{)/, "$1'use strict';");
	}

	function startKarma(config, singleRun, done) {
		var browsers = grunt.option('browsers');
		var reporters = grunt.option('reporters');
		var noColor = grunt.option('no-colors');
		var port = grunt.option('port');
		var p = spawn('node', ['node_modules/karma/bin/karma', 'start', config, singleRun ? '--single-run=true' : '', reporters ? '--reporters=' + reporters : '', browsers ? '--browsers=' + browsers : '', noColor ? '--no-colors' : '', port ? '--port=' + port : '']);

		p.stdout.pipe(process.stdout);
		p.stderr.pipe(process.stderr);

		p.on('exit', function(code) {
			if (code !== 0) {
				grunt.fail.warn("Karma test(s) failed. Exit code: " + code);
			}
			done();
		});
	}

	/**
	 * Generate application module from JISON generated parser
	 */
	function processGrammarFile(filepath, success) {
		var src = grunt.file.read(filepath);
		var names = filepath.match(/[\\\/]([^\.]+)\.js$/, filepath)[1].split("/");
		var _lastInd = names.length - 1;
		names[_lastInd] = _toUpperFirstLetter(names[_lastInd]);
		var name = names.join(".");

		src = src.replace(/var\s*parser\s*=\s*\(function\(\)\{/g, 'window.l2js && function(l2js) {' + "\n" + 'l2js.' + name + ' = (function(){');
		src = src.replace(/\}\)\(\);$/g, '})();' + "\n" + '}(window.l2js);');

		grunt.file.write(filepath, src);
		success();
	}

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

	grunt.registerMultiTask('tests', '**Use `grunt test` instead**', function() {
		startKarma(this.data, true, this.async());
	});

	grunt.registerMultiTask("build", function() {
		build(this.data, this.async);
	});

	grunt.registerTask('wrapparsers', 'wrap jison parsers to app format', function() {
		grunt.util.async.forEach(files.parsers, processGrammarFile, this.async());
	});

	grunt.registerTask('buildall', 'buildall the JS files in parallel', function() {
		grunt.log.writeln("Starting build all components...");
		var builds = grunt.config('build');
		builds = Object.keys(builds).map(function(key) {
			return builds[key];
		});
		grunt.util.async.forEach(builds, build, this.async());
	});

	grunt.registerTask('uglifyall', 'uglify all the tasks it parallel', function() {
		grunt.log.writeln("Starting uglify all tasks...");
		var profiles = grunt.config('uglify'), tasks = Object.keys(profiles);

		grunt.util.async.forEach(tasks, function(task, success) {
			grunt.task.run("uglify:" + task);
			success();
		}, this.async());

	});
	grunt.registerTask('package', ["bower", "clean", "grammar", "buildall", "test", "uglifyall", "compress"]);
	grunt.registerTask('dev', ["clean", "buildall"]);
	grunt.registerTask('grammar', ['jison', 'wrapparsers']);
	grunt.registerTask('test', ['tests:unit']);
	grunt.registerTask('default', ['package']);
}; <|endoftext|>


<commit_before>/*global module, process*/

"use strict";

module.exports = function(grunt) {
    var browsers = [
        {platform: "linux", browserName: "chrome", version: "34"},
        {platform: "linux", browserName: "firefox", version: "29"},
        {platform: "WIN8.1", browserName: "firefox", version: "29"},
        {platform: "WIN8.1", browserName: "chrome", version: "34"},
        {platform: "WIN8.1", browserName: "internet explorer", version: "11"},
        {platform: "WIN8", browserName: "internet explorer", version: "10"},
        {platform: "WIN7", browserName: "internet explorer", version: "9"},
        {platform: "WIN7", browserName: "internet explorer", version: "10"},
        {platform: "VISTA", browserName: "internet explorer", version: "9"},
        {platform: "OS X 10.8", browserName: "safari", version: "6"},
        {platform: "OS X 10.8", browserName: "chrome", version: "34"},
        {platform: "OS X 10.9", browserName: "chrome", version: "34"},
        {platform: "OS X 10.9", browserName: "safari", version: "7"},
        {platform: "OS X 10.9", browserName: "firefox", version: "28"},
        {platform: "OS X 10.9", browserName: "iphone", version: "7.1"},
        {platform: "linux", browserName: "android", version: "4.3"}
        ];

    grunt.initConfig({
        connect: {
            server: {
                options: {
                    base: "",
                    port: 9999
                }
            }
        },
        "saucelabs-jasmine": {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/jasmine/SpecRunner.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "iSat Unit tests",
                    tags: ["master"],
                    sauceConfig: {
                        "video-upload-on-pass": false
                    },
                    onTestComplete: function(result){
                        if (result.passed === undefined) {
                            return true;
                        } else {
                           return undefined;
                        }
                    }
                }
            }
        },
        watch: {}
    });

    // Loading dependencies
    for (var key in grunt.file.readJSON("package.json").devDependencies) {
        if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key);
    }

    grunt.registerTask("dev", ["connect", "watch"]);
    grunt.registerTask("test", ["connect", "saucelabs-jasmine"]);
};
<commit_msg>Add specific comments to give context to the callback<commit_after>/*global module, process*/

"use strict";

module.exports = function(grunt) {
    var browsers = [
        {platform: "linux", browserName: "chrome", version: "34"},
        {platform: "linux", browserName: "firefox", version: "29"},
        {platform: "WIN8.1", browserName: "firefox", version: "29"},
        {platform: "WIN8.1", browserName: "chrome", version: "34"},
        {platform: "WIN8.1", browserName: "internet explorer", version: "11"},
        {platform: "WIN8", browserName: "internet explorer", version: "10"},
        {platform: "WIN7", browserName: "internet explorer", version: "9"},
        {platform: "WIN7", browserName: "internet explorer", version: "10"},
        {platform: "VISTA", browserName: "internet explorer", version: "9"},
        {platform: "OS X 10.8", browserName: "safari", version: "6"},
        {platform: "OS X 10.8", browserName: "chrome", version: "34"},
        {platform: "OS X 10.9", browserName: "chrome", version: "34"},
        {platform: "OS X 10.9", browserName: "safari", version: "7"},
        {platform: "OS X 10.9", browserName: "firefox", version: "28"},
        {platform: "OS X 10.9", browserName: "iphone", version: "7.1"},
        {platform: "linux", browserName: "android", version: "4.3"}
        ];

    grunt.initConfig({
        connect: {
            server: {
                options: {
                    base: "",
                    port: 9999
                }
            }
        },
        "saucelabs-jasmine": {
            all: {
                options: {
                    urls: ["http://127.0.0.1:9999/jasmine/SpecRunner.html"],
                    tunnelTimeout: 5,
                    build: process.env.TRAVIS_JOB_ID,
                    concurrency: 3,
                    browsers: browsers,
                    testname: "iSat Unit tests",
                    tags: ["master"],
                    sauceConfig: {
                        "video-upload-on-pass": false
                    },
                    onTestComplete: function(result){
                        /* returning undefined doesn't alter the test result
                           but returning true or false does.
                           See: https://github.com/axemclion/grunt-saucelabs

                           We return true if result.passed is undefined to
                           gloss over spurious errors from saucelabs.
                           See: https://github.com/admc/wd/issues/86 which is
                           all I could find about it.

                           Everything else gets unaltered results.

                        */
                        if (result.passed === undefined) {
                            return true;
                        } else {
                           return undefined;
                        }
                    }
                }
            }
        },
        watch: {}
    });

    // Loading dependencies
    for (var key in grunt.file.readJSON("package.json").devDependencies) {
        if (key !== "grunt" && key.indexOf("grunt") === 0) grunt.loadNpmTasks(key);
    }

    grunt.registerTask("dev", ["connect", "watch"]);
    grunt.registerTask("test", ["connect", "saucelabs-jasmine"]);
};
<|endoftext|>


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

  grunt.initConfig({
    clean: { tests: ["docs"] },

    jshint: {
      grunt: ['Gruntfile.js'],
      tasks: ['tasks/docco.js'],
      tests: ['test/*.js'],
      options: {
        node: true
      }
    },

    docco: {
      tests: {
        src: ['test/**/*.js', 'test/**/*.coffee'],
        dest: "docs/"
      },
      'custom-css-test': {
        src: ['test/**/*.js'],
        dest: 'docs/',
        options: {
            css: 'test/fixtures/custom.css',
            output: 'docs/'
        }
      }
    },

    nodeunit: {
      tests: ['test/*_test.js']
    }
  });

  grunt.loadTasks('tasks');

  grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');

  grunt.registerTask('test', ['clean:tests', 'docco', 'nodeunit:tests']);
  grunt.registerTask('lint', ['jshint:grunt', 'jshint:tasks', 'jshint:tests']);
  grunt.registerTask('default', ['lint', 'docco']);
};
<commit_msg>fix tests so that they do not create an undfined directory<commit_after>module.exports = function(grunt) {

  grunt.initConfig({
    clean: { tests: ["docs"] },

    jshint: {
      grunt: ['Gruntfile.js'],
      tasks: ['tasks/docco.js'],
      tests: ['test/*.js'],
      options: {
        node: true
      }
    },

    docco: {
      tests: {
        src: ['test/**/*.js', 'test/**/*.coffee'],
        dest: "docs/",
        options: {
            output: 'docs/'
        }
      },
      'custom-css-test': {
        src: ['test/**/*.js'],
        dest: 'docs/',
        options: {
            css: 'test/fixtures/custom.css',
            output: 'docs/'
        }
      }
    },

    nodeunit: {
      tests: ['test/*_test.js']
    }
  });

  grunt.loadTasks('tasks');

  grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');

  grunt.registerTask('test', ['clean:tests', 'docco', 'nodeunit:tests']);
  grunt.registerTask('lint', ['jshint:grunt', 'jshint:tasks', 'jshint:tests']);
  grunt.registerTask('default', ['lint', 'docco']);
};
<|endoftext|>


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

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    copy: {
      dist: {
        expand: true, cwd: 'src/', src: ['**'], dest: 'dist/'
      }
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          'dist/jquery.vgrd.min.js': [ 'dist/jquery.vgrd.js']
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');

  grunt.registerTask('default', ['copy', 'uglify']);

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

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    copy: {
      dist: {
        expand: true, cwd: 'src/', src: ['**'], dest: 'dist/'
      },
      site: {
        expand: true, cwd: 'dist/', src: ['**/*'], dest: 'site/'
      }
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          'dist/jquery.vgrd.min.js': [ 'dist/jquery.vgrd.js']
        }
      }
    },
    livemd: {
      options: {
      },
      site: {
        files: {
          'site/index.html': ['README.md']
        }
      }
    },
    'gh-pages': {
      options: {
        // Options for all targets go here.
      },
      push: {
        options: {
          base: 'site'
        },
        // These files will get pushed to the `gh-pages` branch (the default).
        src: ['index.html', 'jquery.vgrd.min.js']
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-livemd');
  grunt.loadNpmTasks('grunt-gh-pages');

  grunt.registerTask('default', ['copy:dist', 'jshint', 'uglify']);

  grunt.registerTask('build', ['copy:dist', 'uglify']);

  grunt.registerTask('site', ['build', 'copy:site', 'livemd:site']);

};<|endoftext|>


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

  grunt.loadNpmTasks('grunt-bump');

  grunt.initConfig({
    /**
     * Increments the version number, etc.
     */
    bump: {
      options: {
        files: [
          "package.json"
        ],
        commit: true,
        commitMessage: 'chore(release): v%VERSION%',
        commitFiles: [
          "package.json"
        ],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true
      }
    },

  });

};
<commit_msg>fix(gruntfile): change push to<commit_after>
module.exports = function(grunt) {

  grunt.loadNpmTasks('grunt-bump');

  grunt.initConfig({
    /**
     * Increments the version number, etc.
     */
    bump: {
      options: {
        files: [
          "package.json"
        ],
        commit: true,
        commitMessage: 'chore(release): v%VERSION%',
        commitFiles: [
          "package.json"
        ],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true,
        pushTo: 'origin'
      }
    },

  });

};
<|endoftext|>


<commit_before>/*jshint multistr: true */
module.exports = function(grunt) {

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

    // Define a banner to added to the compiled assets.
    banner: "/* <%= pkg.name %> v<%= pkg.version %> | " +
            "(c) <%= grunt.template.today('yyyy') %> <%= pkg.author %>. | " +
            "http://www.apache.org/licenses/LICENSE-2.0.html */",

    // Set the major version as a variable.
    // This is used for deploying bleeding edge builds.

    // Watch and instant rebuild.
    watch: {
      files: ['index.html', 'src/**/*'],
      tasks: ['default'],
    },

    // Javascript validation.
    jshint: {
      all: ['Gruntfile.js', 'src/javascripts/*.js']
    },

    // qUnit test framework.
    qunit: {
      options: {
        inject: 'tests/vendor/phantom.js' // Used for running the tests headlessly.
      },
      files: ['tests/*.html']
    },

    // Minify Javascript Assets.
    uglify: {
      build: {
        src: 'dist/<%= pkg.name %>.js', // Take temporary pre-compiled asset.
        dest: 'dist/<%= pkg.name %>.min.js' // Plop it in the distribution folder.
      },
      options: {
        banner: '<%= banner %>',
        sourceMap: true // Help with debugging errors.
      }
    },

    // Copy unprocesed assets like fonts.
    copy: {
      main: {
        files: [
          // includes files within path and its sub-directories
          {expand: true, cwd: 'src/fonts', src: ['**'], dest: 'dist/fonts'},
        ],
      },
    },

    // Bundle dependancies into a single package.
    browserify: {
      build: {
        src: 'src/javascripts/<%= pkg.name %>.js', // Take temporary pre-compiled asset.
        dest: 'dist/<%= pkg.name %>.js', // Plop it in the distribution folder.
        options: {
          alias: {
            'sorry-api': './src/javascripts/lib/sorry-api' // Not available as its own NPM yet.
          },
          browserifyOptions: {
            // Standalone, self contained bundle/package.
            standalone: 'sorryStatusBar'
          }
        }
      }
    },

    // Minify Stylesheet Assets.
    cssmin: {
      options: {
        banner: '<%= banner %>'
      },
      minify: {
        src: 'src/stylesheets/<%= pkg.name %>.css',
        dest: 'dist/<%= pkg.name %>.min.css',
      }
    },

    // Release & Deployment Tasks.
    release: {
      options: {
        npm: false, // Don't deploy to NPM as we don't want to release like that.
        tagName: '<%= version %>'
      }
    },

    // Local demo / development site.
    connect: {
      server: {
        options: {
          port: 9001,
          keepalive: true
        }
      }
    },

    // Deployment.
    aws_s3: {
      options: {
        accessKeyId: '<%= aws.key %>', // Use the variables
        secretAccessKey: '<%= aws.secret %>', // You can also use env variables
        region: 'eu-west-1',
        bucket: 'sorry-assets-production',
        access: 'public-read'
      },
      dev: {
        files: [
          // Upload this version of the plugin.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/<%= pkg.version %>/', params: { CacheControl: 'public, max-age=31536000' }},
          // And also a bleeding edge minor release.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.<%= pkg.version.split(".")[1] %>.latest/', params: { CacheControl: 'public, max-age=86400' }},
          // Also deploy a bleeding edge version on the major number.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.latest/', params: { CacheControl: 'public, max-age=3600' }},
          // A non-version latest release.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/latest/', params: { CacheControl: 'public, max-age=3600' }}
        ]
      }
    },

    // Cloudfront cleanup.
    invalidate_cloudfront: {
      options: {
        key: '<%= aws.key %>',
        secret: '<%= aws.secret %>',
        distribution: '<%= aws.distribution %>'
      },
      release: {
        files: [{
          expand: true,
          cwd: './dist/',
          src: ['**/*'],
          filter: 'isFile',
          dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.latest/'
        }, {
          expand: true,
          cwd: './dist/',
          src: ['**/*'],
          filter: 'isFile',
          dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.<%= pkg.version.split(".")[1] %>.latest/'
        }, {
          expand: true,
          cwd: './dist/',
          src: ['**/*'],
          filter: 'isFile',
          dest: '<%= pkg.name %>/latest/'
        }]
      }
    }
  });

  // Copy unprocessed files lke fonts.
  grunt.loadNpmTasks('grunt-contrib-copy');
  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  // Load the plugin for minifys CSS.
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  // Load the plugin that validates the JS markup.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  // Release tasks to manage version number bump, tag etc.
  grunt.loadNpmTasks('grunt-release');
  // AWS/S3 deployment tools.
  grunt.loadNpmTasks('grunt-aws-s3');
  // Clean cloudfront up for the .latest builds.
  grunt.loadNpmTasks('grunt-invalidate-cloudfront');
  // Watcher for rebuilding when files changes.
  grunt.loadNpmTasks('grunt-contrib-watch');
  // qUnit test runner.
  grunt.loadNpmTasks('grunt-contrib-qunit');
  // Connect to the test / demo page.
  grunt.loadNpmTasks('grunt-contrib-connect');
  // Bundle dependany modules together for distribution.
  grunt.loadNpmTasks('grunt-browserify');

  // Default task(s).
  grunt.registerTask('default', ['jshint', 'browserify', 'uglify', 'cssmin', 'copy']);

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

  // Publish task.
  grunt.registerTask('publish', ['aws_s3', 'invalidate_cloudfront']);
};<commit_msg>Experimental task after bump, which hopefully brings latest version number into the banner.<commit_after>/*jshint multistr: true */
module.exports = function(grunt) {

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

    // Define a banner to added to the compiled assets.
    banner: "/* <%= pkg.name %> v<%= pkg.version %> | " +
            "(c) <%= grunt.template.today('yyyy') %> <%= pkg.author %>. | " +
            "http://www.apache.org/licenses/LICENSE-2.0.html */",

    // Set the major version as a variable.
    // This is used for deploying bleeding edge builds.

    // Watch and instant rebuild.
    watch: {
      files: ['index.html', 'src/**/*'],
      tasks: ['default'],
    },

    // Javascript validation.
    jshint: {
      all: ['Gruntfile.js', 'src/javascripts/*.js']
    },

    // qUnit test framework.
    qunit: {
      options: {
        inject: 'tests/vendor/phantom.js' // Used for running the tests headlessly.
      },
      files: ['tests/*.html']
    },

    // Minify Javascript Assets.
    uglify: {
      build: {
        src: 'dist/<%= pkg.name %>.js', // Take temporary pre-compiled asset.
        dest: 'dist/<%= pkg.name %>.min.js' // Plop it in the distribution folder.
      },
      options: {
        banner: '<%= banner %>',
        sourceMap: true // Help with debugging errors.
      }
    },

    // Copy unprocesed assets like fonts.
    copy: {
      main: {
        files: [
          // includes files within path and its sub-directories
          {expand: true, cwd: 'src/fonts', src: ['**'], dest: 'dist/fonts'},
        ],
      },
    },

    // Bundle dependancies into a single package.
    browserify: {
      build: {
        src: 'src/javascripts/<%= pkg.name %>.js', // Take temporary pre-compiled asset.
        dest: 'dist/<%= pkg.name %>.js', // Plop it in the distribution folder.
        options: {
          alias: {
            'sorry-api': './src/javascripts/lib/sorry-api' // Not available as its own NPM yet.
          },
          browserifyOptions: {
            // Standalone, self contained bundle/package.
            standalone: 'sorryStatusBar'
          }
        }
      }
    },

    // Minify Stylesheet Assets.
    cssmin: {
      options: {
        banner: '<%= banner %>'
      },
      minify: {
        src: 'src/stylesheets/<%= pkg.name %>.css',
        dest: 'dist/<%= pkg.name %>.min.css',
      }
    },

    // Release & Deployment Tasks.
    release: {
      options: {
        npm: false, // Don't deploy to NPM as we don't want to release like that.
        tagName: '<%= version %>',
        afterBump: ['default'] // Recompile JS with new banners.
      }
    },

    // Local demo / development site.
    connect: {
      server: {
        options: {
          port: 9001,
          keepalive: true
        }
      }
    },

    // Deployment.
    aws_s3: {
      options: {
        accessKeyId: '<%= aws.key %>', // Use the variables
        secretAccessKey: '<%= aws.secret %>', // You can also use env variables
        region: 'eu-west-1',
        bucket: 'sorry-assets-production',
        access: 'public-read'
      },
      dev: {
        files: [
          // Upload this version of the plugin.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/<%= pkg.version %>/', params: { CacheControl: 'public, max-age=31536000' }},
          // And also a bleeding edge minor release.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.<%= pkg.version.split(".")[1] %>.latest/', params: { CacheControl: 'public, max-age=86400' }},
          // Also deploy a bleeding edge version on the major number.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.latest/', params: { CacheControl: 'public, max-age=3600' }},
          // A non-version latest release.
          {expand: true, cwd: 'dist/', src: ['**'], dest: '<%= pkg.name %>/latest/', params: { CacheControl: 'public, max-age=3600' }}
        ]
      }
    },

    // Cloudfront cleanup.
    invalidate_cloudfront: {
      options: {
        key: '<%= aws.key %>',
        secret: '<%= aws.secret %>',
        distribution: '<%= aws.distribution %>'
      },
      release: {
        files: [{
          expand: true,
          cwd: './dist/',
          src: ['**/*'],
          filter: 'isFile',
          dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.latest/'
        }, {
          expand: true,
          cwd: './dist/',
          src: ['**/*'],
          filter: 'isFile',
          dest: '<%= pkg.name %>/<%= pkg.version.split(".")[0] %>.<%= pkg.version.split(".")[1] %>.latest/'
        }, {
          expand: true,
          cwd: './dist/',
          src: ['**/*'],
          filter: 'isFile',
          dest: '<%= pkg.name %>/latest/'
        }]
      }
    }
  });

  // Copy unprocessed files lke fonts.
  grunt.loadNpmTasks('grunt-contrib-copy');
  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  // Load the plugin for minifys CSS.
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  // Load the plugin that validates the JS markup.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  // Release tasks to manage version number bump, tag etc.
  grunt.loadNpmTasks('grunt-release');
  // AWS/S3 deployment tools.
  grunt.loadNpmTasks('grunt-aws-s3');
  // Clean cloudfront up for the .latest builds.
  grunt.loadNpmTasks('grunt-invalidate-cloudfront');
  // Watcher for rebuilding when files changes.
  grunt.loadNpmTasks('grunt-contrib-watch');
  // qUnit test runner.
  grunt.loadNpmTasks('grunt-contrib-qunit');
  // Connect to the test / demo page.
  grunt.loadNpmTasks('grunt-contrib-connect');
  // Bundle dependany modules together for distribution.
  grunt.loadNpmTasks('grunt-browserify');

  // Default task(s).
  grunt.registerTask('default', ['jshint', 'browserify', 'uglify', 'cssmin', 'copy']);

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

  // Publish task.
  grunt.registerTask('publish', ['aws_s3', 'invalidate_cloudfront']);
};<|endoftext|>