<commit_before>/**
 * Copyright 2015, Yahoo! Inc.
 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';

var webpack = require('webpack');
var path = require('path');
var fs = require('fs');

// format `*.[chunkhash].min.js`
var CHUNK_REGEX = /^([A-Za-z0-9_\-]+)\..*/;

module.exports = function (grunt) {
    grunt.initConfig({
        // project variables
        project: {
            build: './build',
            public: '/public',
            cdnPath: 'http://l.yimg.com/os/flx/'
        },

        // clean build
        clean: ['build'],

        // ------------------------------------------------------------------------------
        // DEV TASKS --------------------------------------------------------------------
        // ------------------------------------------------------------------------------

        jshint: {
            all: [
                '*.js',
                '{actions,components,services,stores}/**/*.js'
            ],
            options: {
                jshintrc: true
            }
        },

        copy: {
            images: {
                files: [{
                    expand: true,
                    cwd: 'assets/',
                    src: ['images/**'],
                    dest: '<%= project.build %>/'
                }]
            }
        },

        // run nodemon and watch concurrently
        concurrent: {
            dev: ['nodemon:app', 'watch', 'webpack:dev'],
            options: {
                logConcurrentOutput: true
            }
        },

        // watch for changes in static files (does not require a server restart) run tasks then reload
        // .rebooted is written by the nodemon task, it's written to force a browser reload
        watch: {
            atomizer: {
                files: ['configs/atomic.js', '.rebooted', './assets/css/*.css', './components/*.jsx'],
                tasks: ['atomizer', 'cssmin:dev'],
                options: {
                    interrupt: true,
                    livereload: false
                }
            }
        },

        // atomizer: initial task to generate the config
        atomizer: {
            app: {
                options: {
                    configFile: './configs/atomic.js'
                },
                files: [
                    {
                        src: ['./components/*.jsx'],
                        dest: '<%= project.build %>/css/atomic.css'
                    }
                ]
            }
        },

        // cssmin for production (atomizer needs to run first)
        cssmin: {
            dev: {
                options: {
                    report: 'gzip',
                    compatibility: 'ie8',
                    sourceMap: true
                },
                files: [{
                    src: [
                        '<%= project.build %>/css/atomic.css',
                        './assets/css/base.css',
                        './assets/css/helpers.css',
                        './assets/css/custom.css',
                        './assets/css/mq.css',
                        './assets/css/syntax.css'
                    ],
                    dest: '<%= project.build %>/css/bundle.css'
                }, {
                    src: [ './assets/css/ie.css'],
                    dest: '<%= project.build %>/css/ie.css'
                }]
            },
            prod: {
                options: {
                    report: 'gzip',
                    compatibility: 'ie8',
                    sourceMap: false
                },
                files: [{
                    src: [
                        '<%= project.build %>/css/atomic.css',
                        './assets/css/base.css',
                        './assets/css/helpers.css',
                        './assets/css/custom.css',
                        './assets/css/mq.css',
                        './assets/css/syntax.css'
                    ],
                    dest: '<%= project.build %>/css/bundle.css'
                }, {
                    src: [ './assets/css/ie.css'],
                    dest: '<%= project.build %>/css/ie.css'
                }]
            }
        },

        // functional testing
        protractor_webdriver: {
            options: {
                path: './node_modules/.bin/'
            },
            all: {}
        },
        protractor: {
            options: {
                configFile: './tests/spec/protractor.conf.js',
                args: {
                    baseUrl: 'http://127.0.0.1:3000/'
                }
            },
            all: {}
        },

        // restart server on changes
        nodemon: {
            app: {
                script: './server.js',
                options: {
                    ignore: ['<%= project.build %>/**'],
                    ext: 'js,jsx,md'
                }
            }
        },

        // webpack bundling
        webpack: {
            dev: {
                resolve: {
                    extensions: ['', '.js', '.jsx']
                },
                entry: './client.js',
                output: {
                    path: '<%= project.build %>/js',
                    publicPath: '/public/js/',
                    filename: '[name].js',
                    chunkFilename: '[name].[chunkhash].js'
                },
                module: {
                    loaders: [
                        { test: /\.css$/, loader: 'style!css' },
                        { test: /\.jsx?$/, exclude: /node_modules/, loader: require.resolve('babel-loader') },
                        { test: /\.json$/, loader: 'json-loader'}
                    ]
                },
                plugins: [
                    new webpack.DefinePlugin({
                        'process.env': {
                            NODE_ENV: JSON.stringify('development')
                        }
                    }),
                    new webpack.optimize.CommonsChunkPlugin('common.js', undefined, 2),
                    new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons'))
                ],
                stats: {
                    colors: true
                },
                devtool: 'source-map',
                watch: true,
                keepalive: true
            },
            prod: {
                resolve: {
                    extensions: ['', '.js', '.jsx']
                },
                entry: './client.js',
                output: {
                    path: '<%= project.build %>/js',
                    publicPath: '<%= project.cdnPath %>/js/',
                    filename: '[name].[chunkhash].min.js',
                    chunkFilename: '[name].[chunkhash].min.js'
                },
                module: {
                    loaders: [
                        { test: /\.css$/, loader: 'style!css' },
                        { test: /\.jsx?$/, exclude: /node_modules/, loader: require.resolve('babel-loader') },
                        { test: /\.json$/, loader: 'json-loader'}
                    ]
                },
                plugins: [
                    new webpack.DefinePlugin({
                        'process.env': {
                            NODE_ENV: JSON.stringify('production')
                        }
                    }),

                    // These are performance optimizations for your bundles
                    new webpack.optimize.DedupePlugin(),
                    new webpack.optimize.OccurenceOrderPlugin(),
                    new webpack.optimize.CommonsChunkPlugin('common.[hash].min.js', 2),

                    // This ensures requires for `react` and `react/addons` normalize to the same requirement
                    new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons')),

                    new webpack.optimize.UglifyJsPlugin({
                        compress: {
                            warnings: false
                        }
                    }),

                    // generates webpack assets config to use hashed assets in production mode
                    function webpackStatsPlugin() {
                        this.plugin('done', function(stats) {
                            var data = stats.toJson();
                            var assets = data.assetsByChunkName;
                            var output = {
                                assets: {},
                                cdnPath: this.options.output.publicPath
                            };

                            Object.keys(assets).forEach(function eachAsset(key) {
                                var value = assets[key];

                                // if `*.[chunkhash].min.js` regex matched, then use file name for key
                                var matches = key.match(CHUNK_REGEX);
                                if (matches) {
                                    key = matches[1];
                                }

                                output.assets[key] = value;
                            });

                            fs.writeFileSync(
                                path.join(process.cwd(), 'build', 'assets.json'),
                                JSON.stringify(output, null, 4)
                            );
                        });
                    }
                ],

                // removes verbosity from builds
                progress: false
            }
        }
    });

    // libs
    grunt.loadNpmTasks('grunt-atomizer');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.loadNpmTasks('grunt-protractor-webdriver');
    grunt.loadNpmTasks('grunt-protractor-runner');
    grunt.loadNpmTasks('grunt-webpack');

    // tasks
    grunt.registerTask('default', 'dev');
    grunt.registerTask('dev', ['clean', 'copy', 'jshint', 'atomizer:app', 'cssmin:dev', 'concurrent:dev']);
    grunt.registerTask('build', ['clean', 'copy', 'atomizer:app', 'cssmin:prod', 'webpack:prod']);
    grunt.registerTask('func', ['protractor_webdriver', 'protractor']);
};
<commit_msg>remove extra slash<commit_after>/**
 * Copyright 2015, Yahoo! Inc.
 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
 */
'use strict';

var webpack = require('webpack');
var path = require('path');
var fs = require('fs');

// format `*.[chunkhash].min.js`
var CHUNK_REGEX = /^([A-Za-z0-9_\-]+)\..*/;

