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

	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-ngdocs');

	grunt.initConfig({
		modules: [], // filled in by the build task
		dist: 'dist',
		filename: 'ui-cg',
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			modules: 'angular.module("ui.cg", [<%= srcModules %>]);',
			banner: ['/*',
					 ' * <%= pkg.name %>',
					 ' * <%= pkg.homepage %>',
					 ' * Version: <%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>',
					 ' * License: <%= pkg.license %>',
					 ' */\n'].join('\n')
		},
		concat: {
			options: {
				banner: '<%= meta.banner %><%= meta.modules %>\n'
			},
			dist: {
				src: [], // filled in by the build task
				dest: '<%= dist %>/<%= filename %>-<%= pkg.version %>.js'
			}
		},
		uglify: {
			options: {
				banner: '<%= meta.banner %>'
			},
			dist: {
				src: ['<%= concat.dist.dest %>'],
				dest: '<%= dist %>/<%= filename %>-<%= pkg.version %>.min.js'
			}
		},
		clean: ['<%= dist %>'],
		ngdocs: {
			options: {
				scripts: ['angular.js', '<%= concat.dist.dest %>'],
				html5Mode: false,
				title: 'ui.cg',
			},
			all: ['<%= concat.dist.dest %>']
		},
		connect: {
			options: {
				keepalive: true
			},
			server: {}
		}
	});

	var foundModules = {};
	function findModule(name) {
		if (foundModules[name]) {
			return;
		}

		function breakup(text, separator) {
			return text.replace(/[A-Z]/g, function (match) {
				return separator + match;
			});
		}

		function ucwords(text) {
			return text.replace(/^([a-z])|\s+([a-z])/g, function ($1) {
				return $1.toUpperCase();
			});
		}

		function enquote(value) {
			return '"' + value + '"';
		}

		var module = {
			name: name,
			moduleName: enquote('ui.cg.' + name),
			displayName: ucwords(breakup(name, '')),
			srcFiles: grunt.file.expand('src/' + name + '/*.js')
		};

		grunt.config('modules', grunt.config('modules').concat(module));
	}

	grunt.registerTask('build', 'Build the distributable', function () {
		var _ = grunt.util._;

		// Search all modules inside of the src/ directory
		grunt.file.expand({
			filter: 'isDirectory', cwd: '.'
		}, 'src/*').forEach(function (dir) {
			findModule(dir.split('/')[1]);
		});

		var modules = grunt.config('modules');

		grunt.config('srcModules', _.pluck(modules, 'moduleName'));

		var srcFiles = _.pluck(modules, 'srcFiles');
		// Set the concat task to concatenate the given src modules
		grunt.config(
			'concat.dist.src',
			grunt.config('concat.dist.src').concat(srcFiles));

		grunt.task.run(['concat', 'uglify']);
	});

	grunt.registerTask('default', ['clean', 'build', 'ngdocs', 'connect']);

	return grunt;
}<commit_msg>Configured connect webserver for docs<commit_after>module.exports = function (grunt) {

	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-ngdocs');

	grunt.initConfig({
		modules: [], // filled in by the build task
		dist: 'dist',
		filename: 'ui-cg',
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			modules: 'angular.module("ui.cg", [<%= srcModules %>]);',
			banner: ['/*',
					 ' * <%= pkg.name %>',
					 ' * <%= pkg.homepage %>',
					 ' * Version: <%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>',
					 ' * License: <%= pkg.license %>',
					 ' */\n'].join('\n')
		},
		concat: {
			options: {
				banner: '<%= meta.banner %><%= meta.modules %>\n'
			},
			dist: {
				src: [], // filled in by the build task
				dest: '<%= dist %>/<%= filename %>-<%= pkg.version %>.js'
			}
		},
		uglify: {
			options: {
				banner: '<%= meta.banner %>'
			},
			dist: {
				src: ['<%= concat.dist.dest %>'],
				dest: '<%= dist %>/<%= filename %>-<%= pkg.version %>.min.js'
			}
		},
		clean: ['<%= dist %>'],
		ngdocs: {
			options: {
				dest: 'dist/docs',
				scripts: ['angular.js', '<%= concat.dist.dest %>'],
				html5Mode: false,
				title: 'ui.cg',
			},
			all: ['<%= concat.dist.dest %>']
		},
		connect: {
			options: {
				hostname: 'localhost',
				base: '<%= ngdocs.options.dest %>',
				keepalive: true
			},
			server: {}
		}
	});

	var foundModules = {};
	function findModule(name) {
		if (foundModules[name]) {
			return;
		}

		function breakup(text, separator) {
			return text.replace(/[A-Z]/g, function (match) {
				return separator + match;
			});
		}

		function ucwords(text) {
			return text.replace(/^([a-z])|\s+([a-z])/g, function ($1) {
				return $1.toUpperCase();
			});
		}

		function enquote(value) {
			return '"' + value + '"';
		}

		var module = {
			name: name,
			moduleName: enquote('ui.cg.' + name),
			displayName: ucwords(breakup(name, '')),
			srcFiles: grunt.file.expand('src/' + name + '/*.js')
		};

		grunt.config('modules', grunt.config('modules').concat(module));
	}

	grunt.registerTask('build', 'Build the distributable', function () {
		var _ = grunt.util._;

		// Search all modules inside of the src/ directory
		grunt.file.expand({
			filter: 'isDirectory', cwd: '.'
		}, 'src/*').forEach(function (dir) {
			findModule(dir.split('/')[1]);
		});

		var modules = grunt.config('modules');

		grunt.config('srcModules', _.pluck(modules, 'moduleName'));

		var srcFiles = _.pluck(modules, 'srcFiles');
		// Set the concat task to concatenate the given src modules
		grunt.config(
			'concat.dist.src',
			grunt.config('concat.dist.src').concat(srcFiles));

		grunt.task.run(['concat', 'uglify']);
	});

	grunt.registerTask('default', ['clean', 'build', 'ngdocs', 'connect']);

	return grunt;
}<|endoftext|>


<commit_before>/*
 * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 */
