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

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: [
        'js/app/**/*.js',
        'js/shims/**/*.js',
        'test/*.js'
      ],
      options: {
        globals: {
          console: true,
          module: true,
          require: true,
          navigator: true,
          Parse: true,
          document: true
        },
        undef: true,
        debug: true
      }
    },
    watch: {
      files: [
        'Gruntfile.js',
        '<%= jshint.files %>',
        'js/app/**/*.hbs',
        'css/**/*.scss',
        'test/**/*.js',
        'html/*.html',
        'vendor/**/*'
      ],
      tasks: ['default'],
    },
    simplemocha: {
      options: {
        timeout: 3000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'list'
      },

      all: { src: ['test/**/*.js'] }
    },
    sass: {
      dist: {
        files: {
          'css/static/user.css': ['css/common.scss', 'vendor/css/icons.css', 'css/user/**/*.scss'],
          'css/static/admin.css':  ['css/common.scss', 'vendor/css/icons.css', 'css/admin/**/*.scss']
        }
      }
    },
    cachebuster: {
      index: {
        files: [
          {
            src:  ['js/static/output.js', 'js/static/admin.js', 'css/static/user.css', 'css/static/admin.css'],
          }
        ],
        options: {

          complete: function(hashes) {
            // ugly but the only way to tag each file with a key
            var key_map = {
              'js/static/output.js': 'output_js',
              'js/static/admin.js': 'admin_js',
              'css/static/user.css': 'user_css',
              'css/static/admin.css': 'admin_css'
            };

            var context = {};
            var Handlebars = require('handlebars');

            Object.keys(hashes).forEach(function(key) {
              var outputFile = key + "-" + hashes[key];
              grunt.file.copy(key, outputFile);
              context[key_map[key]] = outputFile;
            });

            ["index.html", "admin.html"].forEach(function(file) {
              var template = Handlebars.compile(grunt.file.read("html/" + file));
              var output = template(context);
              output = "<!-- THIS FILE IS AUTO-GENERATED BY GRUNT.  DO NOT EDIT. -->\n" + output;
              grunt.file.write(file, output);
            });
          }
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-simple-mocha');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-cachebuster');

  var browserifyThings = function(entryPoint, outputJS) {
    var browserify  = require('browserify'),
        shim        = require('browserify-shim'),
        done        = this.async();

    // this will be the js src'd in <script> tags
    var output;

    // vendor js
    output = shim(browserify(), {
      jquery: {
        path: './vendor/js/jquery.min.js',
        exports: '$'
      },
      'jquery-serialize-object': {
        path: './vendor/js/jquery.serialize-object.js',
        exports: null
      },
      bootstrap: {
        path: './vendor/bootstrap/js/bootstrap.min.js',
        exports: null,
        depends: { jquery: '$' }
      }
    })
      .require('./js/shims/parse.js', {expose: 'parse'})
      .require('./js/shims/google-maps.js', {expose: 'google-maps'})
      .require('backbone')
      .require('underscore')
      .require('./vendor/js/backbone_filters.js', {expose: 'backbone-filters'})
      .require('./vendor/js/fastclick.min.js', {expose: 'fastclick'});

    // use hbsfy transform to support requiring .hbs files
    output = output.transform('hbsfy');

    // shared modules.
    // note: these are modules shared between the client and the server
    [
      './js/app/lib/*.js',
      './js/app/models/*.js'
    ].forEach(function(modules) {
      require('glob')(modules, function(er, files) {
        files.forEach(function(file) {
          var name = file
            .replace('./js/app/','')
            .replace(/\.(js|hbs)$/,'');

          output = output.require(file, {expose: "cloud/" + name});
        });
      });
    });

    // application modules
    [
      './js/app/lib/*.js',
      './js/app/models/*.js',
      './js/app/collections/*.js',
      './js/app/routers/*.js',
      './js/app/views/*.js',
      './js/app/templates/*.hbs'
    ].forEach(function(modules) {
      require('glob')(modules, function(er, files) {
        files.forEach(function(file) {
          var name = file
            .replace('./js/app/','')
            .replace(/\.(js|hbs)$/,'');

          output = output.require(file, {expose: name});
        });
      });
    });

    output.require(entryPoint, { entry: true });

    // now bundle it all up!
    output.bundle(function (err, src) {
      if (err) return console.error(err);

      require('fs').writeFileSync(outputJS, src);

      // keep grunt alive until the write stream completes
      done();
    });
  };

  grunt.registerTask('browserify', 'Browserify and concatenate app sources', function() {
    browserifyThings.call(this, "./js/app/index.js", "./js/static/output.js")
  });

  grunt.registerTask('browserify:admin', 'Browserify and concatenate admin sources', function() {
    browserifyThings.call(this, "./js/app/admin.js", "./js/static/admin.js")
  });

  grunt.registerTask('default', [
    'jshint',
    'simplemocha',
    'sass',
    'browserify',
    'browserify:admin',
    'cachebuster'
  ]);
};
<commit_msg>use base-SHA.js instead of base.js-SHA<commit_after>module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: [
        'js/app/**/*.js',
        'js/shims/**/*.js',
        'test/*.js'
      ],
      options: {
        globals: {
          console: true,
          module: true,
          require: true,
          navigator: true,
          Parse: true,
          document: true
        },
        undef: true,
        debug: true
      }
    },
    watch: {
      files: [
        'Gruntfile.js',
        '<%= jshint.files %>',
        'js/app/**/*.hbs',
        'css/**/*.scss',
        'test/**/*.js',
        'html/*.html',
        'vendor/**/*'
      ],
      tasks: ['default'],
    },
    simplemocha: {
      options: {
        timeout: 3000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'list'
      },

      all: { src: ['test/**/*.js'] }
    },
    sass: {
      dist: {
        files: {
          'css/static/user.css': ['css/common.scss', 'vendor/css/icons.css', 'css/user/**/*.scss'],
          'css/static/admin.css':  ['css/common.scss', 'vendor/css/icons.css', 'css/admin/**/*.scss']
        }
      }
    },
    cachebuster: {
      index: {
        files: [
          {
            src:  ['js/static/output.js', 'js/static/admin.js', 'css/static/user.css', 'css/static/admin.css'],
          }
        ],
        options: {

          complete: function(hashes) {
            // ugly but the only way to tag each file with a key
            var key_map = {
              'js/static/output.js': 'output_js',
              'js/static/admin.js': 'admin_js',
              'css/static/user.css': 'user_css',
              'css/static/admin.css': 'admin_css'
            };

            var context = {};
            var Handlebars = require('handlebars');

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

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

            ["index.html", "admin.html"].forEach(function(file) {
              var template = Handlebars.compile(grunt.file.read("html/" + file));
              var output = template(context);
              output = "<!-- THIS FILE IS AUTO-GENERATED BY GRUNT.  DO NOT EDIT. -->\n" + output;
              grunt.file.write(file, output);
            });
          }
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-simple-mocha');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-cachebuster');

  var browserifyThings = function(entryPoint, outputJS) {
    var browserify  = require('browserify'),
        shim        = require('browserify-shim'),
        done        = this.async();

    // this will be the js src'd in <script> tags
    var output;

    // vendor js
    output = shim(browserify(), {
      jquery: {
        path: './vendor/js/jquery.min.js',
        exports: '$'
      },
      'jquery-serialize-object': {
        path: './vendor/js/jquery.serialize-object.js',
        exports: null
      },
      bootstrap: {
        path: './vendor/bootstrap/js/bootstrap.min.js',
        exports: null,
        depends: { jquery: '$' }
      }
    })
      .require('./js/shims/parse.js', {expose: 'parse'})
      .require('./js/shims/google-maps.js', {expose: 'google-maps'})
      .require('backbone')
      .require('underscore')
      .require('./vendor/js/backbone_filters.js', {expose: 'backbone-filters'})
      .require('./vendor/js/fastclick.min.js', {expose: 'fastclick'});

    // use hbsfy transform to support requiring .hbs files
    output = output.transform('hbsfy');

    // shared modules.
    // note: these are modules shared between the client and the server
    [
      './js/app/lib/*.js',
      './js/app/models/*.js'
    ].forEach(function(modules) {
      require('glob')(modules, function(er, files) {
        files.forEach(function(file) {
          var name = file
            .replace('./js/app/','')
            .replace(/\.(js|hbs)$/,'');

          output = output.require(file, {expose: "cloud/" + name});
        });
      });
    });

    // application modules
    [
      './js/app/lib/*.js',
      './js/app/models/*.js',
      './js/app/collections/*.js',
      './js/app/routers/*.js',
      './js/app/views/*.js',
      './js/app/templates/*.hbs'
    ].forEach(function(modules) {
      require('glob')(modules, function(er, files) {
        files.forEach(function(file) {
          var name = file
            .replace('./js/app/','')
            .replace(/\.(js|hbs)$/,'');

          output = output.require(file, {expose: name});
        });
      });
    });

    output.require(entryPoint, { entry: true });

    // now bundle it all up!
    output.bundle(function (err, src) {
      if (err) return console.error(err);

      require('fs').writeFileSync(outputJS, src);

      // keep grunt alive until the write stream completes
      done();
    });
  };

  grunt.registerTask('browserify', 'Browserify and concatenate app sources', function() {
    browserifyThings.call(this, "./js/app/index.js", "./js/static/output.js")
  });

  grunt.registerTask('browserify:admin', 'Browserify and concatenate admin sources', function() {
    browserifyThings.call(this, "./js/app/admin.js", "./js/static/admin.js")
  });

  grunt.registerTask('default', [
    'jshint',
    'simplemocha',
    'sass',
    'browserify',
    'browserify:admin',
    'cachebuster'
  ]);
};
<|endoftext|>


<commit_before>/* global module:false */
module.exports = function(grunt) {
	var srcFiles = ['src/Init.js', 'src/util.js', 'src/Sca.js', 'src/Key.js', 'src/Event.js', 'src/IDBRequest.js', 'src/IDBKeyRange.js', 'src/IDBCursor.js', 'src/IDBIndex.js', 'src/IDBObjectStore.js', 'src/IDBTransaction.js', 'src/IDBDatabase.js', 'src/shimIndexedDB.js', 'src/globalVars.js'];
	// Project configuration.
	var saucekey = null;
	if (typeof process.env.saucekey !== "undefined") {
		saucekey = process.env.saucekey;
	}
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		concat: {
			dist: {
				src: srcFiles,
				dest: 'dist/<%= pkg.name%>.js'
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */\n',
				sourceMap: 'dist/<%=pkg.name%>.min.map',
				sourceMapRoot: 'http://nparashuram.com/IndexedDBShim/',
				sourceMappingURL: 'http://nparashuram.com/IndexedDBShim/dist/<%=pkg.name%>.min.map'
			},
			all: {
				src: srcFiles,
				dest: 'dist/<%=pkg.name%>.min.js',
			}
		},
		connect: {
			server: {
				options: {
					base: '.',
					port: 9999
				}
			}
		},
		qunit: {
			all: ['http://localhost:9999/test/index.html']
		},

		'saucelabs-qunit': {
			all: {
				options : {
					username: 'indexeddb',
					key: saucekey,
					tags: ['master'],
					urls: ['http://127.0.0.1:9999/test/index.html'],
					browsers: [{
						browserName: 'safari',
						platform: 'Windows 2008',
						version: '5'
					}, {
						browserName: 'opera',
						version: '12'
					}]
				}
			}
		},

		jshint: {
			files: ['grunt.js', 'src/**/*.js', 'test/**/*.js'],
			options: {
				jshintrc: '.jshintrc'
			}
		},
		watch: {
			dev: {
				files: ["src/*"],
				tasks: ["jshint", "concat"]
			}
		}
	});

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

	grunt.registerTask("publish", "Publish to gh-pages", function() {
		var done = this.async();
		console.log("Running publish action");
		var request = require("request");
		request("https://api.travis-ci.org/repos/axemclion/IndexedDBShim/builds.json", function(err, res, body) {
			var commit = JSON.parse(body)[0];
			var commitMessage = ["Commit from Travis Build #", commit.number, "\nBuild - https://travis-ci.org/axemclion/IndexedDBShim/builds/", commit.id, "\nBranch : ", commit.branch, "@ ", commit.commit];
			console.log("Got Travis Build details");
			request({
				url: "https://api.github.com/repos/axemclion/IndexedDBShim/merges?access_token=" + process.env.githubtoken,
				method: "POST",
				body: JSON.stringify({
					"base": "gh-pages",
					"head": "master",
					"commit_message": commitMessage.join("")
				})
			}, function(err, response, body) {
				console.log(body);
				done(!err);
			});
		});
	});

	grunt.registerTask('build', ['jshint', 'concat', 'uglify']);
	var testJobs = ["build", "connect"];
	if (saucekey !== null) {
		testJobs.push("saucelabs-qunit");
	}

	if (process.env.CI && process.env.TRAVIS) {
		testJobs.push("publish");
	}
	grunt.registerTask('test', testJobs);

	grunt.registerTask('default', 'build');
	grunt.registerTask('dev', ['build', 'connect', 'watch']);
};<commit_msg>Corrected saucelabs key<commit_after>/* global module:false */
module.exports = function(grunt) {
	var srcFiles = ['src/Init.js', 'src/util.js', 'src/Sca.js', 'src/Key.js', 'src/Event.js', 'src/IDBRequest.js', 'src/IDBKeyRange.js', 'src/IDBCursor.js', 'src/IDBIndex.js', 'src/IDBObjectStore.js', 'src/IDBTransaction.js', 'src/IDBDatabase.js', 'src/shimIndexedDB.js', 'src/globalVars.js'];
	// Project configuration.
	var saucekey = null;
	if (typeof process.env.saucekey !== "undefined") {
		saucekey = process.env.saucekey;
	}
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		concat: {
			dist: {
				src: srcFiles,
				dest: 'dist/<%= pkg.name%>.js'
			}
		},
		uglify: {
			options: {
				banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */\n',
				sourceMap: 'dist/<%=pkg.name%>.min.map',
				sourceMapRoot: 'http://nparashuram.com/IndexedDBShim/',
				sourceMappingURL: 'http://nparashuram.com/IndexedDBShim/dist/<%=pkg.name%>.min.map'
			},
			all: {
				src: srcFiles,
				dest: 'dist/<%=pkg.name%>.min.js',
			}
		},
		connect: {
			server: {
				options: {
					base: '.',
					port: 9999
				}
			}
		},
		qunit: {
			all: ['http://localhost:9999/test/index.html']
		},

		'saucelabs-qunit': {
			all: {
				options : {
					username: 'indexeddbshim',
					key: saucekey,
					tags: ['master'],
					urls: ['http://127.0.0.1:9999/test/index.html'],
					browsers: [{
						browserName: 'safari',
						platform: 'Windows 2008',
						version: '5'
					}, {
						browserName: 'opera',
						version: '12'
					}]
				}
			}
		},

		jshint: {
			files: ['grunt.js', 'src/**/*.js', 'test/**/*.js'],
			options: {
				jshintrc: '.jshintrc'
			}
		},
		watch: {
			dev: {
				files: ["src/*"],
				tasks: ["jshint", "concat"]
			}
		}
	});

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

	grunt.registerTask("publish", "Publish to gh-pages", function() {
		var done = this.async();
		console.log("Running publish action");
		var request = require("request");
		request("https://api.travis-ci.org/repos/axemclion/IndexedDBShim/builds.json", function(err, res, body) {
			var commit = JSON.parse(body)[0];
			var commitMessage = ["Commit from Travis Build #", commit.number, "\nBuild - https://travis-ci.org/axemclion/IndexedDBShim/builds/", commit.id, "\nBranch : ", commit.branch, "@ ", commit.commit];
			console.log("Got Travis Build details");
			request({
				url: "https://api.github.com/repos/axemclion/IndexedDBShim/merges?access_token=" + process.env.githubtoken,
				method: "POST",
				body: JSON.stringify({
					"base": "gh-pages",
					"head": "master",
					"commit_message": commitMessage.join("")
				})
			}, function(err, response, body) {
				console.log(body);
				done(!err);
			});
		});
	});

	grunt.registerTask('build', ['jshint', 'concat', 'uglify']);
	var testJobs = ["build", "connect"];
	if (saucekey !== null) {
		testJobs.push("saucelabs-qunit");
	}

	if (process.env.CI && process.env.TRAVIS) {
		testJobs.push("publish");
	}
	grunt.registerTask('test', testJobs);

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