module.exports = function (grunt) {
    grunt.initConfig({
        // project variables
        project: {
            build: './build',
            public: '/public',
            cdnPath: 'http://l.yimg.com/os/flx/'
        },

        // clean build
        clean: ['build'],

        // ------------------------------------------------------------------------------
        // DEV TASKS --------------------------------------------------------------------
        // ------------------------------------------------------------------------------

        jshint: {
            all: [
                '*.js',
                '{actions,components,services,stores}/**/*.js'
            ],
            options: {
                jshintrc: true
            }
        },

        copy: {
            images: {
                files: [{
                    expand: true,
                    cwd: 'assets/',
                    src: ['images/**'],
                    dest: '<%= project.build %>/'
                }]
            }
        },

        // run nodemon and watch concurrently
        concurrent: {
            dev: ['nodemon:app', 'watch', 'webpack:dev'],
            options: {
                logConcurrentOutput: true
            }
        },

        // watch for changes in static files (does not require a server restart) run tasks then reload
        // .rebooted is written by the nodemon task, it's written to force a browser reload
        watch: {
            atomizer: {
                files: ['configs/atomic.js', '.rebooted', './assets/css/*.css', './components/*.jsx'],
                tasks: ['atomizer', 'cssmin:dev'],
                options: {
                    interrupt: true,
                    livereload: false
                }
            }
        },

        // atomizer: initial task to generate the config
        atomizer: {
            app: {
                options: {
                    configFile: './configs/atomic.js'
                },
                files: [
                    {
                        src: ['./components/*.jsx'],
                        dest: '<%= project.build %>/css/atomic.css'
                    }
                ]
            }
        },

        // cssmin for production (atomizer needs to run first)
        cssmin: {
            dev: {
                options: {
                    report: 'gzip',
                    compatibility: 'ie8',
                    sourceMap: true
                },
                files: [{
                    src: [
                        '<%= project.build %>/css/atomic.css',
                        './assets/css/base.css',
                        './assets/css/helpers.css',
                        './assets/css/custom.css',
                        './assets/css/mq.css',
                        './assets/css/syntax.css'
                    ],
                    dest: '<%= project.build %>/css/bundle.css'
                }, {
                    src: [ './assets/css/ie.css'],
                    dest: '<%= project.build %>/css/ie.css'
                }]
            },
            prod: {
                options: {
                    report: 'gzip',
                    compatibility: 'ie8',
                    sourceMap: false
                },
                files: [{
                    src: [
                        '<%= project.build %>/css/atomic.css',
                        './assets/css/base.css',
                        './assets/css/helpers.css',
                        './assets/css/custom.css',
                        './assets/css/mq.css',
                        './assets/css/syntax.css'
                    ],
                    dest: '<%= project.build %>/css/bundle.css'
                }, {
                    src: [ './assets/css/ie.css'],
                    dest: '<%= project.build %>/css/ie.css'
                }]
            }
        },

        // functional testing
        protractor_webdriver: {
            options: {
                path: './node_modules/.bin/'
            },
            all: {}
        },
        protractor: {
            options: {
                configFile: './tests/spec/protractor.conf.js',
                args: {
                    baseUrl: 'http://127.0.0.1:3000/'
                }
            },
            all: {}
        },

        // restart server on changes
        nodemon: {
            app: {
                script: './server.js',
                options: {
                    ignore: ['<%= project.build %>/**'],
                    ext: 'js,jsx,md'
                }
            }
        },

        // webpack bundling
        webpack: {
            dev: {
                resolve: {
                    extensions: ['', '.js', '.jsx']
                },
                entry: './client.js',
                output: {
                    path: '<%= project.build %>/js',
                    publicPath: '/public/js/',
                    filename: '[name].js',
                    chunkFilename: '[name].[chunkhash].js'
                },
                module: {
                    loaders: [
                        { test: /\.css$/, loader: 'style!css' },
                        { test: /\.jsx?$/, exclude: /node_modules/, loader: require.resolve('babel-loader') },
                        { test: /\.json$/, loader: 'json-loader'}
                    ]
                },
                plugins: [
                    new webpack.DefinePlugin({
                        'process.env': {
                            NODE_ENV: JSON.stringify('development')
                        }
                    }),
                    new webpack.optimize.CommonsChunkPlugin('common.js', undefined, 2),
                    new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons'))
                ],
                stats: {
                    colors: true
                },
                devtool: 'source-map',
                watch: true,
                keepalive: true
            },
            prod: {
                resolve: {
                    extensions: ['', '.js', '.jsx']
                },
                entry: './client.js',
                output: {
                    path: '<%= project.build %>/js',
                    publicPath: '<%= project.cdnPath %>js/',
                    filename: '[name].[chunkhash].min.js',
                    chunkFilename: '[name].[chunkhash].min.js'
                },
                module: {
                    loaders: [
                        { test: /\.css$/, loader: 'style!css' },
                        { test: /\.jsx?$/, exclude: /node_modules/, loader: require.resolve('babel-loader') },
                        { test: /\.json$/, loader: 'json-loader'}
                    ]
                },
                plugins: [
                    new webpack.DefinePlugin({
                        'process.env': {
                            NODE_ENV: JSON.stringify('production')
                        }
                    }),

                    // These are performance optimizations for your bundles
                    new webpack.optimize.DedupePlugin(),
                    new webpack.optimize.OccurenceOrderPlugin(),
                    new webpack.optimize.CommonsChunkPlugin('common.[hash].min.js', 2),

                    // This ensures requires for `react` and `react/addons` normalize to the same requirement
                    new webpack.NormalModuleReplacementPlugin(/^react(\/addons)?$/, require.resolve('react/addons')),

                    new webpack.optimize.UglifyJsPlugin({
                        compress: {
                            warnings: false
                        }
                    }),

                    // generates webpack assets config to use hashed assets in production mode
                    function webpackStatsPlugin() {
                        this.plugin('done', function(stats) {
                            var data = stats.toJson();
                            var assets = data.assetsByChunkName;
                            var output = {
                                assets: {},
                                cdnPath: this.options.output.publicPath
                            };

                            Object.keys(assets).forEach(function eachAsset(key) {
                                var value = assets[key];

                                // if `*.[chunkhash].min.js` regex matched, then use file name for key
                                var matches = key.match(CHUNK_REGEX);
                                if (matches) {
                                    key = matches[1];
                                }

                                output.assets[key] = value;
                            });

                            fs.writeFileSync(
                                path.join(process.cwd(), 'build', 'assets.json'),
                                JSON.stringify(output, null, 4)
                            );
                        });
                    }
                ],

                // removes verbosity from builds
                progress: false
            }
        }
    });

    // libs
    grunt.loadNpmTasks('grunt-atomizer');
    grunt.loadNpmTasks('grunt-concurrent');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.loadNpmTasks('grunt-protractor-webdriver');
    grunt.loadNpmTasks('grunt-protractor-runner');
    grunt.loadNpmTasks('grunt-webpack');

    // tasks
    grunt.registerTask('default', 'dev');
    grunt.registerTask('dev', ['clean', 'copy', 'jshint', 'atomizer:app', 'cssmin:dev', 'concurrent:dev']);
    grunt.registerTask('build', ['clean', 'copy', 'atomizer:app', 'cssmin:prod', 'webpack:prod']);
    grunt.registerTask('func', ['protractor_webdriver', 'protractor']);
};
<|endoftext|>


<commit_before>// -------------------------------------------------------------------
// markItUp!
// -------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// -------------------------------------------------------------------
// Textile tags example
// http://en.wikipedia.org/wiki/Textile_(markup_language)
// http://www.textism.com/
// -------------------------------------------------------------------
// Feel free to add more tags
// -------------------------------------------------------------------
textileSettings = {
    previewParserPath:  '~/textileParser',
	onShiftEnter:		{keepDefault:false, replaceWith:'\n\n'},
	markupSet: [
        {
            name:'Text size', icon:'fa fa-text-height',
            dropMenu:[
                {name:'Heading 1', key:'1', openWith:'h1(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 2', key:'2', openWith:'h2(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 3', key:'3', openWith:'h3(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 4', key:'4', openWith:'h4(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 5', key:'5', openWith:'h5(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 6', key:'6', openWith:'h6(!(([![Class]!]))!). ', placeHolder:'Your title here...' }
            ]
        },
		{name:'Paragraph', icon:'fa fa-align-left', key:'P', openWith:'p(!(([![Class]!]))!). '},
		{name:'Bold', icon:'fa fa-bold', key:'B', closeWith:'*', openWith:'*'},
		{name:'Italic', icon:'fa fa-italic', key:'I', closeWith:'_', openWith:'_'},
		{name:'Stroke through', icon:'fa fa-strikethrough', key:'S', closeWith:'-', openWith:'-'},
		{name:'Bulleted list', icon:'fa fa-list-ul', key:'L', openWith:'(!(* |!|*)!)'},
		{name:'Numeric list', icon:'fa fa-list-ol', key:'N', openWith:'(!(# |!|#)!)'},
		{name:'Picture', icon:'fa fa-picture-o', key:'T', replaceWith:'![![Source:!:http://]!]([![Alternative text]!])!'},
		{name:'Link', icon:'fa fa-link', key:'U', openWith:'"', closeWith:'([![Title]!])":[![Link:!:http://]!]', placeHolder:'Your text to link here...' },
		{name:'Quotes', icon:'fa fa-quote-left', key:'Q', openWith:'bq(!(([![Class]!]))!). '},
		{name:'Code', icon:'fa fa-code', key:'O', openWith:'@', closeWith:'@'},
        {name:'BlockCode',icon:'fa fa-wrench', key:'K', openWith:'bc(!(([![Class]!]))!). '},
        {name:'Checkbox',icon:'fa fa-square-o', key:'S', openWith:'[] '},
        {name:'Checkbox with check',icon:'fa fa-check-square-o', key:'C', openWith:'[x] '}
	]
};<commit_msg>T1278-0 Impossible to copy text from rich text fields using the keyboard shortcut<commit_after>// -------------------------------------------------------------------
// markItUp!
// -------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// -------------------------------------------------------------------
// Textile tags example
// http://en.wikipedia.org/wiki/Textile_(markup_language)
// http://www.textism.com/
// -------------------------------------------------------------------
// Feel free to add more tags
// -------------------------------------------------------------------
textileSettings = {
    previewParserPath:  '~/textileParser',
	onShiftEnter:		{keepDefault:false, replaceWith:'\n\n'},
	markupSet: [
        {
            name:'Text size', icon:'fa fa-text-height',
            dropMenu:[
                {name:'Heading 1', key:'1', openWith:'h1(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 2', key:'2', openWith:'h2(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 3', key:'3', openWith:'h3(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 4', key:'4', openWith:'h4(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 5', key:'5', openWith:'h5(!(([![Class]!]))!). ', placeHolder:'Your title here...' },
                {name:'Heading 6', key:'6', openWith:'h6(!(([![Class]!]))!). ', placeHolder:'Your title here...' }
            ]
        },
		{name:'Paragraph', icon:'fa fa-align-left', key:'P', openWith:'p(!(([![Class]!]))!). '},
		{name:'Bold', icon:'fa fa-bold', key:'B', closeWith:'*', openWith:'*'},
		{name:'Italic', icon:'fa fa-italic', key:'I', closeWith:'_', openWith:'_'},
		{name:'Stroke through', icon:'fa fa-strikethrough', key:'S', closeWith:'-', openWith:'-'},
		{name:'Bulleted list', icon:'fa fa-list-ul', key:'L', openWith:'(!(* |!|*)!)'},
		{name:'Numeric list', icon:'fa fa-list-ol', key:'N', openWith:'(!(# |!|#)!)'},
		{name:'Picture', icon:'fa fa-picture-o', key:'T', replaceWith:'![![Source:!:http://]!]([![Alternative text]!])!'},
		{name:'Link', icon:'fa fa-link', key:'U', openWith:'"', closeWith:'([![Title]!])":[![Link:!:http://]!]', placeHolder:'Your text to link here...' },
		{name:'Quotes', icon:'fa fa-quote-left', key:'Q', openWith:'bq(!(([![Class]!]))!). '},
		{name:'Code', icon:'fa fa-code', key:'O', openWith:'@', closeWith:'@'},
        {name:'BlockCode',icon:'fa fa-wrench', key:'K', openWith:'bc(!(([![Class]!]))!). '},
        {name:'Checkbox',icon:'fa fa-square-o', key:'E', openWith:'[] '},
        {name:'Checkbox with check',icon:'fa fa-check-square-o', key:'M', openWith:'[x] '}
	]
};<|endoftext|>


<commit_before>/**
 * Test and Validation file.
 */

'use strict';

module.exports = function( grunt ){

	grunt.initConfig({
		jshint: {
			all: [
				'Gruntfile.js',
				'bin/**/*.js',
				'lib/**/*.js',
				'tests/**/*.js'
			],
			options: {
				jshintrc: '.jshintrc'
			}
		},

		nodeunit: {
			unit: [
				'tests/**/*tests.js',
				'!tests/yearn*tests.js',
				'!tests/*cli-tests.js'
			],
			utils: [
			     'tests/utils/*utils-tests.js'
			],
			ynpm: [
			    'tests/ynpm-tests.js'
			],
			yearn: [
			    'tests/yearn-tests.js',
			    //'tests/yearn-override-tests.js',
			    //'tests/yearn-override-function-tests.js'
			],
			cli: [
			    'tests/*cli-tests.js'
			],
			options: {
				reporter: 'verbose'
			}
		},

		coveralls: {
			options: {
				force: false
			},
			submit_coverage: {
				src: 'coverage/lcov.info'
			}
		}
	});

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

	grunt.registerTask( 'test', [ 'jshint', 'nodeunit:unit', 'nodeunit:cli', 'nodeunit:yearn' ] );
	grunt.registerTask( 'default', [ 'test' ] );
};<commit_msg>Re-added basic yearn override tests<commit_after>/**
 * Test and Validation file.
 */