/*global module, require*/
module.exports = function (grunt) {
    'use strict';

    // load dependencies
    require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*', 'grunt-targethtml', 'grunt-usemin']});
    grunt.loadTasks('tasks');

    // Project configuration.
    grunt.initConfig({
        pkg  : grunt.file.readJSON("package.json"),
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        'dist',
                        'src/.index.html',
                        'src/styles/brackets.css'
                    ]
                }]
            }
        },
        copy: {
            dist: {
                files: [
                    {
                        'dist/index.html': 'src/.index.html'
                    },
                    /* static files */
                    {
                        expand: true,
                        dest: 'dist/',
                        cwd: 'src/',
                        src: [
                            'nls/{,*/}*.js',
                            'xorigin.js',
                            'dependencies.js',
                            'thirdparty/requirejs/require.js',
                            'LiveDevelopment/launch.html'
                        ]
                    },
                    /* node domains are not minified and must be copied to dist */
                    {
                        expand: true,
                        dest: 'dist/',
                        cwd: 'src/',
                        src: [
                            'extensibility/node/**',
                            '!extensibility/node/spec/**',
                            'filesystem/impls/appshell/node/**',
                            '!filesystem/impls/appshell/node/spec/**'
                        ]
                    },
                    /* extensions and CodeMirror modes */
                    {
                        expand: true,
                        dest: 'dist/',
                        cwd: 'src/',
                        src: [
                            '!extensions/default/*/unittest-files/**/*',
                            '!extensions/default/*/unittests.js',
                            'extensions/default/*/**/*',
                            'extensions/dev/*',
                            'extensions/samples/**/*',
                            'thirdparty/CodeMirror2/addon/{,*/}*',
                            'thirdparty/CodeMirror2/keymap/{,*/}*',
                            'thirdparty/CodeMirror2/lib/{,*/}*',
                            'thirdparty/CodeMirror2/mode/{,*/}*',
                            'thirdparty/CodeMirror2/theme/{,*/}*',
                            'thirdparty/i18n/*.js',
                            'thirdparty/text/*.js'
                        ]
                    },
                    /* styles, fonts and images */
                    {
                        expand: true,
                        dest: 'dist/styles',
                        cwd: 'src/styles',
                        src: ['jsTreeTheme.css', 'fonts/{,*/}*.*', 'images/*', 'brackets.min.css*']
                    }
                ]
            }
        },
        less: {
            dist: {
                files: {
                    "src/styles/brackets.min.css": "src/styles/brackets.less"
                },
                options: {
                    compress: true,
                    sourceMap: true,
                    sourceMapFilename: 'src/styles/brackets.min.css.map',
                    outputSourceFiles: true,
                    sourceMapRootpath: '',
                    sourceMapBasepath: 'src/styles'
                }
            }
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    // `name` and `out` is set by grunt-usemin
                    baseUrl: 'src',
                    optimize: 'uglify2',
                    // brackets.js should not be loaded until after polyfills defined in "utils/Compatibility"
                    // so explicitly include it in main.js
                    include: ["utils/Compatibility", "brackets"],
                    // TODO: Figure out how to make sourcemaps work with grunt-usemin
                    // https://github.com/yeoman/grunt-usemin/issues/30
                    generateSourceMaps: true,
                    useSourceUrl: true,
                    // required to support SourceMaps
                    // http://requirejs.org/docs/errors.html#sourcemapcomments
                    preserveLicenseComments: false,
                    useStrict: true,
                    // Disable closure, we want define/require to be globals
                    wrap: false,
                    exclude: ["text!config.json"],
                    uglify2: {} // https://github.com/mishoo/UglifyJS2
                }
            }
        },
        targethtml: {
            dist: {
                files: {
                    'src/.index.html': 'src/index.html'
                }
            }
        },
        useminPrepare: {
            options: {
                dest: 'dist'
            },
            html: 'src/.index.html'
        },
        usemin: {
            options: {
                dirs: ['dist']
            },
            html: ['dist/{,*/}*.html']
        },
        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: 'src',
                    src: '*.html',
                    dest: 'dist'
                }]
            }
        },
        meta : {
            src   : [
                'src/**/*.js',
                '!src/thirdparty/**',
                '!src/widgets/bootstrap-*.js',
                '!src/extensions/**/unittest-files/**/*.js',
                '!src/extensions/**/thirdparty/**/*.js',
                '!src/extensions/dev/**',
                '!src/extensions/disabled/**',
                '!**/node_modules/**/*.js',
                '!src/**/*-min.js',
                '!src/**/*.min.js'
            ],
            test : [
                'test/**/*.js',
                '!test/perf/*-files/**/*.js',
                '!test/spec/*-files/**/*.js',
                '!test/spec/*-known-goods/**/*.js',
                '!test/spec/FindReplace-test-files-*/**/*.js',
                '!test/smokes/**',
                '!test/temp/**',
                '!test/thirdparty/**',
                '!test/**/node_modules/**/*.js'
            ],
            grunt: [
                'Gruntfile.js',
                'tasks/**/*.js'
            ],
            /* specs that can run in phantom.js */
            specs : [
                'test/spec/CommandManager-test.js',
                //'test/spec/LanguageManager-test.js',
                //'test/spec/PreferencesManager-test.js',
                'test/spec/ViewUtils-test.js'
            ]
        },
        watch: {
            all : {
                files: ['**/*', '!**/node_modules/**'],
                tasks: ['jshint']
            },
            grunt : {
                files: ['<%= meta.grunt %>', 'tasks/**/*'],
                tasks: ['jshint:grunt']
            },
            src : {
                files: ['<%= meta.src %>', 'src/**/*'],
                tasks: ['jshint:src']
            },
            test : {
                files: ['<%= meta.test %>', 'test/**/*'],
                tasks: ['jshint:test']
            }
        },
        /* FIXME (jasonsanjose): how to handle extension tests */
        jasmine : {
            src : 'undefined.js', /* trick the default runner to run without importing src files */
            options : {
                junit : {
                    path: 'test/results',
                    consolidate: true
                },
                specs : '<%= meta.specs %>',
                /* Keep in sync with test/SpecRunner.html dependencies */
                vendor : [
                    'test/polyfills.js', /* For reference to why this polyfill is needed see Issue #7951. The need for this should go away once the version of phantomjs gets upgraded to 2.0 */
                    'src/thirdparty/jquery-2.1.0.min.js',
                    'src/thirdparty/CodeMirror2/lib/codemirror.js',
                    'src/thirdparty/CodeMirror2/lib/util/dialog.js',
                    'src/thirdparty/CodeMirror2/lib/util/searchcursor.js',
                    'src/thirdparty/CodeMirror2/addon/edit/closetag.js',
                    'src/thirdparty/CodeMirror2/addon/selection/active-line.js',
                    'src/thirdparty/mustache/mustache.js',
                    'src/thirdparty/path-utils/path-utils.min',
                    'src/thirdparty/less-1.7.0.min.js'
                ],
                helpers : [
                    'test/spec/PhantomHelper.js'
                ],
                template : require('grunt-template-jasmine-requirejs'),
                templateOptions: {
                    requireConfig : {
                        baseUrl: 'src',
                        paths: {
                            'test' : '../test',
                            'perf' : '../test/perf',
                            'spec' : '../test/spec',
                            'text' : 'thirdparty/text/text',
                            'i18n' : 'thirdparty/i18n/i18n'
                        }
                    }
                }
            }
        },
        'jasmine_node': {
            projectRoot: 'src/extensibility/node/spec/'
        },
        jshint: {
            all: [
                '<%= meta.grunt %>',
                '<%= meta.src %>',
                '<%= meta.test %>'
            ],
            grunt:  '<%= meta.grunt %>',
            src:    '<%= meta.src %>',
            test:   '<%= meta.test %>',
            /* use strict options to mimic JSLINT until we migrate to JSHINT in Brackets */
            options: {
                jshintrc: '.jshintrc'
            }
        },
        shell: {
            repo: grunt.option("shell-repo") || "../brackets-shell",
            mac: "<%= shell.repo %>/installer/mac/staging/<%= pkg.name %>.app",
            win: "<%= shell.repo %>/installer/win/staging/<%= pkg.name %>.exe",
            linux: "<%= shell.repo %>/installer/linux/debian/package-root/opt/brackets/brackets"
        }
    });

    // task: install
    grunt.registerTask('install', ['write-config', 'less']);

    // task: test
    grunt.registerTask('test', ['jshint:all', 'jasmine']);
//    grunt.registerTask('test', ['jshint:all', 'jasmine', 'jasmine_node']);

    // task: set-release
    // Update version number in package.json and rewrite src/config.json
    grunt.registerTask('set-release', ['update-release-number', 'write-config']);

    // task: build
    grunt.registerTask('build', [
        'jshint:src',
        'jasmine',
        'clean',
        'less',
        'targethtml',
        'useminPrepare',
        'htmlmin',
        'requirejs',
        'concat',
        /*'cssmin',*/
        /*'uglify',*/
        'copy',
        'usemin',
        'build-config'
    ]);

    // Default task.
    grunt.registerTask('default', ['test']);
};
<commit_msg>Cleaned code.<commit_after>/*
 * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 */
