<commit_before>/*jslint node:true*/
/**
 * Gruntfile for freedom-for-firefox.jsm
 *
 * This repository provides firefox (extension and os app)
 * specific packaging of the freedom.js library.
 *
 * Here are the common tasks defined:
 * build
 * - Lint source and compile
 * - (Default task)
 * - Unit tests for sanity checking possible without actually launching firefox
 * test
 * - Build and run firefox extension for integration tests
 **/

var freedomPrefix = require('path').dirname(require.resolve('freedom'));

module.exports = function (grunt) {
  'use strict';
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      providers: ['providers/*.js'],
      options: {
        '-W069': true,
        '-W104': false
      }
    },
    browserify: {
      freedom: {
        files: {
          'freedom-for-firefox.jsm': ['src/entry.js']
        },
        options: {
          postBundleCB: function (err, src, next) {
            next(err, require('fs').readFileSync(
              require.resolve('freedom/src/util/header.txt')
            ) + src);
          }
        }
      },
      jasmine: {
        files: {
          'spec.jsm': ['src/spec.js']
        }
      },
      frame: {
        files: {
          'build/frame.js': require.resolve('freedom/src/util/frameEntry.js')
        }
      },
      options: {
        transform: [['folderify', {global: true}]],
        alias: [
          './src/promise.js:es6-promise'
        ]
      }
    },
    "build-test-addon": {
      freedom: {
        files: {
          '.build': [ 'spec.jsm' ]
        },
        options: {
          helper: [
            {path: 'freedom-for-firefox.jsm', include: false},
            {path: freedomPrefix + '/providers', name: 'providers', include: false},
            {path: freedomPrefix + '/spec', name: 'spec', include: false}
          ]
        }
      }
    },
    bump: {
      options: {
        files: ['package.json'],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true,
        pushTo: 'origin'
      }
    },
    clean: ['freedom-for-firefox.jsm', 'freedom.map', 'node_modules/',
            'spec.jsm', '.build/'],
    'npm-publish': {
      options: {
        // list of tasks that are required before publishing
        requires: [],
        // if the workspace is dirty, abort publishing (to avoid publishing local changes)
        abortIfDirty: true
      }
    },
    prompt: {
      tagMessage: {
        options: {
          questions: [
            {
              config: 'bump.options.tagMessage',
              type: 'input',
              message: 'Enter a git tag message:',
            default: 'v%VERSION%'
            }
          ]
        }
      }
    },
    shell: {
      options: {},
      publishWebsite: {
        command: 'bash tools/publishWebsite.sh'
      }
    },
    copy: {
      demo: {
        src: 'build/frame.js',
        dest: 'demo/tictak/data/freedom-frame.js'
      }
    }

  });

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-prompt');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-shell');

  grunt.loadTasks('tasks');

  grunt.registerTask('build', [
    'jshint:providers',
    'browserify:freedom'
  ]);
  grunt.registerTask('test', [
    'build',
    'browserify:jasmine',
    'integration'
  ]);

  grunt.registerTask('release', function (arg) {
    if (arguments.length === 0) {
      arg = 'patch';
    }
    grunt.task.run([
      'default',
      'prompt:tagMessage',
      'bump:' + arg,
      'npm-publish',
      'shell:publishWebsite'
    ]);
  });

  grunt.registerTask('default', ['build']);
};
<commit_msg>spacing fix<commit_after>/*jslint node:true*/
/**
 * Gruntfile for freedom-for-firefox.jsm
 *
 * This repository provides firefox (extension and os app)
 * specific packaging of the freedom.js library.
 *
 * Here are the common tasks defined:
 * build
 * - Lint source and compile
 * - (Default task)
 * - Unit tests for sanity checking possible without actually launching firefox
 * test
 * - Build and run firefox extension for integration tests
 **/

var freedomPrefix = require('path').dirname(require.resolve('freedom'));

module.exports = function (grunt) {
  'use strict';
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      providers: ['providers/*.js'],
      options: {
        '-W069': true,
        '-W104': false
      }
    },
    browserify: {
      freedom: {
        files: {
          'freedom-for-firefox.jsm': ['src/entry.js']
        },
        options: {
          postBundleCB: function (err, src, next) {
            next(err, require('fs').readFileSync(
              require.resolve('freedom/src/util/header.txt')
            ) + src);
          }
        }
      },
      jasmine: {
        files: {
          'spec.jsm': ['src/spec.js']
        }
      },
      frame: {
        files: {
          'build/frame.js': require.resolve('freedom/src/util/frameEntry.js')
        }
      },
      options: {
        transform: [['folderify', {global: true}]],
        alias: [
          './src/promise.js:es6-promise'
        ]
      }
    },
    "build-test-addon": {
      freedom: {
        files: {
          '.build': [ 'spec.jsm' ]
        },
        options: {
          helper: [
            {path: 'freedom-for-firefox.jsm', include: false},
            {path: freedomPrefix + '/providers', name: 'providers', include: false},
            {path: freedomPrefix + '/spec', name: 'spec', include: false}
          ]
        }
      }
    },
    bump: {
      options: {
        files: ['package.json'],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true,
        pushTo: 'origin'
      }
    },
    clean: ['freedom-for-firefox.jsm', 'freedom.map', 'node_modules/',
            'spec.jsm', '.build/'],
    'npm-publish': {
      options: {
        // list of tasks that are required before publishing
        requires: [],
        // if the workspace is dirty, abort publishing (to avoid publishing local changes)
        abortIfDirty: true
      }
    },
    prompt: {
      tagMessage: {
        options: {
          questions: [
            {
              config: 'bump.options.tagMessage',
              type: 'input',
              message: 'Enter a git tag message:',
              default: 'v%VERSION%'
            }
          ]
        }
      }
    },
    shell: {
      options: {},
      publishWebsite: {
        command: 'bash tools/publishWebsite.sh'
      }
    },
    copy: {
      demo: {
        src: 'build/frame.js',
        dest: 'demo/tictak/data/freedom-frame.js'
      }
    }

  });

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-prompt');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-shell');

  grunt.loadTasks('tasks');

  grunt.registerTask('build', [
    'jshint:providers',
    'browserify:freedom'
  ]);
  grunt.registerTask('test', [
    'build',
    'browserify:jasmine',
    'integration'
  ]);

  grunt.registerTask('release', function (arg) {
    if (arguments.length === 0) {
      arg = 'patch';
    }
    grunt.task.run([
      'default',
      'prompt:tagMessage',
      'bump:' + arg,
      'npm-publish',
      'shell:publishWebsite'
    ]);
  });

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


<commit_before>/*!
 * thymus.js Gruntfile
 * http://thymusjs.org
 * Copyright 2013-present Akira LLC
 * Licensed under MIT (https://github.com/ugate/thymus/blob/master/LICENSE)
 */
