<commit_before>var $ = require("abaaso");

module.exports = function (grunt) {
	grunt.initConfig({
		pkg : grunt.file.readJSON("package.json"),
		concat : {
			options : {
				banner : "/**\n" +
				         " * <%= pkg.name %>\n" +
				         " *\n" +
				         " * @author <%= pkg.author.name %> <<%= pkg.author.email %>>\n" +
				         " * @copyright <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>\n" +
				         " * @license <%= pkg.licenses[0].type %> <<%= pkg.licenses[0].url %>>\n" +
				         " * @link <%= pkg.homepage %>\n" +
				         " * @module <%= pkg.name %>\n" +
				         " * @version <%= pkg.version %>\n" +
				         " */\n"
			},
			dist : {
				src : [
					"src/intro.js",
					"src/copy.js",
					"src/display.js",
					"src/hash.js",
					"src/section.js",
					"src/events.js",
					"src/outro.js"
				],
				dest : "assets/dashboard.js"
			}
		},
		exec : {
			closure : {
				cmd : "cd assets\nclosure-compiler --js <%= pkg.name %>.js --js_output_file <%= pkg.name %>.min.js --create_source_map ./<%= pkg.name %>.map"
			},
			sourcemap : {
				cmd : "echo //@ sourceMappingURL=<%= pkg.name %>.map >> assets/<%= pkg.name %>.min.js"
			}
		},
		jshint : {
			options : {
				jshintrc : ".jshintrc"
			},
			src : "assets/<%= pkg.name %>.js"
		},
		nodeunit : {
			all : ["test/*.js"]
		},
		sed : {
			"version" : {
				pattern : "{{VERSION}}",
				replacement : "<%= pkg.version %>",
				path : ["<%= concat.dist.dest %>"]
			}
		},
		watch : {
			js : {
				files : "<%= concat.dist.src %>",
				tasks : "build"
			},
			pkg: {
				files : "package.json",
				tasks : "build"
			}
		}
	});

	// tasks
	grunt.loadNpmTasks("grunt-sed");
	grunt.loadNpmTasks("grunt-exec");
	grunt.loadNpmTasks("grunt-contrib-concat");
	grunt.loadNpmTasks("grunt-contrib-nodeunit");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks('grunt-contrib-watch');

	// aliases
	grunt.registerTask("lint", ["jshint"]);
	grunt.registerTask("test", ["nodeunit"]);
	grunt.registerTask("build", ["concat", "sed", "exec"]);
	grunt.registerTask("default", ["build", "test", "lint"]);
	grunt.registerTask("files", function () {
		var files = ["api", "tutorials"],
			body  = grunt.file.read("index.html").replace('
', '
');

		files.forEach(function (i) {
			console.log("Creating " + i + ".html");
			grunt.file.write(i + ".html", body.replace(RegExp('
'), '
'));
		});
	});

	grunt.registerTask("sitemap", function () {
		var file    = "sitemap.xml",
			body    = grunt.file.read(file),
			date    = new Date(),
			year    = date.getFullYear(),
			month   = date.getMonth() + 1,
			day     = date.getDate(),
			dstring = year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day);

		console.log("Updating " + file);
		grunt.file.write(file, body.replace(/(lastmod\>)(.*)(<\/lastmod)/g, "$1" + dstring + "$3"));
	});

	grunt.registerTask("nav", function () {
		var file  = "index.html",
		    body  = grunt.file.read(file),
		    lists = ["api", "tutorials"],
		    nav   = {api: [], turtorials: []},
		    tpl   = "
{{display}}
";

		nav.api = [
			"Array.prototype",
			"Element.prototype",
			"Function.prototype",
			"Number.prototype",
			"String.prototype",
			"abaaso",
			"array",
			"client",
			"cookie",
			"data",
			"datalist",
			"deferred ",
			"element",
			"events",
			"filter",
			"grid",
			"json",
			"label",
			"loading",
			"message",
			"mouse",
			"number",
			"observer",
			"promise",
			"route",
			"string",
			"timer",
			"validate",
			"xml"
		];

		nav.tutorials = [
			"Creating an AJAX request",
			"Creating an event listener",
			"Creating a data store",
			"Creating a RESTful data store",
			"Creating a data list",
			"Creating a data list filter",
			"Using events",
			"Using promises",
			"Using application states",
			"Iterating an Array",
			"Iterating an Object"
		];

		lists.each(function (i) {
			var li    = [],
			    regex = new RegExp("(
)(.*)(<\/ul>)");

			nav[i].each(function (p) {
				var filename = p.hyphenate() + ".md",
				    html     = tpl;

				html = html.replace(/\{\{url\}\}/g, "wiki/" + filename).replace(/\{\{name\}\}/g, p).replace(/\{\{filename\}\}/g, filename).replace(/\{\{target\}\}/g, i).replace(/\{\{display\}\}/g, p.replace(".prototype", ""));
				li.push(html);
			});

			body = body.replace(regex, "$1" + li.join("") + "$3");
			grunt.file.write(file, body);
		});
	});

	grunt.registerTask("default", ["concat", "exec", "jshint", "nav", "files", "sitemap"]);
};<commit_msg>Updating `grunt watch` task<commit_after>var $ = require("abaaso");

module.exports = function (grunt) {
	grunt.initConfig({
		pkg : grunt.file.readJSON("package.json"),
		concat : {
			options : {
				banner : "/**\n" +
				         " * <%= pkg.name %>\n" +
				         " *\n" +
				         " * @author <%= pkg.author.name %> <<%= pkg.author.email %>>\n" +
				         " * @copyright <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>\n" +
				         " * @license <%= pkg.licenses[0].type %> <<%= pkg.licenses[0].url %>>\n" +
				         " * @link <%= pkg.homepage %>\n" +
				         " * @module <%= pkg.name %>\n" +
				         " * @version <%= pkg.version %>\n" +
				         " */\n"
			},
			dist : {
				src : [
					"src/intro.js",
					"src/copy.js",
					"src/display.js",
					"src/hash.js",
					"src/section.js",
					"src/events.js",
					"src/outro.js"
				],
				dest : "assets/dashboard.js"
			}
		},
		exec : {
			closure : {
				cmd : "cd assets\nclosure-compiler --js <%= pkg.name %>.js --js_output_file <%= pkg.name %>.min.js --create_source_map ./<%= pkg.name %>.map"
			},
			sourcemap : {
				cmd : "echo //@ sourceMappingURL=<%= pkg.name %>.map >> assets/<%= pkg.name %>.min.js"
			}
		},
		jshint : {
			options : {
				jshintrc : ".jshintrc"
			},
			src : "assets/<%= pkg.name %>.js"
		},
		nodeunit : {
			all : ["test/*.js"]
		},
		sed : {
			"version" : {
				pattern : "{{VERSION}}",
				replacement : "<%= pkg.version %>",
				path : ["<%= concat.dist.dest %>"]
			}
		},
		watch : {
			js : {
				files : "<%= concat.dist.src %>",
				tasks : "default"
			},
			pkg: {
				files : "package.json",
				tasks : "default"
			}
		}
	});

	// tasks
	grunt.loadNpmTasks("grunt-sed");
	grunt.loadNpmTasks("grunt-exec");
	grunt.loadNpmTasks("grunt-contrib-concat");
	grunt.loadNpmTasks("grunt-contrib-nodeunit");
	grunt.loadNpmTasks("grunt-contrib-jshint");
	grunt.loadNpmTasks('grunt-contrib-watch');

	// aliases
	grunt.registerTask("lint", ["jshint"]);
	grunt.registerTask("test", ["nodeunit"]);
	grunt.registerTask("build", ["concat", "sed", "exec"]);
	grunt.registerTask("default", ["build", "test", "lint"]);
	grunt.registerTask("files", function () {
		var files = ["api", "tutorials"],
			body  = grunt.file.read("index.html").replace('
', '
');

		files.forEach(function (i) {
			console.log("Creating " + i + ".html");
			grunt.file.write(i + ".html", body.replace(RegExp('
'), '
'));
		});
	});

	grunt.registerTask("sitemap", function () {
		var file    = "sitemap.xml",
			body    = grunt.file.read(file),
			date    = new Date(),
			year    = date.getFullYear(),
			month   = date.getMonth() + 1,
			day     = date.getDate(),
			dstring = year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day);

		console.log("Updating " + file);
		grunt.file.write(file, body.replace(/(lastmod\>)(.*)(<\/lastmod)/g, "$1" + dstring + "$3"));
	});

	grunt.registerTask("nav", function () {
		var file  = "index.html",
		    body  = grunt.file.read(file),
		    lists = ["api", "tutorials"],
		    nav   = {api: [], turtorials: []},
		    tpl   = "
{{display}}
";

		nav.api = [
			"Array.prototype",
			"Element.prototype",
			"Function.prototype",
			"Number.prototype",
			"String.prototype",
			"abaaso",
			"array",
			"client",
			"cookie",
			"data",
			"datalist",
			"deferred ",
			"element",
			"events",
			"filter",
			"grid",
			"json",
			"label",
			"loading",
			"message",
			"mouse",
			"number",
			"observer",
			"promise",
			"route",
			"string",
			"timer",
			"validate",
			"xml"
		];

		nav.tutorials = [
			"Creating an AJAX request",
			"Creating an event listener",
			"Creating a data store",
			"Creating a RESTful data store",
			"Creating a data list",
			"Creating a data list filter",
			"Using events",
			"Using promises",
			"Using application states",
			"Iterating an Array",
			"Iterating an Object"
		];

		lists.each(function (i) {
			var li    = [],
			    regex = new RegExp("(
)(.*)(<\/ul>)");

			nav[i].each(function (p) {
				var filename = p.hyphenate() + ".md",
				    html     = tpl;

				html = html.replace(/\{\{url\}\}/g, "wiki/" + filename).replace(/\{\{name\}\}/g, p).replace(/\{\{filename\}\}/g, filename).replace(/\{\{target\}\}/g, i).replace(/\{\{display\}\}/g, p.replace(".prototype", ""));
				li.push(html);
			});

			body = body.replace(regex, "$1" + li.join("") + "$3");
			grunt.file.write(file, body);
		});
	});

	grunt.registerTask("default", ["concat", "exec", "jshint", "nav", "files", "sitemap"]);
};<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: ['src/js/*.js']
    },
    uglify: {
      app: {
        options: {
          compress: true,
          mangle: true,
          sourceMap: true
        },
        files: {
          'dist/js/app.js': ['src/js/*.js']
        }
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'dist/css/app.css': 'src/sass/site.scss'
        }
      }
    },
    watch: {
      all: {
        files: ['src/js/*.js', 'src/sass/*.scss', 'app/index.html'],
        tasks: ['js', 'css'],
        options: { livereload: true },
      }
    },
    connect: {
      server: {
        options: {
          base: './',
          livereload: true,
          open: true,
        }
      }
    }
  });

  // Loading tasks.
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-connect');

  // Tasks.
  grunt.registerTask('default', ['build']);
  grunt.registerTask('js', ['jshint', 'uglify']);
  grunt.registerTask('build', ['js', 'css','watch']);
  grunt.registerTask('css',['sass']);
  grunt.registerTask('lint', ['jshint']);
  grunt.registerTask('serve', ['connect:server', 'watch']);
};
<commit_msg>Support browserify<commit_after>'use strict';

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      files: ['src/js/*.js']
    },
    uglify: {
      app: {
        options: {
          compress: true,
          mangle: true,
          sourceMap: true
        },
        files: {
          'dist/js/app.js': ['src/js/*.js']
        }
      }
    },
    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'dist/css/app.css': 'src/sass/site.scss'
        }
      }
    },
    watch: {
      html: {
        files: ['index.html'],
      },
      stylesheets: {
        files: ['src/sass/*.scss'],
        tasks: ['css'],
      },
      js: {
        files: ['src/js/*.js'],
        tasks: ['js', 'browserify'],
      },
      options: { livereload: true },
    },
    browserify: {
      dist: {
        files: {
          'dist/js/dnc.js': ['src/js/DNC.js'],
        }
      },
      options: {
        watch: true
      }
    },
    connect: {
      server: {
        options: {
          base: './',
          livereload: true,
          open: true,
        }
      }
    }
  });

  // Loading tasks.
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-browserify');

  // Tasks.
  grunt.registerTask('default', ['build']);
  grunt.registerTask('js', ['jshint', 'uglify']);
  grunt.registerTask('build', ['js', 'css','watch']);
  grunt.registerTask('css',['sass']);
  grunt.registerTask('lint', ['jshint']);
  grunt.registerTask('serve', ['connect:server', 'watch']);
};
<|endoftext|>