/*global module, require*/
module.exports = function (grunt) {
    'use strict';

    // load dependencies
    require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*', 'grunt-targethtml', 'grunt-usemin']});
    grunt.loadTasks('tasks');

    // Project configuration.
    grunt.initConfig({
        pkg  : grunt.file.readJSON("package.json"),
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        'dist',
                        'src/.index.html',
                        'src/styles/brackets.css'
                    ]
                }]
            }
        },
        copy: {
            dist: {
                files: [
                    {
                        'dist/index.html': 'src/.index.html'
                    },
                    /* static files */
                    {
                        expand: true,
                        dest: 'dist/',
                        cwd: 'src/',
                        src: [
                            'nls/{,*/}*.js',
                            'xorigin.js',
                            'dependencies.js',
                            'thirdparty/requirejs/require.js',
                            'LiveDevelopment/launch.html'
                        ]
                    },
                    /* node domains are not minified and must be copied to dist */
                    {
                        expand: true,
                        dest: 'dist/',
                        cwd: 'src/',
                        src: [
                            'extensibility/node/**',
                            '!extensibility/node/spec/**',
                            'filesystem/impls/appshell/node/**',
                            '!filesystem/impls/appshell/node/spec/**'
                        ]
                    },
                    /* extensions and CodeMirror modes */
                    {
                        expand: true,
                        dest: 'dist/',
                        cwd: 'src/',
                        src: [
                            '!extensions/default/*/unittest-files/**/*',
                            '!extensions/default/*/unittests.js',
                            'extensions/default/*/**/*',
                            'extensions/dev/*',
                            'extensions/samples/**/*',
                            'thirdparty/CodeMirror2/addon/{,*/}*',
                            'thirdparty/CodeMirror2/keymap/{,*/}*',
                            'thirdparty/CodeMirror2/lib/{,*/}*',
                            'thirdparty/CodeMirror2/mode/{,*/}*',
                            'thirdparty/CodeMirror2/theme/{,*/}*',
                            'thirdparty/i18n/*.js',
                            'thirdparty/text/*.js'
                        ]
                    },
                    /* styles, fonts and images */
                    {
                        expand: true,
                        dest: 'dist/styles',
                        cwd: 'src/styles',
                        src: ['jsTreeTheme.css', 'fonts/{,*/}*.*', 'images/*', 'brackets.min.css*']
                    }
                ]
            }
        },
        less: {
            dist: {
                files: {
                    "src/styles/brackets.min.css": "src/styles/brackets.less"
                },
                options: {
                    compress: true,
                    sourceMap: true,
                    sourceMapFilename: 'src/styles/brackets.min.css.map',
                    outputSourceFiles: true,
                    sourceMapRootpath: '',
                    sourceMapBasepath: 'src/styles'
                }
            }
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    // `name` and `out` is set by grunt-usemin
                    baseUrl: 'src',
                    optimize: 'uglify2',
                    // brackets.js should not be loaded until after polyfills defined in "utils/Compatibility"
                    // so explicitly include it in main.js
                    include: ["utils/Compatibility", "brackets"],
                    // TODO: Figure out how to make sourcemaps work with grunt-usemin
                    // https://github.com/yeoman/grunt-usemin/issues/30
                    generateSourceMaps: true,
                    useSourceUrl: true,
                    // required to support SourceMaps
                    // http://requirejs.org/docs/errors.html#sourcemapcomments
                    preserveLicenseComments: false,
                    useStrict: true,
                    // Disable closure, we want define/require to be globals
                    wrap: false,
                    exclude: ["text!config.json"],
                    uglify2: {} // https://github.com/mishoo/UglifyJS2
                }
            }
        },
        targethtml: {
            dist: {
                files: {
                    'src/.index.html': 'src/index.html'
                }
            }
        },
        useminPrepare: {
            options: {
                dest: 'dist'
            },
            html: 'src/.index.html'
        },
        usemin: {
            options: {
                dirs: ['dist']
            },
            html: ['dist/{,*/}*.html']
        },
        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: 'src',
                    src: '*.html',
                    dest: 'dist'
                }]
            }
        },
        meta : {
            src   : [
                'src/**/*.js',
                '!src/thirdparty/**',
                '!src/widgets/bootstrap-*.js',
                '!src/extensions/**/unittest-files/**/*.js',
                '!src/extensions/**/thirdparty/**/*.js',
                '!src/extensions/dev/**',
                '!src/extensions/disabled/**',
                '!**/node_modules/**/*.js',
                '!src/**/*-min.js',
                '!src/**/*.min.js'
            ],
            test : [
                'test/**/*.js',
                '!test/perf/*-files/**/*.js',
                '!test/spec/*-files/**/*.js',
                '!test/spec/*-known-goods/**/*.js',
                '!test/spec/FindReplace-test-files-*/**/*.js',
                '!test/smokes/**',
                '!test/temp/**',
                '!test/thirdparty/**',
                '!test/**/node_modules/**/*.js'
            ],
            grunt: [
                'Gruntfile.js',
                'tasks/**/*.js'
            ],
            /* specs that can run in phantom.js */
            specs : [
                'test/spec/CommandManager-test.js',
                //'test/spec/LanguageManager-test.js',
                //'test/spec/PreferencesManager-test.js',
                'test/spec/ViewUtils-test.js'
            ]
        },
        watch: {
            all : {
                files: ['**/*', '!**/node_modules/**'],
                tasks: ['jshint']
            },
            grunt : {
                files: ['<%= meta.grunt %>', 'tasks/**/*'],
                tasks: ['jshint:grunt']
            },
            src : {
                files: ['<%= meta.src %>', 'src/**/*'],
                tasks: ['jshint:src']
            },
            test : {
                files: ['<%= meta.test %>', 'test/**/*'],
                tasks: ['jshint:test']
            }
        },
        /* FIXME (jasonsanjose): how to handle extension tests */
        jasmine : {
            src : 'undefined.js', /* trick the default runner to run without importing src files */
            options : {
                junit : {
                    path: 'test/results',
                    consolidate: true
                },
                specs : '<%= meta.specs %>',
                /* Keep in sync with test/SpecRunner.html dependencies */
                vendor : [
                    'test/polyfills.js', /* For reference to why this polyfill is needed see Issue #7951. The need for this should go away once the version of phantomjs gets upgraded to 2.0 */
                    'src/thirdparty/jquery-2.1.0.min.js',
                    'src/thirdparty/CodeMirror2/lib/codemirror.js',
                    'src/thirdparty/CodeMirror2/lib/util/dialog.js',
                    'src/thirdparty/CodeMirror2/lib/util/searchcursor.js',
                    'src/thirdparty/CodeMirror2/addon/edit/closetag.js',
                    'src/thirdparty/CodeMirror2/addon/selection/active-line.js',
                    'src/thirdparty/mustache/mustache.js',
                    'src/thirdparty/path-utils/path-utils.min',
                    'src/thirdparty/less-1.7.0.min.js'
                ],
                helpers : [
                    'test/spec/PhantomHelper.js'
                ],
                template : require('grunt-template-jasmine-requirejs'),
                templateOptions: {
                    requireConfig : {
                        baseUrl: 'src',
                        paths: {
                            'test' : '../test',
                            'perf' : '../test/perf',
                            'spec' : '../test/spec',
                            'text' : 'thirdparty/text/text',
                            'i18n' : 'thirdparty/i18n/i18n'
                        }
                    }
                }
            }
        },
        'jasmine_node': {
            projectRoot: 'src/extensibility/node/spec/'
        },
        jshint: {
            all: [
                '<%= meta.grunt %>',
                '<%= meta.src %>',
                '<%= meta.test %>'
            ],
            grunt:  '<%= meta.grunt %>',
            src:    '<%= meta.src %>',
            test:   '<%= meta.test %>',
            /* use strict options to mimic JSLINT until we migrate to JSHINT in Brackets */
            options: {
                jshintrc: '.jshintrc'
            }
        },
        shell: {
            repo: grunt.option("shell-repo") || "../brackets-shell",
            mac: "<%= shell.repo %>/installer/mac/staging/<%= pkg.name %>.app",
            win: "<%= shell.repo %>/installer/win/staging/<%= pkg.name %>.exe",
            linux: "<%= shell.repo %>/installer/linux/debian/package-root/opt/brackets/brackets"
        }
    });

    // task: install
    grunt.registerTask('install', ['write-config', 'less']);

    // task: test
    grunt.registerTask('test', ['jshint:all', 'jasmine']);
    // grunt.registerTask('test', ['jshint:all', 'jasmine', 'jasmine_node']);

    // task: set-release
    // Update version number in package.json and rewrite src/config.json
    grunt.registerTask('set-release', ['update-release-number', 'write-config']);

    // task: build
    grunt.registerTask('build', [
        'jshint:src',
        'jasmine',
        'clean',
        'less',
        'targethtml',
        'useminPrepare',
        'htmlmin',
        'requirejs',
        'concat',
        /*'cssmin',*/
        /*'uglify',*/
        'copy',
        'usemin',
        'build-config'
    ]);

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


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
        '<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' +
        '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
        '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
        ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' +
        '<%= "\\n\\n" %>'
    },
    /*
    data_embed: {
      bills: {
        'dist/data.js': ['data/bills.json']
      },
    },
    */
    jshint: {
      files: ['Gruntfile.js', 'js/*.js', 'data-processing/*.js']
    },
    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'css/compiled/main.min.css': 'css/main.scss',
          'css/compiled/main.ie.min.css': 'css/main.scss'
        }
      },
      dev: {
        options: {
          style: 'expanded'
        },
        files: {
          'css/compiled/main.css': 'css/main.scss',
          'css/compiled/main.ie.css': 'css/main.scss'
        }
      }
    },
    clean: {
      folder: 'dist/'
    },
    jst: {
      compile: {
        options: {
          namespace: 'mpApp.<%= pkg.name %>.templates'
        },
        files: {
          'dist/templates.js': ['js/templates/*.html']
        }
      }
    },
    concat: {
      options: {
        separator: '\r\n\r\n'
      },
      // JS application
      dist: {
        src: ['js/core.js', 'dist/templates.js', 'js/app.js', 'js/models.js', 'js/collections.js', 'js/views.js'],
        dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.js'
      },
      dist_latest: {
        src: ['<%= concat.dist.src %>'], dest: 'dist/<%= pkg.name %>.latest.js'
      },
      // CSS application
      dist_css: {
        src: ['css/compiled/main.min.css'], dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.css'
      },
      dist_css_latest: {
        src: ['css/compiled/main.min.css'], dest: 'dist/<%= pkg.name %>.latest.css'
      },
      dist_css_ie: {
        src: ['css/compiled/main.ie.min.css'], dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.ie.css'
      },
      dist_css_latest_ie: {
        src: ['css/compiled/main.ie.min.css'], dest: 'dist/<%= pkg.name %>.latest.ie.css'
      },
      // JS libs
      libs: {
        src: [
          'components/jquery/jquery.min.js',
          'components/jquery-jsonp/src/jquery.jsonp.js',
          'components/underscore/underscore-min.js',
          'components/backbone/backbone-min.js',
          'components/backbone.stickit/backbone.stickit.js',
          'components/topojson/topojson.js',
          'components/moment/min/moment.min.js',
          'components/jqplot/excanvas.min.js',
          'components/jqplot/jquery.jqplot.min.js',
          'components/jqplot/plugins/jqplot.barRenderer.min.js',
          'components/jqplot/plugins/jqplot.dateAxisRenderer.min.js',
          'components/jqplot/plugins/jqplot.canvasTextRenderer.min.js',
          'components/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js',
          'components/jqplot/plugins/jqplot.categoryAxisRenderer.min.js',
          'components/jqplot/plugins/jqplot.barRenderer.min.js'
        ],
        dest: 'dist/<%= pkg.name %>.libs.js',
        options: {
          separator: ';\r\n\r\n'
        }
      },
      // CSS libs
      libs_css: {
        src: ['components/flurid/dist/flurid.min.css'], dest: 'dist/<%= pkg.name %>.libs.css'
      },
      libs_css_ie: {
        src: [], dest: 'dist/<%= pkg.name %>.libs.ie.css'
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: ['<%= concat.dist.dest %>'],
        dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.min.js'
      },
      dist_latest: {
        src: ['<%= concat.dist_latest.dest %>'],
        dest: 'dist/<%= pkg.name %>.latest.min.js'
      }
    },
    copy: {
      images: {
        files: [
          {
            cwd: './css/images/',
            expand: true,
            filter: 'isFile',
            src: ['*'],
            dest: 'dist/images/'
          }
        ]
      },
      data: {
        files: [
          {
            cwd: './data/',
            expand: true,
            filter: 'isFile',
            src: ['**/*.json'],
            dest: 'dist/data/'
          }
        ]
      }
    },
    s3: {
      options: {
        // This is specific to MinnPost
        //
        // These are assumed to be environment variables:
        //
        // AWS_ACCESS_KEY_ID
        // AWS_SECRET_ACCESS_KEY
        //
        // See https://npmjs.org/package/grunt-s3
        //key: 'YOUR KEY',
        //secret: 'YOUR SECRET',
        bucket: 'data.minnpost',
        access: 'public-read'
      },
      mp_deploy: {
        upload: [
          {
            src: 'dist/*',
            dest: 'projects/<%= pkg.name %>/'
          },
          {
            src: 'dist/data/**/*',
            dest: 'projects/<%= pkg.name %>/data/',
            rel: 'dist/data'
          },
          {
            src: 'dist/images/**/*',
            dest: 'projects/<%= pkg.name %>/images/',
            rel: 'dist/images'
          }
        ]
      }
    },
    watch: {
      files: ['<%= jshint.files %>', 'css/*.scss'],
      tasks: 'lint-watch'
    }
  });

  // Load plugin tasks
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jst');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-s3');

  // Custom task to save json data into a JS file for concatentation
  grunt.registerMultiTask('data_embed', 'Make data embeddable', function() {
    var t, file, output;
    var tasks = this.data;
    var config = grunt.config.get();

    for (t in tasks) {
      file = grunt.file.read(tasks[t][0]);
      output = 'mpApp["' + config.pkg.name + '"].data["' + this.target + '"] = ' + file + ';';
      grunt.file.write(t, output);
      grunt.log.write('Wrote ' + tasks[t][0] + ' to ' + t + '...').ok();
    }
  });

  // Default build task
  grunt.registerTask('default', ['jshint', 'sass', 'clean', 'jst', 'concat', 'uglify', 'copy']);

  // Watch dask
  grunt.registerTask('lint-watch', ['jshint', 'sass:dev']);

  // Deploy tasks
  grunt.registerTask('mp-deploy', ['s3']);

};
<commit_msg>Fixing data embededness.<commit_after>/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    meta: {
      banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
        '<%= grunt.template.today("yyyy-mm-dd") + "\\n" %>' +
        '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
        '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
        ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */' +
        '<%= "\\n\\n" %>'
    },
    data_embed: {
      app_data: {
        options: {
          output: 'dist/data.js'
        },
        files: {
          'neighborhoods/minneapolis.topo': ['data/neighborhoods/minneapolis.topo.json'],
          'cities/cities': ['data/cities/cities.json'],
          'crime/categories': ['data/crime/categories.json']
        }
      }
    },
    jshint: {
      files: ['Gruntfile.js', 'js/*.js', 'data-processing/*.js']
    },
    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          'css/compiled/main.min.css': 'css/main.scss',
          'css/compiled/main.ie.min.css': 'css/main.scss'
        }
      },
      dev: {
        options: {
          style: 'expanded'
        },
        files: {
          'css/compiled/main.css': 'css/main.scss',
          'css/compiled/main.ie.css': 'css/main.scss'
        }
      }
    },
    clean: {
      folder: 'dist/'
    },
    jst: {
      compile: {
        options: {
          namespace: 'mpApp.<%= pkg.name %>.templates'
        },
        files: {
          'dist/templates.js': ['js/templates/*.html']
        }
      }
    },
    concat: {
      options: {
        separator: '\r\n\r\n'
      },
      // JS application
      dist: {
        src: ['js/core.js', 'dist/data.js', 'dist/templates.js',
          'js/app.js', 'js/models.js', 'js/collections.js', 'js/views.js'],
        dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.js'
      },
      dist_latest: {
        src: ['<%= concat.dist.src %>'], dest: 'dist/<%= pkg.name %>.latest.js'
      },
      // CSS application
      dist_css: {
        src: ['css/compiled/main.min.css'], dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.css'
      },
      dist_css_latest: {
        src: ['css/compiled/main.min.css'], dest: 'dist/<%= pkg.name %>.latest.css'
      },
      dist_css_ie: {
        src: ['css/compiled/main.ie.min.css'], dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.ie.css'
      },
      dist_css_latest_ie: {
        src: ['css/compiled/main.ie.min.css'], dest: 'dist/<%= pkg.name %>.latest.ie.css'
      },
      // JS libs
      libs: {
        src: [
          'components/jquery/jquery.min.js',
          'components/jquery-jsonp/src/jquery.jsonp.js',
          'components/underscore/underscore-min.js',
          'components/backbone/backbone-min.js',
          'components/backbone.stickit/backbone.stickit.js',
          'components/topojson/topojson.js',
          'components/moment/min/moment.min.js',
          'components/jqplot/excanvas.min.js',
          'components/jqplot/jquery.jqplot.min.js',
          'components/jqplot/plugins/jqplot.barRenderer.min.js',
          'components/jqplot/plugins/jqplot.dateAxisRenderer.min.js',
          'components/jqplot/plugins/jqplot.canvasTextRenderer.min.js',
          'components/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js',
          'components/jqplot/plugins/jqplot.categoryAxisRenderer.min.js',
          'components/jqplot/plugins/jqplot.barRenderer.min.js'
        ],
        dest: 'dist/<%= pkg.name %>.libs.js',
        options: {
          separator: ';\r\n\r\n'
        }
      },
      // CSS libs
      libs_css: {
        src: ['components/flurid/dist/flurid.min.css'], dest: 'dist/<%= pkg.name %>.libs.css'
      },
      libs_css_ie: {
        src: [], dest: 'dist/<%= pkg.name %>.libs.ie.css'
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: ['<%= concat.dist.dest %>'],
        dest: 'dist/<%= pkg.name %>.<%= pkg.version %>.min.js'
      },
      dist_latest: {
        src: ['<%= concat.dist_latest.dest %>'],
        dest: 'dist/<%= pkg.name %>.latest.min.js'
      }
    },
    copy: {
      images: {
        files: [
          {
            cwd: './css/images/',
            expand: true,
            filter: 'isFile',
            src: ['*'],
            dest: 'dist/images/'
          }
        ]
      },
      data: {
        files: [
          {
            cwd: './data/',
            expand: true,
            filter: 'isFile',
            src: ['**/*.json'],
            dest: 'dist/data/'
          }
        ]
      }
    },
    s3: {
      options: {
        // This is specific to MinnPost
        //
        // These are assumed to be environment variables:
        //
        // AWS_ACCESS_KEY_ID
        // AWS_SECRET_ACCESS_KEY
        //
        // See https://npmjs.org/package/grunt-s3
        //key: 'YOUR KEY',
        //secret: 'YOUR SECRET',
        bucket: 'data.minnpost',
        access: 'public-read'
      },
      mp_deploy: {
        upload: [
          {
            src: 'dist/*',
            dest: 'projects/<%= pkg.name %>/'
          },
          {
            src: 'dist/data/**/*',
            dest: 'projects/<%= pkg.name %>/data/',
            rel: 'dist/data'
          },
          {
            src: 'dist/images/**/*',
            dest: 'projects/<%= pkg.name %>/images/',
            rel: 'dist/images'
          }
        ]
      }
    },
    watch: {
      files: ['<%= jshint.files %>', 'css/*.scss'],
      tasks: 'lint-watch'
    }
  });

  // Load plugin tasks
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jst');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-s3');

  // Custom task to save json data into a JS file for concatentation
  grunt.registerMultiTask('data_embed', 'Make data embeddable', function() {
    var options = this.options();
    var config = grunt.config.get();
    var finalOutput = '';
    console.log(options);

    this.files.forEach(function(f) {
      var data = grunt.file.readJSON(f.src[0]);
      finalOutput += 'mpApp["' + config.pkg.name + '"].data["' + f.dest + '"] = ' + JSON.stringify(data) + '; \n\n';
      grunt.log.write('Read file: ' + f.src[0] + '...').ok();

    });

    grunt.file.write(options.output, finalOutput);
    grunt.log.write('Wrote data to: ' + options.output + '...').ok();
  });

  // Default build task
  grunt.registerTask('default', ['jshint', 'sass', 'clean', 'data_embed', 'jst', 'concat', 'uglify', 'copy']);

  // Watch dask
  grunt.registerTask('lint-watch', ['jshint', 'sass:dev']);

  // Deploy tasks
  grunt.registerTask('mp-deploy', ['s3']);

};
<|endoftext|>