//module.exports = function(grunt) {
//  grunt.initConfig({
//    connect: {
//      server: {
//        options: {
//          base: "",
//          port: 9999
//        }
//      }
//    },
//    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"]);
//};
module.exports = function(grunt) {
	'use strict';

	// Force use of Unix newlines
	grunt.util.linefeed = '\n';

	RegExp.quote = function(string) {
		return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
	};

	// Project configuration.
	grunt
			.initConfig({

				// Metadata.
				pkg : grunt.file.readJSON('package.json'),
				banner : '/*!\n'
						+ ' * thymus.js v<%= pkg.version %> (<%= pkg.homepage %>)\n'
						+ ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n'
						+ ' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n'
						+ ' */\n',
				jqueryCheck : 'if (typeof jQuery === \'undefined\') { throw new Error(\'thymus.js requires jQuery\') }\n\n',
				sourceFiles : 'js/*.js',

				// Task configuration.
				clean : {
					dist : [ 'dist', 'frags/docs/dist' ]
				},

				concat : {
					options : {
						banner : '<%= banner %>\n<%= jqueryCheck %>',
						stripBanners : false
					},
					thymus : {
						// src : [ 'js/frags.js', 'js/events.js',
						// 'js/context.js', 'js/siphons.js',
						// 'js/plugin.js', 'js/util.js' ],
						src : [ 'js/thymus.js' ],
						dest : 'dist/js/<%= pkg.name %>.js'
					}
				},

				uglify : {
					options : {
						report : 'min'
					},
					thymus : {
						options : {
							banner : '<%= banner %>'
						},
						src : '<%= concat.thymus.dest %>',
						dest : 'dist/js/<%= pkg.name %>.min.js'
					},
					docsJs : {
						options : {
							preserveComments : 'some'
						},
						src : [ 'frags/docs/js/app.js',
								'frags/docs/js/loader.js' ],
						dest : 'docs/assets/js/docs.min.js'
					}
				},

				copy : {
					docs : {
						expand : true,
						cwd : './dist',
						src : [ '{css,js}/*.min.*', 'css/*.map' ],
						dest : 'frags/docs/dist'
					}
				},

				qunit : {
					options : {
						inject : 'js/test/unit/phantom.js'
					},
					files : 'js/test/*.html'
				},

				connect : {
					server : {
						options : {
							port : 3000,
							base : '.'
						}
					}
				},

				watch : {
					src : {
						files : '<%= sourceFiles %>',
						tasks : [ 'qunit' ]
					},
					test : {
						files : '<%= sourceFiles %>',
						tasks : [ 'qunit' ]
					}
				},

				sed : {
					versionNumber : {
						pattern : (function() {
							var old = grunt.option('oldver');
							return old ? RegExp.quote(old) : old;
						})(),
						replacement : grunt.option('newver'),
						recursive : true
					}
				},

				'saucelabs-qunit' : {
					all : {
						options : {
							build : process.env.TRAVIS_JOB_ID,
							testname : process.env.TRAVIS_BUILD_NUMBER,
							concurrency : 10,
							urls : [ 'http://127.0.0.1:3000/js/test/index.html' ],
							browsers : grunt.file
									.readYAML('test-infra/sauce_browsers.yml')
						}
					}
				}
			});

	// These plugins provide necessary tasks.
	for ( var key in grunt.file.readJSON("package.json").devDependencies) {
		if (key !== "grunt" && key.indexOf("grunt") === 0) {
			grunt.loadNpmTasks(key);
		}
	}

	// Test task.
	var testSubtasks = [];
	// Only run Sauce Labs tests if there's a Sauce access key
	if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
	// Skip Sauce if running a different subset of the test suite
	(!process.env.THX_TEST || process.env.THX_TEST === 'sauce-js-unit')) {
		testSubtasks.push('connect');
		testSubtasks.push('saucelabs-qunit');
	}
	grunt.registerTask('test', testSubtasks);

	// JS distribution task.
	// grunt.registerTask('dist-js', [ 'concat', 'uglify' ]);

	// Docs distribution task.
	// grunt.registerTask('dist-docs', 'copy:docs');

	// Full distribution task.
	// grunt.registerTask('dist', [ 'clean', 'dist-js', 'dist-docs' ]);

	// Default task.
	// grunt.registerTask('default', [ 'test', 'dist' ]);

	// Version numbering task.
	// grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
	// This can be overzealous, so its changes should always be manually
	// reviewed!
	// grunt.registerTask('change-version-number', 'sed');
};<commit_msg>Initial CI build<commit_after>/*!
 * thymus.js Gruntfile
 * http://thymusjs.org
 * Copyright 2013-present Akira LLC
 * Licensed under MIT (https://github.com/ugate/thymus/blob/master/LICENSE)
 */
module.exports = function(grunt) {
	'use strict';

	// Docs: https://saucelabs.com/docs/platforms/webdriver
	// Windows: Opera 15+ not currently supported by Sauce Labs
	// Mac: Opera not currently supported by Sauce Labs
	// Android: Chrome not currently supported by Sauce Labs
	// iOS: Chrome not currently supported by Sauce Labs
	var browsers = [ {
		browserName : "safari",
		version : "7",
		platform : "OS X 10.9"
	}, {
		browserName : "chrome",
		version : "31",
		platform : "OS X 10.9"
	}, {
		browserName : "firefox",
		platform : "OS X 10.9"
	}, {
		browserName : "iphone",
		version : "7",
		platform : "OS X 10.9"
	}, {
		browserName : "ipad",
		version : "7",
		platform : "OS X 10.9"
	}, {
		browserName : "internet explorer",
		version : "11",
		platform : "Windows 8.1"
	}, {
		browserName : "internet explorer",
		version : "10",
		platform : "Windows 8"
	}, {
		browserName : "internet explorer",
		version : "9",
		platform : "Windows 7"
	}, {
		browserName : "chrome",
		version : "31",
		platform : "Windows 8.1"
	}, {
		browserName : "firefox",
		version : "26",
		platform : "Windows 8.1"
	}, {
		browserName : "chrome",
		version : "30",
		platform : "Linux"
	}, {
		browserName : "firefox",
		version : "26",
		platform : "Linux"
	}, {
		browserName : "android",
		version : "4.0",
		platform : "Linux"
	} ];
	// Force use of Unix newlines
	grunt.util.linefeed = '\n';

	RegExp.quote = function(string) {
		return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
	};

	// Project configuration.
	grunt
			.initConfig({

				// Metadata.
				pkg : grunt.file.readJSON('package.json'),
				banner : '/*!\n'
						+ ' * thymus.js v<%= pkg.version %> (<%= pkg.homepage %>)\n'
						+ ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n'
						+ ' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n'
						+ ' */\n',
				jqueryCheck : 'if (typeof jQuery === \'undefined\') { throw new Error(\'thymus.js requires jQuery\') }\n\n',
				sourceFiles : 'js/*.js',

				// Task configuration.
				clean : {
					dist : [ 'dist', 'frags/docs/dist' ]
				},

				concat : {
					options : {
						banner : '<%= banner %>\n<%= jqueryCheck %>',
						stripBanners : false
					},
					thymus : {
						// src : [ 'js/frags.js', 'js/events.js',
						// 'js/context.js', 'js/siphons.js',
						// 'js/plugin.js', 'js/util.js' ],
						src : [ 'js/thymus.js' ],
						dest : 'dist/js/<%= pkg.name %>.js'
					}
				},

				uglify : {
					options : {
						report : 'min'
					},
					thymus : {
						options : {
							banner : '<%= banner %>'
						},
						src : '<%= concat.thymus.dest %>',
						dest : 'dist/js/<%= pkg.name %>.min.js'
					},
					docsJs : {
						options : {
							preserveComments : 'some'
						},
						src : [ 'frags/docs/js/app.js',
								'frags/docs/js/loader.js' ],
						dest : 'docs/assets/js/docs.min.js'
					}
				},

				copy : {
					docs : {
						expand : true,
						cwd : './dist',
						src : [ '{css,js}/*.min.*', 'css/*.map' ],
						dest : 'frags/docs/dist'
					}
				},

				qunit : {
					options : {
						inject : 'js/test/unit/phantom.js'
					},
					files : 'js/test/*.html'
				},

				connect : {
					server : {
						options : {
							port : 3000,
							base : '.'
						}
					}
				},

				watch : {
					src : {
						files : '<%= sourceFiles %>',
						tasks : [ 'qunit' ]
					},
					test : {
						files : '<%= sourceFiles %>',
						tasks : [ 'qunit' ]
					}
				},

				sed : {
					versionNumber : {
						pattern : (function() {
							var old = grunt.option('oldver');
							return old ? RegExp.quote(old) : old;
						})(),
						replacement : grunt.option('newver'),
						recursive : true
					}
				},

				'saucelabs-qunit' : {
					all : {
						options : {
							build : process.env.TRAVIS_JOB_ID,
							testname : process.env.TRAVIS_BUILD_NUMBER,
							concurrency : 10,
							urls : [ 'http://127.0.0.1:3000/js/test/index.html' ],
							browsers : browsers
						}
					}
				}
			});

	// These plugins provide necessary tasks.
	for ( var key in grunt.file.readJSON("package.json").devDependencies) {
		if (key !== "grunt" && key.indexOf("grunt") === 0) {
			grunt.loadNpmTasks(key);
		}
	}

	// Test task.
	var testSubtasks = [];
	// Only run Sauce Labs tests if there's a Sauce access key
	if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
	// Skip Sauce if running a different subset of the test suite
	(!process.env.THX_TEST || process.env.THX_TEST === 'sauce-js-unit')) {
		testSubtasks.push('connect');
		testSubtasks.push('saucelabs-qunit');
	}
	grunt.registerTask('test', testSubtasks);

	// JS distribution task.
	// grunt.registerTask('dist-js', [ 'concat', 'uglify' ]);

	// Docs distribution task.
	// grunt.registerTask('dist-docs', 'copy:docs');

	// Full distribution task.
	// grunt.registerTask('dist', [ 'clean', 'dist-js', 'dist-docs' ]);

	// Default task.
	// grunt.registerTask('default', [ 'test', 'dist' ]);

	// Version numbering task.
	// grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
	// This can be overzealous, so its changes should always be manually
	// reviewed!
	// grunt.registerTask('change-version-number', 'sed');
};<|endoftext|>


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

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

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

    meta: {
      version: '<%= pkg.version %>',
      banner: (
        '// Backbone.Syphon, v<%= meta.version %>\n' +
        '// Copyright (c) <%= grunt.template.today("yyyy") %> Derick Bailey, Muted Solutions, LLC.\n' +
        '// Distributed under MIT license\n' +
        '// http://github.com/marionettejs/backbone.syphon\n'
      )
    },

    clean: {
      lib: 'lib/'
    },

    preprocess: {
      build: {
        src: 'src/build/backbone.syphon.js',
        dest: 'lib/backbone.syphon.js'
      }
    },

    concat: {
      options: {
        banner: '<%= meta.banner %>'
      },
      build: {
        src: '<%= preprocess.build.dest %>',
        dest: 'lib/backbone.syphon.js'
      }
    },

    uglify: {
      options: {
        banner: '<%= meta.banner %>',
        sourceMap: true
      },
      build: {
        src: '<%= concat.build.dest %>',
        dest: 'lib/backbone.syphon.min.js'
      }
    },

    jasmine: {
      tests: {
        src: [
          'src/backbone.syphon.js',
          'src/backbone.syphon.typeregistry.js',
          'src/backbone.syphon.keyextractors.js',
          'src/backbone.syphon.inputreaders.js',
          'src/backbone.syphon.inputwriters.js',
          'src/backbone.syphon.keyassignmentvalidators.js',
          'src/backbone.syphon.keysplitter.js',
          'src/backbone.syphon.keyjoiner.js'
        ],
        options: {
          specs: 'spec/javascripts/*.spec.js',
          vendor: [
            'bower_components/jquery/dist/jquery.js',
            'bower_components/underscore/underscore.js',
            'bower_components/backbone/backbone.js',
            'spec/javascripts/helpers/jasmine-jquery.js',
            'spec/javascripts/helpers/SpecHelper.js'
          ]
        }
      }
    }
  });

  grunt.registerTask('build', [
    'clean:lib',
    'preprocess',
    'concat',
    'uglify'
  ]);

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

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

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

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

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

    meta: {
      version: '<%= pkg.version %>',
      banner: (
        '// Backbone.Syphon, v<%= meta.version %>\n' +
        '// Copyright (c) <%= grunt.template.today("yyyy") %> Derick Bailey, Muted Solutions, LLC.\n' +
        '// Distributed under MIT license\n' +
        '// http://github.com/marionettejs/backbone.syphon\n'
      )
    },

    clean: {
      lib: 'lib/',
      tmp: 'tmp/'
    },

    preprocess: {
      lib: {
        src: 'src/build/backbone.syphon.js',
        dest: 'lib/backbone.syphon.js'
      },

      tmp: {
        src: 'src/build/backbone.syphon.js',
        dest: 'tmp/backbone.syphon.js'
      }
    },

    uglify: {
      options: {
        banner: '<%= meta.banner %>',
        sourceMap: true
      },
      lib: {
        src: '<%= preprocess.lib.dest %>',
        dest: 'lib/backbone.syphon.min.js'
      }
    },

    jasmine: {
      tests: {
        src: [
          'tmp/backbone.syphon.js'
        ],
        options: {
          specs: 'spec/javascripts/*.spec.js',
          vendor: [
            'bower_components/jquery/dist/jquery.js',
            'bower_components/underscore/underscore.js',
            'bower_components/backbone/backbone.js',
            'spec/javascripts/helpers/jasmine-jquery.js',
            'spec/javascripts/helpers/SpecHelper.js'
          ]
        }
      }
    }
  });

  grunt.registerTask('build', [
    'clean:lib',
    'preprocess:lib',
    'uglify'
  ]);

  grunt.registerTask('test', [
    'preprocess:tmp',
    'jasmine',
    'clean:tmp'
  ]);

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