<commit_before>/*
 * grunt-stencil
 * https://github.com/cambridge-healthcare/grunt-stencil
 *
 * Copyright (c) 2013 Cambridge Healthcare
 * Licensed under the MIT license.
 */

"use strict";

module.exports = function (grunt) {
  // Project configuration.
  grunt.initConfig({
    jshint: {
      all: [
        "Gruntfile.js",
        "tasks/*.js",
        "lib/*.js"
      ],
      options: {
        jshintrc: ".jshintrc",
      },
    },

    // Before generating any new files, remove any previously-created files.
    clean: {
      tmp: ["tmp"],
    },

    // Configuration to be run (and then tested).
    stencil: {
      main: {
        options: {
          dot_template_settings: {strip: false},
          dot_it_object: {
            partial_border: "2px dashed #dfdfdf",
            page_border: "2px solid #red",
            file_lists: {
              stylesheets: [{cwd: "."},"test/data/styles/*.css"],
              partials: [{}, "test/data/partials/*"]
            }
          },
          templates_folder: "test/data/templates",
          partials_folder: "test/data/partials"
        },
        files: [
          {
            expand: true,
            cwd: "test/data/pages",
            src: ["*.dot.html", "*.md"],
            dest: "tmp/",
            ext: ".html",
            flatten: true
          }
        ]
      },

      inclusion_error: {
        options: {
          dot_it_object: {
            partial_border: "2px dashed #dfdfdf",
            page_border: "2px solid #red",
            file_lists: {
              stylesheets: [{cwd: "."},"test/data/styles/*.css"],
              partials: [{}, "test/data/partials/*"]
            }
          },
          templates_folder: "test/data/templates",
          partials_folder: "test/data/partials"
        },
        files: [
          {
            expand: true,
            cwd: "test/data/pages",
            src: ["infinite.html"],
            dest: "tmp/",
            ext: ".html"
          }
        ]
      }
    }

  });

  // Actually load this plugin"s task(s).
  grunt.loadTasks("tasks");

  grunt.initConfig({
    stencil: {
      fixtures: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          cwd: 'spec/fixtures',
          src: '*.html',
          dest: 'tmp',
          ext: '.html'
        }]
      }
    }
  });
};
<commit_msg>Separate tasks for each case<commit_after>/*
 * grunt-stencil
 * https://github.com/cambridge-healthcare/grunt-stencil
 *
 * Copyright (c) 2013 Cambridge Healthcare
 * Licensed under the MIT license.
 */

"use strict";