<commit_before>/* To prevent jshint from yelling at module.exports. */
/* jshint node:true */

'use strict';

var LIVERELOAD_PORT = 35729;

module.exports = function(grunt) {

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

  // App configuration
  var config = grunt.file.readYAML('config/common.yml');

  // Tasks configuration
  grunt.initConfig({

    config: config,

    clean: {
      destination: {
        files: [{
          dot: true,
          src: '<%= config.destination %>/*'
        }]
      },
      icons: {
        files: [{
          dot: true,
          src: '<%= config.source %>/icons/icons*.*'
        }]
      }
    },

    copy: {
      cssToDest: {
        src: '*.css',
        dest: '<%= config.destination %>/css/',
        flatten: true,
        filter: 'isFile',
        expand: true,
        nonull: true,
        cwd: '<%= config.source %>/css/'
      }
    },

    csslint: {
      options: {
        csslintrc: '.csslintrc'
      },
      lax: {
        src: '<%= config.destination %>/css/*.css',
        options: {
          import: false
        }
      },
      strict: {
        src: '<%= config.destination %>/css/*.css',
        options: {
          import: 2
        }
      }
    },

    cssmin: {
      css: {
        src: '<%= config.source %>/css/styles.css',
        dest: '<%= config.source %>/css/styles.min.css',
        options: {
          keepSpecialComments: 0
        }
      }
    },

    gae: {
      options: {
        path: 'appengine',
        auth: 'oauth2'
      },
      deploy: {
        action: 'update'
      },
      local: {
        action: 'run',
        options: {
          async: true,
          asyncOutput: true,
          args: {
            port: config.port
          }
        }
      },
      stop: {
        action: 'kill'
      }
    },

    htmlmin: {
      all: {
        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: '<%= config.destination %>',
          src: ['**/*.html'],
          dest: '<%= config.destination %>'
        }]
      }
    },

    imagemin: {
      normal: {
        options: {
          optimizationLevel: 7
        },
        files: [{
          expand: true,
          src: ['**/*.png']
        }]
      },
      o2: {
        options: {
          optimizationLevel: 2
        },
        files: [{
          expand: true,
          src: ['**/*.png']
        }]
      }
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      source: [
        'Gruntfile.js',
        '<%= config.source %>/**/*.js',
        '!<%= config.source %>/**/_code/**/*.js'
      ]
    },

    open: {
      local: {
        path: 'http://localhost:<%=config.port%>/web/fundamentals'
      },
      staging: {
        path: 'http://web-central.appspot.com/web/fundamentals'
      },
    },

    sass: {
      options: {
        precision: 10,
        includePaths: ['<%= config.source %>/css'],
        imagePath: '<%= config.source %>/imgs',
        outputStyle: 'nested'
      },
      all: {
        files: {
          '<%= config.source %>/css/styles.css': '<%= config.source %>/_sass/styles.scss'
        }
      }
    },

    watch: {
      // When styles change, recompile them
      styles: {
        files: [
          '<%= config.source %>/_sass/**/*.scss',
          '<%= config.source %>/css/**/*.css',
          '!<%= config.source %>/css/**/*.min.css'
        ],
        tasks: ['sass', 'cssmin', 'copy:cssToDest']
      },

      // when jekyll source changes, recompile them
      jekyll: {
        files: [
          '<%= config.source %>/**/*.liquid',
          '<%= config.source %>/**/*.markdown',
          '<%= config.source %>/**/*.rb',
          '<%= config.source %>/**/*.md',
          '<%= config.source %>/**/*.xml',
          '<%= config.source %>/**/*.yaml'
        ],
        tasks: ['jekyll:appengine']
      },

      // when served files change, reload them in the browser
      served: {
        options: {
          livereload: LIVERELOAD_PORT
        },
        files: [
          '<%= config.destination %>/**/*.html',  // view files (from jekyll)
          '<%= config.destination %>/css/*.css'   // css files (from sass)
        ]
      }
    },

    webfont: {
      icons: {
        src: '<%= config.source %>/icons/*.svg',
        dest: '<%= config.source %>/icons/',
        destCss: '<%= config.source %>/_sass/_components/',
        options: {
          hashes: false,
          stylesheet: 'scss',
          relativeFontPath: '../icons',
          htmlDemo: false,
          template: '<%= config.source %>/_templates/icons-template.css'
        }
      }

    }
  });

  grunt.registerTask('wsk-version', 'Uses the Github API to determine the latest web-starter-kit version, and writes it to ./config/wsk-version.yml', function() {
    var latest = require('latest-release');
    var done = this.async();
    var out = './config/wsk-version.yml';

    grunt.log.writeln('Determining latest web-starter-kit version..');

    latest('google', 'web-starter-kit', function(release, err) {

      /**
        These logs are for debugging if Travis behaves oddly.
        Github may be returning unexpected results and it's
        causing the build to fail.
      **/
      grunt.log.writeln('release: ' + JSON.stringify(release));
      grunt.log.writeln('err: ' + JSON.stringify(err));

      if (err) {
        grunt.verbose.or.write('Failed to retrieve latest web-starter-kit release information').error().error(err.message);
      } else {
        grunt.log.writeln('Latest version is: ' + release.name);
        grunt.log.writeln('Saved release information under: ' + out);
        /*jshint camelcase: false */
        /*ignore the casing on the variables. These come directly from the Githup API.*/

        grunt.file.write(out,
          'wsk-tag: ' + release.tag_name + '\n' +
          'wsk-name: ' + release.name + '\n' +
          'wsk-zip-url: ' + release.zipball_url + '\n'
          );
        /*jshint camelcase: true */
        done();
      }
    });
  });

  // jekyll:target [--lang <lang_code,lang_code,...|all>]
  // where 'target' is config/target.yml file.
  // defaults to '--lang all'.
  // 'all' builds for all languages specified in config.yml/langs_available + 'en'.
  // builds w/o multilang support if config.yml is missing langs_available.
  grunt.registerTask('jekyll', 'Run jekyll build.\nOptions:\n  [--lang]: list of languages or "all"', function() {
    var langs = grunt.option('lang') || 'all';

    var cfgname = this.args[0] || 'appengine';

    // read langs from config/target.yml
    // returns langs_available + prime_lang
    //         or [] if langs_available is not defined.
    var langsFromConfig = function() {
      /*jshint camelcase: false */
      var cfg = grunt.file.readYAML('config/common.yml');
      if (typeof cfg.langs_available === 'undefined') {
        return [];
      }
      cfg.langs_available.unshift(cfg.prime_lang);
      return cfg.langs_available;
      /*jshint camelcase: true */
    };

    if (langs === 'all' ) {
      langs = langsFromConfig();
    } else {
      langs = langs.split(/,|\s/).filter(function(item) {
        return item.length > 0;
      });
    }

    var cfgfiles = 'config/wsk-version.yml,config/common.yml,config/' + cfgname + '.yml';
    var args = ['exec', 'jekyll', 'build', '--config', cfgfiles, '-t'];
    var spawnJekyll = function(lang, callback) {
      var opts = {env: process.env, stdio: 'inherit'};
      if (lang !== null) {
        opts.env.TRANS_LANG = lang;
        // opts.env.MENTOS_TIMEOUT = 32;
      }
      grunt.util.spawn({cmd: 'bundle', args: args, opts: opts}, callback);
    };

    var done = this.async();
    var count = 0;
    var waitAll = function(err, res, code) {
      if (err) {
        grunt.fatal(String(res), code);
      }
      if (++count >= langs.length) {
        done();
      }
    };

    // multilang build
    for (var i = 0; i < langs.length; i++) {
      spawnJekyll(langs[i], waitAll);
    }
    // simple build (no multilang support)
    if (langs.length === 0) {
      spawnJekyll(null, waitAll);
    }
  });

  // Test task
  grunt.registerTask('test', 'Lints all javascript and CSS sources.', 'jshint:source');

  grunt.registerTask('prepare', ['wsk-version', 'test', 'clean:destination', 'sass', 'cssmin']);

  // Build task
  grunt.registerTask('build', 'Runs the "test" task, then builds the website.', [
    'prepare',
    'jekyll:appengine'   // Build the site with Jekyll
  ]);

  // Develop task
  grunt.registerTask('develop', 'The default task for developers.\nRuns the tests, builds the minimum required, serves the content and watches for changes.', [
    'build',   // Build the site with Jekyll
    'gae:local',
    'open:local',
    'watch'
  ]);

  // Devsite task
  grunt.registerTask('devsite', 'Runs the build steps with devsite config', [
    'clean:icons',        // Clean up icon font files for regeneration
    'webfont:icons',      // Generate icon font files and SASS
    'prepare',
    'jekyll:devsite',     // Build the site with Jekyll
    'htmlmin:all'         // Minify the final HTML
  ]);

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

};
<commit_msg>Added fallback so if wsk-version fails, build does not fail<commit_after>/* To prevent jshint from yelling at module.exports. */
/* jshint node:true */