'use strict';

module.exports = function( grunt ){

	grunt.initConfig({
		jshint: {
			all: [
				'Gruntfile.js',
				'bin/**/*.js',
				'lib/**/*.js',
				'tests/**/*.js'
			],
			options: {
				jshintrc: '.jshintrc'
			}
		},

		nodeunit: {
			unit: [
				'tests/**/*tests.js',
				'!tests/yearn*tests.js',
				'!tests/*cli-tests.js'
			],
			utils: [
			     'tests/utils/*utils-tests.js'
			],
			ynpm: [
			    'tests/ynpm-tests.js'
			],
			yearn: [
			    'tests/yearn-tests.js',
			    'tests/yearn-override-tests.js',
			    //'tests/yearn-override-function-tests.js'
			],
			cli: [
			    'tests/*cli-tests.js'
			],
			options: {
				reporter: 'verbose'
			}
		},

		coveralls: {
			options: {
				force: false
			},
			submit_coverage: {
				src: 'coverage/lcov.info'
			}
		}
	});

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

	grunt.registerTask( 'test', [ 'jshint', 'nodeunit:unit', 'nodeunit:cli', 'nodeunit:yearn' ] );
	grunt.registerTask( 'default', [ 'test' ] );
};<|endoftext|>


<commit_before>//jshint maxcomplexity: 12, maxstatements: false, camelcase: false
var testConfig = require('./build/test/config');

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

	grunt.loadNpmTasks('grunt-babel');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-retire');
	grunt.loadNpmTasks('grunt-mocha');
	grunt.loadTasks('build/tasks');
	grunt.loadNpmTasks('grunt-parallel');

	var langs;
	if (grunt.option('lang')) {
		langs = ['.' + grunt.option('lang')];

	} else if (grunt.option('all-lang')) {
		var localeFiles = require('fs').readdirSync('./locales');
		langs = localeFiles.map(function (file) {
			return '.' + file.replace('.json', '');
		});
		langs.unshift(''); // Add default

	} else {
		langs = [''];
	}

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		parallel: {
			'browser-test': {
				options: {
					grunt: true
				},
				tasks: [
					'test-webdriver:firefox',
					'test-webdriver:chrome',
					// Edge Webdriver isn't all too stable, manual testing required
					// 'test-webdriver:edge',
					// 'test-webdriver:safari',
					'test-webdriver:ie'
				]
			}
		},
    retire: {
			options: {
				/** list of files to ignore **/
				ignorefile: '.retireignore.json' //or '.retireignore.json'
			},
			js: ['lib/*.js'], /** Which js-files to scan. **/
			node: ['./'] /** Which node directories to scan (containing package.json). **/
    },
		clean: ['dist', 'tmp', 'axe.js', 'axe.*.js'],
		babel: {
			options: {
				compact: 'false'
			},
			core: {
				files: [{
					expand: true,
					cwd: 'lib/core',
					src: ['**/*.js'],
					dest: 'tmp/core'
				}]
			},
			misc: {
				files: [{
					expand: true,
					cwd: 'tmp',
					src: ['*.js'],
					dest: 'tmp'
				}]
			}
		},
		'update-help': {
			options: {
				version: '<%=pkg.version%>'
			},
			rules: {
				src: ['lib/rules/**/*.json']
			}
		},
		concat: {
			engine: {
				options: {
					process: true
				},
				files: langs.map(function (lang, i) {
					return {
						src: [
							'lib/intro.stub',
							'tmp/core/index.js',
							'tmp/core/*/index.js',
							'tmp/core/**/index.js',
							'tmp/core/**/*.js',
							// include rules / checks / commons
							'<%= configure.rules.files[' + i + '].dest.auto %>',
							'lib/outro.stub'
						],
						dest: 'axe' + lang + '.js',
					};
				})
			},
			commons: {
				src: [
					'lib/commons/intro.stub',
					'lib/commons/index.js',
					'lib/commons/*/index.js',
					'lib/commons/**/*.js',
					'lib/commons/outro.stub'
				],
				dest: 'tmp/commons.js'
			}
		},
		configure: {
			rules: {
				tmp: 'tmp/rules.js',
				options: {
					tags: grunt.option('tags')
				},
				files: langs.map(function (lang) {
					return {
						src: ['<%= concat.commons.dest %>'],
						dest: {
							auto: 'tmp/rules' + lang + '.js',
							descriptions: 'doc/rule-descriptions' + lang + '.md'
						}
					};
				})
			}
		},
		'add-locale': {
			newLang: {
				options: { lang: grunt.option('lang') },
				src: ['<%= concat.commons.dest %>'],
				dest: './locales/' + (grunt.option('lang') || 'new-locale') + '.json'
			}
		},
		langs : {
			generate: {
				check: 'lib/checks/language/valid-lang'
			}
		},
		validate: {
			tools: {
				options: {
					type: 'tool'
				},
				src: 'lib/tools/**/*.json'
			},
			check: {
				options: {
					type: 'check'
				},
				src: 'lib/checks/**/*.json'
			},
			rule: {
				options: {
					type: 'rule'
				},
				src: 'lib/rules/**/*.json'
			}
		},
		uglify: {
			beautify: {
				files: langs.map(function (lang, i) {
					return {
						src: ['<%= concat.engine.files[' + i + '].dest %>'],
						dest: '<%= concat.engine.files[' + i + '].dest %>'
					};
				}),
				options: {
					mangle: false,
					compress: false,
					beautify: {
						beautify: true,
						indent_level: 2,
						bracketize: true,
						quote_style: 1
					},
					preserveComments: 'some'
				}
			},
			minify: {
				files: langs.map(function (lang, i) {
					return {
						src: ['<%= concat.engine.files[' + i + '].dest %>'],
						dest: './axe' + lang + '.min.js'
					};
				}),
				options: {
					preserveComments: function(node, comment) {
						// preserve comments that start with a bang
						return /^!/.test( comment.value );
					},
					mangle: {
						except: ['commons', 'utils', 'axe', 'window', 'document']
					}
				}
			}
		},
		watch: {
			files: ['lib/**/*', 'test/**/*.js', 'Gruntfile.js'],
			tasks: ['build', 'testconfig', 'fixture']
		},
		testconfig: {
			test: {
				src: ['test/integration/rules/**/*.json'],
				dest: 'tmp/integration-tests.js'
			}
		},
		fixture: {
			engine: {
				src: '<%= concat.engine.src %>',
				dest: 'test/core/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/core',
					data: {
						title: 'aXe Core Tests'
					}
				}
			},
			checks: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.tmp %>'
				],
				dest: 'test/checks/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/checks',
					data: {
						title: 'aXe Check Tests'
					}
				}
			},
			commons: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.tmp %>'
				],
				dest: 'test/commons/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/commons',
					data: {
						title: 'aXe Commons Tests'
					}
				}
			},
			ruleMatches: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.tmp %>'
				],
				dest: 'test/rule-matches/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/rule-matches',
					data: {
						title: 'aXe Rule Matches Tests'
					}
				}
			},
			integration: {
				src: ['<%= concat.engine.dest %>'],
				dest: 'test/integration/rules/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/integration/rules',
					tests: ['../../../tmp/integration-tests.js', 'runner.js'],
					data: {
						title: 'aXe Integration Tests'
					}
				}
			}
		},
		mocha: testConfig(grunt, {
			reporter: grunt.option('reporter') || 'Spec'
		}),
		'test-webdriver': (function () {
			var tests = testConfig(grunt);
			var options = Object.assign({}, tests.unit.options);
			options.urls = options.urls.concat(tests.integration.options.urls);
			var driverTests = {};

			['firefox', 'chrome', 'ie', 'safari', 'edge']
			.forEach(function (browser) {
				driverTests[browser] = {
					options: Object.assign({ browser: browser }, options)
				};
			});
			return driverTests;
		}()),
		connect: {
			test: {
				options: {
					hostname: '0.0.0.0',
					port: grunt.option('port') || 9876,
					base: ['.']
				}
			}
		},
		jshint: {
			axe: {
				options: {
					jshintrc: true,
					reporter: grunt.option('report') ? 'checkstyle' : undefined,
					reporterOutput: grunt.option('report') ? 'tmp/lint.xml' : undefined
				},
				src: ['lib/**/*.js', 'test/**/*.js', 'build/tasks/**/*.js', 'doc/**/*.js', 'Gruntfile.js']
			}
		}
	});

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

	grunt.registerTask('build', ['clean', 'jshint', 'validate', 'retire', 'concat:commons', 'configure',
		 'babel', 'concat:engine', 'uglify']);

	grunt.registerTask('test', ['build', 'testconfig', 'fixture', 'connect',
		'mocha', 'parallel', 'jshint']);

	grunt.registerTask('test-fast', ['build', 'testconfig', 'fixture', 'connect',
		'mocha', 'jshint']);

	grunt.registerTask('translate', ['clean', 'jshint', 'validate', 'concat:commons', 'add-locale']);

	grunt.registerTask('dev', ['build', 'testconfig', 'fixture', 'connect', 'watch']);
};
<commit_msg>allow multiple langs<commit_after>//jshint maxcomplexity: 12, maxstatements: false, camelcase: false
var testConfig = require('./build/test/config');

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

	grunt.loadNpmTasks('grunt-babel');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-retire');
	grunt.loadNpmTasks('grunt-mocha');
	grunt.loadTasks('build/tasks');
	grunt.loadNpmTasks('grunt-parallel');

	var langs;
	if (grunt.option('lang')) {
		langs = (grunt.option('lang') || '')
		.split(/[,;]/g).map(function (lang) {
			lang = lang.trim();
			return (lang !== 'en' ? '.' + lang : '');
		});

	} else if (grunt.option('all-lang')) {
		var localeFiles = require('fs').readdirSync('./locales');
		langs = localeFiles.map(function (file) {
			return '.' + file.replace('.json', '');
		});
		langs.unshift(''); // Add default

	} else {
		langs = [''];
	}

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		parallel: {
			'browser-test': {
				options: {
					grunt: true
				},
				tasks: [
					'test-webdriver:firefox',
					'test-webdriver:chrome',
					// Edge Webdriver isn't all too stable, manual testing required
					// 'test-webdriver:edge',
					// 'test-webdriver:safari',
					'test-webdriver:ie'
				]
			}
		},
    retire: {
			options: {
				/** list of files to ignore **/
				ignorefile: '.retireignore.json' //or '.retireignore.json'
			},
			js: ['lib/*.js'], /** Which js-files to scan. **/
			node: ['./'] /** Which node directories to scan (containing package.json). **/
    },
		clean: ['dist', 'tmp', 'axe.js', 'axe.*.js'],
		babel: {
			options: {
				compact: 'false'
			},
			core: {
				files: [{
					expand: true,
					cwd: 'lib/core',
					src: ['**/*.js'],
					dest: 'tmp/core'
				}]
			},
			misc: {
				files: [{
					expand: true,
					cwd: 'tmp',
					src: ['*.js'],
					dest: 'tmp'
				}]
			}
		},
		'update-help': {
			options: {
				version: '<%=pkg.version%>'
			},
			rules: {
				src: ['lib/rules/**/*.json']
			}
		},
		concat: {
			engine: {
				options: {
					process: true
				},
				files: langs.map(function (lang, i) {
					return {
						src: [
							'lib/intro.stub',
							'tmp/core/index.js',
							'tmp/core/*/index.js',
							'tmp/core/**/index.js',
							'tmp/core/**/*.js',
							// include rules / checks / commons
							'<%= configure.rules.files[' + i + '].dest.auto %>',
							'lib/outro.stub'
						],
						dest: 'axe' + lang + '.js',
					};
				})
			},
			commons: {
				src: [
					'lib/commons/intro.stub',
					'lib/commons/index.js',
					'lib/commons/*/index.js',
					'lib/commons/**/*.js',
					'lib/commons/outro.stub'
				],
				dest: 'tmp/commons.js'
			}
		},
		configure: {
			rules: {
				tmp: 'tmp/rules.js',
				options: {
					tags: grunt.option('tags')
				},
				files: langs.map(function (lang) {
					return {
						src: ['<%= concat.commons.dest %>'],
						dest: {
							auto: 'tmp/rules' + lang + '.js',
							descriptions: 'doc/rule-descriptions' + lang + '.md'
						}
					};
				})
			}
		},
		'add-locale': {
			newLang: {
				options: { lang: grunt.option('lang') },
				src: ['<%= concat.commons.dest %>'],
				dest: './locales/' + (grunt.option('lang') || 'new-locale') + '.json'
			}
		},
		langs : {
			generate: {
				check: 'lib/checks/language/valid-lang'
			}
		},
		validate: {
			tools: {
				options: {
					type: 'tool'
				},
				src: 'lib/tools/**/*.json'
			},
			check: {
				options: {
					type: 'check'
				},
				src: 'lib/checks/**/*.json'
			},
			rule: {
				options: {
					type: 'rule'
				},
				src: 'lib/rules/**/*.json'
			}
		},
		uglify: {
			beautify: {
				files: langs.map(function (lang, i) {
					return {
						src: ['<%= concat.engine.files[' + i + '].dest %>'],
						dest: '<%= concat.engine.files[' + i + '].dest %>'
					};
				}),
				options: {
					mangle: false,
					compress: false,
					beautify: {
						beautify: true,
						indent_level: 2,
						bracketize: true,
						quote_style: 1
					},
					preserveComments: 'some'
				}
			},
			minify: {
				files: langs.map(function (lang, i) {
					return {
						src: ['<%= concat.engine.files[' + i + '].dest %>'],
						dest: './axe' + lang + '.min.js'
					};
				}),
				options: {
					preserveComments: function(node, comment) {
						// preserve comments that start with a bang
						return /^!/.test( comment.value );
					},
					mangle: {
						except: ['commons', 'utils', 'axe', 'window', 'document']
					}
				}
			}
		},
		watch: {
			files: ['lib/**/*', 'test/**/*.js', 'Gruntfile.js'],
			tasks: ['build', 'testconfig', 'fixture']
		},
		testconfig: {
			test: {
				src: ['test/integration/rules/**/*.json'],
				dest: 'tmp/integration-tests.js'
			}
		},
		fixture: {
			engine: {
				src: '<%= concat.engine.src %>',
				dest: 'test/core/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/core',
					data: {
						title: 'aXe Core Tests'
					}
				}
			},
			checks: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.tmp %>'
				],
				dest: 'test/checks/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/checks',
					data: {
						title: 'aXe Check Tests'
					}
				}
			},
			commons: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.tmp %>'
				],
				dest: 'test/commons/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/commons',
					data: {
						title: 'aXe Commons Tests'
					}
				}
			},
			ruleMatches: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.tmp %>'
				],
				dest: 'test/rule-matches/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/rule-matches',
					data: {
						title: 'aXe Rule Matches Tests'
					}
				}
			},
			integration: {
				src: ['<%= concat.engine.dest %>'],
				dest: 'test/integration/rules/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/integration/rules',
					tests: ['../../../tmp/integration-tests.js', 'runner.js'],
					data: {
						title: 'aXe Integration Tests'
					}
				}
			}
		},
		mocha: testConfig(grunt, {
			reporter: grunt.option('reporter') || 'Spec'
		}),
		'test-webdriver': (function () {
			var tests = testConfig(grunt);
			var options = Object.assign({}, tests.unit.options);
			options.urls = options.urls.concat(tests.integration.options.urls);
			var driverTests = {};

			['firefox', 'chrome', 'ie', 'safari', 'edge']
			.forEach(function (browser) {
				driverTests[browser] = {
					options: Object.assign({ browser: browser }, options)
				};
			});
			return driverTests;
		}()),
		connect: {
			test: {
				options: {
					hostname: '0.0.0.0',
					port: grunt.option('port') || 9876,
					base: ['.']
				}
			}
		},
		jshint: {
			axe: {
				options: {
					jshintrc: true,
					reporter: grunt.option('report') ? 'checkstyle' : undefined,
					reporterOutput: grunt.option('report') ? 'tmp/lint.xml' : undefined
				},
				src: ['lib/**/*.js', 'test/**/*.js', 'build/tasks/**/*.js', 'doc/**/*.js', 'Gruntfile.js']
			}
		}
	});

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

	grunt.registerTask('build', ['clean', 'jshint', 'validate', 'retire', 'concat:commons', 'configure',
		 'babel', 'concat:engine', 'uglify']);

	grunt.registerTask('test', ['build', 'testconfig', 'fixture', 'connect',
		'mocha', 'parallel', 'jshint']);

	grunt.registerTask('test-fast', ['build', 'testconfig', 'fixture', 'connect',
		'mocha', 'jshint']);

	grunt.registerTask('translate', ['clean', 'jshint', 'validate', 'concat:commons', 'add-locale']);

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