<commit_before>'use strict';

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-contrib-watch'); //Run predefined tasks whenever watched file patterns are added, changed or deleted
    grunt.loadNpmTasks('grunt-contrib-clean'); //Clean files and folders
    grunt.loadNpmTasks('grunt-contrib-copy'); //Copy files and folders
    grunt.loadNpmTasks('grunt-contrib-concat'); //Concatenate files
    grunt.loadNpmTasks('grunt-mkdir'); //Create directories with Grunt
    grunt.loadNpmTasks('grunt-remove'); //Remove directory and files

    grunt.loadNpmTasks('grunt-usemin'); //Replaces references to non-optimized scripts or stylesheets into a set of HTML
    grunt.loadNpmTasks('grunt-ng-annotate'); //AngularJS dependency injection annotations
    grunt.loadNpmTasks('grunt-contrib-uglify'); //Minify files with UglifyJS
    grunt.loadNpmTasks('grunt-contrib-cssmin'); //Minify CSS

    grunt.loadNpmTasks('grunt-notify'); //Automatic desktop notifications for Grunt errors and warnings
    grunt.loadNpmTasks('grunt-cache-breaker'); //Cache-breaker, appends a timestamp or md5 hash to any urls
    grunt.loadNpmTasks('grunt-angular-templates'); //Concatenate & register your AngularJS templates in the $templateCache

    grunt.initConfig({
        clean: {
            build: ['dist', '.tmp']
        },

        copy: {
            build: {
                files: [
                    {
                        expand: true,
                        cwd: 'frontend',
                        src: [
                            'common/images/**',
                            '**/**/*.html'
                        ],
                        dest: 'dist'
                    },
                    {
                        expand: true,
                        cwd: 'frontend',
                        src: [
                            '*.html'
                        ],
                        dest: 'dist'
                    }
                ]
            },
            dist: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist',
                        src: '**',
                        dest: 'frontend'
                    }
                ]
            }
        },

        concat: {
            styles: {
                files: {
                    'dist/styles/vendors.css': [
                        'frontend/bower_components/angular-ui-grid/ui-grid.min.css',
                        'frontend/bower_components/angular-ui-notification/dist/angular-ui-notification.min.css',
                        'frontend/bower_components/bootstrap/dist/css/bootstrap.min.css',
                        'frontend/bower_components/bootstrap-daterangepicker/daterangepicker-bs3.css'
                    ],
                    'dist/styles/styles.css': [
                        'frontend/common/sass/styles.css',
                        'frontend/common/sass/bootstrap-mifort.css',
                        'frontend/components/tabs/tabs.css',
                        'frontend/company/company.css',
                        'frontend/login/login.css',
                        'frontend/projects/projects.css',
                        'frontend/timesheet/timesheet.css',
                        'frontend/calendar/calendar.css',
                        'frontend/report/report.css'
                    ],
                    'dist/styles/print.css': [
                        'frontend/common/sass/print.css'
                    ]
                },
                options: {
                    process: function(src) {
                        return src.replace(/(?:(?:(?:\.\.\/)+common\/)|(?:(?:\.\.\/)*))images\//g, '../common/images/');
                    }
                }
            },
            scripts: {
                src: [
                    'frontend/app.js',
                    'frontend/components/tabs/bootstrapTabs.js',
                    'frontend/components/tableCell/tableCell.js',
                    'frontend/components/projectRow/projectRow.js',
                    'frontend/components/preferences/preferences.js',
                    'frontend/components/preferences/preferencesService.js',
                    'frontend/components/customDay/customDay.js',
                    'frontend/components/filters/getByProperty.js',
                    'frontend/components/filters/propsFilter.js',
                    'frontend/components/dropdownFilter/dropdownFilter.js',
                    'frontend/components/reportDatePicker/reportDatePicker.js',
                    'frontend/components/timesheetIntro/timesheetIntro.js',
                    'frontend/login/loginController.js',
                    'frontend/login/loginService.js',
                    'frontend/company/companyController.js',
                    'frontend/company/companyService.js',
                    'frontend/projects/projectsController.js',
                    'frontend/projects/projectsService.js',
                    'frontend/timesheet/timesheetController.js',
                    'frontend/timesheet/timesheetService.js',
                    'frontend/calendar/calendarController.js',
                    'frontend/calendar/calendarService.js',
                    'frontend/report/reportController.js',
                    'frontend/report/reportService.js'
                ],
                dest: 'dist/scripts/scripts.js'
            },
            vendors: {
                src: [
                    'frontend/bower_components/jquery/dist/jquery.min.js',
                    'frontend/bower_components/angular/angular.min.js',
                    'frontend/bower_components/angular-route/angular-route.min.js',
                    'frontend/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
                    'frontend/bower_components/underscore/underscore-min.js',
                    'frontend/bower_components/moment/min/moment.min.js',
                    'frontend/bower_components/angular-moment/angular-moment.min.js',
                    'frontend/bower_components/angular-cookies/angular-cookies.min.js',
                    'frontend/bower_components/angular-ui-grid/ui-grid.min.js',
                    'frontend/bower_components/angular-click-outside/clickoutside.directive.js',
                    'frontend/bower_components/bootstrap-daterangepicker/daterangepicker.js',
                    'frontend/bower_components/ng-bs-daterangepicker/dist/ng-bs-daterangepicker.min.js',
                    'frontend/bower_components/angular-ui-notification/dist/angular-ui-notification.min.js',
                    'frontend/bower_components/ui-select/dist/select.min.js',
                    'frontend/bower_components/angular-sanitize/angular-sanitize.min.js',
                    'frontend/bower_components/intro.js/minified/intro.min.js',
                    'frontend/bower_components/angular-intro.js/build/angular-intro.min.js'
                ],
                dest: 'dist/scripts/vendors.js'
            }
        },

        usemin: {
            html: ['dist/index.html']
        },

        ngAnnotate: {
            options: {
                singleQuotes: true
            },
            app: {
                files: {
                    'dist/scripts/scripts.js': ['dist/scripts/scripts.js'],
                    'dist/scripts/scripts.min.js': ['dist/scripts/scripts.min.js'],
                    'dist/scripts/vendors.js': ['dist/scripts/vendors.js'],
                    'dist/scripts/vendors.min.js': ['dist/scripts/vendors.min.js']
                }
            }
        },

        //for later usage(caching html templates)
        ngtemplates: {
            app: {
                src: [
                    'dist/**/*.html',
                    '!dist/frontend/bower_components/**'
                ],
                dest: 'dist/scripts/templates.js',
                options: {
                    url: function(url) {
                        url = url.slice(url.indexOf('dist'));

                        return url.replace('dist/', '');
                    },
                    module: 'mifortTimesheet',
                    htmlmin: {
                        collapseBooleanAttributes: false, // Otherwise 'sortable' attribute values are deleted
                        collapseWhitespace: true,
                        removeAttributeQuotes: true,
                        removeComments: true, // Only if you don't use comment directives!
                        removeEmptyAttributes: false, // Because some directives look like empty attributes
                        removeRedundantAttributes: true,
                        removeScriptTypeAttributes: true,
                        removeStyleLinkTypeAttributes: true
                    }
                }
            }
        },

        uglify: {
            options: {
                mangle: false,
                sourceMap: true
            },
            build: {
                files: {
                    'dist/scripts/scripts.min.js': ['dist/scripts/scripts.js'],
                    'dist/scripts/vendors.min.js': ['dist/scripts/vendors.js']
                }
            }
        },

        cssmin: {
            options: {
                keepSpecialComments: 0
            },
            build: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist/styles/',
                        src: ['*.css', '!*.min.css'],
                        dest: 'dist/styles/',
                        ext: '.min.css'
                    }
                ]
            }
        },

        notify: {
            options: {
                enabled: true,
                title: 'Mifort'
            }
        },

        cachebreaker: {
            scripts: {
                options: {
                    match: ['scripts.min.js'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/scripts/scripts.min.js'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            },
            vendorsscripts: {
                options: {
                    match: ['vendors.min.js'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/scripts/vendors.min.js'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            },
            vendors: {
                options: {
                    match: ['vendors.min.css'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/styles/vendors.min.css'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            },
            styles: {
                options: {
                    match: ['styles.min.css'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/styles/styles.min.css'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            }
        },

        remove: {
            // Removes the frontend directory. Careful. Used to replace app with dist in official build.
            frontend: {
                dirList: ['frontend']
            },
            dist: {
                dirList: ['dist']
            }
        },

        mkdir: {
            frontend: {
                options: {
                    create: ['frontend']
                }
            }
        }
    });

    var tasks = [];
    if(process.env.GRUNT_ENV === 'production') {
        tasks = [
            'clean:build',
            'copy:build',
            'concat',
            'ngAnnotate',
            'usemin',
            //'ngtemplates',
            'uglify',
            'cssmin',
            'notify',
            'cachebreaker',

            'remove:frontend',
            'mkdir:frontend',
            'copy:dist',
            'remove:dist'
        ];
    }

    grunt.registerTask('build', tasks);
};
<commit_msg>Not loaded icon calendar Fix #91<commit_after>'use strict';

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-contrib-watch'); //Run predefined tasks whenever watched file patterns are added, changed or deleted
    grunt.loadNpmTasks('grunt-contrib-clean'); //Clean files and folders
    grunt.loadNpmTasks('grunt-contrib-copy'); //Copy files and folders
    grunt.loadNpmTasks('grunt-contrib-concat'); //Concatenate files
    grunt.loadNpmTasks('grunt-mkdir'); //Create directories with Grunt
    grunt.loadNpmTasks('grunt-remove'); //Remove directory and files

    grunt.loadNpmTasks('grunt-usemin'); //Replaces references to non-optimized scripts or stylesheets into a set of HTML
    grunt.loadNpmTasks('grunt-ng-annotate'); //AngularJS dependency injection annotations
    grunt.loadNpmTasks('grunt-contrib-uglify'); //Minify files with UglifyJS
    grunt.loadNpmTasks('grunt-contrib-cssmin'); //Minify CSS

    grunt.loadNpmTasks('grunt-notify'); //Automatic desktop notifications for Grunt errors and warnings
    grunt.loadNpmTasks('grunt-cache-breaker'); //Cache-breaker, appends a timestamp or md5 hash to any urls
    grunt.loadNpmTasks('grunt-angular-templates'); //Concatenate & register your AngularJS templates in the $templateCache

    grunt.initConfig({
        clean: {
            build: ['dist', '.tmp']
        },

        copy: {
            build: {
                files: [
                    {
                        expand: true,
                        cwd: 'frontend',
                        src: [
                            'common/images/**',
                            '**/**/*.html'
                        ],
                        dest: 'dist'
                    },
                    {
                        expand: true,
                        cwd: 'frontend',
                        src: [
                            '*.html'
                        ],
                        dest: 'dist'
                    },
                    {
                        expand: true,
                        cwd: 'frontend',
                        flatten: true,
                        src: 'bower_components/bootstrap/dist/fonts/*',
                        dest: 'dist/fonts'
                    }
                ]
            },
            dist: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist',
                        src: '**',
                        dest: 'frontend'
                    }
                ]
            }
        },

        concat: {
            styles: {
                files: {
                    'dist/styles/vendors.css': [
                        'frontend/bower_components/angular-ui-grid/ui-grid.min.css',
                        'frontend/bower_components/angular-ui-notification/dist/angular-ui-notification.min.css',
                        'frontend/bower_components/bootstrap/dist/css/bootstrap.min.css',
                        'frontend/bower_components/bootstrap-daterangepicker/daterangepicker-bs3.css'
                    ],
                    'dist/styles/styles.css': [
                        'frontend/common/sass/styles.css',
                        'frontend/common/sass/bootstrap-mifort.css',
                        'frontend/components/tabs/tabs.css',
                        'frontend/company/company.css',
                        'frontend/login/login.css',
                        'frontend/projects/projects.css',
                        'frontend/timesheet/timesheet.css',
                        'frontend/calendar/calendar.css',
                        'frontend/report/report.css'
                    ],
                    'dist/styles/print.css': [
                        'frontend/common/sass/print.css'
                    ]
                },
                options: {
                    process: function(src) {
                        return src.replace(/(?:(?:(?:\.\.\/)+common\/)|(?:(?:\.\.\/)*))images\//g, '../common/images/');
                    }
                }
            },
            scripts: {
                src: [
                    'frontend/app.js',
                    'frontend/components/tabs/bootstrapTabs.js',
                    'frontend/components/tableCell/tableCell.js',
                    'frontend/components/projectRow/projectRow.js',
                    'frontend/components/preferences/preferences.js',
                    'frontend/components/preferences/preferencesService.js',
                    'frontend/components/customDay/customDay.js',
                    'frontend/components/filters/getByProperty.js',
                    'frontend/components/filters/propsFilter.js',
                    'frontend/components/dropdownFilter/dropdownFilter.js',
                    'frontend/components/reportDatePicker/reportDatePicker.js',
                    'frontend/components/timesheetIntro/timesheetIntro.js',
                    'frontend/login/loginController.js',
                    'frontend/login/loginService.js',
                    'frontend/company/companyController.js',
                    'frontend/company/companyService.js',
                    'frontend/projects/projectsController.js',
                    'frontend/projects/projectsService.js',
                    'frontend/timesheet/timesheetController.js',
                    'frontend/timesheet/timesheetService.js',
                    'frontend/calendar/calendarController.js',
                    'frontend/calendar/calendarService.js',
                    'frontend/report/reportController.js',
                    'frontend/report/reportService.js'
                ],
                dest: 'dist/scripts/scripts.js'
            },
            vendors: {
                src: [
                    'frontend/bower_components/jquery/dist/jquery.min.js',
                    'frontend/bower_components/angular/angular.min.js',
                    'frontend/bower_components/angular-route/angular-route.min.js',
                    'frontend/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
                    'frontend/bower_components/underscore/underscore-min.js',
                    'frontend/bower_components/moment/min/moment.min.js',
                    'frontend/bower_components/angular-moment/angular-moment.min.js',
                    'frontend/bower_components/angular-cookies/angular-cookies.min.js',
                    'frontend/bower_components/angular-ui-grid/ui-grid.min.js',
                    'frontend/bower_components/angular-click-outside/clickoutside.directive.js',
                    'frontend/bower_components/bootstrap-daterangepicker/daterangepicker.js',
                    'frontend/bower_components/ng-bs-daterangepicker/dist/ng-bs-daterangepicker.min.js',
                    'frontend/bower_components/angular-ui-notification/dist/angular-ui-notification.min.js',
                    'frontend/bower_components/ui-select/dist/select.min.js',
                    'frontend/bower_components/angular-sanitize/angular-sanitize.min.js',
                    'frontend/bower_components/intro.js/minified/intro.min.js',
                    'frontend/bower_components/angular-intro.js/build/angular-intro.min.js'
                ],
                dest: 'dist/scripts/vendors.js'
            }
        },

        usemin: {
            html: ['dist/index.html']
        },

        ngAnnotate: {
            options: {
                singleQuotes: true
            },
            app: {
                files: {
                    'dist/scripts/scripts.js': ['dist/scripts/scripts.js'],
                    'dist/scripts/scripts.min.js': ['dist/scripts/scripts.min.js'],
                    'dist/scripts/vendors.js': ['dist/scripts/vendors.js'],
                    'dist/scripts/vendors.min.js': ['dist/scripts/vendors.min.js']
                }
            }
        },

        //for later usage(caching html templates)
        ngtemplates: {
            app: {
                src: [
                    'dist/**/*.html',
                    '!dist/frontend/bower_components/**'
                ],
                dest: 'dist/scripts/templates.js',
                options: {
                    url: function(url) {
                        url = url.slice(url.indexOf('dist'));

                        return url.replace('dist/', '');
                    },
                    module: 'mifortTimesheet',
                    htmlmin: {
                        collapseBooleanAttributes: false, // Otherwise 'sortable' attribute values are deleted
                        collapseWhitespace: true,
                        removeAttributeQuotes: true,
                        removeComments: true, // Only if you don't use comment directives!
                        removeEmptyAttributes: false, // Because some directives look like empty attributes
                        removeRedundantAttributes: true,
                        removeScriptTypeAttributes: true,
                        removeStyleLinkTypeAttributes: true
                    }
                }
            }
        },

        uglify: {
            options: {
                mangle: false,
                sourceMap: true
            },
            build: {
                files: {
                    'dist/scripts/scripts.min.js': ['dist/scripts/scripts.js'],
                    'dist/scripts/vendors.min.js': ['dist/scripts/vendors.js']
                }
            }
        },

        cssmin: {
            options: {
                keepSpecialComments: 0
            },
            build: {
                files: [
                    {
                        expand: true,
                        cwd: 'dist/styles/',
                        src: ['*.css', '!*.min.css'],
                        dest: 'dist/styles/',
                        ext: '.min.css'
                    }
                ]
            }
        },

        notify: {
            options: {
                enabled: true,
                title: 'Mifort'
            }
        },

        cachebreaker: {
            scripts: {
                options: {
                    match: ['scripts.min.js'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/scripts/scripts.min.js'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            },
            vendorsscripts: {
                options: {
                    match: ['vendors.min.js'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/scripts/vendors.min.js'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            },
            vendors: {
                options: {
                    match: ['vendors.min.css'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/styles/vendors.min.css'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            },
            styles: {
                options: {
                    match: ['styles.min.css'],
                    replacement: 'md5',
                    src: {
                        path: 'dist/styles/styles.min.css'
                    }
                },
                files: {
                    src: ['dist/index.html']
                }
            }
        },

        remove: {
            // Removes the frontend directory. Careful. Used to replace app with dist in official build.
            frontend: {
                dirList: ['frontend']
            },
            dist: {
                dirList: ['dist']
            }
        },

        mkdir: {
            frontend: {
                options: {
                    create: ['frontend']
                }
            }
        }
    });

    var tasks = [];
    if(process.env.GRUNT_ENV === 'production') {
        tasks = [
            'clean:build',
            'copy:build',
            'concat',
            'ngAnnotate',
            'usemin',
            //'ngtemplates',
            'uglify',
            'cssmin',
            'notify',
            'cachebreaker',

            'remove:frontend',
            'mkdir:frontend',
            'copy:dist',
            'remove:dist'
        ];
    }

    grunt.registerTask('build', tasks);
};
<|endoftext|>


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

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

		jshint: {
			src: [
				"**/*.js", "!{node_modules,ViewStack/transitions}/**", "!**/themes/**", "!*/css/*.js"
			],
			options: {
				jshintrc: ".jshintrc"
			}
		},

		// Task for compiling less files into CSS files
		less : {
			// Compile less code for each widget
			widgets : {
				files: [
					{
						expand: true,
						src: ["*/themes/*/*.less", "list/*/themes/*/*.less", "!**/variables.less",
						      "!{dijit,mobile}/themes/*/*.less", "*/css/*.less",
							 "ViewStack/transitions/*.less"],
						ext: ".css"
					}
				]
			}
		},

		// Convert CSS files to JS files
		cssToJs : {
			src: [
				"*/themes/*/*.css", "list/*/themes/*/*.css",
				"!{dijit,mobile}/themes/*/*.css", "ViewStack/transitions/*.css"
			],
			options: {
				remove: true	// remove intermediate CSS files, generated from LESS files in less step
			}
		},

		// Copied from grunt web site but not tested
		uglify: {
			options: {
				banner: "/*! <%= pkg.name %> <%= grunt.template.today('yyyy-mm-dd') %> */\n"
			},
			build: {
				src: "src/<%= pkg.name %>.js",
				dest: "build/<%= pkg.name %>.min.js"
			}
		},

		intern: {
			local: {
				options: {
					runType: "runner",
					config: "tests/intern.local",
					reporters: ["runner"]
				}
			},
			"local.android": {
				options: {
					runType: "runner",
					config: "tests/intern.local.android",
					reporters: ["runner"]
				}
			},
			"local.ios": {
				options: {
					runType: "runner",
					config: "tests/intern.local.ios",
					reporters: ["runner"]
				}
			},
			remote: {
				options: {
					runType: "runner",
					config: "tests/intern",
					reporters: ["runner"]
				}
			}
		},

		"jsdoc-amddcl": {
			deliteful: {
				files: [
					{
						args: [
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"./README.md",
							"./package.json"
						],
						imports: [
							"../delite/out"
						]
					},
					{
						args: [
							"-X",
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"./README.md",
							"./package.json"
						],
						dest: "./out/doclets.json",
						imports: [
							"../delite/out"
						]
					}
				]
			}
		}
	});

	// Load plugins
	grunt.loadNpmTasks("intern");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks("grunt-contrib-less");
	grunt.loadNpmTasks("grunt-contrib-uglify");
	grunt.loadNpmTasks("jsdoc-amddcl");
	grunt.loadTasks("../delite/themes/tasks");// Custom cssToJs task to convert CSS to JS

	grunt.registerTask("default", ["less", "cssToJs"]);
	// always specify the target e.g. grunt test:remote, grunt test:remote
	// then add on any other flags afterwards e.g. console, lcovhtml
	var testTaskDescription = "Run this task instead of the intern task directly! \n" +
		"Always specify the test target e.g. \n" +
		"grunt test:local\n" +
		"grunt test:local.android\n" +
		"grunt test:local.ios\n" +
		"grunt test:remote\n\n" +
		"Add any optional reporters via a flag e.g. \n" +
		"grunt test:local:console\n" +
		"grunt test:local:lcovhtml\n" +
		"grunt test:local:console:lcovhtml";
	grunt.registerTask("test", testTaskDescription, function (target) {
		function addReporter(reporter) {
			var property = "intern." + target + ".options.reporters",
				value = grunt.config.get(property);
			if (value.indexOf(reporter) !== -1) {
				return;
			}
			value.push(reporter);
			grunt.config.set(property, value);
		}
		if (this.flags.lcovhtml) {
			addReporter("lcovhtml");
		}

		if (this.flags.console) {
			addReporter("console");
		}
		grunt.task.run("intern:" + target);
	});
};<commit_msg>add alias from jsdoc --> jsdoc-amddcl (same as Bill did for delite)<commit_after>/*global module */
module.exports = function (grunt) {

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

		jshint: {
			src: [
				"**/*.js", "!{node_modules,ViewStack/transitions}/**", "!**/themes/**", "!*/css/*.js"
			],
			options: {
				jshintrc: ".jshintrc"
			}
		},

		// Task for compiling less files into CSS files
		less : {
			// Compile less code for each widget
			widgets : {
				files: [
					{
						expand: true,
						src: ["*/themes/*/*.less", "list/*/themes/*/*.less", "!**/variables.less",
						      "!{dijit,mobile}/themes/*/*.less", "*/css/*.less",
							 "ViewStack/transitions/*.less"],
						ext: ".css"
					}
				]
			}
		},

		// Convert CSS files to JS files
		cssToJs : {
			src: [
				"*/themes/*/*.css", "list/*/themes/*/*.css",
				"!{dijit,mobile}/themes/*/*.css", "ViewStack/transitions/*.css"
			],
			options: {
				remove: true	// remove intermediate CSS files, generated from LESS files in less step
			}
		},

		// Copied from grunt web site but not tested
		uglify: {
			options: {
				banner: "/*! <%= pkg.name %> <%= grunt.template.today('yyyy-mm-dd') %> */\n"
			},
			build: {
				src: "src/<%= pkg.name %>.js",
				dest: "build/<%= pkg.name %>.min.js"
			}
		},

		intern: {
			local: {
				options: {
					runType: "runner",
					config: "tests/intern.local",
					reporters: ["runner"]
				}
			},
			"local.android": {
				options: {
					runType: "runner",
					config: "tests/intern.local.android",
					reporters: ["runner"]
				}
			},
			"local.ios": {
				options: {
					runType: "runner",
					config: "tests/intern.local.ios",
					reporters: ["runner"]
				}
			},
			remote: {
				options: {
					runType: "runner",
					config: "tests/intern",
					reporters: ["runner"]
				}
			}
		},

		"jsdoc-amddcl": {
			deliteful: {
				files: [
					{
						args: [
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"./README.md",
							"./package.json"
						],
						imports: [
							"../delite/out"
						]
					},
					{
						args: [
							"-X",
							"-c",
							"./node_modules/jsdoc-amddcl/conf.json"
						],
						src: [
							".",
							"./README.md",
							"./package.json"
						],
						dest: "./out/doclets.json",
						imports: [
							"../delite/out"
						]
					}
				]
			}
		}
	});

	// Load plugins
	grunt.loadNpmTasks("intern");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks("grunt-contrib-less");
	grunt.loadNpmTasks("grunt-contrib-uglify");
	grunt.loadNpmTasks("jsdoc-amddcl");
	grunt.loadTasks("../delite/themes/tasks");// Custom cssToJs task to convert CSS to JS

	// Aliases
	grunt.registerTask("default", ["less", "cssToJs"]);
	grunt.registerTask("jsdoc", "jsdoc-amddcl");

	// Testing.
	// always specify the target e.g. grunt test:remote, grunt test:remote
	// then add on any other flags afterwards e.g. console, lcovhtml
	var testTaskDescription = "Run this task instead of the intern task directly! \n" +
		"Always specify the test target e.g. \n" +
		"grunt test:local\n" +
		"grunt test:local.android\n" +
		"grunt test:local.ios\n" +
		"grunt test:remote\n\n" +
		"Add any optional reporters via a flag e.g. \n" +
		"grunt test:local:console\n" +
		"grunt test:local:lcovhtml\n" +
		"grunt test:local:console:lcovhtml";
	grunt.registerTask("test", testTaskDescription, function (target) {
		function addReporter(reporter) {
			var property = "intern." + target + ".options.reporters",
				value = grunt.config.get(property);
			if (value.indexOf(reporter) !== -1) {
				return;
			}
			value.push(reporter);
			grunt.config.set(property, value);
		}
		if (this.flags.lcovhtml) {
			addReporter("lcovhtml");
		}

		if (this.flags.console) {
			addReporter("console");
		}
		grunt.task.run("intern:" + target);
	});
};<|endoftext|>


<commit_before>/* global require, module, process */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/**\n' +
      ' * <%= pkg.description %>\n' +
      ' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
      ' * @link <%= pkg.homepage %>\n' +
      ' * @author <%= pkg.author %>\n' +
      ' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
      ' */\n'
    },
    dirs: {
      dest: 'dist'
    },
    concat: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: ['src/*.js'],
        dest: '<%= dirs.dest %>/<%= pkg.name %>.js'
      }
    },
    cssmin: {
      combine: {
        files: {
          '<%= dirs.dest %>/<%= pkg.name %>.min.css': ['src/*.css']
        }
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: ['<%= concat.dist.dest %>'],
        dest: '<%= dirs.dest %>/<%= pkg.name %>.min.js'
      }
    },
    release: {
      options: {
        commitMessage: '<%= version %>',
        tagName: 'v<%= version %>',
        file: 'package.json',
        push: false,
        tag: false,
        pushTags: false,
        npm: false
      }
    },
    jshint: {
      files: ['Gruntfile.js', 'src/*.js', 'test/unit/*.js'],
      options: {
        curly: false,
        browser: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        expr: true,
        node: true,
        globals: {
          exports: true,
          angular: false,
          $: false
        }
      }
    },
    // watch: {
    //   files: '<config:jshint.files>',
    //   tasks: 'default'
    // },
    karma: {
      test: {
        options: {
          reporters: ['dots'],
          singleRun: true
        }
      },
      server: {
        options: {
          singleRun: false
        }
      },
      options: {
        configFile: 'test/karma.conf.js'
      }
    }
  });

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

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

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

  grunt.loadNpmTasks('grunt-contrib-cssmin');

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

  grunt.loadNpmTasks('grunt-release');

  grunt.renameTask('release', 'originalRelease');

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

  // Test tasks.
  grunt.registerTask('test', ['jshint', 'karma:test']);
  grunt.registerTask('test-server', ['karma:server']);

  // Build task.
  grunt.registerTask('build', ['test', 'concat', 'uglify', 'cssmin']);

  // Provides the "karma" task.
  grunt.registerMultiTask('karma', 'Starts up a karma server.', function() {
    var done = this.async();
    require('karma').server.start(this.options(), function(code) {
      done(code === 0);
    });
  });

};
<commit_msg>chore(grunt): add webserver cmd<commit_after>/* global require, module, process */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/**\n' +
      ' * <%= pkg.description %>\n' +
      ' * @version v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
      ' * @link <%= pkg.homepage %>\n' +
      ' * @author <%= pkg.author %>\n' +
      ' * @license MIT License, http://www.opensource.org/licenses/MIT\n' +
      ' */\n'
    },
    connect: {
      devserver: {
        options: {
          port: 9999,
          hostname: '0.0.0.0',
          base: '.',
          keepalive: true
        }
      }
    },
    dirs: {
      dest: 'dist'
    },
    concat: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: ['src/*.js'],
        dest: '<%= dirs.dest %>/<%= pkg.name %>.js'
      }
    },
    cssmin: {
      combine: {
        files: {
          '<%= dirs.dest %>/<%= pkg.name %>.min.css': ['src/*.css']
        }
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: ['<%= concat.dist.dest %>'],
        dest: '<%= dirs.dest %>/<%= pkg.name %>.min.js'
      }
    },
    jshint: {
      files: ['Gruntfile.js', 'src/*.js', 'test/unit/*.js'],
      options: {
        curly: false,
        browser: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        expr: true,
        node: true,
        globals: {
          exports: true,
          angular: false,
          $: false
        }
      }
    },
    // watch: {
    //   files: '<config:jshint.files>',
    //   tasks: 'default'
    // },
    karma: {
      test: {
        options: {
          reporters: ['dots'],
          singleRun: true
        }
      },
      server: {
        options: {
          singleRun: false
        }
      },
      options: {
        configFile: 'test/karma.conf.js'
      }
    }
  });

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

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

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

  grunt.loadNpmTasks('grunt-contrib-cssmin');

  grunt.loadNpmTasks('grunt-contrib-connect');

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

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

  // Test tasks.
  grunt.registerTask('test', ['jshint', 'karma:test']);
  grunt.registerTask('test-server', ['karma:server']);

  // Build task.
  grunt.registerTask('build', ['test', 'concat', 'uglify', 'cssmin']);

  // run devserver
  grunt.registerTask('webserver', ['connect:devserver']);

  // Provides the "karma" task.
  grunt.registerMultiTask('karma', 'Starts up a karma server.', function() {
    var done = this.async();
    require('karma').server.start(this.options(), function(code) {
      done(code === 0);
    });
  });

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

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

  // Project Configuration
  grunt.initConfig({
    exec: {
      appConfig: {
        command: 'node ./util/buildAppConfig.js'
      },
      externalServices: {
        command: 'node ./util/buildExternalServices.js'
      },
      clean: {
        command: 'rm -Rf bower_components node_modules'
      },
      cordovaclean: {
        command: 'make -C cordova clean'
      },
      osx: {
        command: 'webkitbuilds/build-osx.sh sign'
      },
      coveralls: {
        command: 'cat  coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
      },
      chrome: {
        command: 'make -C chrome-app '
      },
      wp: {
        command: 'make -C cordova wp',
      },
      ios: {
        command: 'make -C cordova ios',
      },
      xcode: {
        command: 'open cordova/project-ios/platforms/ios/*.xcodeproj',
      },
      android: {
        command: 'make -C cordova android',
      },
      androidrun: {
        command: 'make -C cordova androidrun',
      },
      androidbuild: {
        command: 'cd cordova/project && cordova build android --release',
      },
      androidsign: {
        command: 'rm -f cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk  cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk ',
        stdin: true,
      },
      desktopsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/Copay-linux.zip.sig --detach-sig webkitbuilds/Copay-linux.zip && gpg -u 1112CFA1 --output webkitbuilds/Copay-win.exe.sig --detach-sig webkitbuilds/Copay-win.exe'
      },
      desktopverify: {
        cmd: 'gpg --verify webkitbuilds/Copay-linux.zip.sig webkitbuilds/Copay-linux.zip && gpg --verify webkitbuilds/Copay-win.exe.sig webkitbuilds/Copay-win.exe'
      },
    },
    watch: {
      options: {
        dateFormat: function(time) {
          grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
          grunt.log.writeln('Waiting for more changes...');
        },
      },
      css: {
        files: ['src/css/*.css'],
        tasks: ['concat:css']
      },
      sass: {
        files: ['src/sass/**/**/*.scss'],
        tasks: ['sass', 'concat:css']
      },
      main: {
        files: [
          'src/js/init.js',
          'src/js/app.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/routes.js',
          'src/js/services/*.js',
          'src/js/models/*.js',
          'src/js/controllers/**/*.js'
        ],
        tasks: ['concat:js']
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compact',
          sourcemap: 'none'
        },
        files: [{
          expand: true,
          src: ['src/sass/main.scss'],
          dest: './',
          ext: '.css'
        }]
      }
    },
    concat: {
      options: {
        sourceMap: false,
        sourceMapStyle: 'link' // embed, link, inline
      },
      angular: {
        src: [
          'bower_components/qrcode-generator/js/qrcode.js',
          'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
          'bower_components/moment/min/moment-with-locales.js',
          'bower_components/angular-moment/angular-moment.js',
          'bower_components/ng-lodash/build/ng-lodash.js',
          'bower_components/angular-qrcode/angular-qrcode.js',
          'bower_components/angular-gettext/dist/angular-gettext.js',
          'bower_components/ng-csv/build/ng-csv.js',
          'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js',
          'bower_components/angular-clipboard/angular-clipboard.js',
          'bower_components/angular-mocks/angular-mocks.js',
          'angular-pbkdf2/angular-pbkdf2.js',
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
        ],
        dest: 'public/lib/angular.js'
      },
      js: {
        src: [
          'src/js/app.js',
          'src/js/routes.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/models/*.js',
          'src/js/services/*.js',
          'src/js/controllers/**/*.js',
          'src/js/translations.js',
          'src/js/appConfig.js',
          'src/js/externalServices.js',
          'src/js/init.js',
          'src/js/trezor-url.js',
          'bower_components/trezor-connect/login.js'
        ],
        dest: 'public/js/copay.js'
      },
      css: {
        src: ['src/sass/*.css', 'src/css/*.css'],
        dest: 'public/css/copay.css'
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'public/js/copay.js': ['public/js/copay.js'],
          'public/lib/angular.js': ['public/lib/angular.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'i18n/po/template.pot': [
            'public/index.html',
            'public/views/**/*.html',
            'src/js/routes.js',
            'src/js/services/*.js',
            'src/js/controllers/**/*.js'
          ]
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'src/js/translations.js': ['i18n/po/*.po']
        }
      },
    },
    copy: {
      ionic_fonts: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/fonts/ionicons.*',
        dest: 'public/fonts/'
      },
      ionic_js: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/js/ionic.bundle.min.js',
        dest: 'public/lib/'
      },
      linux: {
        files: [{
          expand: true,
          cwd: 'webkitbuilds/',
          src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],
          dest: 'webkitbuilds/Copay/linux64/',
          flatten: true,
          filter: 'isFile'
        }],
      }
    },
    karma: {
      unit: {
        configFile: 'test/karma.conf.js'
      },
      prod: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },
    nwjs: {
      options: {
        appName: 'Copay',
        platforms: ['win64', 'osx64', 'linux64'],
        buildDir: './webkitbuilds',
        version: '0.16.0',
        macIcns: './public/img/icons/icon.icns',
        exeIco: './public/img/icons/icon.ico'
      },
      src: ['./package.json', './public/**/*']
    },
    compress: {
      linux: {
        options: {
          archive: './webkitbuilds/Copay-linux.zip'
        },
        expand: true,
        cwd: './webkitbuilds/Copay/linux64/',
        src: ['**/*'],
        dest: 'copay-linux/'
      }
    },
    browserify: {
      dist: {
        files: {
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
          'angular-pbkdf2/angular-pbkdf2.js': ['angular-pbkdf2/index.js']
        },
      }
    }
  });

  grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:externalServices', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js']);
  grunt.registerTask('prod', ['default', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('test', ['karma:unit']);
  grunt.registerTask('test-coveralls', ['browserify', 'karma:prod', 'exec:coveralls']);
  grunt.registerTask('desktop', ['prod', 'nwjs', 'copy:linux', 'compress:linux']);
  grunt.registerTask('osx', ['prod', 'nwjs', 'exec:osx']);
  grunt.registerTask('chrome', ['exec:chrome']);
  grunt.registerTask('wp', ['prod', 'exec:wp']);
  grunt.registerTask('wp-debug', ['default', 'exec:wp']);
  grunt.registerTask('ios', ['prod', 'exec:ios']);
  grunt.registerTask('ios-debug', ['default', 'exec:ios']);
  grunt.registerTask('ios-run', ['exec:xcode']);
  grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
  grunt.registerTask('android-debug', ['default', 'exec:android', 'exec:androidrun']);
  grunt.registerTask('android', ['prod', 'exec:android']);
  grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
  grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);

};
<commit_msg>fix grunt file<commit_after>'use strict';