'use strict';

var LIVERELOAD_PORT = 35729;

module.exports = function(grunt) {

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

  // App configuration
  var config = grunt.file.readYAML('config/common.yml');

  // Tasks configuration
  grunt.initConfig({

    config: config,

    clean: {
      destination: {
        files: [{
          dot: true,
          src: '<%= config.destination %>/*'
        }]
      },
      icons: {
        files: [{
          dot: true,
          src: '<%= config.source %>/icons/icons*.*'
        }]
      }
    },

    copy: {
      cssToDest: {
        src: '*.css',
        dest: '<%= config.destination %>/css/',
        flatten: true,
        filter: 'isFile',
        expand: true,
        nonull: true,
        cwd: '<%= config.source %>/css/'
      }
    },

    csslint: {
      options: {
        csslintrc: '.csslintrc'
      },
      lax: {
        src: '<%= config.destination %>/css/*.css',
        options: {
          import: false
        }
      },
      strict: {
        src: '<%= config.destination %>/css/*.css',
        options: {
          import: 2
        }
      }
    },

    cssmin: {
      css: {
        src: '<%= config.source %>/css/styles.css',
        dest: '<%= config.source %>/css/styles.min.css',
        options: {
          keepSpecialComments: 0
        }
      }
    },

    gae: {
      options: {
        path: 'appengine',
        auth: 'oauth2'
      },
      deploy: {
        action: 'update'
      },
      local: {
        action: 'run',
        options: {
          async: true,
          asyncOutput: true,
          args: {
            port: config.port
          }
        }
      },
      stop: {
        action: 'kill'
      }
    },

    htmlmin: {
      all: {
        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: '<%= config.destination %>',
          src: ['**/*.html'],
          dest: '<%= config.destination %>'
        }]
      }
    },

    imagemin: {
      normal: {
        options: {
          optimizationLevel: 7
        },
        files: [{
          expand: true,
          src: ['**/*.png']
        }]
      },
      o2: {
        options: {
          optimizationLevel: 2
        },
        files: [{
          expand: true,
          src: ['**/*.png']
        }]
      }
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      source: [
        'Gruntfile.js',
        '<%= config.source %>/**/*.js',
        '!<%= config.source %>/**/_code/**/*.js'
      ]
    },

    open: {
      local: {
        path: 'http://localhost:<%=config.port%>/web/fundamentals'
      },
      staging: {
        path: 'http://web-central.appspot.com/web/fundamentals'
      },
    },

    sass: {
      options: {
        precision: 10,
        includePaths: ['<%= config.source %>/css'],
        imagePath: '<%= config.source %>/imgs',
        outputStyle: 'nested'
      },
      all: {
        files: {
          '<%= config.source %>/css/styles.css': '<%= config.source %>/_sass/styles.scss'
        }
      }
    },

    watch: {
      // When styles change, recompile them
      styles: {
        files: [
          '<%= config.source %>/_sass/**/*.scss',
          '<%= config.source %>/css/**/*.css',
          '!<%= config.source %>/css/**/*.min.css'
        ],
        tasks: ['sass', 'cssmin', 'copy:cssToDest']
      },

      // when jekyll source changes, recompile them
      jekyll: {
        files: [
          '<%= config.source %>/**/*.liquid',
          '<%= config.source %>/**/*.markdown',
          '<%= config.source %>/**/*.rb',
          '<%= config.source %>/**/*.md',
          '<%= config.source %>/**/*.xml',
          '<%= config.source %>/**/*.yaml'
        ],
        tasks: ['jekyll:appengine']
      },

      // when served files change, reload them in the browser
      served: {
        options: {
          livereload: LIVERELOAD_PORT
        },
        files: [
          '<%= config.destination %>/**/*.html',  // view files (from jekyll)
          '<%= config.destination %>/css/*.css'   // css files (from sass)
        ]
      }
    },

    webfont: {
      icons: {
        src: '<%= config.source %>/icons/*.svg',
        dest: '<%= config.source %>/icons/',
        destCss: '<%= config.source %>/_sass/_components/',
        options: {
          hashes: false,
          stylesheet: 'scss',
          relativeFontPath: '../icons',
          htmlDemo: false,
          template: '<%= config.source %>/_templates/icons-template.css'
        }
      }

    }
  });

  grunt.registerTask('wsk-version', 'Uses the Github API to determine the latest web-starter-kit version, and writes it to ./config/wsk-version.yml', function() {
    var latest = require('latest-release');
    var done = this.async();
    var out = './config/wsk-version.yml';

    grunt.log.writeln('Determining latest web-starter-kit version..');

    latest('google', 'web-starter-kit', function(release, err) {

      /**
        These logs are for debugging if Travis behaves oddly.
        Github may be returning unexpected results and it's
        causing the build to fail.
      **/
      grunt.log.writeln('release: ' + JSON.stringify(release));
      grunt.log.writeln('err: ' + JSON.stringify(err));
      if (((release === undefined) && (err === undefined)) || (err)) {
        if (err) {
          grunt.log.writeln('Failed to retrieve latest web-starter-kit release information');
          grunt.log.writeln(' - ', err.message);
        } else {
          grunt.log.writeln('WARNING - wsk-latest returned undefined');
        }
        grunt.log.writeln('Using safe (0.5.2) WSK Version Info');
        release = {
          'name': 'Web Starter Kit 0.5.2',
          'tag_name': 'v0.5.2',
          'zipball_url': 'https://api.github.com/repos/google/web-starter-kit/zipball/v0.5.2'
        };
      }

      grunt.log.writeln('Latest version is: ' + release.name);
      grunt.log.writeln('Saved release information under: ' + out);
      /*jshint camelcase: false */
      /*ignore the casing on the variables. These come directly from the Githup API.*/

      grunt.file.write(out,
        'wsk-tag: ' + release.tag_name + '\n' +
        'wsk-name: ' + release.name + '\n' +
        'wsk-zip-url: ' + release.zipball_url + '\n'
        );
      /*jshint camelcase: true */
      done();
    });
  });

  // jekyll:target [--lang <lang_code,lang_code,...|all>]
  // where 'target' is config/target.yml file.
  // defaults to '--lang all'.
  // 'all' builds for all languages specified in config.yml/langs_available + 'en'.
  // builds w/o multilang support if config.yml is missing langs_available.
  grunt.registerTask('jekyll', 'Run jekyll build.\nOptions:\n  [--lang]: list of languages or "all"', function() {
    var langs = grunt.option('lang') || 'all';

    var cfgname = this.args[0] || 'appengine';

    // read langs from config/target.yml
    // returns langs_available + prime_lang
    //         or [] if langs_available is not defined.
    var langsFromConfig = function() {
      /*jshint camelcase: false */
      var cfg = grunt.file.readYAML('config/common.yml');
      if (typeof cfg.langs_available === 'undefined') {
        return [];
      }
      cfg.langs_available.unshift(cfg.prime_lang);
      return cfg.langs_available;
      /*jshint camelcase: true */
    };

    if (langs === 'all' ) {
      langs = langsFromConfig();
    } else {
      langs = langs.split(/,|\s/).filter(function(item) {
        return item.length > 0;
      });
    }

    var cfgfiles = 'config/wsk-version.yml,config/common.yml,config/' + cfgname + '.yml';
    var args = ['exec', 'jekyll', 'build', '--config', cfgfiles, '-t'];
    var spawnJekyll = function(lang, callback) {
      var opts = {env: process.env, stdio: 'inherit'};
      if (lang !== null) {
        opts.env.TRANS_LANG = lang;
        // opts.env.MENTOS_TIMEOUT = 32;
      }
      grunt.util.spawn({cmd: 'bundle', args: args, opts: opts}, callback);
    };

    var done = this.async();
    var count = 0;
    var waitAll = function(err, res, code) {
      if (err) {
        grunt.fatal(String(res), code);
      }
      if (++count >= langs.length) {
        done();
      }
    };

    // multilang build
    for (var i = 0; i < langs.length; i++) {
      spawnJekyll(langs[i], waitAll);
    }
    // simple build (no multilang support)
    if (langs.length === 0) {
      spawnJekyll(null, waitAll);
    }
  });

  // Test task
  grunt.registerTask('test', 'Lints all javascript and CSS sources.', 'jshint:source');

  grunt.registerTask('prepare', ['wsk-version', 'test', 'clean:destination', 'sass', 'cssmin']);

  // Build task
  grunt.registerTask('build', 'Runs the "test" task, then builds the website.', [
    'prepare',
    'jekyll:appengine'   // Build the site with Jekyll
  ]);

  // Develop task
  grunt.registerTask('develop', 'The default task for developers.\nRuns the tests, builds the minimum required, serves the content and watches for changes.', [
    'build',   // Build the site with Jekyll
    'gae:local',
    'open:local',
    'watch'
  ]);

  // Devsite task
  grunt.registerTask('devsite', 'Runs the build steps with devsite config', [
    'clean:icons',        // Clean up icon font files for regeneration
    'webfont:icons',      // Generate icon font files and SASS
    'prepare',
    'jekyll:devsite',     // Build the site with Jekyll
    'htmlmin:all'         // Minify the final HTML
  ]);

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

};
<|endoftext|>