<commit_before>var fallback = require("connect-history-api-fallback");
var livereload = require("connect-livereload");

//
// http://24ways.org/2013/grunt-is-not-weird-and-hard/
//
module.exports = function(grunt) {
  require("load-grunt-tasks")(grunt);
  grunt.loadNpmTasks('bit-imports');

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

  grunt.initConfig({
    pkg: pkg,
    connect: {
      test: {
        options: {
          port: 8012,
          hostname: "localhost"
        }
      },
      site: {
        options: {
          protocol: "http2", // or "https"

          // key: grunt.file.read("server.key").toString(),
          // cert: grunt.file.read("server.crt").toString(),
          // ca: grunt.file.read("ca.crt").toString(),

          port: 8015,
          hostname: "localhost",
          keepalive: true,
          // base: "_site",
          open: "https://localhost:8015/_site/index.html",
          middleware: function(connect, options, middlewares) {
            middlewares.unshift(fallback({ index: "/_site/index.html" }));
            middlewares.unshift(livereload({ port: 32012 }));
            return middlewares;
          }
        }
      },
      dev: {
        options: {
          port: 8010,
          host: "localhost",
          keepalive: true,
          open: "http://localhost:8010/test/SpecRunner.html"
        }
      },
      docs: {
        options: {
          port: 8017,
          host: "localhost",
          keepalive: true,
          base: "_docs/",
          open: "http://localhost:8017/global.html"
        }
      }
    },
    mocha: {
      test: {
        options: {
          log: true,
          logErrors: true,
          reporter: "Spec",
          run: false,
          timeout: 10000,
          urls: ["http://localhost:8012/test/SpecRunner.html"]
        }
      }
    },
    watch: {
      docs: {
        files: ["src/**/*.js"],
        tasks: ["jshint:all", "jsdoc:build"],
        options: {
          livereload: 32010
        }
      },
      build: {
        files: ["src/**/*.js", "test/**/*.js", "*.js"],
        tasks: ["build"],
        options: {
          livereload: 32011
        }
      },
      site: {
        files: ["src/**/*.js", "site/**/*"],
        tasks: ["build-site"],
        options: {
          livereload: 32012
        }
      }
    },
    jshint: {
      all: {
        options: {
          jshintrc: true,
          reporter: require("jshint-stylish")
        },
        src: ["src/**/*.js", "test/**/*.js", "*.js"]
      }
    },
    concurrent: {
      build: {
        tasks: ["connect:dev", "watch:build"],
        options: {
          logConcurrentOutput: true
        }
      },
      docs: {
        tasks: ["connect:docs", "watch:docs"],
        options: {
          logConcurrentOutput: true
        }
      },
      site: {
        tasks: ["connect:site", "watch:site"],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    jsdoc: {
      build: {
        src: [
          "src/bit-imports.js",
          "node_modules/bit-loader/src/bit-loader.js",
          "node_modules/bit-loader/src/module.js",
          "README.md"
        ],
        options: {
          destination: "_docs",
          verbose: true,
          private: true,
          plugins: ["plugins/markdown"],
          template: "./docs/template",
          configure: "./docs/site.conf.json"
        }
      }
    },
    browserify: {
      build: {
        src: ["browser.js"],
        dest: "dist/<%= pkg.name %>.js",
        options: {
          banner: "/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today() %>. (c) <%= grunt.template.today('yyyy') %> Miguel Castillo. Licensed under MIT */",
          browserifyOptions: {
            "detectGlobals": true,
            "ignoreMissing": true,
            "standalone": "bitimports"
          }
        }
      }
    },
    uglify: {
      build: {
        options: {
          preserveComments: "some",
          sourceMap: true
        },
        files: {
          "dist/<%= pkg.name %>.min.js": ["<%= browserify.build.dest %>"]
        }
      }
    },
    release: {
      options: {
        tagName: "v<%= version %>",
        tagMessage: "Version <%= version %>",
        commitMessage: "Release v<%= version %>",
        afterBump: ["build"]
      }
    },
    buildcontrol: {
      options: {
        dir: "_site",
        commit: true,
        push: true,
        message: "Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%"
      },
      pages: {
        options: {
          remote: "https://github.com/MiguelCastillo/bit-imports.git",
          branch: "gh-pages"
        }
      },
      local: {
        options: {
          remote: "../",
          branch: "gh-pages"
        }
      }
    },
    copy: {
      site: {
        cwd: "site",
        expand: true,
        src: [
          "bitimportsfile.js",
          "node_modules/loadstyle-bits/dist/**/*",
          "node_modules/bit-imports/dist/**/*",
          "node_modules/spromise/dist/**/*"
        ],
        dest: "_site"
      },
      siteignore: {
        src: ".site-gitignore",
        dest: "_site/.gitignore"
      },
      sitedocs: {
        expand: true,
        src: "_docs/**",
        dest: "_site"
      }
    },
    clean: {
      site: {
        src: ["_site"]
      }
    },
    bitimports: {
      site: {
        cwd: "site",
        src: ["main.js", "img/**/*", "style/**/*", "*.html", ".nojekyll"],
        dest: "_site",
        options: {
          ignore: ["three"],
          plugins: [{
            name: "js",
            match: { path: /\.(js)$/ },
            transform: {
              handler: "babel-bits",
              options: {
                presets: ["es2015"],
                sourceMap: "inline"
              }
            }
          }]
        }
      }
    }
  });

  grunt.registerTask("build", ["jshint:all", "browserify:build", "uglify:build"]);
  grunt.registerTask("test", ["connect:test", "mocha:test"]);
  grunt.registerTask("serve", ["concurrent:build"]);
  grunt.registerTask("build-docs", ["jsdoc:build"]);
  grunt.registerTask("serve-docs", ["build-docs", "concurrent:docs"]);
  grunt.registerTask("build-site", ["clean:site", "build", "jsdoc", "bitimports:site", "copy:siteignore", "copy:site", "copy:sitedocs"]);
  grunt.registerTask("publish-site", ["build-site", "buildcontrol:pages"]);
  grunt.registerTask("serve-site", ["build-site", "concurrent:site"]);
};
<commit_msg>Enabled http2 for running tests in browser<commit_after>var fallback = require("connect-history-api-fallback");
var livereload = require("connect-livereload");

//
// http://24ways.org/2013/grunt-is-not-weird-and-hard/
//
module.exports = function(grunt) {
  require("load-grunt-tasks")(grunt);
  grunt.loadNpmTasks('bit-imports');

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

  grunt.initConfig({
    pkg: pkg,
    connect: {
      test: {
        options: {
          port: 8012,
          hostname: "localhost"
        }
      },
      site: {
        options: {
          protocol: "http2", // or "https"

          // key: grunt.file.read("server.key").toString(),
          // cert: grunt.file.read("server.crt").toString(),
          // ca: grunt.file.read("ca.crt").toString(),

          port: 8015,
          hostname: "localhost",
          keepalive: true,
          // base: "_site",
          open: "https://localhost:8015/_site/index.html",
          middleware: function(connect, options, middlewares) {
            middlewares.unshift(fallback({ index: "/_site/index.html" }));
            middlewares.unshift(livereload({ port: 32012 }));
            return middlewares;
          }
        }
      },
      dev: {
        options: {
          protocol: "http2", // or "https"

          port: 8010,
          host: "localhost",
          keepalive: true,
          open: "https://localhost:8010/test/SpecRunner.html"
        }
      },
      docs: {
        options: {
          port: 8017,
          host: "localhost",
          keepalive: true,
          base: "_docs/",
          open: "http://localhost:8017/global.html"
        }
      }
    },
    mocha: {
      test: {
        options: {
          log: true,
          logErrors: true,
          reporter: "Spec",
          run: false,
          timeout: 10000,
          urls: ["http://localhost:8012/test/SpecRunner.html"]
        }
      }
    },
    watch: {
      docs: {
        files: ["src/**/*.js"],
        tasks: ["jshint:all", "jsdoc:build"],
        options: {
          livereload: 32010
        }
      },
      build: {
        files: ["src/**/*.js", "test/**/*.js", "*.js"],
        tasks: ["build"],
        options: {
          livereload: 32011
        }
      },
      site: {
        files: ["src/**/*.js", "site/**/*"],
        tasks: ["build-site"],
        options: {
          livereload: 32012
        }
      }
    },
    jshint: {
      all: {
        options: {
          jshintrc: true,
          reporter: require("jshint-stylish")
        },
        src: ["src/**/*.js", "test/**/*.js", "*.js"]
      }
    },
    concurrent: {
      build: {
        tasks: ["connect:dev", "watch:build"],
        options: {
          logConcurrentOutput: true
        }
      },
      docs: {
        tasks: ["connect:docs", "watch:docs"],
        options: {
          logConcurrentOutput: true
        }
      },
      site: {
        tasks: ["connect:site", "watch:site"],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    jsdoc: {
      build: {
        src: [
          "src/bit-imports.js",
          "node_modules/bit-loader/src/bit-loader.js",
          "node_modules/bit-loader/src/module.js",
          "README.md"
        ],
        options: {
          destination: "_docs",
          verbose: true,
          private: true,
          plugins: ["plugins/markdown"],
          template: "./docs/template",
          configure: "./docs/site.conf.json"
        }
      }
    },
    browserify: {
      build: {
        src: ["browser.js"],
        dest: "dist/<%= pkg.name %>.js",
        options: {
          banner: "/*! <%= pkg.name %> v<%= pkg.version %> - <%= grunt.template.today() %>. (c) <%= grunt.template.today('yyyy') %> Miguel Castillo. Licensed under MIT */",
          browserifyOptions: {
            "detectGlobals": true,
            "ignoreMissing": true,
            "standalone": "bitimports"
          }
        }
      }
    },
    uglify: {
      build: {
        options: {
          preserveComments: "some",
          sourceMap: true
        },
        files: {
          "dist/<%= pkg.name %>.min.js": ["<%= browserify.build.dest %>"]
        }
      }
    },
    release: {
      options: {
        tagName: "v<%= version %>",
        tagMessage: "Version <%= version %>",
        commitMessage: "Release v<%= version %>",
        afterBump: ["build"]
      }
    },
    buildcontrol: {
      options: {
        dir: "_site",
        commit: true,
        push: true,
        message: "Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%"
      },
      pages: {
        options: {
          remote: "https://github.com/MiguelCastillo/bit-imports.git",
          branch: "gh-pages"
        }
      },
      local: {
        options: {
          remote: "../",
          branch: "gh-pages"
        }
      }
    },
    copy: {
      site: {
        cwd: "site",
        expand: true,
        src: [
          "bitimportsfile.js",
          "node_modules/loadstyle-bits/dist/**/*",
          "node_modules/bit-imports/dist/**/*",
          "node_modules/spromise/dist/**/*"
        ],
        dest: "_site"
      },
      siteignore: {
        src: ".site-gitignore",
        dest: "_site/.gitignore"
      },
      sitedocs: {
        expand: true,
        src: "_docs/**",
        dest: "_site"
      }
    },
    clean: {
      site: {
        src: ["_site"]
      }
    },
    bitimports: {
      site: {
        cwd: "site",
        src: ["main.js", "img/**/*", "style/**/*", "*.html", ".nojekyll"],
        dest: "_site",
        options: {
          ignore: ["three"],
          plugins: [{
            name: "js",
            extensions: ["js"],
            transform: {
              handler: "babel-bits",
              options: {
                presets: ["es2015"],
                sourceMap: "inline"
              }
            }
          }]
        }
      }
    }
  });

  grunt.registerTask("build", ["jshint:all", "browserify:build", "uglify:build"]);
  grunt.registerTask("test", ["connect:test", "mocha:test"]);
  grunt.registerTask("serve", ["concurrent:build"]);
  grunt.registerTask("build-docs", ["jsdoc:build"]);
  grunt.registerTask("serve-docs", ["build-docs", "concurrent:docs"]);
  grunt.registerTask("build-site", ["clean:site", "build", "jsdoc", "bitimports:site", "copy:siteignore", "copy:site", "copy:sitedocs"]);
  grunt.registerTask("publish-site", ["build-site", "buildcontrol:pages"]);
  grunt.registerTask("serve-site", ["build-site", "concurrent:site"]);
};
<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('OpenSearchlight.pkg.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.copyright %>;' +
        ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") + "\\n" %>*/' + "\n"
    },
    clean: {
      folder: "dist/"
    },
    concat: {
      options: {
        stripBanners: true,
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: [
          'src/<%= pkg.name %>.js',
          'src/OpenSearchQuery.js',
          'src/OpenSearchService.js',
          'src/OpenSearchDescriptionDocument.js'
        ],
        dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        // Banner
        src: ['<%= concat.dist.dest %>'],
        dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.min.js'
      }
    },
    exec: {
      docco: {
        command: 'node_modules/docco/bin/docco -o dist/docs <%= concat.dist.dest %>'
      }
    },
    qunit: {
      all: ['test/**/*.html']
    },
    watch: {
      files: '<%= jshint.all %>',
      tasks: ['jshint', 'concat', 'qunit']
    },
    jshint: {
      all: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true,
          $: true,
          sinon: true,
          _: true,
          test: true,
          ok: true,
          module: true,
          equal: true,
          deepEqual: true,

          // specit
          describe: true,
          it: true,
          assert: true,
          should: true,
          before: true,
          after: true,

          // specit matchers
          include: true,
          eql: true,
          beSimilarTo: true,
          be: true,
          beA: true,
          beAn: true,
          match: true,
          respondTo: true,
          beLessThan: true,
          beLessThanOrEqualTo: true,
          beGreaterThan: true,
          beGreaterThanOrEqualTo: true,
          beOnThePage: true,
          beEmpty: true,
          beToTheLeftOf: true,
          beToTheRightOf: true,
          beAbove: true
        }
      }
    }
  });

  // Load modules
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-exec');

  // Default task.
  grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
  grunt.registerTask('dist', ['concat', 'uglify']);
  grunt.registerTask('docs', ['default', 'exec']);
};