module.exports = function (grunt) {
  // Project configuration.
  grunt.initConfig({
    jshint: {
      all: [
        "Gruntfile.js",
        "tasks/*.js",
        "lib/*.js"
      ],
      options: {
        jshintrc: ".jshintrc",
      },
    },

    // Before generating any new files, remove any previously-created files.
    clean: {
      tmp: ["tmp"],
    },

    // Configuration to be run (and then tested).
    stencil: {
      main: {
        options: {
          dot_template_settings: {strip: false},
          dot_it_object: {
            partial_border: "2px dashed #dfdfdf",
            page_border: "2px solid #red",
            file_lists: {
              stylesheets: [{cwd: "."},"test/data/styles/*.css"],
              partials: [{}, "test/data/partials/*"]
            }
          },
          templates_folder: "test/data/templates",
          partials_folder: "test/data/partials"
        },
        files: [
          {
            expand: true,
            cwd: "test/data/pages",
            src: ["*.dot.html", "*.md"],
            dest: "tmp/",
            ext: ".html",
            flatten: true
          }
        ]
      },

      inclusion_error: {
        options: {
          dot_it_object: {
            partial_border: "2px dashed #dfdfdf",
            page_border: "2px solid #red",
            file_lists: {
              stylesheets: [{cwd: "."},"test/data/styles/*.css"],
              partials: [{}, "test/data/partials/*"]
            }
          },
          templates_folder: "test/data/templates",
          partials_folder: "test/data/partials"
        },
        files: [
          {
            expand: true,
            cwd: "test/data/pages",
            src: ["infinite.html"],
            dest: "tmp/",
            ext: ".html"
          }
        ]
      }
    }

  });

  // Actually load this plugin"s task(s).
  grunt.loadTasks("tasks");

  grunt.initConfig({
    stencil: {
      all: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          cwd: 'spec/fixtures',
          src: '*.html',
          dest: 'tmp',
          ext: '.html',
          flatten: true
        }]
      },

      dot_only: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          src: 'spec/fixtures/dot_only.dot.html',
          dest: 'tmp',
          ext: '.html',
          flatten: true
        }]
      },

      include_with_params: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          src: 'spec/fixtures/include_with_params.dot.html',
          dest: 'tmp',
          ext: '.html',
          flatten: true
        }]
      },

      includes_partial: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          src: 'spec/fixtures/includes_partial.dot.html',
          dest: 'tmp',
          ext: '.html',
          flatten: true
        }]
      },

      nested_include: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          src: 'spec/fixtures/nested_include.dot.html',
          dest: 'tmp',
          ext: '.html',
          flatten: true
        }]
      },

      with_header: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          src: 'spec/fixtures/with_header.md.dot.html',
          dest: 'tmp',
          ext: '.html',
          flatten: true
        }]
      },

      circular: {
        options: {
          partials: 'spec/includes'
        },
        files: [{
          expand: true,
          src: 'spec/includes/example_with_circular_include.dot.html',
          dest: 'tmp',
          ext: '.html',
          flatten: true
        }]
      }
    }
  });
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

    var pkg = require('./package.json');
    var globalConfig = {
        repo: pkg.repository.url
    };

    // Project configuration.
    grunt.initConfig( {
        globalConfig: globalConfig,

        jshint: {
            all: ['Gruntfile.js', 'index.js', 'test/**/*.js'],
            options: {
                jshintrc: '.jshintrc'
            }
        },

        mochacov: {
            coveralls: {
                options: {
                    coveralls: true
                }
            },
            covHtml: {
                options: {
                    reporter: 'html-cov',
                    output: 'coverage/index.html'
                }
            },
            test: {
                options: {
                    reporter: 'spec'
                }
            },
            options: {
                files: 'test/*.test.js'
            }
        },

        bump: {
            options: {
                files: ['package.json', 'component.json', 'bower.json'],
                commitFiles: ['-a']
            }
        },

        exec: {
            releaseNpm: {
                cmd: "npm publish ."
            },

            releaseBower: {
                cmd: "bower register logicbox <%= globalConfig.repo %>"
            }
        }
    });

    grunt.loadNpmTasks('grunt-bump');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-mocha-cov');

    grunt.registerTask('default', ['test']);
    grunt.registerTask('test', ['jshint', 'mochacov:test']);
    grunt.registerTask('cov', ['jshint', 'mochacov:covHtml']);
    grunt.registerTask('ci', ['test', 'mochacov:coveralls']);
    grunt.registerTask('release:npm', ['exec:releaseNpm']);
    grunt.registerTask('release:bower', ['exec:releaseNpm']);
    grunt.registerTask('release', ['release:npm', 'release:bower']);
};
<commit_msg>try to make grunt bump push to master branch<commit_after>'use strict';

module.exports = function(grunt) {

    var pkg = require('./package.json');
    var globalConfig = {
        repo: pkg.repository.url
    };

    // Project configuration.
    grunt.initConfig( {
        globalConfig: globalConfig,

        jshint: {
            all: ['Gruntfile.js', 'index.js', 'test/**/*.js'],
            options: {
                jshintrc: '.jshintrc'
            }
        },

        mochacov: {
            coveralls: {
                options: {
                    coveralls: true
                }
            },
            covHtml: {
                options: {
                    reporter: 'html-cov',
                    output: 'coverage/index.html'
                }
            },
            test: {
                options: {
                    reporter: 'spec'
                }
            },
            options: {
                files: 'test/*.test.js'
            }
        },

        bump: {
            options: {
                files: ['package.json', 'component.json', 'bower.json'],
                commitFiles: ['-a'],
                pushTo: 'origin master'
            }
        },

        exec: {
            releaseNpm: {
                cmd: "npm publish ."
            },

            releaseBower: {
                cmd: "bower register logicbox <%= globalConfig.repo %>"
            }
        }
    });

    grunt.loadNpmTasks('grunt-bump');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-mocha-cov');

    grunt.registerTask('default', ['test']);
    grunt.registerTask('test', ['jshint', 'mochacov:test']);
    grunt.registerTask('cov', ['jshint', 'mochacov:covHtml']);
    grunt.registerTask('ci', ['test', 'mochacov:coveralls']);
    grunt.registerTask('release:npm', ['exec:releaseNpm']);
    grunt.registerTask('release:bower', ['exec:releaseNpm']);
    grunt.registerTask('release', ['release:npm', 'release:bower']);
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
    // load all grunt tasks
    require('matchdep').filter('grunt-*').forEach(grunt.loadNpmTasks);
    grunt.loadTasks('tasks');
    // show elapsed time at the end
    require('time-grunt')(grunt);

    var DEFAULT_PORT = 3000;

    grunt.initConfig({
        env: {
            development: {
                PORT: DEFAULT_PORT,
                MONGOHQ_URL: 'mongodb://localhost/studyokee',
                src: '.env',
                URL: 'http://localhost:' + DEFAULT_PORT
            },
            test: {
                MONGOHQ_URL: 'mongodb://localhost/studyokee-test',
                src: '.env'
            },
            travis: {
                MONGOHQ_URL: 'mongodb://localhost/studyokee-test'
            }
        },
        watch: {
            coffee: {
                files: [
                    'public/src/**/*.coffee'
                ],
                tasks: [
                    'coffeelint',
                    'coffee'
                ]
            },
            handlebars: {
                files: [
                    'public/src/**/*.handlebars'
                ],
                tasks: [
                    'handlebars'
                ]
            },
            stylus: {
                files: ['public/src/**/*.styl'],
                tasks: [
                    'stylus'
                ]
            },
            styles: {
                files: ['public/styles/{,*/}*.css'],
                tasks: ['autoprefixer']
            }
        },
        handlebars: {
            compile: {
                options: {
                    namespace: 'Handlebars.templates',
                    amd: true,
                    processName: function(filename) {
                        var path = require('path');
                        return path.basename(filename, '.handlebars');
                    }
                },
                files: {
                    'public/lib/templates.js': 'public/src/**/*.handlebars'
                }
            }
        },
        coffee: {
            compile: {
                cwd: 'public/src/',
                src: ['**/*.coffee'],
                dest: 'public/lib/',
                ext: '.js',
                expand: true,
                options: {
                    runtime: 'inline',
                    sourceMap: true
                }
            }
        },
        coffeelint: {
            app: {
                files: {
                    src: [
                        'public/src/**/*.coffee',
                        '!components/**/*',
                        '!node_modules/**/*'
                    ]
                },
                options: {
                    'max_line_length': {
                        level: 'warn'
                    }
                }
            }
        },
        jshint2: {
            server: {
                src: [
                    '**/*.js',
                    '!node_modules/**/*.js',
                    '!public/**/*.js',
                    '!app/api/rdio/rdio.js',
                    '!test/public/**/*.js'
                ],
                options: {
                    jshint: {
                        'node': true,
                        'browser': false,
                        'esnext': true,
                        'bitwise': true,
                        'camelcase': true,
                        'curly': true,
                        'eqeqeq': true,
                        'immed': true,
                        'indent': 4,
                        'latedef': true,
                        'newcap': true,
                        'noarg': true,
                        'quotmark': 'single',
                        'regexp': true,
                        'undef': true,
                        'unused': true,
                        'strict': true,
                        'trailing': true,
                        'smarttabs': true
                    },
                    globals: {
                        'describe': false,
                        'it': false,
                        'beforeEach': false,
                        'afterEach': false,
                        'before': false,
                        'console': false
                    }
                }
            }
        },
        jasmine: {
            all: 'test/public/index.html'
        },
        mochaTest: {
            files: [
                'test/app/**/*.js',
                'test/models/**/*.js',
                'test/utils/**/*.js'
            ]
        },
        mochaTestConfig: {
            options: {
                reporter: 'json-stream'
            }
        },
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },
        bower: {
            options: {
                exclude: ['modernizr']
            },
            all: {
                rjsConfig: 'public/scripts/main.js'
            }
        },
        stylus: {
            dist: {
                options: {
                    compress: true
                },
                files: {
                    'public/styles/main.css': 'public/styles/main.styl'
                }
            },
            dev: {
                options: {
                    compress: false
                },
                files: {
                    'public/styles/main.css': 'public/styles/main.styl'
                }
            }
        }
    });
    grunt.registerTask('lint', [
        'jshint2',
        'coffeelint'
    ]);
    grunt.registerTask('preprocessor', [
        'coffee',
        'handlebars',
        'stylus',
        'autoprefixer'
    ]);
    grunt.registerTask('keep-alive', function () {
        this.async();
    });
    grunt.registerTask('travis', ['lint', 'env:travis', 'mochaTest']);
    grunt.registerTask('test', ['lint', 'env:test', 'mongod', 'mochaTest']);
    grunt.registerTask('default', ['env:development', 'lint', 'preprocessor', 'mongod', 'server', 'watch']);
    grunt.registerTask('uitest', ['jasmine']);
};
<commit_msg>fixing lint grunt file globs<commit_after>'use strict';