<commit_before>// Generated on 2013-08-05 using generator-webapp 0.2.7
'use strict';
var LIVERELOAD_PORT = 35729;
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 recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {
    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

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

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            compass: {
                files: ['<%= yeoman.src %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server', 'autoprefixer']
            },
            styles: {
                files: ['<%= yeoman.src %>/styles/{,*/}*.css'],
                tasks: ['copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    'examples/index.html',
                    '.tmp/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.src %>}/scripts/{,*/}*.js',
                    '<%= yeoman.src %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'// 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.src),
                            mountFolder(connect, 'examples')
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test'),
                            mountFolder(connect, yeomanConfig.src)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.src %>/scripts/{,*/}*.js',
                '!<%= yeoman.src %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    log: true,
                    reporter: 'Spec',
                    urls: ['http://localhost:<%= connect.options.port %>/index.html']
                }
            }
        },
        compass: {
            options: {
                sassDir: '<%= yeoman.src %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.src %>/images',
                javascriptsDir: '<%= yeoman.src %>/scripts',
                fontsDir: '<%= yeoman.src %>/styles/fonts',
                importPath: '<%= yeoman.src %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false
            },
            dist: {
                options: {
                    generatedImagesDir: '<%= yeoman.dist %>/images/generated'
                }
            },
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },
        concat: {
            dist: {}
        },
        uglify: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/scripts/akno.min.js': ['src/scripts/akno.js']
                }
            }
        },
        cssmin: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/styles/akno.css': [
                        '.tmp/styles/{,*/}*.css',
                        '<%= yeoman.src %>/styles/{,*/}*.css'
                    ]
                }
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.src %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        'scripts/akno.js',
                        '*.{ico,png,txt}',
                        'images/{,*/}*.{webp,gif}',
                        'styles/fonts/*'
                    ]
                }]
            },
            styles: {
                expand: true,
                dot: true,
                cwd: '<%= yeoman.src %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            }
        },
        concurrent: {
            server: [
                'compass',
                'copy:styles'
            ],
            test: [
                'compass',
                'copy:styles'
            ],
            dist: [
                'compass',
                'copy:styles'
            ]
        }
    });

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

        if (target === 'test') {
            return grunt.task.run([
                'clean:server',
                'concurrent:test',
                'autoprefixer',
                'connect:test:keepalive'
            ]);
        }

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

    grunt.registerTask('test', [
        'clean:server',
        'concurrent:test',
        'autoprefixer',
        'connect:test',
        'mocha'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'cssmin',
        'uglify',
        'copy:dist'
    ]);

    grunt.registerTask('default', [
        'jshint',
        'test',
        'build'
    ]);
};
<commit_msg>adding non-minified css to build<commit_after>// Generated on 2013-08-05 using generator-webapp 0.2.7
'use strict';
var LIVERELOAD_PORT = 35729;
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 recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {
    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

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

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            compass: {
                files: ['<%= yeoman.src %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server', 'autoprefixer']
            },
            styles: {
                files: ['<%= yeoman.src %>/styles/{,*/}*.css'],
                tasks: ['copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    'examples/index.html',
                    '.tmp/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.src %>}/scripts/{,*/}*.js',
                    '<%= yeoman.src %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'// 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.src),
                            mountFolder(connect, 'examples')
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test'),
                            mountFolder(connect, yeomanConfig.src)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.src %>/scripts/{,*/}*.js',
                '!<%= yeoman.src %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    log: true,
                    reporter: 'Spec',
                    urls: ['http://localhost:<%= connect.options.port %>/index.html']
                }
            }
        },
        compass: {
            options: {
                sassDir: '<%= yeoman.src %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.src %>/images',
                javascriptsDir: '<%= yeoman.src %>/scripts',
                fontsDir: '<%= yeoman.src %>/styles/fonts',
                importPath: '<%= yeoman.src %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false
            },
            dist: {
                options: {
                    generatedImagesDir: '<%= yeoman.dist %>/images/generated'
                }
            },
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },
        concat: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/styles/akno.css': [
                        '.tmp/styles/{,*/}*.css',
                        '<%= yeoman.src %>/styles/{,*/}*.css'
                    ]
                }
            }
        },
        uglify: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/scripts/akno.min.js': ['src/scripts/akno.js']
                }
            }
        },
        cssmin: {
            dist: {
                files: {
                    '<%= yeoman.dist %>/styles/akno.min.css': [
                        '.tmp/styles/{,*/}*.css',
                        '<%= yeoman.src %>/styles/{,*/}*.css'
                    ]
                }
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.src %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        'scripts/akno.js',
                        '*.{ico,png,txt}',
                        'images/{,*/}*.{webp,gif}',
                        'styles/fonts/*'
                    ]
                }]
            },
            styles: {
                expand: true,
                dot: true,
                cwd: '<%= yeoman.src %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            }
        },
        concurrent: {
            server: [
                'compass',
                'copy:styles'
            ],
            test: [
                'compass',
                'copy:styles'
            ],
            dist: [
                'compass',
                'copy:styles'
            ]
        }
    });

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

        if (target === 'test') {
            return grunt.task.run([
                'clean:server',
                'concurrent:test',
                'autoprefixer',
                'connect:test:keepalive'
            ]);
        }

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

    grunt.registerTask('test', [
        'clean:server',
        'concurrent:test',
        'autoprefixer',
        'connect:test',
        'mocha'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'cssmin',
        'uglify',
        'copy:dist'
    ]);

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