<commit_msg>Revert "Add working grunt task to create dist/ with grunt dist.  The default grunt task fails because unit tests do not pass, and grunt dist fails because it is expecting grunt concat to be run first."<commit_after>/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('OpenSearchlight.pkg.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.copyright %>;' +
        ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") + "\\n" %>*/' + "\n"
    },
    clean: {
      folder: "dist/"
    },
    concat: {
      options: {
        stripBanners: true,
        banner: '<%= meta.banner %>'
      },
      dist: {
        src: [
          'src/<%= pkg.name %>.js',
          'src/OpenSearchQuery.js',
          'src/OpenSearchService.js',
          'src/OpenSearchDescriptionDocument.js'
        ],
        dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= meta.banner %>'
      },
      dist: {
        // Banner
        src: ['<%= concat.dist.dest %>'],
        dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.min.js'
      }
    },
    exec: {
      docco: {
        command: 'node_modules/docco/bin/docco -o dist/docs <%= concat.dist.dest %>'
      }
    },
    qunit: {
      all: ['test/**/*.html']
    },
    watch: {
      files: '<%= jshint.all %>',
      tasks: ['jshint', 'concat', 'qunit']
    },
    jshint: {
      all: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true,
          $: true,
          sinon: true,
          _: true,
          test: true,
          ok: true,
          module: true,
          equal: true,
          deepEqual: true,

          // specit
          describe: true,
          it: true,
          assert: true,
          should: true,
          before: true,
          after: true,

          // specit matchers
          include: true,
          eql: true,
          beSimilarTo: true,
          be: true,
          beA: true,
          beAn: true,
          match: true,
          respondTo: true,
          beLessThan: true,
          beLessThanOrEqualTo: true,
          beGreaterThan: true,
          beGreaterThanOrEqualTo: true,
          beOnThePage: true,
          beEmpty: true,
          beToTheLeftOf: true,
          beToTheRightOf: true,
          beAbove: true
        }
      }
    }
  });

  // Load modules
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-exec');

  // Default task.
  grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify']);
  grunt.registerTask('docs', ['default', 'exec']);
};