module.exports = function (grunt) {
    // load all grunt tasks
    require('matchdep').filter('grunt-*').forEach(grunt.loadNpmTasks);
    grunt.loadTasks('tasks');
    // show elapsed time at the end
    require('time-grunt')(grunt);

    var DEFAULT_PORT = 3000;

    grunt.initConfig({
        env: {
            development: {
                PORT: DEFAULT_PORT,
                MONGOHQ_URL: 'mongodb://localhost/studyokee',
                src: '.env',
                URL: 'http://localhost:' + DEFAULT_PORT
            },
            test: {
                MONGOHQ_URL: 'mongodb://localhost/studyokee-test',
                src: '.env'
            },
            travis: {
                MONGOHQ_URL: 'mongodb://localhost/studyokee-test'
            }
        },
        watch: {
            coffee: {
                files: [
                    'public/src/**/*.coffee'
                ],
                tasks: [
                    'coffeelint',
                    'coffee'
                ]
            },
            handlebars: {
                files: [
                    'public/src/**/*.handlebars'
                ],
                tasks: [
                    'handlebars'
                ]
            },
            stylus: {
                files: ['public/src/**/*.styl'],
                tasks: [
                    'stylus'
                ]
            },
            styles: {
                files: ['public/styles/{,*/}*.css'],
                tasks: ['autoprefixer']
            }
        },
        handlebars: {
            compile: {
                options: {
                    namespace: 'Handlebars.templates',
                    amd: true,
                    processName: function(filename) {
                        var path = require('path');
                        return path.basename(filename, '.handlebars');
                    }
                },
                files: {
                    'public/lib/templates.js': 'public/src/**/*.handlebars'
                }
            }
        },
        coffee: {
            compile: {
                cwd: 'public/src/',
                src: ['**/*.coffee'],
                dest: 'public/lib/',
                ext: '.js',
                expand: true,
                options: {
                    runtime: 'inline',
                    sourceMap: true
                }
            }
        },
        coffeelint: {
            app: {
                files: {
                    src: [
                        'public/src/**/*.coffee',
                        '!public/bower_components/**/*'
                    ]
                },
                options: {
                    'max_line_length': {
                        level: 'warn'
                    }
                }
            }
        },
        jshint2: {
            server: {
                src: [
                    '**/*.js',
                    '!node_modules/**/*.js',
                    '!public/**/*.js',
                    '!test/public/**/*.js'
                ],
                options: {
                    jshint: {
                        'node': true,
                        'browser': false,
                        'esnext': true,
                        'bitwise': true,
                        'camelcase': true,
                        'curly': true,
                        'eqeqeq': true,
                        'immed': true,
                        'indent': 4,
                        'latedef': true,
                        'newcap': true,
                        'noarg': true,
                        'quotmark': 'single',
                        'regexp': true,
                        'undef': true,
                        'unused': true,
                        'strict': true,
                        'trailing': true,
                        'smarttabs': true
                    },
                    globals: {
                        'describe': false,
                        'it': false,
                        'beforeEach': false,
                        'afterEach': false,
                        'before': false,
                        'console': false
                    }
                }
            }
        },
        jasmine: {
            all: 'test/public/index.html'
        },
        mochaTest: {
            files: [
                'test/app/**/*.js',
                'test/models/**/*.js',
                'test/utils/**/*.js'
            ]
        },
        mochaTestConfig: {
            options: {
                reporter: 'json-stream'
            }
        },
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },
        bower: {
            options: {
                exclude: ['modernizr']
            },
            all: {
                rjsConfig: 'public/scripts/main.js'
            }
        },
        stylus: {
            dist: {
                options: {
                    compress: true
                },
                files: {
                    'public/styles/main.css': 'public/styles/main.styl'
                }
            },
            dev: {
                options: {
                    compress: false
                },
                files: {
                    'public/styles/main.css': 'public/styles/main.styl'
                }
            }
        }
    });
    grunt.registerTask('lint', [
        'jshint2',
        'coffeelint'
    ]);
    grunt.registerTask('preprocessor', [
        'coffee',
        'handlebars',
        'stylus',
        'autoprefixer'
    ]);
    grunt.registerTask('keep-alive', function () {
        this.async();
    });
    grunt.registerTask('travis', ['lint', 'env:travis', 'mochaTest']);
    grunt.registerTask('test', ['lint', 'env:test', 'mongod', 'mochaTest']);
    grunt.registerTask('default', ['env:development', 'lint', 'preprocessor', 'mongod', 'server', 'watch']);
    grunt.registerTask('uitest', ['jasmine']);
};
<|endoftext|>


<commit_before>/*global module */