<commit_before>module.exports = function(grunt) {
  require('./grunt/server')(grunt);

  grunt.initConfig({

    server: {
      host: "0.0.0.0",
      files: {
        "spec.js": "test/spec.js"
      },
      base: 'test/',
      folders: {
        "app": "app",
        "spec": "spec",
        "styles": "styles"
      }
    }

  });
};

<commit_msg>Make server port configurable<commit_after>module.exports = function(grunt) {
  require('./grunt/server')(grunt);

  grunt.initConfig({

    server: {
      port: process.env.PORT || "8000",
      host: "0.0.0.0",
      files: {
        "spec.js": "test/spec.js"
      },
      base: 'test/',
      folders: {
        "app": "app",
        "spec": "spec",
        "styles": "styles"
      }
    }

  });
};

<|endoftext|>


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

  require('jit-grunt')(grunt);
  require('time-grunt')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    less: {
      core: {
        options: {
          outputSourceFiles: true,
          sourceMap: true,
          sourceMapFilename: 'html/assets/app/css/style.css.map',
          sourceMapURL: 'style.css.map',
          strictMath: true
        }
        files: {
          'html/assets/app/css/style.css': 'less/style.less'
        }
      }
    },
    postcss: {
      options: {
        map: true,
        processors: [
          require('autoprefixer')
        ]
      }
    },
    csscomb: {
      options: {
        config: 'less/.csscomb.json'
      },
      core: {
        src: 'html/assets/app/css/style.css',
        dest: 'html/assets/app/css/style.css'
      }
    },
    csslint: {
      options: {
        csslintrc: 'less/.csslintrc'
      },
      core: {
        src: 'html/assets/app/css/style.css'
      }
    },
    cssmin: {
      options: {
        advanced: false,
        keepSpecialComments: '*',
        sourceMap: true
      },
      core: {
        expand: true,
        cwd: 'dist/assets/app/css',
        src: ['*.css', '!*.min.css'],
        dest: 'dist/assets/app/css',
        ext: '.min.css'
      }
    },
    eslint: {
      options: {
        configFile: 'js/.eslintrc'
      },
      target: 'js/*.js'
    },
    jscs: {
      options: {
        config: 'js/.jscsrc'
      },
      grunt: {
        src: 'Gruntfile.js'
      },
      core: {
        src: 'js/*.js'
      }
    },
    concat: {
      core: {
        src: [
          'js/application.js'
        ],
        dest: 'html/assets/app/js/application.js'
      }
    },
    uglify: {
      options: {
        compress: {
          warnings: false
        },
        preserveComments: 'some'
      },
      core: {
        src: '<%= concat.core.dest %>',
        dest: 'html/assets/app/js/application.min.js'
      }
    },
    env: {
      build: {
        JEKYLL_ENV: grunt.option('environment') || 'development'
      }
    }
  });
};
<commit_msg>Added jekyll config<commit_after>module.exports = function (grunt) {
  'use strict';

  require('jit-grunt')(grunt);
  require('time-grunt')(grunt);

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    less: {
      core: {
        options: {
          outputSourceFiles: true,
          sourceMap: true,
          sourceMapFilename: 'html/assets/app/css/style.css.map',
          sourceMapURL: 'style.css.map',
          strictMath: true
        }
        files: {
          'html/assets/app/css/style.css': 'less/style.less'
        }
      }
    },
    postcss: {
      options: {
        map: true,
        processors: [
          require('autoprefixer')
        ]
      }
    },
    csscomb: {
      options: {
        config: 'less/.csscomb.json'
      },
      core: {
        src: 'html/assets/app/css/style.css',
        dest: 'html/assets/app/css/style.css'
      }
    },
    csslint: {
      options: {
        csslintrc: 'less/.csslintrc'
      },
      core: {
        src: 'html/assets/app/css/style.css'
      }
    },
    cssmin: {
      options: {
        advanced: false,
        keepSpecialComments: '*',
        sourceMap: true
      },
      core: {
        expand: true,
        cwd: 'dist/assets/app/css',
        src: ['*.css', '!*.min.css'],
        dest: 'dist/assets/app/css',
        ext: '.min.css'
      }
    },
    eslint: {
      options: {
        configFile: 'js/.eslintrc'
      },
      target: 'js/*.js'
    },
    jscs: {
      options: {
        config: 'js/.jscsrc'
      },
      grunt: {
        src: 'Gruntfile.js'
      },
      core: {
        src: 'js/*.js'
      }
    },
    concat: {
      core: {
        src: [
          'js/application.js'
        ],
        dest: 'html/assets/app/js/application.js'
      }
    },
    uglify: {
      options: {
        compress: {
          warnings: false
        },
        preserveComments: 'some'
      },
      core: {
        src: '<%= concat.core.dest %>',
        dest: 'html/assets/app/js/application.min.js'
      }
    },
    env: {
      build: {
        JEKYLL_ENV: grunt.option('environment') || 'development'
      }
    },
    jekyll: {
      options: {
        config: '_config.yml'
      },
      build: {},
      serve: {
        options: {
          serve: true
        }
      },
      watch: {
        options: {
          watch: true
        }
      }
    }
  });
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        browserify: {
            dist: {
                files: {
                    'build/stanzaio.bundle.js': ['<%= pkg.main %>']
                },
                options: {
                    bundleOptions: {
                        standalone: 'XMPP'
                    }
                }
            }
        },
        uglify: {
            options: {
                banner: '/*! stanzaio <%= grunt.template.today("yyyy-mm-dd") %>*/'
            },
            dist: {
                files: {
                    'build/stanzaio.bundle.min.js': ['build/stanzaio.bundle.js']
                }
            }
        },
        jshint: {
            files: ['Gruntfile.js', 'index.js', 'lib/**.js', 'lib/stanza/**.js', 'lib/plugins/**.js', 'test/**.js'],
            options: grunt.file.readJSON('.jshintrc')
        },
        tape: {
            options: {
                pretty: true
            },
            files: ['test/index.js']
        }
    });

    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-tape');
    grunt.loadNpmTasks('grunt-nsp-package');

    grunt.registerTask('default', ['jshint', 'browserify', 'uglify', 'tape', 'validate-package']);
};
<commit_msg>Update linting paths<commit_after>'use strict';

module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        browserify: {
            dist: {
                files: {
                    'build/stanzaio.bundle.js': ['<%= pkg.main %>']
                },
                options: {
                    bundleOptions: {
                        standalone: 'XMPP'
                    }
                }
            }
        },
        uglify: {
            options: {
                banner: '/*! stanzaio <%= grunt.template.today("yyyy-mm-dd") %>*/'
            },
            dist: {
                files: {
                    'build/stanzaio.bundle.min.js': ['build/stanzaio.bundle.js']
                }
            }
        },
        jshint: {
            files: [
                'Gruntfile.js',
                'index.js',
                'lib/**.js',
                'lib/stanza/**.js',
                'lib/plugins/**.js',
                'lib/transports/**.js',
                'test/**.js'
            ],
            options: grunt.file.readJSON('.jshintrc')
        },
        tape: {
            options: {
                pretty: true
            },
            files: ['test/index.js']
        }
    });

    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-tape');
    grunt.loadNpmTasks('grunt-nsp-package');

    grunt.registerTask('default', ['jshint', 'browserify', 'uglify', 'tape', 'validate-package']);
};
<|endoftext|>