<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-typescript');
  grunt.loadNpmTasks('grunt-typedoc');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.initConfig({

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

    typescript: {
      base: {
        src: ['src/**/*.ts'],
        dest: 'lib',
        options: {
          module: 'commonjs',
          target: 'es5',
          sourceMap: true,
          declaration: true,
          references: [
            'typings/**/*.d.ts'
          ],
          noImplicitAny: true
        }
      }
    },

    typedoc: {
      build: {
        options: {
          module: 'commonjs',
          target: 'es6',
          out: 'docs/',
          name: 'Aff - Asynchronous effect system for TypeScript',
        },
        src: 'src/'
      }
    },

    watch: {
      files: 'src/**/*.ts',
      tasks: ['typescript']
    }

  });

  grunt.registerTask('default', ['typescript', 'typedoc']);
  grunt.registerTask('dev', ['watch']);
};
<commit_msg>disable typedoc<commit_after>'use strict';

module.exports = function (grunt) {
  grunt.loadNpmTasks('grunt-typescript');
  grunt.loadNpmTasks('grunt-typedoc');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.initConfig({

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

    typescript: {
      base: {
        src: ['src/**/*.ts'],
        dest: 'lib',
        options: {
          module: 'commonjs',
          target: 'es5',
          sourceMap: true,
          declaration: true,
          references: [
            'typings/**/*.d.ts'
          ],
          noImplicitAny: true
        }
      }
    },

    typedoc: {
      build: {
        options: {
          module: 'commonjs',
          target: 'es6',
          out: 'docs/',
          name: 'Aff - Asynchronous effect system for TypeScript',
        },
        src: 'src/'
      }
    },

    watch: {
      files: 'src/**/*.ts',
      tasks: ['typescript']
    }

  });

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


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

	// todo: use grunt to change html to client/subject/data

	var fs = require('fs')
		,glob = require('glob')

		,aFiles = [
			'src/js/sfbrowser.js'
		]
//		,sMain = fs.readFileSync(aFiles[0]).toString()
//		,oBanner = readBanner(sMain)
	;

//	// update package.json with jsdoc data
//	var oMap = {namespace:'name',name:'title',title:'description'};
//	for (var bannerKey in oBanner) {
//		var sPackageKey = oMap[bannerKey]||bannerKey
//			,oValP = oPackage[sPackageKey]
//			,oValB = oBanner[bannerKey];
//		if (oValP!==undefined&&oValP!==oValB) {
//			grunt.log.writeln('Updated package '+sPackageKey+' from',oValP,'to',oValB,' (',sPackage,')');
//			oPackage[sPackageKey] = oValB;
//		}
//		fs.writeFileSync(sPackage,JSON.stringify(oPackage,null,'\t'));
//	}
//
//	// update jsdoc.conf.json with jsdoc data
//	oJsDoc.templates.systemName = oBanner.name;
//	oJsDoc.templates.copyright = oBanner.copyright;
//	oJsDoc.templates.theme = 'sjeiti';
//	// ok: Flatly Spacelab Cerulean United
//	// not ok: Amelia Cosmo Cyborg Journal Readable Simplex Slate Superhero Spruce
//	fs.writeFileSync(sJsDoc,JSON.stringify(oJsDoc,null,'\t'));
//
//
//	/**
//	 * Convert initial jsdoc comments to object
//	 * @param source source file
//	 * @returns {{title: *}} jsdoc as object
//	 */
//	function readBanner(source){
//		var sBanner = source.match(/\/\*\*([\s\S]*?)\*\//g)[0]
//			,aLines = sBanner.split(/[\n\r]/g)
//			,aMatchName = sBanner.match(/(\s?\*\s?([^@]+))/g)
//			,sName = aMatchName.shift().replace(/[\/\*\s\r\n]+/g,' ').trim()
//			,oBanner = {title:sName};
//		for (var i = 0, l = aLines.length; i<l; i++) {
//			var sLine = aLines[i]
//				,aMatchKey = sLine.match(/(\s?\*\s?@([^\s]*))/);
//			if (aMatchKey) {
//				var sKey = aMatchKey[2];
//				oBanner[sKey] = sLine.split(sKey).pop().trim();
//			}
//		}
//		return oBanner;
//	}

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

		jshint: {
			options: { jshintrc: '.jshintrc' },
			files: aFiles
		},

		clean: {
			dist: {
				src: ['dist/**']
			}
		},

		copy: {
			dist: {
				files: [
					{ // index.html and test data/
						expand: true
						,cwd: 'dist_files/'
						,src: ['**']
						,dest: 'dist/'
						,filter: 'isFile'
					},
					{ // fonts
						expand: true
						,cwd: 'src/fonts/'
						,src: ['**']
						,dest: 'dist/fonts/'
						,filter: 'isFile'
					},
					{ // vendor js files
						expand: true
						,cwd: 'src/js/vendor/'
						,src: ['**']
						,dest: 'dist/js/vendor/'
						,filter: 'isFile'
					}
				]
			}
			,connector: {
				files: [
					{
						expand: true
						,dot: true
						,cwd: 'src/connector/'
						,src: ['**']
						,dest: 'dist/connector/'
						,filter: 'isFile'
					}
				]
			}
			,css: {
				files: [
					{
						expand: true
						,cwd: 'src/less/'
						,src: ['**']
						,dest: 'dist/css/'
						,filter: function(src){
							return ['less','css','bootstrap'].indexOf(src.split('.').pop())===-1;
						}
					}
				]
			}
			,devjs: {
				files: [
					{
						expand: true
						,cwd: 'src/js/'
						,src: ['sfbrowser.js']
						,dest: 'dist/js/'
						,filter: 'isFile'
					}
				]
			}
			,temp: {
				files: [
					{
						expand: true
						,cwd: 'temp/'
						,src: 'sfbrowser.js'
						,dest: 'dist/js/'
						,filter: 'isFile'
					}
				]
			}
		},

		wrapconcat: {
			options: {
				prefix: '<script type="text/ng-template" id="%filename%">'
				,suffix: '</script>'
			},
//			dist: {
//				src: ['src/tpl/*.html','src/tpl/*'],
//				dest: 'dist/sfbrowser.html'
//			},
			dist: {
				src: ['src/tpl/*.html','src/tpl/*'],
				dest: 'temp/templates.html'
			}
		},

		uglify: {
			dist: {
				src: aFiles,
				dest: 'dist/js/sfbrowser.min.js'
			}
		},

		includejs: {
			temp: {
				cwd: 'src/js/',
				src: ['sfbrowser.js'],
				dest: 'temp/'
			}
		}

		,less: {
			options: {
				compress: true
			}
			,dist: {
				src: ['src/less/sfbrowser.less'],
				dest: 'dist/css/sfbrowser.css'
			}
			,dev: {
				src: ['src/less/sfbrowser.less'],
				dest: 'src/less/sfbrowser.css'
			}
		}

	});

	grunt.registerMultiTask('includejs', '', function() {
		//var oOptions = this.options({});
		var sCwd = this.data.cwd
			,sDest = this.data.dest
			,iNumFiles = 0;
		this.data.src.forEach(function(src){
			console.log('including ',sCwd+src); // log
			fs.writeFileSync(sDest+src,includeInto(sCwd+src));
		});
		function includeInto(file){
			iNumFiles++;
			var sFileContents = fs.readFileSync(file).toString()
				,aMatch = sFileContents.match(/\/\*\s?include(\s\-esc)?\s+.*\s?\*\//g);
			if (aMatch) {
				aMatch.forEach(function(include){
					var aFile = include.match(/(\/\*\s?include(\s\-esc)?\s+)(.*)(\s?\*\/)/)
						,sFile = aFile[3]
						,aSplit = file.split('/')
						,sPath
						,bEsc = include.indexOf(' -esc ')!==-1
						,bBase64 = include.indexOf(' -base64 ')!==-1
					;
					aSplit.pop();
					sPath = aSplit.join('/')+'/';
					console.log('including ',sPath+sFile); // log
//					if (bEsc) sFileContents = sFileContents.replace(include,encodeURIComponent(includeInto(sPath+sFile)).replace('\'','\\\\'));
//					if (bEsc) sFileContents = sFileContents.replace(include,includeInto(sPath+sFile).replace(/'/gi,'\\\''));
					if (bEsc) sFileContents = sFileContents.replace(include,encodeURIComponent(includeInto(sPath+sFile)).replace(/'/gi,'\\\''));
					else if (bBase64) sFileContents = sFileContents.replace(include,new Buffer(includeInto(sPath+sFile)).toString('base64'));
					else sFileContents = sFileContents.replace(include,includeInto(sPath+sFile));
				});
			}
			return sFileContents;
		}
		grunt.log.writeln(iNumFiles+' files processed.');
	});

	grunt.registerMultiTask('wrapconcat', '', function() {
		var oOptions = this.options({});
		var aFiles = []
			,sContents = '';
		this.data.src.forEach(function(src){
			glob.sync(src).forEach(function(file){
				if (aFiles.indexOf(file)===-1) aFiles.push(file);
			});
		});
		aFiles.forEach(function(file){
			var sFileName = file.split('/').pop();
			sContents += oOptions.prefix.replace('%filename%',sFileName)+fs.readFileSync(file).toString().replace(/[\r\n\t]/g,' ').replace(/\s+/g,' ').replace(/>\s</g,'><')+oOptions.suffix;
		});
		fs.writeFileSync(this.data.dest,sContents);
		grunt.log.writeln(aFiles.length+' files wrapped and concatenated.');
	});

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-less');

	grunt.registerTask('default',['jshint','uglify']);
	grunt.registerTask('dev',['includejs:temp','copy:temp']);
	grunt.registerTask('dist',[
		'clean:dist'
		,'copy:dist'
		,'copy:connector'
		,'copy:css'
		,'includejs:temp'
		,'copy:temp'
		,'wrapconcat:dist'
		,'uglify:dist'
	]);

	grunt.registerTask('css',['less:dev','includejs:temp','copy:temp']);
	grunt.registerTask('tpl',['wrapconcat','includejs:temp','copy:temp']);

};
<commit_msg>Update Gruntfile.js<commit_after>/* global module */
/* global require */
module.exports = function (grunt) {
	/* jshint strict: false */

	// todo: use grunt to change html to client/subject/data

	var fs = require('fs')
		,glob = require('glob')

		,aFiles = [
			'src/js/sfbrowser.js'
		]
//		,sMain = fs.readFileSync(aFiles[0]).toString()
//		,oBanner = readBanner(sMain)
	;

//	// update package.json with jsdoc data
//	var oMap = {namespace:'name',name:'title',title:'description'};
//	for (var bannerKey in oBanner) {
//		var sPackageKey = oMap[bannerKey]||bannerKey
//			,oValP = oPackage[sPackageKey]
//			,oValB = oBanner[bannerKey];
//		if (oValP!==undefined&&oValP!==oValB) {
//			grunt.log.writeln('Updated package '+sPackageKey+' from',oValP,'to',oValB,' (',sPackage,')');
//			oPackage[sPackageKey] = oValB;
//		}
//		fs.writeFileSync(sPackage,JSON.stringify(oPackage,null,'\t'));
//	}
//
//	// update jsdoc.conf.json with jsdoc data
//	oJsDoc.templates.systemName = oBanner.name;
//	oJsDoc.templates.copyright = oBanner.copyright;
//	oJsDoc.templates.theme = 'sjeiti';
//	// ok: Flatly Spacelab Cerulean United
//	// not ok: Amelia Cosmo Cyborg Journal Readable Simplex Slate Superhero Spruce
//	fs.writeFileSync(sJsDoc,JSON.stringify(oJsDoc,null,'\t'));
//
//
//	/**
//	 * Convert initial jsdoc comments to object
//	 * @param source source file
//	 * @returns {{title: *}} jsdoc as object
//	 */
//	function readBanner(source){
//		var sBanner = source.match(/\/\*\*([\s\S]*?)\*\//g)[0]
//			,aLines = sBanner.split(/[\n\r]/g)
//			,aMatchName = sBanner.match(/(\s?\*\s?([^@]+))/g)
//			,sName = aMatchName.shift().replace(/[\/\*\s\r\n]+/g,' ').trim()
//			,oBanner = {title:sName};
//		for (var i = 0, l = aLines.length; i<l; i++) {
//			var sLine = aLines[i]
//				,aMatchKey = sLine.match(/(\s?\*\s?@([^\s]*))/);
//			if (aMatchKey) {
//				var sKey = aMatchKey[2];
//				oBanner[sKey] = sLine.split(sKey).pop().trim();
//			}
//		}
//		return oBanner;
//	}

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

		jshint: {
			options: { jshintrc: '.jshintrc' },
			files: aFiles
		},

		clean: {
			dist: {
				src: ['dist/**']
			}
		},

		copy: {
			dist: {
				files: [
					{ // index.html and test data/
						expand: true
						,cwd: 'dist_files/'
						,src: ['**']
						,dest: 'dist/'
						,filter: 'isFile'
					},
					{ // fonts
						expand: true
						,cwd: 'src/fonts/'
						,src: ['**']
						,dest: 'dist/fonts/'
						,filter: 'isFile'
					},
					{ // vendor js files
						expand: true
						,cwd: 'src/js/vendor/'
						,src: ['**']
						,dest: 'dist/js/vendor/'
						,filter: 'isFile'
					}
				]
			}
			,connector: {
				files: [
					{
						expand: true
						,dot: true
						,cwd: 'src/connector/'
						,src: ['**']
						,dest: 'dist/connector/'
						,filter: 'isFile'
					}
				]
			}
			,css: {
				files: [
					{
						expand: true
						,cwd: 'src/less/'
						,src: ['**']
						,dest: 'dist/css/'
						,filter: function(src){
							return ['less','css','bootstrap'].indexOf(src.split('.').pop())===-1;
						}
					}
				]
			}
			,devjs: {
				files: [
					{
						expand: true
						,cwd: 'src/js/'
						,src: ['sfbrowser.js']
						,dest: 'dist/js/'
						,filter: 'isFile'
					}
				]
			}
			,temp: {
				files: [
					{
						expand: true
						,cwd: 'temp/'
						,src: 'sfbrowser.js'
						,dest: 'dist/js/'
						,filter: 'isFile'
					}
				]
			}
		},

		wrapconcat: {
			options: {
				prefix: '<script type="text/ng-template" id="%filename%">'
				,suffix: '</script>'
			},
//			dist: {
//				src: ['src/tpl/*.html','src/tpl/*'],
//				dest: 'dist/sfbrowser.html'
//			},
			dist: {
				src: ['src/tpl/*.html','src/tpl/*'],
				dest: 'temp/templates.html'
			}
		},

		uglify: {
			dist: {
				src: aFiles,
				dest: 'dist/js/sfbrowser.min.js'
			}
		},

		includejs: {
			temp: {
				cwd: 'src/js/',
				src: ['sfbrowser.js'],
				dest: 'temp/'
			}
		}

		,less: {
			options: {
				compress: true
			}
			,dist: {
				src: ['src/less/sfbrowser.less'],
				dest: 'dist/css/sfbrowser.css'
			}
			,dev: {
				src: ['src/less/sfbrowser.less'],
				dest: 'src/less/sfbrowser.css'
			}
		}

	});

	// todo: grunt-include-all
	/* include -e asdf/qwer.js */
	/*
	-e escape quotes
	-u encodeURIComponent
	-b base64 encoding

	config
	cwd .
	regex /\/\*\s?include(\s\-\w)?\s+.*\s?\*\//g
	*/
	grunt.registerMultiTask('includejs', '', function() {
		//var oOptions = this.options({});
		var sCwd = this.data.cwd||''
			,sDest = this.data.dest
			,iNumFiles = 0;
		this.data.src.forEach(function(src){
			console.log('including ',sCwd+src); // log
			fs.writeFileSync(sDest+src,includeInto(sCwd+src));
		});
		function includeInto(file){
			iNumFiles++;
			var sFileContents = fs.readFileSync(file).toString()
				,aMatch = sFileContents.match(/\/\*\s?include(\s\-esc)?\s+.*\s?\*\//g);
			if (aMatch) {
				aMatch.forEach(function(include){
					var aFile = include.match(/(\/\*\s?include(\s\-esc)?\s+)(.*)(\s?\*\/)/)
						,sFile = aFile[3]
						,aSplit = file.split('/')
						,sPath
						,bEsc = include.indexOf(' -esc ')!==-1
						,bBase64 = include.indexOf(' -base64 ')!==-1
					;
					aSplit.pop();
					sPath = aSplit.join('/')+'/';
					console.log('including ',sPath+sFile); // log
//					if (bEsc) sFileContents = sFileContents.replace(include,encodeURIComponent(includeInto(sPath+sFile)).replace('\'','\\\\'));
//					if (bEsc) sFileContents = sFileContents.replace(include,includeInto(sPath+sFile).replace(/'/gi,'\\\''));
					if (bEsc) sFileContents = sFileContents.replace(include,encodeURIComponent(includeInto(sPath+sFile)).replace(/'/gi,'\\\''));
					else if (bBase64) sFileContents = sFileContents.replace(include,new Buffer(includeInto(sPath+sFile)).toString('base64'));
					else sFileContents = sFileContents.replace(include,includeInto(sPath+sFile));
				});
			}
			return sFileContents;
		}
		grunt.log.writeln(iNumFiles+' files processed.');
	});

	grunt.registerMultiTask('wrapconcat', '', function() {
		var oOptions = this.options({});
		var aFiles = []
			,sContents = '';
		this.data.src.forEach(function(src){
			glob.sync(src).forEach(function(file){
				if (aFiles.indexOf(file)===-1) aFiles.push(file);
			});
		});
		aFiles.forEach(function(file){
			var sFileName = file.split('/').pop();
			sContents += oOptions.prefix.replace('%filename%',sFileName)+fs.readFileSync(file).toString().replace(/[\r\n\t]/g,' ').replace(/\s+/g,' ').replace(/>\s</g,'><')+oOptions.suffix;
		});
		fs.writeFileSync(this.data.dest,sContents);
		grunt.log.writeln(aFiles.length+' files wrapped and concatenated.');
	});

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-less');

	grunt.registerTask('default',['jshint','uglify']);
	grunt.registerTask('dev',['includejs:temp','copy:temp']);
	grunt.registerTask('dist',[
		'clean:dist'
		,'copy:dist'
		,'copy:connector'
		,'copy:css'
		,'includejs:temp'
		,'copy:temp'
		,'wrapconcat:dist'
		,'uglify:dist'
	]);

	grunt.registerTask('css',['less:dev','includejs:temp','copy:temp']);
	grunt.registerTask('tpl',['wrapconcat','includejs:temp','copy:temp']);

};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
    require('time-grunt')(grunt);
    require('load-grunt-tasks')(grunt);

    var path = {
        src: 'src',
        dist: 'dist'
    };

    grunt.initConfig({
        path: path,
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            options: {
                nospawn: true,
            },
            scripts: {
                files: ['<%= jshint.scripts %>'],
                tasks: ['jshint:scripts']
            },
            gruntfile: {
                files: ['<%= jshint.gruntfile %>'],
                tasks: ['jshint:gruntfile']
            }
        },
        clean: {
            dist: ['<%= path.dist %>']
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            gruntfile: [
                'Gruntfile.js'
            ],
            scripts: [
                '<%= path.src %>/**/*.js',
                '!<%= path.src %>/vendor/**/*.js',
            ],
            all: [
                'Gruntfile.js',
                '<%= path.src %>/**/*.js',
                '!<%= path.src %>/vendor/**/*.js'
            ]
        },
        bump: {
            options: {
                files: ['package.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'chore(release): %VERSION%',
                commitFiles: ['package.json', 'CHANGELOG.md'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'version %VERSION%',
                push: false,
                gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
            }
        },
        uglify: {
            options: {
                preserveComments: false,
                banner: '/**\n * <%= pkg.name %> - <%= pkg.version %>\n * <%= pkg.author %>\n */\n\n'
            },
            build: {
                options: {
                    compress: false
                },
                files: {
                    '<%= path.dist %>/bg.js': [
                        '<%= path.src %>/vendor/promise-0.1.1.js',
                        '<%= path.src %>/icons.js',
                        '<%= path.src %>/main.js'
                    ]
                }
            },
            dist: {
                options: {
                    mangle: true,
                    compress: true
                },
                files: {
                    '<%= path.dist %>/bg.js': '<%= path.dist %>/bg.js'
                }
            }
        },
        copy: {
            manifest: {
                src: '<%= path.src %>/manifest.json',
                dest: '<%= path.dist %>/manifest.json',
                options: {
                    process: function (content, path) {
                        return grunt.template.process(content);
                    }
                }
            },
            icons: {
                files: [{
                    expand: true,
                    cwd: '<%= path.src %>',
                    dest: '<%= path.dist %>',
                    src: [
                        'icons/**/*.png'
                    ]
                }]
            }
        }
    });

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

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

    grunt.registerTask('dist', [
        'jshint',
        'bump-only:minor',
        'build',
        'uglify:dist',
        'changelog',
        'bump-commit'
    ]);
};
<commit_msg>chore(grunt): change uglify compressor flags<commit_after>'use strict';