(function () {
    'use strict';

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

            clean: {
                all: ['README.md', 'docs', 'lib', 'src/cldr.zip', 'src/tzdata.tar.gz', 'src/*.json', 'src/cldr', 'src/tz', 'coverage'],
                after: ['src/cldr.zip', 'src/tzdata.tar.gz', 'src/cldr', 'src/tz', 'coverage']
            },

            curl: {
                cldr: {
                    src: '<%= pkg.sources.cldr %>',
                    dest: 'src/cldr.zip'
                },

                tzdata: {
                    src: '<%= pkg.sources.tzdata %>',
                    dest: 'src/tzdata.tar.gz'
                }
            },

            unzip: {
                cldr: {
                    src: 'src/cldr.zip',
                    dest: 'src/cldr'
                }
            },

            extactTargz: {
                tzdata: {
                    src: 'src/tzdata.tar.gz',
                    dest: 'src/tz'
                }
            },

            buildLanguage: {
                all: {
                    src: 'src/cldr',
                    dest: 'src'
                }
            },

            buildLeapSeconds: {
                all: {
                    src: 'src/tz',
                    dest: 'src'
                }
            },

            buildReadme: {
                readme: {
                    readme: 'templates/README.tpl',
                    dest: 'README.md'
                }
            },

            jsbeautifier: {
                lib: {
                    src: ['lib/<%= pkg.name %>.js'],
                    options: {
                        js: {
                            jslintHappy: true
                        }
                    }
                }
            },

            uglify: {
                lib: {
                    files: {
                        'lib/<%= pkg.name %>.min.js': 'lib/<%= pkg.name %>.js'
                    }
                },
                options: {
                    mangle: true,
                    compress: {},
                    output: {
                        'ascii_only': true
                    },
                    report: 'min',
                    preserveComments: 'some'
                }
            },

            jshint: {
                build: ['Gruntfile.js', 'index.js', 'src/*.js', 'tasks/**/*.js', 'tests/**/*.js'],
                lib: ['lib/<%= pkg.name %>.js'],
                options: {
                    'bitwise': true,
                    'camelcase': true,
                    'curly': true,
                    'eqeqeq': true,
                    'forin': true,
                    'freeze': true,
                    'funcscope': true,
                    'globalstrict': true,
                    'immed': true,
                    'newcap': true,
                    'noarg': true,
                    'nomen': true,
                    'nonew': true,
                    'notypeof': true,
                    'plusplus': true,
                    'regexp': true,
                    'strict': true,
                    'trailing': true,
                    'undef': true,
                    'white': true,
                    'noempty': true,
                    'quotmark': 'single'
                }
            },

            jsonlint: {
                all: {
                    src: ['src/*.json']
                }
            },

            replace: {
                lib: {
                    options: {
                        patterns: [{
                            match: 'VERSION',
                            replacement: '<%= pkg.version %>'
                        }, {
                            match: 'MODULE',
                            replacement: '<%= pkg.name %>'
                        }, {
                            match: 'DESCRIPTION',
                            replacement: '<%= pkg.description %>'
                        }, {
                            match: 'AUTHORNAME',
                            replacement: '<%= pkg.author.name %>'
                        }, {
                            match: 'AUTHOREMAIL',
                            replacement: '<%= pkg.author.email %>'
                        }, {
                            match: 'HOMEPAGE',
                            replacement: '<%= pkg.homepage %>'
                        }, {
                            match: 'COPYRIGHT',
                            replacement: '<%= pkg.copyright %>'
                        }, {
                            match: 'LICENSE',
                            replacement: '<%= pkg.licenses[0].type %>'
                        }, {
                            match: 'LICLINK',
                            replacement: '<%= pkg.licenses[0].url %>'
                        }, {
                            match: '/\\/\\*@@leapSeconds\\*\\//g',
                            replacement: '<%= grunt.file.read("src/leapSeconds.json") %>',
                            expression: true
                        }, {
                            match: '/\\/\\*@@supplemental\\*\\//g',
                            replacement: '<%= grunt.file.read("src/supplemental.json") %>',
                            expression: true
                        }, {
                            match: '/\\/\\*@@languages\\*\\//g',
                            replacement: '<%= grunt.file.read("src/language.json") %>',
                            expression: true
                        }, {
                            match: '/\\/\\*@@BigNumber\\*\\//g',
                            replacement: (grunt.file.read('node_modules/bignumber.js/bignumber.js').replace(/\$/g, '$$$$')),
                            expression: true
                        }]
                    },
                    files: [{
                        src: ['src/<%= pkg.name %>.js'],
                        dest: 'lib/<%= pkg.name %>.js'
                    }]
                }
            },

            jsdoc: {
                lib: {
                    jsdoc: 'node_modules/.bin/jsdoc',
                    src: ['README.md', 'lib/<%= pkg.name %>.js'],
                    options: {
                        destination: 'docs',
                        private: false
                    }
                }
            },

            shell: {
                beautified: {
                    options: {
                        stdout: true,
                        stderr: true,
                        failOnError: true,
                        execOptions: {
                            maxBuffer: 1048576
                        }
                    },
                    command: 'node_modules/tape/bin/tape tests/*.js'
                },
                coveralls: {
                    options: {
                        stdout: false,
                        stderr: true,
                        failOnError: true,
                        execOptions: {
                            maxBuffer: 1048576
                        }
                    },
                    command: 'node_modules/istanbul/lib/cli.js cover tests/*.js --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage'
                },
                uglified: {
                    options: {
                        stdout: true,
                        stderr: true,
                        failOnError: true,
                        execOptions: {
                            maxBuffer: 1048576
                        }
                    },
                    command: 'ASTRODATE_COVERAGE=1 node_modules/tape/bin/tape tests/*.js'
                }
            },

            watch: {
                test: {
                    files: [
                        'lib/<%= pkg.name %>.js',
                        'tests/*.js'
                    ],
                    tasks: ['shell:beautified', 'shell:coveralls', 'shell:uglified']
                },

                jshint: {
                    files: [
                        '<%= jshint.build %>',
                        '<%= jshint.lib %>'
                    ],
                    tasks: ['jshint']
                },

                jsonlint: {
                    files: [
                        '<%= jsonlint.all.src %>'
                    ],
                    tasks: ['jsonlint']
                }
            }
        });

        // Custom tasks.
        grunt.loadTasks('tasks');

        // These plugins provide necessary tasks.
        grunt.loadNpmTasks('grunt-contrib-jshint');
        grunt.loadNpmTasks('grunt-contrib-concat');
        grunt.loadNpmTasks('grunt-contrib-uglify');
        grunt.loadNpmTasks('grunt-contrib-watch');
        grunt.loadNpmTasks('grunt-jsdoc');
        grunt.loadNpmTasks('grunt-jsbeautifier');
        grunt.loadNpmTasks('grunt-replace');
        grunt.loadNpmTasks('grunt-contrib-clean');
        grunt.loadNpmTasks('grunt-curl');
        grunt.loadNpmTasks('grunt-zip');
        grunt.loadNpmTasks('grunt-shell');
        grunt.loadNpmTasks('grunt-jsonlint');

        // Default task.
        grunt.registerTask('default', [
            'clean:all',
            'jshint:build',
            'curl',
            'unzip',
            'extactTargz',
            'buildLanguage',
            'buildLeapSeconds',
            'jsonlint',
            'replace:lib',
            'jsbeautifier:lib',
            'jshint:lib',
            'shell:beautified',
            'uglify',
            'shell:uglified',
            //'shell:coveralls',
            'buildReadme',
            'jsdoc',
            'clean:after'
        ]);

        grunt.registerTask('test', [
            'shell:beautified',
            //'shell:coveralls',
            'shell:uglified'
        ]);
    };
}());
<commit_msg>Fixed some other missed tape -> tape.compact references<commit_after>/*global module */