module.exports = function(grunt) {

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

  // Project Configuration
  grunt.initConfig({
    exec: {
      appConfig: {
        command: 'node ./util/buildAppConfig.js'
      },
      externalServices: {
        command: 'node ./util/buildExternalServices.js'
      },
      clean: {
        command: 'rm -Rf bower_components node_modules'
      },
      cordovaclean: {
        command: 'make -C cordova clean'
      },
      osx: {
        command: 'webkitbuilds/build-osx.sh sign'
      },
      coveralls: {
        command: 'cat  coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
      },
      chrome: {
        command: 'make -C chrome-app '
      },
      wpinit: {
        command: 'make -C cordova wp-init',
      },
      wpcopy: {
        command: 'make -C cordova wp-copy',
      },
      ios: {
        command: 'make -C cordova ios',
      },
      xcode: {
        command: 'open cordova/project-ios/platforms/ios/*.xcodeproj',
      },
      android: {
        command: 'make -C cordova android',
      },
      androidrun: {
        command: 'make -C cordova androidrun',
      },
      androidbuild: {
        command: 'cd cordova/project && cordova build android --release',
      },
      androidsign: {
        command: 'rm -f cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk  cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk ',
        stdin: true,
      },
      desktopsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/Copay-linux.zip.sig --detach-sig webkitbuilds/Copay-linux.zip && gpg -u 1112CFA1 --output webkitbuilds/Copay-win.exe.sig --detach-sig webkitbuilds/Copay-win.exe'
      },
      desktopverify: {
        cmd: 'gpg --verify webkitbuilds/Copay-linux.zip.sig webkitbuilds/Copay-linux.zip && gpg --verify webkitbuilds/Copay-win.exe.sig webkitbuilds/Copay-win.exe'
      },
    },
    watch: {
      options: {
        dateFormat: function(time) {
          grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
          grunt.log.writeln('Waiting for more changes...');
        },
      },
      css: {
        files: ['src/css/*.css'],
        tasks: ['concat:css']
      },
      sass: {
        files: ['src/sass/**/**/*.scss'],
        tasks: ['sass', 'concat:css']
      },
      main: {
        files: [
          'src/js/init.js',
          'src/js/app.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/routes.js',
          'src/js/services/*.js',
          'src/js/models/*.js',
          'src/js/controllers/**/*.js'
        ],
        tasks: ['concat:js']
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compact',
          sourcemap: 'none'
        },
        files: [{
          expand: true,
          src: ['src/sass/main.scss'],
          dest: './',
          ext: '.css'
        }]
      }
    },
    concat: {
      options: {
        sourceMap: false,
        sourceMapStyle: 'link' // embed, link, inline
      },
      angular: {
        src: [
          'bower_components/qrcode-generator/js/qrcode.js',
          'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
          'bower_components/moment/min/moment-with-locales.js',
          'bower_components/angular-moment/angular-moment.js',
          'bower_components/ng-lodash/build/ng-lodash.js',
          'bower_components/angular-qrcode/angular-qrcode.js',
          'bower_components/angular-gettext/dist/angular-gettext.js',
          'bower_components/ng-csv/build/ng-csv.js',
          'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js',
          'bower_components/angular-clipboard/angular-clipboard.js',
          'bower_components/angular-mocks/angular-mocks.js',
          'angular-pbkdf2/angular-pbkdf2.js',
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
        ],
        dest: 'public/lib/angular.js'
      },
      js: {
        src: [
          'src/js/app.js',
          'src/js/routes.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/models/*.js',
          'src/js/services/*.js',
          'src/js/controllers/**/*.js',
          'src/js/translations.js',
          'src/js/appConfig.js',
          'src/js/externalServices.js',
          'src/js/init.js',
          'src/js/trezor-url.js',
          'bower_components/trezor-connect/login.js'
        ],
        dest: 'public/js/copay.js'
      },
      css: {
        src: ['src/sass/*.css', 'src/css/*.css'],
        dest: 'public/css/copay.css'
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'public/js/copay.js': ['public/js/copay.js'],
          'public/lib/angular.js': ['public/lib/angular.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'i18n/po/template.pot': [
            'public/index.html',
            'public/views/**/*.html',
            'src/js/routes.js',
            'src/js/services/*.js',
            'src/js/controllers/**/*.js'
          ]
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'src/js/translations.js': ['i18n/po/*.po']
        }
      },
    },
    copy: {
      ionic_fonts: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/fonts/ionicons.*',
        dest: 'public/fonts/'
      },
      ionic_js: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/js/ionic.bundle.min.js',
        dest: 'public/lib/'
      },
      linux: {
        files: [{
          expand: true,
          cwd: 'webkitbuilds/',
          src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],
          dest: 'webkitbuilds/Copay/linux64/',
          flatten: true,
          filter: 'isFile'
        }],
      }
    },
    karma: {
      unit: {
        configFile: 'test/karma.conf.js'
      },
      prod: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    },
    nwjs: {
      options: {
        appName: 'Copay',
        platforms: ['win64', 'osx64', 'linux64'],
        buildDir: './webkitbuilds',
        version: '0.16.0',
        macIcns: './public/img/icons/icon.icns',
        exeIco: './public/img/icons/icon.ico'
      },
      src: ['./package.json', './public/**/*']
    },
    compress: {
      linux: {
        options: {
          archive: './webkitbuilds/Copay-linux.zip'
        },
        expand: true,
        cwd: './webkitbuilds/Copay/linux64/',
        src: ['**/*'],
        dest: 'copay-linux/'
      }
    },
    browserify: {
      dist: {
        files: {
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
          'angular-pbkdf2/angular-pbkdf2.js': ['angular-pbkdf2/index.js']
        },
      }
    }
  });

  grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:externalServices', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js']);
  grunt.registerTask('prod', ['default', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('test', ['karma:unit']);
  grunt.registerTask('test-coveralls', ['browserify', 'karma:prod', 'exec:coveralls']);
  grunt.registerTask('desktop', ['prod', 'nwjs', 'copy:linux', 'compress:linux']);
  grunt.registerTask('osx', ['prod', 'nwjs', 'exec:osx']);
  grunt.registerTask('chrome', ['exec:chrome']);
  grunt.registerTask('wp', ['prod', 'exec:wp']);
  grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']);
  grunt.registerTask('wp-init', ['default', 'exec:wpinit']);
  grunt.registerTask('ios', ['prod', 'exec:ios']);
  grunt.registerTask('ios-debug', ['default', 'exec:ios']);
  grunt.registerTask('ios-run', ['exec:xcode']);
  grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
  grunt.registerTask('android-debug', ['default', 'exec:android', 'exec:androidrun']);
  grunt.registerTask('android', ['prod', 'exec:android']);
  grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
  grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);

};
<|endoftext|>


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

  // Define the browser to test with Sauce Labs
  var platforms = {
    'Windows 8.1': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['11']
    },
    'Windows 8': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['10']
    },
    'Windows 7': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['9', '10', '11']
    },
    'OS X 10.8': {
      iPhone: ['6.0'],
      safari: ['6']
    },
    'OS X 10.9': {
      iPhone: ['8.1'],
      iPad: ['8.1'],
      safari: ['7']
    },
    'OS X 10.10': {
      safari: ['8']
    },
    Linux: {
      chrome: ['38', '39'],
      firefox: ['33', '34'],
      android: ['4.0', '4.4']
    }
  };

  var sauceBrowsers = [];

  for (var platform in platforms) {
    var browsers = platforms[platform];
    for (var browser in browsers) {
      var versions = browsers[browser];
      for (var i = 0; i < versions.length; i++) {
        sauceBrowsers.push([platform, browser, versions[i]]);
      }
    }
  }

  // Define more options
  var qunitTestsUrl = 'http://127.0.0.1:9999/test/index.html';

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsonlint: {
      all: {
        src: [
          'package.json',
          '.jshintrc',
          'src/.jshintrc',
          'test/tests/.jshintrc'
        ]
      }
    },
    jshint: {
      all: {
        src: [
          'Gruntfile.js',
          'build/**/*.js',
          'src/**/*.js',
          'test/tests/**/*.js'
        ],
        options: {
          jshintrc: true
        }
      }
    },
    connect: {
      temp: {
        options: {
          port: 9999
        }
      },
      local: {
        options: {
          port: 9999,
          open: qunitTestsUrl,
          keepalive: true
        }
      }
    },
    'saucelabs-qunit': {
      full: {
        options: {
          browsers: sauceBrowsers,
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit full test',
          urls: [qunitTestsUrl]
        }
      },
      simple: {
        options: {
          browsers: [sauceBrowsers[1]],
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit simple test',
          urls: [qunitTestsUrl]
        }
      },
      custom: {
        options: {
          browsers: [ ['OS X 10.8', 'iPhone', '6.0'] ],
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit custom test',
          urls: [qunitTestsUrl]
        }
      }
    },
    copy: {
      all: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! Firebolt v<%= pkg.version %> | (c)2014 Nathan Woltman | fireboltjs.com/license */',
        sourceMap: true,
        sourceMapName: 'dist/firebolt.min.map'
      },
      build: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.min.js'
      }
    },
    compare_size: {
      files: [
        'dist/firebolt.js',
        'dist/firebolt.min.js'
      ],
      options: {
        cache: 'build/.sizecache.json',
        compress: {
          gz: function(contents) {
            return require('gzip-js').zip(contents, {}).length;
          }
        }
      }
    }
  });

  // Load the Grunt plugins
  require('load-grunt-tasks')(grunt);

  // Load custom build tasks
  grunt.loadTasks('build');

  /* Register tasks */
  grunt.registerTask('lint', ['jsonlint', 'jshint']);
  grunt.registerTask('dev', ['lint', 'connect:local']);
  grunt.registerTask('cleanbuild', ['tasks.cleandist', 'copy', 'uglify']);
  grunt.registerTask('build', ['lint', 'cleanbuild', 'compare_size']);
  grunt.registerTask('release', ['lint', 'cleanbuild', 'tasks.release']);

  // Only connect to Sauce if the user has Sauce credentials
  if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
    grunt.registerTask('test', ['lint', 'connect:temp', 'saucelabs-qunit:simple']);
    grunt.registerTask('fulltest', ['lint', 'connect:temp', 'saucelabs-qunit:full']);
    grunt.registerTask('customtest', ['connect:temp', 'saucelabs-qunit:custom']);
  } else {
    grunt.registerTask('test', ['lint', 'connect:local']); // Same as dev
    grunt.registerTask('fulltest', ['lint', 'tasks.nofulltest']);
  }

  // Default: run everything
  grunt.registerTask('default', ['fulltest', 'cleanbuild', 'compare_size', 'tasks.release']);
};
<commit_msg>Added iOS 5.1 to the list of test browsers<commit_after>module.exports = function(grunt) {
  'use strict';

  // Define the browser to test with Sauce Labs
  var platforms = {
    'Windows 8.1': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['11']
    },
    'Windows 8': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['10']
    },
    'Windows 7': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['9', '10', '11']
    },
    'OS X 10.8': {
      iPhone: ['5.1', '6.0'],
      safari: ['6']
    },
    'OS X 10.9': {
      iPhone: ['8.1'],
      iPad: ['8.1'],
      safari: ['7']
    },
    'OS X 10.10': {
      safari: ['8']
    },
    Linux: {
      chrome: ['38', '39'],
      firefox: ['33', '34'],
      android: ['4.0', '4.4']
    }
  };

  var sauceBrowsers = [];

  for (var platform in platforms) {
    var browsers = platforms[platform];
    for (var browser in browsers) {
      var versions = browsers[browser];
      for (var i = 0; i < versions.length; i++) {
        sauceBrowsers.push([platform, browser, versions[i]]);
      }
    }
  }

  // Define more options
  var qunitTestsUrl = 'http://127.0.0.1:9999/test/index.html';

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsonlint: {
      all: {
        src: [
          'package.json',
          '.jshintrc',
          'src/.jshintrc',
          'test/tests/.jshintrc'
        ]
      }
    },
    jshint: {
      all: {
        src: [
          'Gruntfile.js',
          'build/**/*.js',
          'src/**/*.js',
          'test/tests/**/*.js'
        ],
        options: {
          jshintrc: true
        }
      }
    },
    connect: {
      temp: {
        options: {
          port: 9999
        }
      },
      local: {
        options: {
          port: 9999,
          open: qunitTestsUrl,
          keepalive: true
        }
      }
    },
    'saucelabs-qunit': {
      full: {
        options: {
          browsers: sauceBrowsers,
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit full test',
          urls: [qunitTestsUrl]
        }
      },
      simple: {
        options: {
          browsers: [sauceBrowsers[1]],
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit simple test',
          urls: [qunitTestsUrl]
        }
      },
      custom: {
        options: {
          browsers: [ ['OS X 10.8', 'iPhone', '6.0'] ],
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit custom test',
          urls: [qunitTestsUrl]
        }
      }
    },
    copy: {
      all: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! Firebolt v<%= pkg.version %> | (c)2014 Nathan Woltman | fireboltjs.com/license */',
        sourceMap: true,
        sourceMapName: 'dist/firebolt.min.map'
      },
      build: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.min.js'
      }
    },
    compare_size: {
      files: [
        'dist/firebolt.js',
        'dist/firebolt.min.js'
      ],
      options: {
        cache: 'build/.sizecache.json',
        compress: {
          gz: function(contents) {
            return require('gzip-js').zip(contents, {}).length;
          }
        }
      }
    }
  });

  // Load the Grunt plugins
  require('load-grunt-tasks')(grunt);

  // Load custom build tasks
  grunt.loadTasks('build');

  /* Register tasks */
  grunt.registerTask('lint', ['jsonlint', 'jshint']);
  grunt.registerTask('dev', ['lint', 'connect:local']);
  grunt.registerTask('cleanbuild', ['tasks.cleandist', 'copy', 'uglify']);
  grunt.registerTask('build', ['lint', 'cleanbuild', 'compare_size']);
  grunt.registerTask('release', ['lint', 'cleanbuild', 'tasks.release']);

  // Only connect to Sauce if the user has Sauce credentials
  if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
    grunt.registerTask('test', ['lint', 'connect:temp', 'saucelabs-qunit:simple']);
    grunt.registerTask('fulltest', ['lint', 'connect:temp', 'saucelabs-qunit:full']);
    grunt.registerTask('customtest', ['connect:temp', 'saucelabs-qunit:custom']);
  } else {
    grunt.registerTask('test', ['lint', 'connect:local']); // Same as dev
    grunt.registerTask('fulltest', ['lint', 'tasks.nofulltest']);
  }

  // Default: run everything
  grunt.registerTask('default', ['fulltest', 'cleanbuild', 'compare_size', 'tasks.release']);
};
<|endoftext|>