module.exports = function (grunt) {
    require('time-grunt')(grunt);
    require('load-grunt-tasks')(grunt);

    var path = {
        src: 'src',
        dist: 'dist'
    };

    grunt.initConfig({
        path: path,
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            options: {
                nospawn: true,
            },
            scripts: {
                files: ['<%= jshint.scripts %>'],
                tasks: ['jshint:scripts']
            },
            gruntfile: {
                files: ['<%= jshint.gruntfile %>'],
                tasks: ['jshint:gruntfile']
            }
        },
        clean: {
            dist: ['<%= path.dist %>']
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            gruntfile: [
                'Gruntfile.js'
            ],
            scripts: [
                '<%= path.src %>/**/*.js',
                '!<%= path.src %>/vendor/**/*.js',
            ],
            all: [
                'Gruntfile.js',
                '<%= path.src %>/**/*.js',
                '!<%= path.src %>/vendor/**/*.js'
            ]
        },
        bump: {
            options: {
                files: ['package.json'],
                updateConfigs: ['pkg'],
                commit: true,
                commitMessage: 'chore(release): %VERSION%',
                commitFiles: ['package.json', 'CHANGELOG.md'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'version %VERSION%',
                push: false,
                gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
            }
        },
        uglify: {
            options: {
                preserveComments: false,
                banner: '/**\n * <%= pkg.name %> - <%= pkg.version %>\n * <%= pkg.author %>\n */\n\n'
            },
            build: {
                options: {
                    compress: false
                },
                files: {
                    '<%= path.dist %>/bg.js': [
                        '<%= path.src %>/vendor/promise-0.1.1.js',
                        '<%= path.src %>/icons.js',
                        '<%= path.src %>/main.js'
                    ]
                }
            },
            dist: {
                options: {
                    mangle: true,
                    compress: {
                        side_effects: false,
                        unused: false
                    }
                },
                files: ['<%= uglify.build.files %>']
            }
        },
        copy: {
            manifest: {
                src: '<%= path.src %>/manifest.json',
                dest: '<%= path.dist %>/manifest.json',
                options: {
                    process: function (content, path) {
                        return grunt.template.process(content);
                    }
                }
            },
            icons: {
                files: [{
                    expand: true,
                    cwd: '<%= path.src %>',
                    dest: '<%= path.dist %>',
                    src: [
                        'icons/**/*.png'
                    ]
                }]
            }
        }
    });

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

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

    grunt.registerTask('dist', [
        'jshint',
        'bump-only:minor',
        'build',
        'uglify:dist',
        'changelog',
        'bump-commit'
    ]);
};
<|endoftext|>