<commit_before>'use strict';

module.exports = function (grunt) {
    grunt.initConfig({
        bumpup: {
            options: {
                updateProps: {
                    pkg: 'package.json'
                }
            },
            file: 'package.json'
        },
        jshint: {
            js: {
                options: {
                    jshintrc: '.jshintrc'
                },
                src: [
                    '**/*.js',
                    '!node_modules/**/*.js'
                ]
            },
            json: {
                src: [
                    '**/*.json',
                    '!node_modules/**/*.json'
                ]
            }
        },
        module: {
            check: {
                options: {
                    check: true
                }
            },
            license: {
                options: {
                    replace: true,
                    line: 3
                },
                src: 'LICENSE'
            },
            'release-publish': {
                options: {
                    release: true,
                    publish: true
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-bumpup');
    grunt.loadNpmTasks('grunt-contrib-jshint');

    grunt.loadTasks('tasks');

    grunt.registerTask('default', 'lint');

    grunt.registerTask('lint', [
        'jshint:js',
        'jshint:json'
    ]);

    grunt.registerTask('release', function (type) {
        grunt.task.run('lint');
        grunt.task.run('bumpup:' + (type || 'patch'));
    });

    grunt.registerTask('travis', 'lint');
};
<commit_msg>Update Gruntfile.js<commit_after>'use strict';

module.exports = function (grunt) {
    grunt.initConfig({
        bumpup: {
            options: {
                updateProps: {
                    pkg: 'package.json'
                }
            },
            file: 'package.json'
        },
        jshint: {
            js: {
                options: {
                    jshintrc: '.jshintrc'
                },
                src: [
                    '**/*.js',
                    '!node_modules/**/*.js'
                ]
            },
            json: {
                src: [
                    '**/*.json',
                    '!node_modules/**/*.json'
                ]
            }
        },
        module: {
            check: {
                options: {
                    check: true
                }
            },
            license: {
                options: {
                    replace: true,
                    line: 3
                },
                src: 'LICENSE'
            },
            'release-publish': {
                options: {
                    release: true,
                    publish: true
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-bumpup');
    grunt.loadNpmTasks('grunt-contrib-jshint');

    grunt.loadTasks('tasks');

    grunt.registerTask('default', 'lint');

    grunt.registerTask('lint', [
        'jshint:js',
        'jshint:json'
    ]);

    grunt.registerTask('release', function (type) {
        grunt.task.run('lint');
        grunt.task.run('module:check');
        grunt.task.run('bumpup:' + (type || 'patch'));
    });

    grunt.registerTask('travis', 'lint');
};
<|endoftext|>


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

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

    concat: {
      dist: {
        src: [
          'src/export-top.js',
          'src/vars.js',
          'src/poker.js',
          'src/export-bot.js'
        ],
        dest: 'dist/disbranded.poker.js'
      }
    },

    jasmine: {
      src: 'dist/disbranded.poker-min.js',
      options: {
        specs: 'spec/*.js'
      }
    },

    uglify: {
      min: {
        options: {},
        files: {
          'dist/disbranded.poker-min.js': ['dist/disbranded.poker.js']
        }
      }
    },

    usebanner: {
      dist: {
        options: {
          position: 'top',
          banner: '/*\n' +
                  ' * <%= pkg.name %> v<%= pkg.version %>\n' +
                  ' * by <%= pkg.author.name %> / <%= pkg.author.email %>\n' +
                  ' * last updated <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                  '**/\n',
          linebreak: false
        },
        files: {
          dist: ['dist/disbranded.poker.js', 'dist/disbranded.poker-min.js']
        }
      }
    },

    watch: {
      test: {
        files: ['src/*.js'],
        tasks: ['concat']
      }
    }
  })

  grunt.loadNpmTasks('grunt-banner')
  grunt.loadNpmTasks('grunt-contrib-concat')
  grunt.loadNpmTasks('grunt-contrib-uglify')
  grunt.loadNpmTasks('grunt-contrib-jasmine')
  grunt.loadNpmTasks('grunt-contrib-watch')

  grunt.registerTask('default', ['concat', 'uglify', 'jasmine', 'usebanner'])
  grunt.registerTask('test', ['jasmine'])
};<commit_msg>remove jasmine from default grunt task<commit_after>module.exports = function (grunt) {

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

    concat: {
      dist: {
        src: [
          'src/export-top.js',
          'src/vars.js',
          'src/poker.js',
          'src/export-bot.js'
        ],
        dest: 'dist/disbranded.poker.js'
      }
    },

    jasmine: {
      src: 'dist/disbranded.poker-min.js',
      options: {
        specs: 'spec/*.js'
      }
    },

    uglify: {
      min: {
        options: {},
        files: {
          'dist/disbranded.poker-min.js': ['dist/disbranded.poker.js']
        }
      }
    },

    usebanner: {
      dist: {
        options: {
          position: 'top',
          banner: '/*\n' +
                  ' * <%= pkg.name %> v<%= pkg.version %>\n' +
                  ' * by <%= pkg.author.name %> / <%= pkg.author.email %>\n' +
                  ' * last updated <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                  '**/\n',
          linebreak: false
        },
        files: {
          dist: ['dist/disbranded.poker.js', 'dist/disbranded.poker-min.js']
        }
      }
    },

    watch: {
      test: {
        files: ['src/*.js'],
        tasks: ['default']
      }
    }
  })

  grunt.loadNpmTasks('grunt-banner')
  grunt.loadNpmTasks('grunt-contrib-concat')
  grunt.loadNpmTasks('grunt-contrib-uglify')
  grunt.loadNpmTasks('grunt-contrib-jasmine')
  grunt.loadNpmTasks('grunt-contrib-watch')

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


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

  grunt.loadNpmTasks('grunt-tizen');
  grunt.loadNpmTasks('grunt-crosswalk');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadTasks('tools/grunt-tasks');

  grunt.initConfig({
    packageInfo: grunt.file.readJSON('package.json'),
    chromeInfo: grunt.file.readJSON('platforms/chrome-crx/manifest.json'),

    crosswalk: {
      shared: {
        "outDir": 'build',
        verbose: false,
        version: '<%= packageInfo.version %>',
        name: '<%= packageInfo.name %>',
        pkg: 'org.org01.webapps.<%= packageInfo.name.toLowerCase() %>',
        icon: 'icon_128.png',
        fullscreen: true,
        remoteDebugging: true,
        appRoot: 'build/xpk',
        appLocalPath: 'index.html',
        embedded: false
        //androidSDKDir: '/opt/android-sdk-linux/',
        //xwalkAndroidDir: process.env.HOME+'/Downloads/crosswalk-3.32.53.4-arm'
        //arch: 'arm',
        //androidAPIVersion: "18.0.1"
      },
      arm: {
        "outDir": 'build',
        verbose: false,
        version: '<%= packageInfo.version %>',
        name: '<%= packageInfo.name %>',
        pkg: 'org.org01.webapps.<%= packageInfo.name.toLowerCase() %>',
        icon: 'icon_128.png',
        fullscreen: true,
        remoteDebugging: true,
        appRoot: 'build/xpk',
        appLocalPath: 'index.html',
        //embedded: true,
        //androidSDKDir: '/opt/android-sdk-linux/',
        //xwalkAndroidDir: process.env.HOME+'/Downloads/crosswalk-3.32.53.4-arm'
        arch: 'arm',
        //androidAPIVersion: "18.0.1"
      },
      x86: {
        "outDir": 'build',
        verbose: false,
        version: '<%= packageInfo.version %>',
        name: '<%= packageInfo.name %>',
        pkg: 'org.org01.webapps.<%= packageInfo.name.toLowerCase() %>',
        icon: 'icon_128.png',
        fullscreen: true,
        remoteDebugging: true,
        appRoot: 'build/xpk',
        appLocalPath: 'index.html',
        //embedded: true,
        //androidSDKDir: '/opt/android-sdk-linux/',
        //xwalkAndroidDir: process.env.HOME+'/Downloads/crosswalk-3.32.53.4-x86'
        arch: 'x86',
        //androidAPIVersion: "18.0.1"
      }
    },

    clean: ['build'],

    release: {
      options: {
        npm: false,
        npmtag: false,
        tagName: 'v<%= version %>'
      }
    },

    tizen_configuration: {
      // location on the device to install the tizen-app.sh script to
      // (default: '/tmp')
      tizenAppScriptDir: '/home/developer/',

      // path to the config.xml file for the Tizen wgt file - post templating
      // (default: 'config.xml')
      configFile: 'build/wgt/config.xml',

      // path to the sdb command (default: process.env.SDB or 'sdb')
      sdbCmd: 'sdb'
    },

    // minify JS
    uglify: {
      dist: {
        files: [
          { expand: true, cwd: '.', src: 'app/js/**/*.js', dest: 'build/' }
        ]
      }
    },

    // minify CSS
    cssmin: {
      dist: {
        files: [
          { expand: true, cwd: '.', src: ['app/css/**/*.css'], dest: 'build/' }
        ]
      }
    },

    copy: {
      common: {
        files: [
          { expand: true, cwd: '.', src: ['app/lib/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/audio/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/data/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['LICENSE'], dest: 'build/app/' },
          { expand: true, cwd: '.', src: ['app/README.txt'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/_locales/**'], dest: 'build/' }
        ]
      },

      wgt: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/wgt/' },
          { expand: true, cwd: '.', src: ['icon_128.png'], dest: 'build/wgt/' }
        ]
      },

      wgt_config: {
        files: [
          { expand: true, cwd: 'platforms/tizen-wgt/', src: ['config.xml'], dest: 'build/wgt/' }
        ],
        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }
      },

      crx: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/crx/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/crx/' }
        ]
      },

      crx_unpacked: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/crx/' },
          { expand: true, cwd: 'app/', src: ['js/**'], dest: 'build/crx/' },
          { expand: true, cwd: 'app/', src: ['css/**'], dest: 'build/crx/' },
          { expand: true, cwd: 'app/', src: ['*.html'], dest: 'build/crx/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/crx/' }
        ]
      },

      crx_manifest:
      {
        files: [
          { expand: true, cwd: 'platforms/chrome-crx/', src: ['manifest.json'], dest: 'build/crx/' }
        ],

        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }

      },

      xpk: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/xpk/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/xpk/' }
        ]
      },

      xpk_manifest:
      {
        files: [
          { expand: true, cwd: 'platforms/tizen-xpk/', src: ['manifest.json'], dest: 'build/xpk/' }
        ],

        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }

      },

      sdk: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/sdk/' },
          { expand: true, cwd: 'app/', src: ['js/**'], dest: 'build/sdk/' },
          { expand: true, cwd: 'app/', src: ['css/**'], dest: 'build/sdk/' },
          { expand: true, cwd: 'app/', src: ['*.html'], dest: 'build/sdk/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/sdk/' }
        ]
      },

      sdk_platform:
      {
        files: [
          { expand: true, cwd: 'platforms/tizen-sdk/', src: ['.project'], dest: 'build/sdk/' },
          { expand: true, cwd: 'platforms/tizen-wgt/', src: ['config.xml'], dest: 'build/sdk/' }
        ],

        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }

      },

    },

    htmlmin: {
      dist: {
        files: [
          { expand: true, cwd: '.', src: ['app/*.html'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/html/*.html'], dest: 'build/' }
        ],
        options: {
          removeComments: true,
          collapseWhitespace: true,
          removeCommentsFromCDATA: false,
          removeCDATASectionsFromCDATA: false,
          removeEmptyAttributes: true,
          removeEmptyElements: false
        }
      }
    },

    imagemin: {
      dist: {
        options: {
          optimizationLevel: 3,
          progressive: true
        },
        files: [
          { expand: true, cwd: '.', src: ['app/images/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/css/images/**'], dest: 'build/' }
        ]
      }
    },

    // make wgt package in build/ directory
    package: {
      wgt: {
        appName: '<%= packageInfo.name %>',
        version: '<%= packageInfo.version %>',
        files: 'build/wgt/**',
        stripPrefix: 'build/wgt/',
        outDir: 'build',
        suffix: '.wgt',
        addGitCommitId: false
      },
      sdk: {
        appName: '<%= packageInfo.name %>',
        version: '<%= packageInfo.version %>',
        files: 'build/sdk/**',
        stripPrefix: 'build/sdk/',
        outDir: 'build',
        suffix: '.zip'
      },
      'crx_zip': {
        appName: '<%= packageInfo.name %>-crx',
        version: '<%= packageInfo.version %>',
        files: 'build/crx/**',
        stripPrefix: 'build/crx/',
        outDir: 'build',
        suffix: '.zip'
      }
    },

    simple_server: {
      port: 30303,
      dir: 'build/app/'
    },

    tizen: {
      push: {
        action: 'push',
        localFiles: {
          pattern: 'build/*.wgt',
          filter: 'latest'
        },
        remoteDir: '/home/developer/'
      },

      install: {
        action: 'install',
        remoteFiles: {
          pattern: '/home/developer/<%= packageInfo.name %>*.wgt',
          filter: 'latest'
        }
      },

      uninstall: {
        action: 'uninstall'
      },

      start: {
        action: 'start',
        stopOnFailure: true
      },

      stop: {
        action: 'stop',
        stopOnFailure: false
      },

      debug: {
        action: 'debug',
        browserCmd: 'google-chrome %URL%',
        localPort: 9090,
        stopOnFailure: true
      }
    }
  });

  grunt.registerTask('dist', [
    'clean',
    'imagemin:dist',
    'uglify:dist',
    'cssmin:dist',
    'htmlmin:dist',
    'copy:common'
  ]);

  grunt.registerTask('crx', ['dist', 'copy:crx', 'copy:crx_manifest']);
  grunt.registerTask('crx_unpacked', [
    'clean',
    'imagemin:dist',
    'copy:common',
    'copy:crx_unpacked',
    'copy:crx_manifest',
    'package:crx_zip'
  ]);
  grunt.registerTask('wgt', ['dist', 'copy:wgt', 'copy:wgt_config', 'package:wgt']);
  grunt.registerTask('xpk', ['dist', 'copy:xpk', 'copy:xpk_manifest']);
  grunt.registerTask('sdk', [
    'clean',
    'imagemin:dist',
    'copy:common',
    'copy:sdk',
    'copy:sdk_platform',
    'package:sdk'
  ]);

  grunt.registerTask('perf', [
    'dist',
    'uglify:perf',
    'inline',
    'copy:wgt',
    'copy:wgt_config',
    'package:wgt'
  ]);

  grunt.registerTask('install', [
    'tizen:push',
    'tizen:stop',
    'tizen:uninstall',
    'tizen:install',
    'tizen:start'
  ]);

  grunt.registerTask('wait', function () {
    var done = this.async();
    setTimeout(function () {
      done();
    }, 10000);
  });

  grunt.registerTask('restart', ['tizen:stop', 'tizen:start']);

  grunt.registerTask('server', ['dist', 'simple_server']);

  grunt.registerTask('wgt-install', ['wgt', 'install']);
  grunt.registerTask('sdk-install', ['sdk', 'install']);

  grunt.registerTask('default', 'wgt');
  grunt.registerTask('apk', [
    'xpk',
    'crosswalk:x86',
    'crosswalk:arm'
  ]);
};
<commit_msg>Moving common parts of crosswalk targets into options<commit_after>module.exports = function (grunt) {

  grunt.loadNpmTasks('grunt-tizen');
  grunt.loadNpmTasks('grunt-crosswalk');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadTasks('tools/grunt-tasks');

  grunt.initConfig({
    packageInfo: grunt.file.readJSON('package.json'),
    chromeInfo: grunt.file.readJSON('platforms/chrome-crx/manifest.json'),

    crosswalk: {
      options: {
        outDir: 'build',
        verbose: false,
        version: '<%= packageInfo.version %>',
        name: '<%= packageInfo.name %>',
        pkg: 'org.org01.webapps.<%= packageInfo.name.toLowerCase() %>',
        icon: 'icon_128.png',
        fullscreen: true,
        remoteDebugging: true,
        appRoot: 'build/xpk',
        appLocalPath: 'index.html',
      },
      shared: {
        // no arch for shared
      },
      arm: {
        arch: 'arm',
      },
      x86: {
        arch: 'x86',
      }
    },

    clean: ['build'],

    release: {
      options: {
        npm: false,
        npmtag: false,
        tagName: 'v<%= version %>'
      }
    },

    tizen_configuration: {
      // location on the device to install the tizen-app.sh script to
      // (default: '/tmp')
      tizenAppScriptDir: '/home/developer/',

      // path to the config.xml file for the Tizen wgt file - post templating
      // (default: 'config.xml')
      configFile: 'build/wgt/config.xml',

      // path to the sdb command (default: process.env.SDB or 'sdb')
      sdbCmd: 'sdb'
    },

    // minify JS
    uglify: {
      dist: {
        files: [
          { expand: true, cwd: '.', src: 'app/js/**/*.js', dest: 'build/' }
        ]
      }
    },

    // minify CSS
    cssmin: {
      dist: {
        files: [
          { expand: true, cwd: '.', src: ['app/css/**/*.css'], dest: 'build/' }
        ]
      }
    },

    copy: {
      common: {
        files: [
          { expand: true, cwd: '.', src: ['app/lib/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/audio/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/data/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['LICENSE'], dest: 'build/app/' },
          { expand: true, cwd: '.', src: ['app/README.txt'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/_locales/**'], dest: 'build/' }
        ]
      },

      wgt: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/wgt/' },
          { expand: true, cwd: '.', src: ['icon_128.png'], dest: 'build/wgt/' }
        ]
      },

      wgt_config: {
        files: [
          { expand: true, cwd: 'platforms/tizen-wgt/', src: ['config.xml'], dest: 'build/wgt/' }
        ],
        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }
      },

      crx: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/crx/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/crx/' }
        ]
      },

      crx_unpacked: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/crx/' },
          { expand: true, cwd: 'app/', src: ['js/**'], dest: 'build/crx/' },
          { expand: true, cwd: 'app/', src: ['css/**'], dest: 'build/crx/' },
          { expand: true, cwd: 'app/', src: ['*.html'], dest: 'build/crx/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/crx/' }
        ]
      },

      crx_manifest:
      {
        files: [
          { expand: true, cwd: 'platforms/chrome-crx/', src: ['manifest.json'], dest: 'build/crx/' }
        ],

        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }

      },

      xpk: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/xpk/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/xpk/' }
        ]
      },

      xpk_manifest:
      {
        files: [
          { expand: true, cwd: 'platforms/tizen-xpk/', src: ['manifest.json'], dest: 'build/xpk/' }
        ],

        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }

      },

      sdk: {
        files: [
          { expand: true, cwd: 'build/app/', src: ['**'], dest: 'build/sdk/' },
          { expand: true, cwd: 'app/', src: ['js/**'], dest: 'build/sdk/' },
          { expand: true, cwd: 'app/', src: ['css/**'], dest: 'build/sdk/' },
          { expand: true, cwd: 'app/', src: ['*.html'], dest: 'build/sdk/' },
          { expand: true, cwd: '.', src: ['icon*.png'], dest: 'build/sdk/' }
        ]
      },

      sdk_platform:
      {
        files: [
          { expand: true, cwd: 'platforms/tizen-sdk/', src: ['.project'], dest: 'build/sdk/' },
          { expand: true, cwd: 'platforms/tizen-wgt/', src: ['config.xml'], dest: 'build/sdk/' }
        ],

        options:
        {
          processContent: function(content, srcpath)
          {
            return grunt.template.process(content);
          }
        }

      },

    },

    htmlmin: {
      dist: {
        files: [
          { expand: true, cwd: '.', src: ['app/*.html'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/html/*.html'], dest: 'build/' }
        ],
        options: {
          removeComments: true,
          collapseWhitespace: true,
          removeCommentsFromCDATA: false,
          removeCDATASectionsFromCDATA: false,
          removeEmptyAttributes: true,
          removeEmptyElements: false
        }
      }
    },

    imagemin: {
      dist: {
        options: {
          optimizationLevel: 3,
          progressive: true
        },
        files: [
          { expand: true, cwd: '.', src: ['app/images/**'], dest: 'build/' },
          { expand: true, cwd: '.', src: ['app/css/images/**'], dest: 'build/' }
        ]
      }
    },

    // make wgt package in build/ directory
    package: {
      wgt: {
        appName: '<%= packageInfo.name %>',
        version: '<%= packageInfo.version %>',
        files: 'build/wgt/**',
        stripPrefix: 'build/wgt/',
        outDir: 'build',
        suffix: '.wgt',
        addGitCommitId: false
      },
      sdk: {
        appName: '<%= packageInfo.name %>',
        version: '<%= packageInfo.version %>',
        files: 'build/sdk/**',
        stripPrefix: 'build/sdk/',
        outDir: 'build',
        suffix: '.zip'
      },
      'crx_zip': {
        appName: '<%= packageInfo.name %>-crx',
        version: '<%= packageInfo.version %>',
        files: 'build/crx/**',
        stripPrefix: 'build/crx/',
        outDir: 'build',
        suffix: '.zip'
      }
    },

    simple_server: {
      port: 30303,
      dir: 'build/app/'
    },

    tizen: {
      push: {
        action: 'push',
        localFiles: {
          pattern: 'build/*.wgt',
          filter: 'latest'
        },
        remoteDir: '/home/developer/'
      },

      install: {
        action: 'install',
        remoteFiles: {
          pattern: '/home/developer/<%= packageInfo.name %>*.wgt',
          filter: 'latest'
        }
      },

      uninstall: {
        action: 'uninstall'
      },

      start: {
        action: 'start',
        stopOnFailure: true
      },

      stop: {
        action: 'stop',
        stopOnFailure: false
      },

      debug: {
        action: 'debug',
        browserCmd: 'google-chrome %URL%',
        localPort: 9090,
        stopOnFailure: true
      }
    }
  });

  grunt.registerTask('dist', [
    'clean',
    'imagemin:dist',
    'uglify:dist',
    'cssmin:dist',
    'htmlmin:dist',
    'copy:common'
  ]);

  grunt.registerTask('crx', ['dist', 'copy:crx', 'copy:crx_manifest']);
  grunt.registerTask('crx_unpacked', [
    'clean',
    'imagemin:dist',
    'copy:common',
    'copy:crx_unpacked',
    'copy:crx_manifest',
    'package:crx_zip'
  ]);
  grunt.registerTask('wgt', ['dist', 'copy:wgt', 'copy:wgt_config', 'package:wgt']);
  grunt.registerTask('xpk', ['dist', 'copy:xpk', 'copy:xpk_manifest']);
  grunt.registerTask('sdk', [
    'clean',
    'imagemin:dist',
    'copy:common',
    'copy:sdk',
    'copy:sdk_platform',
    'package:sdk'
  ]);

  grunt.registerTask('perf', [
    'dist',
    'uglify:perf',
    'inline',
    'copy:wgt',
    'copy:wgt_config',
    'package:wgt'
  ]);

  grunt.registerTask('install', [
    'tizen:push',
    'tizen:stop',
    'tizen:uninstall',
    'tizen:install',
    'tizen:start'
  ]);

  grunt.registerTask('wait', function () {
    var done = this.async();
    setTimeout(function () {
      done();
    }, 10000);
  });

  grunt.registerTask('restart', ['tizen:stop', 'tizen:start']);

  grunt.registerTask('server', ['dist', 'simple_server']);

  grunt.registerTask('wgt-install', ['wgt', 'install']);
  grunt.registerTask('sdk-install', ['sdk', 'install']);

  grunt.registerTask('default', 'wgt');
  grunt.registerTask('apk', [
    'xpk',
    'crosswalk:x86',
    'crosswalk:arm'
  ]);
};
<|endoftext|>


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

  var customLaunchers = {
    /*
    'SL_IE8': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '8.0',
      platform: 'windows XP'
    },
    'SL_EDGE': {
      base: 'SauceLabs',
      browserName: 'microsoftedge',
      version: 'latest',
      platform: 'windows 10'
    },
    'SL_SAFARI': {
      base: 'SauceLabs',
      browserName: 'safari',
      version: 'latest',
      platform: 'OS X 10.12'
    },
    */
    '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_CHROME': {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: 'latest',
      platform: 'windows 8'
    },
    'SL_FIREFOX': {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: 'latest',
      platform: 'windows 8'
    }
  };

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

    // bulid source(grunt-build.js).
    build: {
      bs3: {
        input: './src/js/bs3/settings',
        output: './dist/summernote.js'
      },
      bs4: {
        input: './src/js/bs4/settings',
        output: './dist/summernote-bs4.js'
      },
      lite: {
        input: './src/js/lite/settings',
        output: './dist/summernote-lite.js'
      }
    },

    // for javascript convention.
    eslint: {
      target: [
        'src/**/*.js',
        'plugin/**/*.js',
        'lang/**/*.js',
        'Gruntfile.js',
        'test/**/*.js',
        '!coverage/**/*.js',
        'build/*.js'
      ]
    },

    // uglify: minify javascript
    uglify: {
      options: {
        banner: '/*! Summernote v<%=pkg.version%> | (c) 2013- Alan Hong and other contributors | MIT license */\n'
      },
      all: {
        files: [
          { 'dist/summernote.min.js': ['dist/summernote.js'] },
          { 'dist/summernote-bs4.min.js': ['dist/summernote-bs4.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'],
            'dist/summernote-bs4.css': ['src/less/summernote-bs4.less'],
            'dist/summernote-lite.css': ['src/less/summernote-lite.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: {
      less: {
        files: ['src/less/*.less'],
        tasks: ['recess'],
        options: {
          livereload: true
        }
      },
      script: {
        files: ['src/js/**/*.js', 'test/unit/**/*.js'],
        tasks: ['lint', 'build', 'karma:all'],
        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: './karma.conf.js'
      },
      watch: {
        background: false,
        singleRun: false
      },
      all: {
        // Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS, IE
        singleRun: true,
        browsers: ['PhantomJS']
      },
      dist: {
        singleRun: true,
        browsers: ['PhantomJS']
      },
      travis: {
        singleRun: true,
        browsers: ['PhantomJS'],
        reporters: ['dots', '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: 'coverage/**/lcov.info'
      }
    },
    clean: {
      dist: ['dist/**/*']
    },
    copy: {
      dist: {
        files: [
          { src: 'lang/*', dest: 'dist/' },
          { expand: true, cwd: 'src/icons/dist/font/', src: ['**', '!*.html'], dest: 'dist/font/' }
        ]
      }
    },
    webfont: {
      icons: {
        src: 'src/icons/*.svg',
        dest: 'src/icons/dist/font',
        destCss: 'src/icons/dist/',
        options: {
          font: 'summernote',
          relativeFontPath: './font/',
          stylesheet: 'less',
          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', ['eslint']);

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

  // 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>Exclude test/coverage folder to prevent lint errors by external sources<commit_after>module.exports = function(grunt) {
  'use strict';

  var customLaunchers = {
    /*
    'SL_IE8': {
      base: 'SauceLabs',
      browserName: 'internet explorer',
      version: '8.0',
      platform: 'windows XP'
    },
    'SL_EDGE': {
      base: 'SauceLabs',
      browserName: 'microsoftedge',
      version: 'latest',
      platform: 'windows 10'
    },
    'SL_SAFARI': {
      base: 'SauceLabs',
      browserName: 'safari',
      version: 'latest',
      platform: 'OS X 10.12'
    },
    */
    '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_CHROME': {
      base: 'SauceLabs',
      browserName: 'chrome',
      version: 'latest',
      platform: 'windows 8'
    },
    'SL_FIREFOX': {
      base: 'SauceLabs',
      browserName: 'firefox',
      version: 'latest',
      platform: 'windows 8'
    }
  };

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

    // bulid source(grunt-build.js).
    build: {
      bs3: {
        input: './src/js/bs3/settings',
        output: './dist/summernote.js'
      },
      bs4: {
        input: './src/js/bs4/settings',
        output: './dist/summernote-bs4.js'
      },
      lite: {
        input: './src/js/lite/settings',
        output: './dist/summernote-lite.js'
      }
    },

    // for javascript convention.
    eslint: {
      target: [
        'src/**/*.js',
        'plugin/**/*.js',
        'lang/**/*.js',
        'Gruntfile.js',
        'test/**/*.js',
        '!coverage/**/*.js',
        '!test/coverage/**/*.js',
        'build/*.js'
      ]
    },

    // uglify: minify javascript
    uglify: {
      options: {
        banner: '/*! Summernote v<%=pkg.version%> | (c) 2013- Alan Hong and other contributors | MIT license */\n'
      },
      all: {
        files: [
          { 'dist/summernote.min.js': ['dist/summernote.js'] },
          { 'dist/summernote-bs4.min.js': ['dist/summernote-bs4.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'],
            'dist/summernote-bs4.css': ['src/less/summernote-bs4.less'],
            'dist/summernote-lite.css': ['src/less/summernote-lite.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: {
      less: {
        files: ['src/less/*.less'],
        tasks: ['recess'],
        options: {
          livereload: true
        }
      },
      script: {
        files: ['src/js/**/*.js', 'test/unit/**/*.js'],
        tasks: ['lint', 'build', 'karma:all'],
        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: './karma.conf.js'
      },
      watch: {
        background: false,
        singleRun: false
      },
      all: {
        // Chrome, ChromeCanary, Firefox, Opera, Safari, PhantomJS, IE
        singleRun: true,
        browsers: ['PhantomJS']
      },
      dist: {
        singleRun: true,
        browsers: ['PhantomJS']
      },
      travis: {
        singleRun: true,
        browsers: ['PhantomJS'],
        reporters: ['dots', '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: 'coverage/**/lcov.info'
      }
    },
    clean: {
      dist: ['dist/**/*']
    },
    copy: {
      dist: {
        files: [
          { src: 'lang/*', dest: 'dist/' },
          { expand: true, cwd: 'src/icons/dist/font/', src: ['**', '!*.html'], dest: 'dist/font/' }
        ]
      }
    },
    webfont: {
      icons: {
        src: 'src/icons/*.svg',
        dest: 'src/icons/dist/font',
        destCss: 'src/icons/dist/',
        options: {
          font: 'summernote',
          relativeFontPath: './font/',
          stylesheet: 'less',
          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', ['eslint']);

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

  // 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) {
  'use strict';

  // displays the elapsed execution time of grunt tasks when done
  require('time-grunt')(grunt);
  // only load the plugins required for each task
  require('jit-grunt')(grunt, {
    bower: 'grunt-bower-task',
    simplemocha: 'grunt-simple-mocha'
  });

  // define some app specific options
  var ops = {

    // output filenames:
    // main.js
    name: {
      js: 'main'
    },

    // input filenames:
    // main.js requires the rest of the javascript files
    src: {
      js: 'main'
    },

    // don't change options below here
    // _____________________________

    // options for built directory naming
    built: {
      js: 'app.browserify',
      test: 'tests.browserify'
    }
  };

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

    // deletes files
    clean: {
      scripts: ['public/js'],
      styles: ['public/css'],
      templates: ['public/**/*.html'],
      img: ['public/img'],
      dev: {
        src: ['public', 'build']
      },
      prod: ['dist']
    },

    // copies files
    // TODO(joe) would be nice to create copy:dev from copy:scripts, copy:styles, etc to improve code resuse
    copy: {
      scripts: {
        files: [{
          src: 'build/<%= ops.built.js %>.js',
          dest: 'public/js/<%= ops.name.js %>.js'
        }]
      },
      fonts: {
        files: [{
          expand: true,
          cwd: 'client/fonts',
          src: '**/*',
          dest: 'public/fonts'
        },
        {
          expand: true,
          cwd: 'client/requires/fontawesome/fonts',
          src: '**/*',
          dest: 'public/fonts'
        }]
      },
      img: {
        files: [{
          expand: true,
          cwd: 'client/img',
          src: '**/*',
          dest: 'public/img'
        }]
      },
      dev: {
        files: [{
          src: 'build/<%= ops.built.js %>.js',
          dest: 'public/js/<%= ops.name.js %>.js'
        },
        {
          expand: true,
          cwd: 'client/fonts',
          src: '**/*',
          dest: 'public/fonts'
        },
        {
          expand: true,
          cwd: 'client/requires/fontawesome/fonts',
          src: '**/*',
          dest: 'public/fonts'
        },
        {
          expand: true,
          cwd: 'client/img',
          src: '**/*',
          dest: 'public/img'
        }]
      },
      prod: {
        files: [{
          expand: true,
          cwd: 'client/fonts',
          src: '**/*',
          dest: 'dist/fonts'
        },
        {
          expand: true,
          cwd: 'client/requires/fontawesome/fonts',
          src: '**/*',
          dest: 'dist/fonts'
        },
        {
          expand: true,
          cwd: 'client/img',
          src: '**/*',
          dest: 'dist/img'
        }]
      }
    },

    // front end package manager
    // like npm but for the front end
    bower: {
      install: {
        options: {
          targetDir: 'client/requires',
          layout: 'byComponent'
        }
      }
    },

    // front end dependency management
    // use node require() style to include modules
    // note: vendor.js includes all javascript from dependencies in bower.json
    // but we're ignoring the bootstrap js files
    browserify: {
      app: {
        files: {
          'build/<%= ops.built.js %>.js': [
            'client/src/lib.js',
            'client/src/main.js'
          ]
        },
        options: {
          // browserify-shim makes CommonJS-incompatible files browserifyable
          // hbsfy allows you to require handlebars templates in your javascript
          transform: ['browserify-shim', 'hbsfy'],
          watch: true
        }
      },
      test: {
        files: {
          'build/<%= ops.built.test %>.js': [
            'client/spec/**/*.test.js'
          ]
        },
        options: {
          transform: ['browserify-shim', 'hbsfy'],
          watch: true
        }
      }
    },

    // checks for good JavaScript coding practices
    jshint: {
      all: ['Gruntfile.js', 'client/src/**/*.js', 'client/spec/**/*.js'],
      dev: ['client/src/**/*.js'],
      test: ['client/spec/**/*.js'],
      server: ['Gruntfile.js', 'spec/**/*.js'],
      options: {
        debug: true,
        smarttabs: true
      }
    },

    // compiles less files to css files
    less: {
      dev: {
        files: [{
          expand: true,
          cwd: 'client/pages',
          src: ['**/*.less'],
          dest: 'public',
          ext: '.css'
        }]
      },
      prod: {
        options: {
          cleancss: true
        },
        files: [{
          expand: true,
          cwd: 'client/pages',
          src: ['**/*.less'],
          dest: 'dist',
          ext: '.css'
        }]
      }
    },

    // precompiles handlebars templates to html on the server
    // TODO(joe) check this for helpers and partials
    'compile-handlebars': {
      dev: {
        template: 'client/templates/views/**/*.hbs',
        templateData: 'client/templates/views/**/*.json',
        output: 'public/**/*.html',
        //helpers: 'client/templates/helpers/**/*.js',
        //partials: 'client/templates/partials/**/*.hbs',
        globals: [
          'client/data/global.json'
        ]
      },
      prod: {
        template: 'client/templates/views/**/*.hbs',
        templateData: 'client/templates/views/**/*.json',
        output: 'dist/**/*.html',
        //helpers: 'client/templates/helpers/**/*.js',
        //partials: 'client/templates/partials/**/*.hbs',
        globals: [
          'client/data/global.json'
        ]
      }
    },

    // javascript minification
    // puts the file in /dist
    uglify: {
      compile: {
        options: {
          compress: true,
          verbose: true
        },
        files: [{
          src: 'build/<%= ops.built.js %>.js',
          dest: 'dist/js/<%= ops.name.js %>.js'
        }]
      }
    },

    // runs tasks when code changes
    // TODO(joe) test this and make sure it works
    // TODO(joe) test a watcher for images
    watch: {
      scripts: {
        files: ['client/src/**/*.js'],
        tasks: ['jshint:dev', 'clean:scripts', 'copy:scripts']
      },
      less: {
        files: ['client/styles/**/*.less'],
        tasks: ['clean:styles', 'less:transpile', 'copy:styles']
      },
      templates: {
        files: ['client/templates/views/**/*.hbs', 'client/templates/views/**/*.json', 'client/data/**/*.json'],
        tasks: ['clean:templates', 'compile-handlebars:dev']
      },
      karma: {
        files: ['build/<%= ops.built.test %>.js'],
        tasks: ['jshint:test', 'karma:watcher:run']
      }
    },

    // restarts server when server.js or watchedFolders files change
    nodemon: {
      dev: {
        script: 'server.js',
        options: {
          nodeArgs: ['--debug'],
          watch: ['server.js', 'Gruntfile.js'],
          ignore: [],
          env: {
            PORT: '3300'
          }
        }
      }
    },

    // run slow tasks concurrently to speed them up
    // can also run multiple blocking tasks (like nodemon and watch)
    concurrent: {
      dev: {
        tasks: ['nodemon:dev', 'watch:scripts', 'watch:less', 'watch:templates'],
        options: {
          logConcurrentOutput: true
        }
      },
      test: {
        tasks: ['watch:karma'],
        options: {
          logConcurrentOutput: true
        }
      }
    },

    // runs arbitrary shell commands
    // supports background processes
    shell: {

    },

    // runs server tests
    simplemocha: {
      options: {
        globals: ['expect', 'sinon'],
        timeout: 3000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'spec'
      },

      server: {
        src: ['spec/spechelper.js', 'spec/**/*.test.js']
      }
    },

    // for front-end tdd
    karma: {
      options: {
        configFile: 'karma.conf.js',
        files: [
          'build/<%= ops.built.test %>.js'
        ]
      },
      watcher: {
        background: true,
        singleRun: false
      },
      test: {
        singleRun: true
      }
    },

    // host site using github pages
    // puts dist directory in a gh-pages branch and pushes to origin remote
    'gh-pages': {
      options: {
        base: 'dist'
      },
      src: ['**']
    }

  });

  // cleans the build, then downloads front end packages
  grunt.registerTask('init:dev', ['clean', 'bower']);

  // builds dev
  // 1. deletes /public
  // 2. builds assets
  // 3. copies assets to /public
  // TODO(joe) consider not copying over images and other large files
  grunt.registerTask('build:dev', ['clean:dev', 'browserify:app', 'browserify:test', 'jshint:dev', 'less:dev', 'compile-handlebars:dev', 'copy:dev']);
  // builds prod
  grunt.registerTask('build:prod', ['clean:prod', 'browserify:app', 'jshint:all', 'less:prod', 'compile-handlebars:prod', 'uglify', 'copy:prod']);

  // builds dev then starts the server
  grunt.registerTask('server', ['build:dev', 'concurrent:dev']);
  // tests the server code
  grunt.registerTask('test:server', ['jshint:server', 'simplemocha:server']);

  // tests the client code
  grunt.registerTask('test:client', ['jshint:test', 'browserify:test', 'karma:test']);
  // continuously tests the client code when files change
  // TODO(joe): get this working
  grunt.registerTask('tdd', ['karma:watcher:start', 'concurrent:test']);

  // runs all the tests once
  grunt.registerTask('test', ['test:server', 'test:client']);

  // release the site via hosting on github pages
  grunt.registerTask('release', ['build:prod', 'gh-pages']);
};
<commit_msg>update watch<commit_after>module.exports = function(grunt) {
  'use strict';

  // displays the elapsed execution time of grunt tasks when done
  require('time-grunt')(grunt);
  // only load the plugins required for each task
  require('jit-grunt')(grunt, {
    bower: 'grunt-bower-task',
    simplemocha: 'grunt-simple-mocha'
  });

  // define some app specific options
  var ops = {

    // output filenames:
    // main.js
    name: {
      js: 'main'
    },

    // input filenames:
    // main.js requires the rest of the javascript files
    src: {
      js: 'main'
    },

    // don't change options below here
    // _____________________________

    // options for built directory naming
    built: {
      js: 'app.browserify',
      test: 'tests.browserify'
    }
  };

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

    // deletes files
    clean: {
      scripts: ['public/js'],
      styles: ['public/css'],
      templates: ['public/**/*.html'],
      img: ['public/img'],
      dev: {
        src: ['public', 'build']
      },
      prod: ['dist']
    },

    // copies files
    // TODO(joe) would be nice to create copy:dev from copy:scripts, copy:styles, etc to improve code resuse
    copy: {
      scripts: {
        files: [{
          src: 'build/<%= ops.built.js %>.js',
          dest: 'public/js/<%= ops.name.js %>.js'
        }]
      },
      fonts: {
        files: [{
          expand: true,
          cwd: 'client/fonts',
          src: '**/*',
          dest: 'public/fonts'
        },
        {
          expand: true,
          cwd: 'client/requires/fontawesome/fonts',
          src: '**/*',
          dest: 'public/fonts'
        }]
      },
      img: {
        files: [{
          expand: true,
          cwd: 'client/img',
          src: '**/*',
          dest: 'public/img'
        }]
      },
      dev: {
        files: [{
          src: 'build/<%= ops.built.js %>.js',
          dest: 'public/js/<%= ops.name.js %>.js'
        },
        {
          expand: true,
          cwd: 'client/fonts',
          src: '**/*',
          dest: 'public/fonts'
        },
        {
          expand: true,
          cwd: 'client/requires/fontawesome/fonts',
          src: '**/*',
          dest: 'public/fonts'
        },
        {
          expand: true,
          cwd: 'client/img',
          src: '**/*',
          dest: 'public/img'
        }]
      },
      prod: {
        files: [{
          expand: true,
          cwd: 'client/fonts',
          src: '**/*',
          dest: 'dist/fonts'
        },
        {
          expand: true,
          cwd: 'client/requires/fontawesome/fonts',
          src: '**/*',
          dest: 'dist/fonts'
        },
        {
          expand: true,
          cwd: 'client/img',
          src: '**/*',
          dest: 'dist/img'
        }]
      }
    },

    // front end package manager
    // like npm but for the front end
    bower: {
      install: {
        options: {
          targetDir: 'client/requires',
          layout: 'byComponent'
        }
      }
    },

    // front end dependency management
    // use node require() style to include modules
    // note: vendor.js includes all javascript from dependencies in bower.json
    // but we're ignoring the bootstrap js files
    browserify: {
      app: {
        files: {
          'build/<%= ops.built.js %>.js': [
            'client/src/lib.js',
            'client/src/main.js'
          ]
        },
        options: {
          // browserify-shim makes CommonJS-incompatible files browserifyable
          // hbsfy allows you to require handlebars templates in your javascript
          transform: ['browserify-shim', 'hbsfy'],
          watch: true
        }
      },
      test: {
        files: {
          'build/<%= ops.built.test %>.js': [
            'client/spec/**/*.test.js'
          ]
        },
        options: {
          transform: ['browserify-shim', 'hbsfy'],
          watch: true
        }
      }
    },

    // checks for good JavaScript coding practices
    jshint: {
      all: ['Gruntfile.js', 'client/src/**/*.js', 'client/spec/**/*.js'],
      dev: ['client/src/**/*.js'],
      test: ['client/spec/**/*.js'],
      server: ['Gruntfile.js', 'spec/**/*.js'],
      options: {
        debug: true,
        smarttabs: true
      }
    },

    // compiles less files to css files
    less: {
      dev: {
        files: [{
          expand: true,
          cwd: 'client/pages',
          src: ['**/*.less'],
          dest: 'public',
          ext: '.css'
        }]
      },
      prod: {
        options: {
          cleancss: true
        },
        files: [{
          expand: true,
          cwd: 'client/pages',
          src: ['**/*.less'],
          dest: 'dist',
          ext: '.css'
        }]
      }
    },

    // precompiles handlebars templates to html on the server
    // TODO(joe) check this for helpers and partials
    'compile-handlebars': {
      dev: {
        template: 'client/pages/**/*.hbs',
        templateData: 'client/templates/views/**/*.json',
        output: 'public/**/*.html',
        //helpers: 'client/templates/helpers/**/*.js',
        //partials: 'client/templates/partials/**/*.hbs',
        globals: [
          'client/data/global.json'
        ]
      },
      prod: {
        template: 'client/pages/**/*.hbs',
        templateData: 'client/templates/views/**/*.json',
        output: 'dist/**/*.html',
        //helpers: 'client/templates/helpers/**/*.js',
        //partials: 'client/templates/partials/**/*.hbs',
        globals: [
          'client/data/global.json'
        ]
      }
    },

    // javascript minification
    // puts the file in /dist
    uglify: {
      compile: {
        options: {
          compress: true,
          verbose: true
        },
        files: [{
          src: 'build/<%= ops.built.js %>.js',
          dest: 'dist/js/<%= ops.name.js %>.js'
        }]
      }
    },

    // runs tasks when code changes
    // TODO(joe) test this and make sure it works
    // TODO(joe) test a watcher for images
    watch: {
      scripts: {
        files: ['client/src/**/*.js'],
        tasks: ['jshint:dev', 'clean:scripts', 'copy:scripts']
      },
      less: {
        files: ['client/pages/**/*.less', 'client/styles/**/*.less'],
        tasks: ['clean:styles', 'less:dev']
      },
      templates: {
        files: ['client/pages/**/*.hbs', 'client/pages/**/*.json', 'client/data/**/*.json', 'client/templates/**/*.hbs'],
        tasks: ['clean:templates', 'compile-handlebars:dev']
      },
      karma: {
        files: ['build/<%= ops.built.test %>.js'],
        tasks: ['jshint:test', 'karma:watcher:run']
      }
    },

    // restarts server when server.js or watchedFolders files change
    nodemon: {
      dev: {
        script: 'server.js',
        options: {
          nodeArgs: ['--debug'],
          watch: ['server.js', 'Gruntfile.js'],
          ignore: [],
          env: {
            PORT: '3300'
          }
        }
      }
    },

    // run slow tasks concurrently to speed them up
    // can also run multiple blocking tasks (like nodemon and watch)
    concurrent: {
      dev: {
        tasks: ['nodemon:dev', 'watch:scripts', 'watch:less', 'watch:templates'],
        options: {
          logConcurrentOutput: true
        }
      },
      test: {
        tasks: ['watch:karma'],
        options: {
          logConcurrentOutput: true
        }
      }
    },

    // runs arbitrary shell commands
    // supports background processes
    shell: {

    },

    // runs server tests
    simplemocha: {
      options: {
        globals: ['expect', 'sinon'],
        timeout: 3000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'spec'
      },

      server: {
        src: ['spec/spechelper.js', 'spec/**/*.test.js']
      }
    },

    // for front-end tdd
    karma: {
      options: {
        configFile: 'karma.conf.js',
        files: [
          'build/<%= ops.built.test %>.js'
        ]
      },
      watcher: {
        background: true,
        singleRun: false
      },
      test: {
        singleRun: true
      }
    },

    // host site using github pages
    // puts dist directory in a gh-pages branch and pushes to origin remote
    'gh-pages': {
      options: {
        base: 'dist'
      },
      src: ['**']
    }

  });

  // cleans the build, then downloads front end packages
  grunt.registerTask('init:dev', ['clean', 'bower']);

  // builds dev
  // 1. deletes /public
  // 2. builds assets
  // 3. copies assets to /public
  // TODO(joe) consider not copying over images and other large files
  grunt.registerTask('build:dev', ['clean:dev', 'browserify:app', 'browserify:test', 'jshint:dev', 'less:dev', 'compile-handlebars:dev', 'copy:dev']);
  // builds prod
  grunt.registerTask('build:prod', ['clean:prod', 'browserify:app', 'jshint:all', 'less:prod', 'compile-handlebars:prod', 'uglify', 'copy:prod']);

  // builds dev then starts the server
  grunt.registerTask('server', ['build:dev', 'concurrent:dev']);
  // tests the server code
  grunt.registerTask('test:server', ['jshint:server', 'simplemocha:server']);

  // tests the client code
  grunt.registerTask('test:client', ['jshint:test', 'browserify:test', 'karma:test']);
  // continuously tests the client code when files change
  // TODO(joe): get this working
  grunt.registerTask('tdd', ['karma:watcher:start', 'concurrent:test']);

  // runs all the tests once
  grunt.registerTask('test', ['test:server', 'test:client']);

  // release the site via hosting on github pages
  grunt.registerTask('release', ['build:prod', 'gh-pages']);
};
<|endoftext|>