<commit_before>
/**
 *  Grunfile runner file for CartoDB.js
 *  framework
 *
 */

module.exports = function(grunt) {

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

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

  var config = {
    dist: 'dist',
    app:  'www',
    version: {
      major:      version[0],
      minor:      version[0] + '.' + version[1],
      bugfixing:  pkg.version
    },
    pkg:  pkg
  };

  grunt.initConfig({
    config: config,
    gitinfo: {},
    s3: require('./grunt/tasks/s3').task(grunt, config),
    prompt: require('./grunt/tasks/prompt').task(grunt, config),
    replace: require('./grunt/tasks/replace').task(grunt, config),
    fastly: require('./grunt/tasks/fastly').task(grunt, config),
    watch: require('./grunt/tasks/watch').task(),
    connect: require('./grunt/tasks/connect').task(config),
    clean: require('./grunt/tasks/clean').task(),
    compass: require('./grunt/tasks/compass').task(),
    autoprefixer: require('./grunt/tasks/autoprefixer').task(),
    useminPrepare: require('./grunt/tasks/useminPrepare').task(),
    usemin: require('./grunt/tasks/usemin').task(),
    htmlmin: require('./grunt/tasks/htmlmin').task(),
    concat: require('./grunt/tasks/concat').task(grunt, config),
    uglify: require('./grunt/tasks/uglify').task(),
    cssmin: require('./grunt/tasks/cssmin').task(),
    imagemin: require('./grunt/tasks/imagemin').task(),
    svgmin: require('./grunt/tasks/svgmin').task(),
    copy: require('./grunt/tasks/copy').task(grunt, config),
    filerev: require('./grunt/tasks/filerev').task(),
    buildcontrol: require('./grunt/tasks/buildcontrol').task(),
    jshint: require('./grunt/tasks/jshint').task(),
    csslint: require('./grunt/tasks/csslint').task(),
    concurrent: require('./grunt/tasks/concurrent').task(),
    jasmine: require('./grunt/tasks/jasmine').task()
  });

  /* TASKS */

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

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

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

  grunt.registerTask('check', [
    'clean:server',
    'compass:server',
    'jshint:all',
    'csslint:check'
  ]);

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

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

  grunt.registerTask('publish', function (target) {

    if (!grunt.file.exists('secrets.json')) {
      grunt.fail.fatal('secrets.json file does not exist, copy secrets.example.json and rename it' , 1);
    }

    // Read secrets
    grunt.config.set('secrets', grunt.file.readJSON('secrets.json'));

    if (
        !grunt.config('secrets') ||
        !grunt.config('secrets').S3_KEY ||
        !grunt.config('secrets').S3_SECRET ||
        !grunt.config('secrets').S3_BUCKET
      ) {
      grunt.fail.fatal('S3 keys not specified in secrets.json' , 1);
    }

    grunt.task.run([
      'jasmine', // Don't comment this line unless you have a GOOD REASON
      's3'
    ]);
  });

  grunt.registerTask('set_current_version', function() {
    var version = pkg.version;
    var minor = version.split('.')
    minor.pop()
    minor = minor.join('.');

    grunt.config.set('bump', { increment: 'build', version: version, minor: minor });
  });

  grunt.registerTask('invalidate', function(){
    if (!grunt.file.exists('secrets.json')) {
      grunt.fail.fatal('secrets.json file does not exist, copy secrets.example.json and rename it' , 1);
    }

    // Read secrets
    grunt.config.set('secrets', grunt.file.readJSON('secrets.json'));

    if (!grunt.config('secrets') ||
        !grunt.config('secrets').FASTLY_API_KEY ||
        !grunt.config('secrets').FASTLY_CARTODB_SERVICE
      ) {
      grunt.fail.fatal('Fastly keys not specified in secrets.json' , 1);
    }

    grunt.task.run([
      'fastly'
    ]);
  });

  grunt.registerTask('pages', [ 'buildcontrol:pages' ]);

  grunt.registerTask('build', [
      'prompt:bump',
      'js',
      'useminPrepare',
      'cssmin',
      'copy:distStatic',
      'imagemin',
      'svgmin',
      'filerev',
      'usemin',
      'htmlmin',
      'uglify'
  ]);

  grunt.registerTask('js', [
      'replace',
      'gitinfo',
      'clean:dist',
      'concurrent:dist',
      'concat',
      'autoprefixer:dist'
  ]);

  grunt.registerTask('dist_js', [
    'set_current_version',
    'js'
  ])

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

  grunt.registerTask('default', [
    'build'
  ]);
}
<commit_msg>Fixes #332 - Grunt checks package version before running any task<commit_after>
/**
 *  Grunfile runner file for CartoDB.js
 *  framework
 *
 */