(function () {
    'use strict';

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

            clean: {
                all: ['README.md', 'docs', 'lib', 'src/cldr.zip', 'src/tzdata.tar.gz', 'src/*.json', 'src/cldr', 'src/tz', 'coverage'],
                after: ['src/cldr.zip', 'src/tzdata.tar.gz', 'src/cldr', 'src/tz', 'coverage']
            },

            curl: {
                cldr: {
                    src: '<%= pkg.sources.cldr %>',
                    dest: 'src/cldr.zip'
                },

                tzdata: {
                    src: '<%= pkg.sources.tzdata %>',
                    dest: 'src/tzdata.tar.gz'
                }
            },

            unzip: {
                cldr: {
                    src: 'src/cldr.zip',
                    dest: 'src/cldr'
                }
            },

            extactTargz: {
                tzdata: {
                    src: 'src/tzdata.tar.gz',
                    dest: 'src/tz'
                }
            },

            buildLanguage: {
                all: {
                    src: 'src/cldr',
                    dest: 'src'
                }
            },

            buildLeapSeconds: {
                all: {
                    src: 'src/tz',
                    dest: 'src'
                }
            },

            buildReadme: {
                readme: {
                    readme: 'templates/README.tpl',
                    dest: 'README.md'
                }
            },

            jsbeautifier: {
                lib: {
                    src: ['lib/<%= pkg.name %>.js'],
                    options: {
                        js: {
                            jslintHappy: true
                        }
                    }
                }
            },

            uglify: {
                lib: {
                    files: {
                        'lib/<%= pkg.name %>.min.js': 'lib/<%= pkg.name %>.js'
                    }
                },
                options: {
                    mangle: true,
                    compress: {},
                    output: {
                        'ascii_only': true
                    },
                    report: 'min',
                    preserveComments: 'some'
                }
            },

            jshint: {
                build: ['Gruntfile.js', 'index.js', 'src/*.js', 'tasks/**/*.js', 'tests/**/*.js'],
                lib: ['lib/<%= pkg.name %>.js'],
                options: {
                    'bitwise': true,
                    'camelcase': true,
                    'curly': true,
                    'eqeqeq': true,
                    'forin': true,
                    'freeze': true,
                    'funcscope': true,
                    'globalstrict': true,
                    'immed': true,
                    'newcap': true,
                    'noarg': true,
                    'nomen': true,
                    'nonew': true,
                    'notypeof': true,
                    'plusplus': true,
                    'regexp': true,
                    'strict': true,
                    'trailing': true,
                    'undef': true,
                    'white': true,
                    'noempty': true,
                    'quotmark': 'single'
                }
            },

            jsonlint: {
                all: {
                    src: ['src/*.json']
                }
            },

            replace: {
                lib: {
                    options: {
                        patterns: [{
                            match: 'VERSION',
                            replacement: '<%= pkg.version %>'
                        }, {
                            match: 'MODULE',
                            replacement: '<%= pkg.name %>'
                        }, {
                            match: 'DESCRIPTION',
                            replacement: '<%= pkg.description %>'
                        }, {
                            match: 'AUTHORNAME',
                            replacement: '<%= pkg.author.name %>'
                        }, {
                            match: 'AUTHOREMAIL',
                            replacement: '<%= pkg.author.email %>'
                        }, {
                            match: 'HOMEPAGE',
                            replacement: '<%= pkg.homepage %>'
                        }, {
                            match: 'COPYRIGHT',
                            replacement: '<%= pkg.copyright %>'
                        }, {
                            match: 'LICENSE',
                            replacement: '<%= pkg.licenses[0].type %>'
                        }, {
                            match: 'LICLINK',
                            replacement: '<%= pkg.licenses[0].url %>'
                        }, {
                            match: '/\\/\\*@@leapSeconds\\*\\//g',
                            replacement: '<%= grunt.file.read("src/leapSeconds.json") %>',
                            expression: true
                        }, {
                            match: '/\\/\\*@@supplemental\\*\\//g',
                            replacement: '<%= grunt.file.read("src/supplemental.json") %>',
                            expression: true
                        }, {
                            match: '/\\/\\*@@languages\\*\\//g',
                            replacement: '<%= grunt.file.read("src/language.json") %>',
                            expression: true
                        }, {
                            match: '/\\/\\*@@BigNumber\\*\\//g',
                            replacement: (grunt.file.read('node_modules/bignumber.js/bignumber.js').replace(/\$/g, '$$$$')),
                            expression: true
                        }]
                    },
                    files: [{
                        src: ['src/<%= pkg.name %>.js'],
                        dest: 'lib/<%= pkg.name %>.js'
                    }]
                }
            },

            jsdoc: {
                lib: {
                    jsdoc: 'node_modules/.bin/jsdoc',
                    src: ['README.md', 'lib/<%= pkg.name %>.js'],
                    options: {
                        destination: 'docs',
                        private: false
                    }
                }
            },

            shell: {
                beautified: {
                    options: {
                        stdout: true,
                        stderr: true,
                        failOnError: true,
                        execOptions: {
                            maxBuffer: 1048576
                        }
                    },
                    command: 'node_modules/tape-compact/bin/tape tests/*.js'
                },
                coveralls: {
                    options: {
                        stdout: false,
                        stderr: true,
                        failOnError: true,
                        execOptions: {
                            maxBuffer: 1048576
                        }
                    },
                    command: 'node_modules/istanbul/lib/cli.js cover tests/*.js --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage'
                },
                uglified: {
                    options: {
                        stdout: true,
                        stderr: true,
                        failOnError: true,
                        execOptions: {
                            maxBuffer: 1048576
                        }
                    },
                    command: 'ASTRODATE_COVERAGE=1 node_modules/tape-compact/bin/tape tests/*.js'
                }
            },

            watch: {
                test: {
                    files: [
                        'lib/<%= pkg.name %>.js',
                        'tests/*.js'
                    ],
                    tasks: ['shell:beautified', 'shell:coveralls', 'shell:uglified']
                },

                jshint: {
                    files: [
                        '<%= jshint.build %>',
                        '<%= jshint.lib %>'
                    ],
                    tasks: ['jshint']
                },

                jsonlint: {
                    files: [
                        '<%= jsonlint.all.src %>'
                    ],
                    tasks: ['jsonlint']
                }
            }
        });

        // Custom tasks.
        grunt.loadTasks('tasks');

        // These plugins provide necessary tasks.
        grunt.loadNpmTasks('grunt-contrib-jshint');
        grunt.loadNpmTasks('grunt-contrib-concat');
        grunt.loadNpmTasks('grunt-contrib-uglify');
        grunt.loadNpmTasks('grunt-contrib-watch');
        grunt.loadNpmTasks('grunt-jsdoc');
        grunt.loadNpmTasks('grunt-jsbeautifier');
        grunt.loadNpmTasks('grunt-replace');
        grunt.loadNpmTasks('grunt-contrib-clean');
        grunt.loadNpmTasks('grunt-curl');
        grunt.loadNpmTasks('grunt-zip');
        grunt.loadNpmTasks('grunt-shell');
        grunt.loadNpmTasks('grunt-jsonlint');

        // Default task.
        grunt.registerTask('default', [
            'clean:all',
            'jshint:build',
            'curl',
            'unzip',
            'extactTargz',
            'buildLanguage',
            'buildLeapSeconds',
            'jsonlint',
            'replace:lib',
            'jsbeautifier:lib',
            'jshint:lib',
            'shell:beautified',
            'uglify',
            'shell:uglified',
            //'shell:coveralls',
            'buildReadme',
            'jsdoc',
            'clean:after'
        ]);

        grunt.registerTask('test', [
            'shell:beautified',
            //'shell:coveralls',
            'shell:uglified'
        ]);
    };
}());
<|endoftext|>


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

    // config
    grunt.initConfig({

        less: {
            build: {
                expand: true,
                cwd: 'src/less/',
                src: ['**/*.less'],
                dest: 'build/css/',
                ext: '.css'
            }
        },

        csslint: {
            check: {
                src: '<%= less.build.dest %>**/*.css'
            }
        },

        watch: {
            less2css: {
                files: 'src/css/*.less',
                tasks: ['less', 'csslint']
            }
        },

        typescript: {
            build: {
                expand: true,
                cwd: 'src/ts/',
                src: ['**/*.ts', '!node_modules/**/*.ts'],
                dest: 'build/js/',
                ext: '.js',
                options: {
                    noImplicitAny: true
                }
            }
        }

    });

    // plugin
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-typescript');

    // tasks
    grunt.registerTask('default', ['less', 'csslint', 'typescript']);

};
<commit_msg>Edit  gruntfile: create task less2css<commit_after>module.exports = function(grunt) {

    // config
    grunt.initConfig({

        less: {
            build: {
                expand: true,
                cwd: 'src/less/',
                src: ['**/*.less'],
                dest: 'build/css/',
                ext: '.css'
            }
        },

        csslint: {
            check: {
                src: '<%= less.build.dest %>**/*.css'
            }
        },

        watch: {
            less: {
                files: 'src/less/**/*.less',
                tasks: ['less', 'csslint']
            }
        },

        typescript: {
            build: {
                expand: true,
                cwd: 'src/ts/',
                src: ['**/*.ts', '!node_modules/**/*.ts'],
                dest: 'build/js/',
                ext: '.js',
                options: {
                    noImplicitAny: true
                }
            }
        }

    });

    // plugin
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-typescript');

    // tasks
    grunt.registerTask('less2css', ['less', 'csslint']);
    grunt.registerTask('default', ['less2css', 'typescript']);

};
<|endoftext|>


<commit_before>'use strict';
var LIVERELOAD_PORT = 35729;
var SERVER_PORT = 9000;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

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