<commit_before>/*jshint node:true */
module.exports = function(grunt) {
  'use strict';

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

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      front: {
        src: ['Gruntfile.js', 'public/javascripts/**/*.js']
      },
      test: {
        src: ['test/**/*.coffee']
      }
    },
    simplemocha: {
      all: {
        src: '<%= jshint.test.src %>',
        options: {
          timeout: 4000,
          ignoreLeaks: false,
          ui: 'bdd',
          reporter: 'spec'
        }
      }
    }

  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-simple-mocha');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task.
  grunt.registerTask('default', ['simplemocha']);
  grunt.registerTask('test', ['simplemocha']);
  grunt.registerTask('lint', ['jshint']);
};
<commit_msg>Delete Gruntfile.js<commit_after><|endoftext|>


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

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

	grunt.initConfig({

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

		jshint: {
			files: [
				'math.format.js'
			]
		},

		qunit: {
			all: ['test/index.html']
		}
	});

	grunt.registerTask('default', [
		'jshint',
		'qunit'
	]);
};
<commit_msg>Tells JSHint to ignore the two 'eval' calls in the source code<commit_after>
module.exports = function(grunt) {

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

	grunt.initConfig({

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

		jshint: {
			options: {
				'-W061': true
			},
			files: [
				'math.format.js'
			]
		},

		qunit: {
			all: ['test/index.html']
		}
	});

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


<commit_before>'use strict';

// livereload
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
  return connect.static(path.resolve(point));
};

module.exports = function(grunt) {

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

  grunt.initConfig({
    livereload: {
      port: 35729 // Default livereload listening port.
    },
    watch: {
      livereload: {
        files: [
          '*.html',
          '.tmp/{,*/}*.js',
          'test/js/{,*/}*.js',
          'test/css/{,*/}*.css'
        ],
        tasks: ['livereload']
      },
      src: {
        files: [
          'src/{,*/}*.js',
          'spec/**/*.spec.js'
        ],
        tasks: ['concat:editable']
      }
    },
    connect: {
      livereload: {
        options: {
          port: 9000,
          hostname: '0.0.0.0',
          // Change this to '0.0.0.0' to access the server from outside.
          middleware: function(connect, options) {
            return [lrSnippet, folderMount(connect, options.base)];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          hostname: '0.0.0.0',
          middleware: function(connect, options) {
            return [
              folderMount(connect, options.base)
            ];
          }
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= connect.livereload.options.port %>'
      }
    },
    clean: {
      server: '.tmp'
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'src/{,*/}*.js'
      ]
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        browsers: ['PhantomJS']
      },
      browsers: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari', 'Opera']
      },
      build: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari', 'Opera'],
        singleRun: true
      }
    },
    concat: {
      dist: {
        files: {
          'editable.js': [
            'vendor/rangy-1.2.3/rangy-core.js',
            'vendor/rangy-1.2.3/rangy-selectionsaverestore.js',
            'vendor/bowser.js',
            '.tmp/editable.js'
          ]
        }
      },
      editable: {
        files: {
          '.tmp/editable.js': [
            'editable.prefix',
            'src/util/*.js',
            'src/core.js',
            'src/!(core).js',
            'editable.suffix'
          ],
          '.tmp/editable-test.js': [
            'editable.prefix',
            'src/util/*.js',
            'src/core.js',
            'src/!(core).js',
            'spec/**/*.js',
            'editable.suffix'
          ]
        }
      }
    },
    uglify: {
      dist: {
        files: {
          'editable.min.js': [
            'editable.js'
          ],
        }
      }
    },
    copy: {
      lukas: {
        files: [{
          expand: true,
          src: ['editable.js'],
          dest: '../livingdocs-engine/vendor/editableJS/'
        }]

      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        commitFiles: ['package.json', 'bower.json', 'Changelog.md'], // '-a' for all files
        pushTo: 'origin'
      }
    }

  });

  // livereload does not work with grunt-contrib-watch, so we use regarde instead
  // https://github.com/gruntjs/grunt-contrib-watch/issues/59
  grunt.renameTask('regarde', 'watch');

  grunt.registerTask('server', [
    'clean:server',
    'concat:editable',
    'livereload-start',
    'connect:livereload',
    'open',
    'watch:livereload'
  ]);

  grunt.registerTask('test', [
    'clean:server',
    'concat:editable',
    'karma:unit'
  ]);

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

  grunt.registerTask('dev', [
    'concat:editable',
    'watch:src'
  ]);

  grunt.registerTask('build', [
    'jshint',
    'clean:server',
    'concat:editable',
    'karma:build',
    'concat:dist',
    'uglify'
  ]);

  grunt.registerTask('build-lukas', [
    'build',
    'copy:lukas'
  ]);

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

  // Release a new version
  // Only do this on the `master` branch.
  //
  // options:
  // release:patch
  // release:minor
  // release:major
  grunt.registerTask('release', function (type) {
    type = type ? type : 'patch';
    grunt.task.run('bump:' + type);
  });

};
<commit_msg>Commit all files with grunt release<commit_after>'use strict';

// livereload
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
  return connect.static(path.resolve(point));
};

module.exports = function(grunt) {

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

  grunt.initConfig({
    livereload: {
      port: 35729 // Default livereload listening port.
    },
    watch: {
      livereload: {
        files: [
          '*.html',
          '.tmp/{,*/}*.js',
          'test/js/{,*/}*.js',
          'test/css/{,*/}*.css'
        ],
        tasks: ['livereload']
      },
      src: {
        files: [
          'src/{,*/}*.js',
          'spec/**/*.spec.js'
        ],
        tasks: ['concat:editable']
      }
    },
    connect: {
      livereload: {
        options: {
          port: 9000,
          hostname: '0.0.0.0',
          // Change this to '0.0.0.0' to access the server from outside.
          middleware: function(connect, options) {
            return [lrSnippet, folderMount(connect, options.base)];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          hostname: '0.0.0.0',
          middleware: function(connect, options) {
            return [
              folderMount(connect, options.base)
            ];
          }
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= connect.livereload.options.port %>'
      }
    },
    clean: {
      server: '.tmp'
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'src/{,*/}*.js'
      ]
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        browsers: ['PhantomJS']
      },
      browsers: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari', 'Opera']
      },
      build: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari', 'Opera'],
        singleRun: true
      }
    },
    concat: {
      dist: {
        files: {
          'editable.js': [
            'vendor/rangy-1.2.3/rangy-core.js',
            'vendor/rangy-1.2.3/rangy-selectionsaverestore.js',
            'vendor/bowser.js',
            '.tmp/editable.js'
          ]
        }
      },
      editable: {
        files: {
          '.tmp/editable.js': [
            'editable.prefix',
            'src/util/*.js',
            'src/core.js',
            'src/!(core).js',
            'editable.suffix'
          ],
          '.tmp/editable-test.js': [
            'editable.prefix',
            'src/util/*.js',
            'src/core.js',
            'src/!(core).js',
            'spec/**/*.js',
            'editable.suffix'
          ]
        }
      }
    },
    uglify: {
      dist: {
        files: {
          'editable.min.js': [
            'editable.js'
          ],
        }
      }
    },
    copy: {
      lukas: {
        files: [{
          expand: true,
          src: ['editable.js'],
          dest: '../livingdocs-engine/vendor/editableJS/'
        }]

      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        commitFiles: ['-a'], // '-a' for all files
        pushTo: 'origin'
      }
    }

  });

  // livereload does not work with grunt-contrib-watch, so we use regarde instead
  // https://github.com/gruntjs/grunt-contrib-watch/issues/59
  grunt.renameTask('regarde', 'watch');

  grunt.registerTask('server', [
    'clean:server',
    'concat:editable',
    'livereload-start',
    'connect:livereload',
    'open',
    'watch:livereload'
  ]);

  grunt.registerTask('test', [
    'clean:server',
    'concat:editable',
    'karma:unit'
  ]);

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

  grunt.registerTask('dev', [
    'concat:editable',
    'watch:src'
  ]);

  grunt.registerTask('build', [
    'jshint',
    'clean:server',
    'concat:editable',
    'karma:build',
    'concat:dist',
    'uglify'
  ]);

  grunt.registerTask('build-lukas', [
    'build',
    'copy:lukas'
  ]);

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

  // Release a new version
  // Only do this on the `master` branch.
  //
  // options:
  // release:patch
  // release:minor
  // release:major
  grunt.registerTask('release', function (type) {
    type = type ? type : 'patch';
    grunt.task.run('bump:' + type);
  });

};
<|endoftext|>