module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);
  require('time-grunt')(grunt);
  var semver = require('semver');

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

  if (!pkg.version || !semver.valid(pkg.version)) {
    grunt.fail.fatal('package.json version is not valid' , 1);
  }

  var version = pkg.version.split('.');

  var config = {
    dist: 'dist',
    app:  'www',
    version: {
      major:      version[0],
      minor:      version[0] + '.' + version[1],
      bugfixing:  pkg.version
    },
    pkg:  pkg
  };

  grunt.initConfig({
    config: config,
    gitinfo: {},
    s3: require('./grunt/tasks/s3').task(grunt, config),
    prompt: require('./grunt/tasks/prompt').task(grunt, config),
    replace: require('./grunt/tasks/replace').task(grunt, config),
    fastly: require('./grunt/tasks/fastly').task(grunt, config),
    watch: require('./grunt/tasks/watch').task(),
    connect: require('./grunt/tasks/connect').task(config),
    clean: require('./grunt/tasks/clean').task(),
    compass: require('./grunt/tasks/compass').task(),
    autoprefixer: require('./grunt/tasks/autoprefixer').task(),
    useminPrepare: require('./grunt/tasks/useminPrepare').task(),
    usemin: require('./grunt/tasks/usemin').task(),
    htmlmin: require('./grunt/tasks/htmlmin').task(),
    concat: require('./grunt/tasks/concat').task(grunt, config),
    uglify: require('./grunt/tasks/uglify').task(),
    cssmin: require('./grunt/tasks/cssmin').task(),
    imagemin: require('./grunt/tasks/imagemin').task(),
    svgmin: require('./grunt/tasks/svgmin').task(),
    copy: require('./grunt/tasks/copy').task(grunt, config),
    filerev: require('./grunt/tasks/filerev').task(),
    buildcontrol: require('./grunt/tasks/buildcontrol').task(),
    jshint: require('./grunt/tasks/jshint').task(),
    csslint: require('./grunt/tasks/csslint').task(),
    concurrent: require('./grunt/tasks/concurrent').task(),
    jasmine: require('./grunt/tasks/jasmine').task()
  });

  /* TASKS */

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

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

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

  grunt.registerTask('check', [
    'clean:server',
    'compass:server',
    'jshint:all',
    'csslint:check'
  ]);

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

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

  grunt.registerTask('publish', function (target) {

    if (!grunt.file.exists('secrets.json')) {
      grunt.fail.fatal('secrets.json file does not exist, copy secrets.example.json and rename it' , 1);
    }

    // Read secrets
    grunt.config.set('secrets', grunt.file.readJSON('secrets.json'));

    if (
        !grunt.config('secrets') ||
        !grunt.config('secrets').S3_KEY ||
        !grunt.config('secrets').S3_SECRET ||
        !grunt.config('secrets').S3_BUCKET
      ) {
      grunt.fail.fatal('S3 keys not specified in secrets.json' , 1);
    }

    grunt.task.run([
      'jasmine', // Don't comment this line unless you have a GOOD REASON
      's3'
    ]);
  });

  grunt.registerTask('set_current_version', function() {
    var version = pkg.version;
    var minor = version.split('.')
    minor.pop()
    minor = minor.join('.');

    grunt.config.set('bump', { increment: 'build', version: version, minor: minor });
  });

  grunt.registerTask('invalidate', function(){
    if (!grunt.file.exists('secrets.json')) {
      grunt.fail.fatal('secrets.json file does not exist, copy secrets.example.json and rename it' , 1);
    }

    // Read secrets
    grunt.config.set('secrets', grunt.file.readJSON('secrets.json'));

    if (!grunt.config('secrets') ||
        !grunt.config('secrets').FASTLY_API_KEY ||
        !grunt.config('secrets').FASTLY_CARTODB_SERVICE
      ) {
      grunt.fail.fatal('Fastly keys not specified in secrets.json' , 1);
    }

    grunt.task.run([
      'fastly'
    ]);
  });

  grunt.registerTask('pages', [ 'buildcontrol:pages' ]);

  grunt.registerTask('build', [
      'prompt:bump',
      'js',
      'useminPrepare',
      'cssmin',
      'copy:distStatic',
      'imagemin',
      'svgmin',
      'filerev',
      'usemin',
      'htmlmin',
      'uglify'
  ]);

  grunt.registerTask('js', [
      'replace',
      'gitinfo',
      'clean:dist',
      'concurrent:dist',
      'concat',
      'autoprefixer:dist'
  ]);

  grunt.registerTask('dist_js', [
    'set_current_version',
    'js'
  ])

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

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