module.exports = function (grunt) {
    // show elapsed time at the end
    require('time-grunt')(grunt);
    // load all grunt tasks
    require('load-grunt-tasks')(grunt);

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist'
    };

    grunt.initConfig({
        yeoman: yeomanConfig,
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            options: {
                nospawn: true,
                livereload: true
            },
            coffee: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
                tasks: ['coffee:dist']
            },
            coffeeTest: {
                files: ['test/spec/{,*/}*.coffee'],
                tasks: ['coffee:test']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                    '<%= yeoman.app %>/scripts/templates/*.{ejs,mustache,hbs}',
                    'test/spec/**/*.js'
                ]
            },
            jst: {
                files: [
                    '<%= yeoman.app %>/scripts/templates/*.ejs'
                ],
                tasks: ['jst']
            },
            test: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js', 'test/spec/**/*.js'],
                tasks: ['test:true']
            }
        },
        connect: {
            options: {
                port: SERVER_PORT,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            test: {
                options: {
                    port: 9001,
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            },
            test: {
                path: 'http://localhost:<%= connect.test.options.port %>'
            }
        },
        clean: {
            dist: ['.tmp', '<%= yeoman.dist %>/*'],
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                '!<%= yeoman.app %>/scripts/libs/dropbox.js',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://localhost:<%= connect.test.options.port %>/index.html']
                }
            }
        },
        coffee: {
            dist: {
                files: [{
                    // rather than compiling multiple files here you should
                    // require them into your main .coffee file
                    expand: true,
                    cwd: '<%= yeoman.app %>/scripts',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/scripts',
                    ext: '.js'
                }]
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'test/spec',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/spec',
                    ext: '.js'
                }]
            }
        },
        // Compile less files
        less: {
            compile: {
                options: {
                    compress: true
                },
                files : {
                    '<%= yeoman.app %>/styles/main.css': '<%= yeoman.app %>/styles/main.less'
                }
            }
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    baseUrl: '<%= yeoman.app %>/scripts',
                    mainConfigFile: '<%= yeoman.app %>/scripts/main.js',
                    optimize: 'none',
                    exclude : ['dropbox'],
                    // TODO: Figure out how to make sourcemaps work with grunt-usemin
                    // https://github.com/yeoman/grunt-usemin/issues/30
                    //generateSourceMaps: true,
                    // required to support SourceMaps
                    // http://requirejs.org/docs/errors.html#sourcemapcomments
                    preserveLicenseComments: true,
                    useStrict: true,
                    wrapShim: true,
                    wrap: true
                    //uglify2: {} // https://github.com/mishoo/UglifyJS2
                }
            }
        },
        useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= yeoman.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/styles/main.css': [
                        '.tmp/styles/{,*/}*.css',
                        '<%= yeoman.app %>/styles/{,*/}*.css'
                    ]
                }
            }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
                    // https://github.com/yeoman/grunt-usemin/issues/44
                    //collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeAttributeQuotes: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: '*.html',
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        copy: {
            readme: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/../',
                    dest: '<%= yeoman.app %>/docs/',
                    src: [
                        'README.md'
                    ]
                }]
            },
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,txt}',
                        '.htaccess',
                        'images/{,*/}*.{webp,gif}',
                        'font/*',
                        'locales/*/*',
                        'docs/*.md'
                    ]
                },
                {
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        'scripts/libs/dropbox.js',
                        'bower_components/pagedown/Markdown.Editor.js',
                        'bower_components/ace/lib/ace/css/editor.css',
                        'bower_components/ace/lib/ace/theme/textmate.css',
                        'bower_components/ace/lib/ace/theme/github.css'
                    ]
                }]
            }
        },
        // Replace string
        'string-replace': {
            // App version in constants.js
            constants: {
                files: {
                    '<%= yeoman.app %>/scripts/constants.js': '<%= yeoman.app %>/scripts/constants.js'
                },
                options: {
                    replacements: [
                        {
                            pattern: /constants\.VERSION = .*/,
                            replacement: 'constants.VERSION = \'<%= pkg.version %>\';'
                        }
                    ]
                }
            },
            // App version in collections/configs.js
            settingsAppVersion: {
                files: {
                    '<%= yeoman.app %>/scripts/collections/configs.js': '<%= yeoman.app %>/scripts/collections/configs.js'
                },
                options: {
                    replacements: [
                        {
                            pattern: /\'appVersion\', .*/,
                            replacement: '\'appVersion\', value: \'<%= pkg.version %>\' }));'
                        }
                    ]
                }
            },
            // i18next cache to localStorage in production
            i18nextLocal: {
                files: {
                    '<%= yeoman.app %>/scripts/app.js': '<%= yeoman.app %>/scripts/app.js'
                },
                options: {
                    replacements: [
                        {
                            pattern: /useLocalStorage\ :\ (true|false)/ig,
                            replacement: function (str, status) {
                                if (status === 'false') {
                                    return 'useLocalStorage : true';
                                }
                                else {
                                    return 'useLocalStorage : false';
                                }
                            }
                        }
                    ]
                }
            },
            // Cache manifest <html manifest=
            manifest: {
                files : {
                    '<%= yeoman.dist %>/index.html' : '<%= yeoman.dist %>/index.html',
                    // '<%= yeoman.dist %>/welcome.html' : '<%= yeoman.dist %>/welcome.html',
                    '<%= yeoman.dist %>/404.html' : '<%= yeoman.dist %>/404.html'
                },
                options: {
                    replacements: [
                        {
                            pattern: /<html class="no-js/,
                            replacement: '<html manifest="manifest.appcache" class="no-js'
                        }
                    ]
                }
            }
        },
        // Web Application cache manifest
        manifest: {
            generate: {
                options: {
                    basePath: '<%= yeoman.dist %>',
                    cache: [
                    ],
                    network: ['*'],
                    fallback: ['/ /404.html'],
                    preferOnline: true,
                    verbose: true,
                    timestamp: true,
                    hash: true,
                    exclude: ['welcome.html', 'dropbox.html'],
                    master: ['index.html']
                },
                src: [
                    '*.html',
                    'favicon.ico',
                    'robots.txt',
                    'bower_components/requirejs/require.js',
                    'bower_components/ace/lib/ace/{,*/}*.css',
                    'docs/*.md',
                    'scripts/{,*/}*.js',
                    'styles/{,*/}*.css',
                    'images/{,*/}*.{webp,gif,png}',
                    'font/*'
                ],
                dest: '<%= yeoman.dist %>/manifest.appcache'
            }
        },
        bower: {
            all: {
                rjsConfig: '<%= yeoman.app %>/scripts/main.js'
            }
        },
        jst: {
            options: {
                amd: true
            },
            compile: {
                files: {
                    '.tmp/scripts/templates.js': ['<%= yeoman.app %>/scripts/templates/*.ejs']
                }
            }
        },
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                        '/styles/fonts/{,*/}*.*',
                    ]
                }
            }
        }
    });

    grunt.registerTask('createDefaultTemplate', function () {
        grunt.file.write('.tmp/scripts/templates.js', 'this.JST = this.JST || {};');
    });

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

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

        if (target === 'test') {
            return grunt.task.run([
                'clean:server',
                'coffee',
                'createDefaultTemplate',
                'jst',
                'connect:test',
                'open:test',
                // 'watch:livereload'
            ]);
        }

        grunt.task.run([
            'clean:server',
            'coffee:dist',
            'createDefaultTemplate',
            'jst',
            'connect:livereload',
            'open:server',
            'watch'
        ]);
    });

    grunt.registerTask('test', function (isConnected) {
        isConnected = Boolean(isConnected);
        var testTasks = [
                'clean:server',
                // 'coffee',
                'createDefaultTemplate',
                'jst',
                'connect:test',
                'mocha',
                // 'watch:test'
            ];

        if(!isConnected) {
            return grunt.task.run(testTasks);
        } else {
            // already connected so not going to connect again, remove the connect:test task
            testTasks.splice(testTasks.indexOf('connect:test'), 1);
            return grunt.task.run(testTasks);
        }
    });

    // Change App version in scripts
    grunt.registerTask('version', [
        'string-replace:constants',
        'string-replace:settingsAppVersion'
    ]);

    // Compile less file
    grunt.registerTask('lessc', [
        'less'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'string-replace:i18nextLocal',
        // 'coffee',
        'createDefaultTemplate',
        'jst',
        'lessc',
        'useminPrepare',
        'requirejs',
        'imagemin',
        'htmlmin',
        'concat',
        'cssmin',
        'uglify',
        'rev',
        'copy',
        'string-replace:manifest',
        'usemin',
        'string-replace:i18nextLocal',
        'manifest'
    ]);

    grunt.registerTask('default', [
        'jshint',
        'test',
        'version',
        'build'
    ]);
};
<commit_msg>Gruntfile.js: exclude remotestorage.js from requirejs optimizer<commit_after>'use strict';
var LIVERELOAD_PORT = 35729;
var SERVER_PORT = 9000;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

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

module.exports = function (grunt) {
    // show elapsed time at the end
    require('time-grunt')(grunt);
    // load all grunt tasks
    require('load-grunt-tasks')(grunt);

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist'
    };

    grunt.initConfig({
        yeoman: yeomanConfig,
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            options: {
                nospawn: true,
                livereload: true
            },
            coffee: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
                tasks: ['coffee:dist']
            },
            coffeeTest: {
                files: ['test/spec/{,*/}*.coffee'],
                tasks: ['coffee:test']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                    '<%= yeoman.app %>/scripts/templates/*.{ejs,mustache,hbs}',
                    'test/spec/**/*.js'
                ]
            },
            jst: {
                files: [
                    '<%= yeoman.app %>/scripts/templates/*.ejs'
                ],
                tasks: ['jst']
            },
            test: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js', 'test/spec/**/*.js'],
                tasks: ['test:true']
            }
        },
        connect: {
            options: {
                port: SERVER_PORT,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            test: {
                options: {
                    port: 9001,
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            },
            test: {
                path: 'http://localhost:<%= connect.test.options.port %>'
            }
        },
        clean: {
            dist: ['.tmp', '<%= yeoman.dist %>/*'],
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                '!<%= yeoman.app %>/scripts/libs/dropbox.js',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://localhost:<%= connect.test.options.port %>/index.html']
                }
            }
        },
        coffee: {
            dist: {
                files: [{
                    // rather than compiling multiple files here you should
                    // require them into your main .coffee file
                    expand: true,
                    cwd: '<%= yeoman.app %>/scripts',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/scripts',
                    ext: '.js'
                }]
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'test/spec',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/spec',
                    ext: '.js'
                }]
            }
        },
        // Compile less files
        less: {
            compile: {
                options: {
                    compress: true
                },
                files : {
                    '<%= yeoman.app %>/styles/main.css': '<%= yeoman.app %>/styles/main.less'
                }
            }
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    baseUrl: '<%= yeoman.app %>/scripts',
                    mainConfigFile: '<%= yeoman.app %>/scripts/main.js',
                    optimize: 'none',
                    exclude : ['dropbox', 'remotestorage'],
                    // TODO: Figure out how to make sourcemaps work with grunt-usemin
                    // https://github.com/yeoman/grunt-usemin/issues/30
                    //generateSourceMaps: true,
                    // required to support SourceMaps
                    // http://requirejs.org/docs/errors.html#sourcemapcomments
                    preserveLicenseComments: true,
                    useStrict: true,
                    wrapShim: true,
                    wrap: true
                    //uglify2: {} // https://github.com/mishoo/UglifyJS2
                }
            }
        },
        useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= yeoman.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/styles/main.css': [
                        '.tmp/styles/{,*/}*.css',
                        '<%= yeoman.app %>/styles/{,*/}*.css'
                    ]
                }
            }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
                    // https://github.com/yeoman/grunt-usemin/issues/44
                    //collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeAttributeQuotes: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: '*.html',
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        copy: {
            readme: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/../',
                    dest: '<%= yeoman.app %>/docs/',
                    src: [
                        'README.md'
                    ]
                }]
            },
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,txt}',
                        '.htaccess',
                        'images/{,*/}*.{webp,gif}',
                        'font/*',
                        'locales/*/*',
                        'docs/*.md'
                    ]
                },
                {
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        'scripts/libs/dropbox.js',
                        'scripts/libs/remotestorage.js',
                        'bower_components/pagedown/Markdown.Editor.js',
                        'bower_components/ace/lib/ace/css/editor.css',
                        'bower_components/ace/lib/ace/theme/textmate.css',
                        'bower_components/ace/lib/ace/theme/github.css'
                    ]
                }]
            }
        },
        // Replace string
        'string-replace': {
            // App version in constants.js
            constants: {
                files: {
                    '<%= yeoman.app %>/scripts/constants.js': '<%= yeoman.app %>/scripts/constants.js'
                },
                options: {
                    replacements: [
                        {
                            pattern: /constants\.VERSION = .*/,
                            replacement: 'constants.VERSION = \'<%= pkg.version %>\';'
                        }
                    ]
                }
            },
            // App version in collections/configs.js
            settingsAppVersion: {
                files: {
                    '<%= yeoman.app %>/scripts/collections/configs.js': '<%= yeoman.app %>/scripts/collections/configs.js'
                },
                options: {
                    replacements: [
                        {
                            pattern: /\'appVersion\', .*/,
                            replacement: '\'appVersion\', value: \'<%= pkg.version %>\' }));'
                        }
                    ]
                }
            },
            // i18next cache to localStorage in production
            i18nextLocal: {
                files: {
                    '<%= yeoman.app %>/scripts/app.js': '<%= yeoman.app %>/scripts/app.js'
                },
                options: {
                    replacements: [
                        {
                            pattern: /useLocalStorage\ :\ (true|false)/ig,
                            replacement: function (str, status) {
                                if (status === 'false') {
                                    return 'useLocalStorage : true';
                                }
                                else {
                                    return 'useLocalStorage : false';
                                }
                            }
                        }
                    ]
                }
            },
            // Cache manifest <html manifest=
            manifest: {
                files : {
                    '<%= yeoman.dist %>/index.html' : '<%= yeoman.dist %>/index.html',
                    // '<%= yeoman.dist %>/welcome.html' : '<%= yeoman.dist %>/welcome.html',
                    '<%= yeoman.dist %>/404.html' : '<%= yeoman.dist %>/404.html'
                },
                options: {
                    replacements: [
                        {
                            pattern: /<html class="no-js/,
                            replacement: '<html manifest="manifest.appcache" class="no-js'
                        }
                    ]
                }
            }
        },
        // Web Application cache manifest
        manifest: {
            generate: {
                options: {
                    basePath: '<%= yeoman.dist %>',
                    cache: [
                    ],
                    network: ['*'],
                    fallback: ['/ /404.html'],
                    preferOnline: true,
                    verbose: true,
                    timestamp: true,
                    hash: true,
                    exclude: ['welcome.html', 'dropbox.html'],
                    master: ['index.html']
                },
                src: [
                    '*.html',
                    'favicon.ico',
                    'robots.txt',
                    'bower_components/requirejs/require.js',
                    'bower_components/ace/lib/ace/{,*/}*.css',
                    'docs/*.md',
                    'scripts/{,*/}*.js',
                    'styles/{,*/}*.css',
                    'images/{,*/}*.{webp,gif,png}',
                    'font/*'
                ],
                dest: '<%= yeoman.dist %>/manifest.appcache'
            }
        },
        bower: {
            all: {
                rjsConfig: '<%= yeoman.app %>/scripts/main.js'
            }
        },
        jst: {
            options: {
                amd: true
            },
            compile: {
                files: {
                    '.tmp/scripts/templates.js': ['<%= yeoman.app %>/scripts/templates/*.ejs']
                }
            }
        },
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                        '/styles/fonts/{,*/}*.*',
                    ]
                }
            }
        }
    });

    grunt.registerTask('createDefaultTemplate', function () {
        grunt.file.write('.tmp/scripts/templates.js', 'this.JST = this.JST || {};');
    });

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

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

        if (target === 'test') {
            return grunt.task.run([
                'clean:server',
                'coffee',
                'createDefaultTemplate',
                'jst',
                'connect:test',
                'open:test',
                // 'watch:livereload'
            ]);
        }

        grunt.task.run([
            'clean:server',
            'coffee:dist',
            'createDefaultTemplate',
            'jst',
            'connect:livereload',
            'open:server',
            'watch'
        ]);
    });

    grunt.registerTask('test', function (isConnected) {
        isConnected = Boolean(isConnected);
        var testTasks = [
                'clean:server',
                // 'coffee',
                'createDefaultTemplate',
                'jst',
                'connect:test',
                'mocha',
                // 'watch:test'
            ];

        if(!isConnected) {
            return grunt.task.run(testTasks);
        } else {
            // already connected so not going to connect again, remove the connect:test task
            testTasks.splice(testTasks.indexOf('connect:test'), 1);
            return grunt.task.run(testTasks);
        }
    });

    // Change App version in scripts
    grunt.registerTask('version', [
        'string-replace:constants',
        'string-replace:settingsAppVersion'
    ]);

    // Compile less file
    grunt.registerTask('lessc', [
        'less'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'string-replace:i18nextLocal',
        // 'coffee',
        'createDefaultTemplate',
        'jst',
        'lessc',
        'useminPrepare',
        'requirejs',
        'imagemin',
        'htmlmin',
        'concat',
        'cssmin',
        'uglify',
        'rev',
        'copy',
        'string-replace:manifest',
        'usemin',
        'string-replace:i18nextLocal',
        'manifest'
    ]);

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