<commit_before>module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        env : {
            sauceLabs : (grunt.file.exists('.sauce-labs.creds') ?
                    grunt.file.readJSON('.sauce-labs.creds') : {})
        },
        karma : {
            options: {
                browserNoActivityTimeout: 60000,
                browserDisconnectTimeout: 10000,
                browserDisconnectTolerance: 2,
                frameworks: ['qunit'],
                files: [
                    'min/moment-with-locales.js',
                    'min/tests.js'
                ],
                sauceLabs: {
                    startConnect: true,
                    testName: 'MomentJS'
                },
                customLaunchers: {
                    slChromeWinXp: {
                        base: 'SauceLabs',
                        browserName: 'chrome',
                        platform: 'Windows XP'
                    },
                    slIe10Win7: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 7',
                        version: '10'
                    },
                    slIe9Win7: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 7',
                        version: '9'
                    },
                    slIe8Win7: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 7',
                        version: '8'
                    },
                    slIe11Win10: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 10',
                        version: '11'
                    },
                    slME25Win10: {
                        base: 'SauceLabs',
                        browserName: 'MicrosoftEdge',
                        platform: 'Windows 10',
                        version: '20.10240'
                    },
                    slFfLinux: {
                        base: 'SauceLabs',
                        browserName: 'firefox',
                        platform: 'Linux'
                    },
                    slSafariOsx: {
                        base: 'SauceLabs',
                        browserName: 'safari',
                        platform: 'OS X 10.8'
                    },
                    slSafariOsx11: {
                        base: 'SauceLabs',
                        browserName: 'safari',
                        platform: 'OS X 10.11'
                    }
                }
            },
            server: {
                browsers: []
            },
            chrome: {
                singleRun: true,
                browsers: ['Chrome']
            },
            firefox: {
                singleRun: true,
                browsers: ['Firefox']
            },
            sauce: {
                options: {
                    reporters: ['dots']
                },
                singleRun: true,
                browsers: [
                    'slChromeWinXp',
                    'slIe10Win7',
                    'slIe9Win7',
                    'slIe8Win7',
                    'slIe11Win10',
                    'slME25Win10',
                    'slFfLinux',
                    'slSafariOsx'
                ]
            }
        },
        uglify : {
            main: {
                files: {
                    'min/moment-with-locales.min.js'     : 'min/moment-with-locales.js',
                    'min/locales.min.js'                 : 'min/locales.js',
                    'min/moment.min.js'                  : 'moment.js'
                }
            },
            options: {
                mangle: true,
                compress: {
                    dead_code: false // jshint ignore:line
                },
                output: {
                    ascii_only: true // jshint ignore:line
                },
                report: 'min',
                preserveComments: /^!|@preserve|@license|@cc_on/i
            }
        },
        jshint: {
            all: [
                'Gruntfile.js',
                'tasks/**.js',
                'src/**/*.js'
            ],
            options: {
                jshintrc: true
            }
        },
        jscs: {
            all: [
                'Gruntfile.js',
                'tasks/**.js',
                'src/**/*.js'
            ],
            options: {
                config: '.jscs.json'
            }
        },
        watch : {
            test : {
                files : [
                    'src/**/*.js'
                ],
                tasks: ['test']
            },
            jshint : {
                files : '<%= jshint.all %>',
                tasks: ['jshint']
            }
        },
        benchmark: {
            all: {
                src: ['benchmarks/*.js']
            }
        },
        exec: {
            'meteor-init': {
                // Make sure Meteor is installed, per https://meteor.com/install.
                // The curl'ed script is safe; takes 2 minutes to read source & check.
                command: 'type meteor >/dev/null 2>&1 || { curl https://install.meteor.com/ | sh; }'
            },
            'meteor-test': {
                command: 'spacejam --mongo-url mongodb:// test-packages ./meteor'
            },
            'meteor-publish': {
                command: 'cd meteor && meteor publish'
            },
            'typescript-test': {
                command: 'npm run typescript-test'
            },
            'coveralls': {
                command: 'npm run coveralls'
            }
        }

    });

    grunt.loadTasks('tasks');

    // These plugins provide necessary tasks.
    require('load-grunt-tasks')(grunt);

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

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

    // test tasks
    grunt.registerTask('test', ['test:node', 'test:typescript']);
    grunt.registerTask('test:node', ['transpile', 'qtest']);
    grunt.registerTask('test:typescript', ['exec:typescript-test']);
    // TODO: For some weird reason karma doesn't like the files in
    // build/umd/min/* but works with min/*, so update-index, then git checkout
    grunt.registerTask('test:server', ['transpile', 'update-index', 'karma:server']);
    grunt.registerTask('test:browser', ['transpile', 'update-index', 'karma:chrome', 'karma:firefox']);
    grunt.registerTask('test:sauce-browser', ['transpile', 'update-index', 'env:sauceLabs', 'karma:sauce']);
    grunt.registerTask('test:meteor', ['exec:meteor-init', 'exec:meteor-test', 'exec:meteor-cleanup']);

    // travis build task
    grunt.registerTask('build:travis', ['default', 'exec:coveralls']);
    grunt.registerTask('meteor-publish', ['exec:meteor-init', 'exec:meteor-publish', 'exec:meteor-cleanup']);

    // Task to be run when releasing a new version
    grunt.registerTask('release', [
        'default',
        'update-index',
        'component',
        'uglify:main'
    ]);
};
<commit_msg>Revert "Merge pull request #3848 from marwahaha:add-coveralls"<commit_after>module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        env : {
            sauceLabs : (grunt.file.exists('.sauce-labs.creds') ?
                    grunt.file.readJSON('.sauce-labs.creds') : {})
        },
        karma : {
            options: {
                browserNoActivityTimeout: 60000,
                browserDisconnectTimeout: 10000,
                browserDisconnectTolerance: 2,
                frameworks: ['qunit'],
                files: [
                    'min/moment-with-locales.js',
                    'min/tests.js'
                ],
                sauceLabs: {
                    startConnect: true,
                    testName: 'MomentJS'
                },
                customLaunchers: {
                    slChromeWinXp: {
                        base: 'SauceLabs',
                        browserName: 'chrome',
                        platform: 'Windows XP'
                    },
                    slIe10Win7: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 7',
                        version: '10'
                    },
                    slIe9Win7: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 7',
                        version: '9'
                    },
                    slIe8Win7: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 7',
                        version: '8'
                    },
                    slIe11Win10: {
                        base: 'SauceLabs',
                        browserName: 'internet explorer',
                        platform: 'Windows 10',
                        version: '11'
                    },
                    slME25Win10: {
                        base: 'SauceLabs',
                        browserName: 'MicrosoftEdge',
                        platform: 'Windows 10',
                        version: '20.10240'
                    },
                    slFfLinux: {
                        base: 'SauceLabs',
                        browserName: 'firefox',
                        platform: 'Linux'
                    },
                    slSafariOsx: {
                        base: 'SauceLabs',
                        browserName: 'safari',
                        platform: 'OS X 10.8'
                    },
                    slSafariOsx11: {
                        base: 'SauceLabs',
                        browserName: 'safari',
                        platform: 'OS X 10.11'
                    }
                }
            },
            server: {
                browsers: []
            },
            chrome: {
                singleRun: true,
                browsers: ['Chrome']
            },
            firefox: {
                singleRun: true,
                browsers: ['Firefox']
            },
            sauce: {
                options: {
                    reporters: ['dots']
                },
                singleRun: true,
                browsers: [
                    'slChromeWinXp',
                    'slIe10Win7',
                    'slIe9Win7',
                    'slIe8Win7',
                    'slIe11Win10',
                    'slME25Win10',
                    'slFfLinux',
                    'slSafariOsx'
                ]
            }
        },
        uglify : {
            main: {
                files: {
                    'min/moment-with-locales.min.js'     : 'min/moment-with-locales.js',
                    'min/locales.min.js'                 : 'min/locales.js',
                    'min/moment.min.js'                  : 'moment.js'
                }
            },
            options: {
                mangle: true,
                compress: {
                    dead_code: false // jshint ignore:line
                },
                output: {
                    ascii_only: true // jshint ignore:line
                },
                report: 'min',
                preserveComments: /^!|@preserve|@license|@cc_on/i
            }
        },
        jshint: {
            all: [
                'Gruntfile.js',
                'tasks/**.js',
                'src/**/*.js'
            ],
            options: {
                jshintrc: true
            }
        },
        jscs: {
            all: [
                'Gruntfile.js',
                'tasks/**.js',
                'src/**/*.js'
            ],
            options: {
                config: '.jscs.json'
            }
        },
        watch : {
            test : {
                files : [
                    'src/**/*.js'
                ],
                tasks: ['test']
            },
            jshint : {
                files : '<%= jshint.all %>',
                tasks: ['jshint']
            }
        },
        benchmark: {
            all: {
                src: ['benchmarks/*.js']
            }
        },
        exec: {
            'meteor-init': {
                // Make sure Meteor is installed, per https://meteor.com/install.
                // The curl'ed script is safe; takes 2 minutes to read source & check.
                command: 'type meteor >/dev/null 2>&1 || { curl https://install.meteor.com/ | sh; }'
            },
            'meteor-test': {
                command: 'spacejam --mongo-url mongodb:// test-packages ./meteor'
            },
            'meteor-publish': {
                command: 'cd meteor && meteor publish'
            },
            'typescript-test': {
                command: 'npm run typescript-test'
            }
        }

    });

    grunt.loadTasks('tasks');

    // These plugins provide necessary tasks.
    require('load-grunt-tasks')(grunt);

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

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

    // test tasks
    grunt.registerTask('test', ['test:node', 'test:typescript']);
    grunt.registerTask('test:node', ['transpile', 'qtest']);
    grunt.registerTask('test:typescript', ['exec:typescript-test']);
    // TODO: For some weird reason karma doesn't like the files in
    // build/umd/min/* but works with min/*, so update-index, then git checkout
    grunt.registerTask('test:server', ['transpile', 'update-index', 'karma:server']);
    grunt.registerTask('test:browser', ['transpile', 'update-index', 'karma:chrome', 'karma:firefox']);
    grunt.registerTask('test:sauce-browser', ['transpile', 'update-index', 'env:sauceLabs', 'karma:sauce']);
    grunt.registerTask('test:meteor', ['exec:meteor-init', 'exec:meteor-test', 'exec:meteor-cleanup']);

    // travis build task
    grunt.registerTask('build:travis', ['default']);
    grunt.registerTask('meteor-publish', ['exec:meteor-init', 'exec:meteor-publish', 'exec:meteor-cleanup']);

    // Task to be run when releasing a new version
    grunt.registerTask('release', [
        'default',
        'update-index',
        'component',
        'uglify:main'
    ]);
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

    // Use jit-grunt to only load necessary tasks for each invocation of grunt.
    require('jit-grunt')(grunt, {
        // useminPrepare is a task of usemin.
        'useminPrepare': 'grunt-usemin',
    });

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

    grunt.initConfig({
        config: {
            app: 'app',
            dist: 'dist',
            lib: 'app/lib',
            htmlmin: {
                collapseBooleanAttributes: true,
                collapseWhitespace: true,
                removeAttributeQuotes: true,
                removeComments: true,
                removeEmptyAttributes: true,
                removeScriptTypeAttributes: true,
                removeStyleLinkTypeAttributes: true,
                useShortDoctype: true
            }
        },
        concurrent: {
            options: {
                logConcurrentOutput: true
            },
            dev: [
                'compass:watch'
            ]
        },
        connect: {
            options: {
                port: process.env.PORT || 9000
            },
            dev: {
                options: {
                    base: '<%= config.app %>'
                }
            },
            dist: {
                options: {
                    base: '<%= config.dist %>'
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= connect.options.port %>'
            }
        },
        compass: {
            options: {
                sassDir: '<%= config.app %>/sass',
                cssDir: '<%= config.app %>/styles',
                imagesDir: '<%= config.app %>/images',
                generatedImagesDir: '<%= config.app %>/images/generated',
                fontsDir: '<%= config.app %>/fonts',
                relativeAssets: true,
                importPath: '<%= config.lib %>/sass-font-face',
                debugInfo: false
            },
            dev: {
                options: {}
            },
            force: {
                options: {
                    force: true
                }
            },
            watch: {
                options: {
                    watch: true
                }
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '<%= config.dist %>/*',
                        '!<%= config.dist %>/.git*'
                    ]
                }]
            },
            dev: [
                '<%= config.app %>/styles',
                '<%= config.app %>/images/generated'
            ]
        },
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= config.dist %>/styles/**/*.css',
                        '<%= config.dist %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                        '!<%= config.dist %>/images/inline/**/*'
                    ]
                }
            }
        },
        useminPrepare: {
            html: '<%= config.app %>/index.html',
            options: {
                dest: '<%= config.dist %>'
            }
        },
        usemin: {
            html: ['<%= config.dist %>/{,*/}*.html'],
            css: ['<%= config.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= config.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    src: '<%= config.dist %>/images/**/*.{png,jpg,jpeg}'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    src: '<%= config.dist %>/images/**/*.svg'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: '<%= config.htmlmin %>',
                files: [{
                    expand: true,
                    src: '<%= config.dist %>/index.html'
                }]
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        dot: true,
                        cwd: '<%= config.app %>',
                        dest: '<%= config.dist %>',
                        src: [
                            'index.html',
                            '*.{ico,png,txt}',
                            'images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                            '!images/*/sprite-files/*',
                            'fonts/**/*',
                            '!fonts/**/originals/*',
                            '!fonts/**/*.json'
                        ]
                    }
                ]
            }
        },
        uglify: {
            options: {
                compress: {
                    drop_console: true
                }
            }
        },
        inline: {
            dist: {
                options:{
                    tag: ''
                },
                src: ['dist/index.html']
            }
        }
    });

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

    grunt.registerTask('dev', function (locale) {
        grunt.task.run([
            'clean:dev',
            'compass:dev',
            'connect:dev',
            'open',
            'concurrent:dev'
        ]);
    });

    grunt.registerTask('build', function (locale) {
        grunt.task.run([
            'clean',
            'compass:dev',
            'useminPrepare',
            'copy:dist',
            'concat:generated',
            'imagemin',
            'svgmin',
            'cssmin',
            'uglify',
            'rev',
            'usemin',
            'inline',
            'htmlmin'
        ]);
    });
};

<commit_msg>Add dist task for testing.<commit_after>'use strict';

module.exports = function (grunt) {

    // Use jit-grunt to only load necessary tasks for each invocation of grunt.
    require('jit-grunt')(grunt, {
        // useminPrepare is a task of usemin.
        'useminPrepare': 'grunt-usemin',
    });

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

    grunt.initConfig({
        config: {
            app: 'app',
            dist: 'dist',
            lib: 'app/lib',
            htmlmin: {
                collapseBooleanAttributes: true,
                collapseWhitespace: true,
                removeAttributeQuotes: true,
                removeComments: true,
                removeEmptyAttributes: true,
                removeScriptTypeAttributes: true,
                removeStyleLinkTypeAttributes: true,
                useShortDoctype: true
            }
        },
        concurrent: {
            options: {
                logConcurrentOutput: true
            },
            dev: [
                'compass:watch'
            ]
        },
        connect: {
            options: {
                port: process.env.PORT || 9000
            },
            dev: {
                options: {
                    base: '<%= config.app %>'
                }
            },
            dist: {
                options: {
                    base: '<%= config.dist %>'
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= connect.options.port %>'
            }
        },
        compass: {
            options: {
                sassDir: '<%= config.app %>/sass',
                cssDir: '<%= config.app %>/styles',
                imagesDir: '<%= config.app %>/images',
                generatedImagesDir: '<%= config.app %>/images/generated',
                fontsDir: '<%= config.app %>/fonts',
                relativeAssets: true,
                importPath: '<%= config.lib %>/sass-font-face',
                debugInfo: false
            },
            dev: {
                options: {}
            },
            force: {
                options: {
                    force: true
                }
            },
            watch: {
                options: {
                    watch: true
                }
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '<%= config.dist %>/*',
                        '!<%= config.dist %>/.git*'
                    ]
                }]
            },
            dev: [
                '<%= config.app %>/styles',
                '<%= config.app %>/images/generated'
            ]
        },
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= config.dist %>/styles/**/*.css',
                        '<%= config.dist %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                        '!<%= config.dist %>/images/inline/**/*'
                    ]
                }
            }
        },
        useminPrepare: {
            html: '<%= config.app %>/index.html',
            options: {
                dest: '<%= config.dist %>'
            }
        },
        usemin: {
            html: ['<%= config.dist %>/{,*/}*.html'],
            css: ['<%= config.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= config.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    src: '<%= config.dist %>/images/**/*.{png,jpg,jpeg}'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    src: '<%= config.dist %>/images/**/*.svg'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: '<%= config.htmlmin %>',
                files: [{
                    expand: true,
                    src: '<%= config.dist %>/index.html'
                }]
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        dot: true,
                        cwd: '<%= config.app %>',
                        dest: '<%= config.dist %>',
                        src: [
                            'index.html',
                            '*.{ico,png,txt}',
                            'images/**/*.{png,jpg,jpeg,gif,webp,svg}',
                            '!images/*/sprite-files/*',
                            'fonts/**/*',
                            '!fonts/**/originals/*',
                            '!fonts/**/*.json'
                        ]
                    }
                ]
            }
        },
        uglify: {
            options: {
                compress: {
                    drop_console: true
                }
            }
        },
        inline: {
            dist: {
                options:{
                    tag: ''
                },
                src: ['dist/index.html']
            }
        }
    });

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

    grunt.registerTask('dev', function (locale) {
        grunt.task.run([
            'clean:dev',
            'compass:dev',
            'connect:dev',
            'open',
            'concurrent:dev'
        ]);
    });

    grunt.registerTask('build', function (locale) {
        grunt.task.run([
            'clean',
            'compass:dev',
            'useminPrepare',
            'copy:dist',
            'concat:generated',
            'imagemin',
            'svgmin',
            'cssmin',
            'uglify',
            'rev',
            'usemin',
            'inline',
            'htmlmin'
        ]);
    });

    grunt.registerTask('dist', function (locale) {
        grunt.task.run([
            'build',
            'connect:dist',
            'concurrent:dev'
        ]);
    });

};

<|endoftext|>


<commit_before>/*jshint node:true*/
'use strict';

var path = require('path');
require('js-yaml');

var CLEAN_DIRS = [
  'components',
  'build'
];

var BROWSERS = require('./node_modules/browsers-yaml/browsers');

var ASSET_HOST = process.env.ASSET_HOST;

module.exports = function(grunt) {
  var COMPONENT_BIN_PATH = path.join(__dirname,
                                     'node_modules/component/bin/component');

  var UGLIFY_BIN_PATH = path.join(__dirname,
                                  'node_modules/uglify-js/bin/uglifyjs');

  function getSemver() {
    return require('./component').version;
  }

  function getName() {
    return require('./component').name;
  }

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

  grunt.initConfig({
    clean: CLEAN_DIRS,
    connect: {
      server: {
        options: {
          base: "",
          port: 9999
        }
      }
    },
    'saucelabs-mocha': {
      all: {
        options: {
          urls: ["http://localhost:9999/test/index.html"],
            tunnelTimeout: 5,
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 8,
          browsers: BROWSERS,
          testname: "mocha tests",
          tags: ["master"]
        }
      }
    },
  });

  grunt.registerTask('test', ['connect', 'saucelabs-mocha']);

  // Jshint default task
  grunt.registerTask('build', [
    'clean',
    'component:install',
    'component:build:dev'
  ]);

  grunt.registerTask('build:prod', [
    'clean',
    'component:install',
    'component:build:prod',
    'minify'
  ]);

  grunt.registerTask('component:install', function() {
    var done = this.async();

    var install = {
      cmd: COMPONENT_BIN_PATH,
      args: [ 'install', '-d' ]
    };

    // Build the component.

    grunt.log.writeln('component install - start');
    grunt.util.spawn(install, function(err) {
      if (err) {
        return done(err);
      }

      grunt.log.writeln('component install - done');

      done();
    });
  });

  grunt.registerTask('component:build:dev', function() {
    var done = this.async();

    var args = ['build', '-c', '-d'];

    var build = {
      cmd: COMPONENT_BIN_PATH,
      args: args
    };

    // Build the component.
    grunt.util.spawn(build, function(err) {
      if (err) {
        return done(err);
      }

      done();
    });
  });

  grunt.registerTask('component:build:prod', function() {
    var done = this.async();

    // To prevent having to write a custom build.js file, we take advantage
    // of their lack of escaping in order to build up the widgets namespace.

    // Yeah, this is hacky.
    // In the following code string's context, `this` is the window object.
    var exportName = '"];' +
      'this.goinstant = this.goinstant || {};' +
      'this.goinstant.widgets = this.goinstant.widgets || {};' +
      'this.goinstant.widgets["Colors Common';

    var args = [
      'build', '-c',
      '-n', getName(),
      '-s', exportName
    ];

    var build = {
      cmd: COMPONENT_BIN_PATH,
      args: args
    };

    // Build the component.
    grunt.util.spawn(build, function(err) {
      if (err) {
        return done(err);
      }

      done();
    });
  });

 };
<commit_msg>remove build:prod<commit_after>/*jshint node:true*/
'use strict';

var path = require('path');
require('js-yaml');

var CLEAN_DIRS = [
  'components',
  'build'
];

var BROWSERS = require('./node_modules/browsers-yaml/browsers');

module.exports = function(grunt) {
  var COMPONENT_BIN_PATH = path.join(__dirname,
                                     'node_modules/component/bin/component');

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

  grunt.initConfig({
    clean: CLEAN_DIRS,
    connect: {
      server: {
        options: {
          base: "",
          port: 9999
        }
      }
    },
    'saucelabs-mocha': {
      all: {
        options: {
          urls: ["http://localhost:9999/test/index.html"],
            tunnelTimeout: 5,
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 8,
          browsers: BROWSERS,
          testname: "mocha tests",
          tags: ["master"]
        }
      }
    },
  });

  grunt.registerTask('test', ['build', 'connect', 'saucelabs-mocha']);

  // Jshint default task
  grunt.registerTask('build', [
    'clean',
    'component:install',
    'component:build:dev'
  ]);

  grunt.registerTask('component:install', function() {
    var done = this.async();

    var install = {
      cmd: COMPONENT_BIN_PATH,
      args: [ 'install', '-d' ]
    };

    // Build the component.

    grunt.log.writeln('component install - start');
    grunt.util.spawn(install, function(err) {
      if (err) {
        return done(err);
      }

      grunt.log.writeln('component install - done');

      done();
    });
  });

  grunt.registerTask('component:build:dev', function() {
    var done = this.async();

    var args = ['build', '-c', '-d'];

    var build = {
      cmd: COMPONENT_BIN_PATH,
      args: args
    };

    // Build the component.
    grunt.util.spawn(build, function(err) {
      if (err) {
        return done(err);
      }

      done();
    });
  });

};
<|endoftext|>


<commit_before>/*
Auth0 Wrapper for pong-security2 module

The MIT License (MIT)

Copyright (c) 2019 Markus Harms, ma@mh-svr.de

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

function mSec_Login( params ) {
  // https://auth0.com/docs/libraries/auth0js/v9
  var webAuth = new auth0.WebAuth({
    domain   : params.authDomain,
    clientID : params.clientId
  });
  var authParam = {
    responseType : 'token id_token',
    clientID     : params.clientId,
    redirectUri  : params.loginRedirect,
    state        : 234564678909890,   // TODO
    // scope        : 'read:all'
  }
  if ( params.audience ) {
    authParam.audience = params.audience
  }
  webAuth.authorize( authParam );
}

function mSec_isAuthenticated( params, token, callback ) {
  if ( ! token ) { return callback( null ); }
  // init the Auth0 lib
  var webAuth = new auth0.WebAuth({
    domain   : params.authDomain,
    clientID : params.clientId
  });
  // get user profile
  webAuth.client.userInfo( token.idToken, function( err, user ) {
    if ( err ) {
      console.log( err )
      callback( null, err );
    } else {
      callback( user, null )
    }
  });
}

function mSec_getIdTokenfromURL() {
  var idx = window.location.href.indexOf( 'id_token' )
  if (  idx > 0 ) {
    var tokenStr = window.location.href.substring( idx + 9 )
    if ( tokenStr.indexOf('&') > 0 ) {
      tokenStr = tokenStr.substring( 0, tokenStr.indexOf('&') )
    }
    return tokenStr
  } else {
    return false
  }
}

function mSec_getAccessTokenFrmURL() {
  var idx = window.location.href.indexOf( 'access_token' )
  if (  idx > 0 ) {
    var tokenStr = window.location.href.substring( idx + 13 )
    if ( tokenStr.indexOf('&') > 0 ) {
      tokenStr = tokenStr.substring( 0, tokenStr.indexOf('&') )
    }
    return tokenStr
  } else {
    return false
  }
}

function mSec_getUserId( userInfo ) {
  //console.log( userInfo );
  if ( userInfo && userInfo.name ) {
    return userInfo.name;
  } else {
    return '?';
  }
}

function mSec_Logout( params ) {
  // https://auth0.com/docs/api/authentication#logout
  var loginURL = 'https://'+params.authDomain+'/v2/logout'
    + '?client_id=' + params.clientId
    + '&returnTo=' + params.logoutRedirect
  window.location.href = loginURL
}

function mSec_ChangePassword( params, userEmail ) {
  var webAuth = new auth0.WebAuth({
    domain   : params.authDomain,
    clientID : params.clientId
  });
  webAuth.changePassword({
    email      : userEmail,
    connection : 'Auth0'
  })
  alert( 'Auth0 will send you a link to change your password.\nPlease check your Emails!' )
}
<commit_msg>fix open id example<commit_after>/*
Auth0 Wrapper for pong-security2 module

The MIT License (MIT)

Copyright (c) 2019 Markus Harms, ma@mh-svr.de

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

function mSec_Login( params ) {
  // https://auth0.com/docs/libraries/auth0js/v9
  var webAuth = new auth0.WebAuth({
    domain   : params.authDomain,
    clientID : params.clientId
  });
  var authParam = {
    responseType : 'token id_token',
    clientID     : params.clientId,
    redirectUri  : params.loginRedirect,
    state        : 234564678909890,   // TODO
    // scope        : 'read:all'
  }
  if ( params.audience ) {
    authParam.audience = params.audience
  }
  webAuth.authorize( authParam );
}

function mSec_isAuthenticated( params, token, callback ) {
  console.log( token )
  if ( ! token || ! token.idToken ) { return callback( null ); }
  // init the Auth0 lib
  var webAuth = new auth0.WebAuth({
    domain   : params.authDomain,
    clientID : params.clientId
  });
  // get user profile
  webAuth.client.userInfo( token.accessToken, function( err, user ) {
    console.log(' webAuth.client.userInfo',err, user)
    if ( err ) {
      console.log( err )
      callback( null, err );
    } else {
      callback( user, null )
    }
  });
}

function mSec_getIdTokenfromURL() {
  var idx = window.location.href.indexOf( 'id_token' )
  if (  idx > 0 ) {
    var tokenStr = window.location.href.substring( idx + 9 )
    if ( tokenStr.indexOf('&') > 0 ) {
      tokenStr = tokenStr.substring( 0, tokenStr.indexOf('&') )
    }
    return tokenStr
  } else {
    return false
  }
}

function mSec_getAccessTokenFrmURL() {
  var idx = window.location.href.indexOf( 'access_token' )
  if (  idx > 0 ) {
    var tokenStr = window.location.href.substring( idx + 13 )
    if ( tokenStr.indexOf('&') > 0 ) {
      tokenStr = tokenStr.substring( 0, tokenStr.indexOf('&') )
    }
    return tokenStr
  } else {
    return false
  }
}

function mSec_getUserId( userInfo ) {
  //console.log( userInfo );
  if ( userInfo && userInfo.name ) {
    return userInfo.name;
  } else {
    return '?';
  }
}

function mSec_Logout( params ) {
  // https://auth0.com/docs/api/authentication#logout
  var loginURL = 'https://'+params.authDomain+'/v2/logout'
    + '?client_id=' + params.clientId
    + '&returnTo=' + params.logoutRedirect
  window.location.href = loginURL
}

function mSec_ChangePassword( params, userEmail ) {
  var webAuth = new auth0.WebAuth({
    domain   : params.authDomain,
    clientID : params.clientId
  });
  webAuth.changePassword({
    email      : userEmail,
    connection : 'Auth0'
  })
  alert( 'Auth0 will send you a link to change your password.\nPlease check your Emails!' )
}
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.initConfig({
        paths: {
            src: {
                app: {
                    ussd_clinic: 'src/ussd_clinic.js',
                    ussd_chw: 'src/ussd_chw.js',
                    ussd_public: 'src/ussd_public.js',
                    ussd_optout: 'src/ussd_optout.js',
                    sms_inbound: 'src/sms_inbound.js',
                    ussd_servicerating: 'src/ussd_servicerating.js',
                    ussd_nurse: 'src/ussd_nurse.js',
                    sms_nurse: 'src/sms_nurse.js',
                    ussd_pmtct: 'src/ussd_pmtct.js'
                },
                ussd_clinic: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_clinic %>',
                    'src/init.js'
                ],
                ussd_chw: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_chw %>',
                    'src/init.js'
                ],
                ussd_public: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_public %>',
                    'src/init.js'
                ],
                ussd_optout: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_optout %>',
                    'src/init.js'
                ],
                sms_inbound: [
                    'src/index.js',
                    '<%= paths.src.app.sms_inbound %>',
                    'src/init.js'
                ],
                ussd_servicerating: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_servicerating %>',
                    'src/init.js'
                ],
                ussd_nurse: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_nurse %>',
                    'src/init.js'
                ],
                sms_nurse: [
                    'src/index.js',
                    '<%= paths.src.app.sms_nurse %>',
                    'src/init.js'
                ],
                ussd_pmtct: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_pmtct %>',
                    'src/init.js'
                ],
                all: [
                    'src/**/*.js'
                ]
            },
            dest: {
                ussd_clinic: 'go-app-ussd_clinic.js',
                ussd_chw: 'go-app-ussd_chw.js',
                ussd_public: 'go-app-ussd_public.js',
                ussd_optout: 'go-app-ussd_optout.js',
                sms_inbound: 'go-app-sms_inbound.js',
                ussd_servicerating: 'go-app-ussd_servicerating.js',
                ussd_nurse: 'go-app-ussd_nurse.js',
                sms_nurse: 'go-app-sms_nurse.js',
                ussd_pmtct: 'go-app-ussd_pmtct.js',
                ussd_pmtct_optout: 'go-app-ussd_pmtct_optout.js'
            },
            test: {
                ussd_clinic: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_clinic %>',
                    'test/ussd_clinic.test.js'
                ],
                ussd_chw: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_chw %>',
                    'test/ussd_chw.test.js'
                ],
                ussd_public: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_public %>',
                    'test/ussd_public.test.js'
                ],
                ussd_optout: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_optout %>',
                    'test/ussd_optout.test.js'
                ],
                sms_inbound: [
                    'test/setup.js',
                    '<%= paths.src.app.sms_inbound %>',
                    'test/sms_inbound.test.js'
                ],
                ussd_servicerating: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_servicerating %>',
                    'test/ussd_servicerating.test.js'
                ],
                ussd_nurse: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_nurse %>',
                    'test/ussd_nurse.test.js'
                ],
                sms_nurse: [
                    'test/setup.js',
                    '<%= paths.src.app.sms_nurse %>',
                    'test/sms_nurse.test.js'
                ],
                ussd_pmtct: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_pmtct %>',
                    'test/ussd_pmtct.test.js'
                ]
            }
        },

        jshint: {
            options: {jshintrc: '.jshintrc'},
            all: [
                'Gruntfile.js',
                '<%= paths.src.all %>'
            ]
        },

        watch: {
            src: {
                files: ['<%= paths.src.all %>'],
                tasks: ['build']
            }
        },

        concat: {
            ussd_clinic: {
                src: ['<%= paths.src.ussd_clinic %>'],
                dest: '<%= paths.dest.ussd_clinic %>'
            },
            ussd_chw: {
                src: ['<%= paths.src.ussd_chw %>'],
                dest: '<%= paths.dest.ussd_chw %>'
            },
            ussd_public: {
                src: ['<%= paths.src.ussd_public %>'],
                dest: '<%= paths.dest.ussd_public %>'
            },
            ussd_optout: {
                src: ['<%= paths.src.ussd_optout %>'],
                dest: '<%= paths.dest.ussd_optout %>'
            },
            sms_inbound: {
                src: ['<%= paths.src.sms_inbound %>'],
                dest: '<%= paths.dest.sms_inbound %>'
            },
            ussd_servicerating: {
                src: ['<%= paths.src.ussd_servicerating %>'],
                dest: '<%= paths.dest.ussd_servicerating %>'
            },
            ussd_nurse: {
                src: ['<%= paths.src.ussd_nurse %>'],
                dest: '<%= paths.dest.ussd_nurse %>'
            },
            sms_nurse: {
                src: ['<%= paths.src.sms_nurse %>'],
                dest: '<%= paths.dest.sms_nurse %>'
            },
            ussd_pmtct: {
                src: ['<%= paths.src.ussd_pmtct %>'],
                dest: '<%= paths.dest.ussd_pmtct %>'
            }
        },

        mochaTest: {
            options: {
                reporter: 'spec'
            },
            test_ussd_clinic: {
                src: ['<%= paths.test.ussd_clinic %>']
            },
            test_ussd_chw: {
                src: ['<%= paths.test.ussd_chw %>']
            },
            test_ussd_public: {
                src: ['<%= paths.test.ussd_public %>']
            },
            test_ussd_optout: {
                src: ['<%= paths.test.ussd_optout %>']
            },
            test_sms_inbound: {
                src: ['<%= paths.test.sms_inbound %>']
            },
            test_ussd_servicerating: {
                src: ['<%= paths.test.ussd_servicerating %>']
            },
            test_ussd_nurse: {
                src: ['<%= paths.test.ussd_nurse %>']
            },
            test_sms_nurse: {
                src: ['<%= paths.test.sms_nurse %>']
            },
            test_ussd_pmtct: {
                src: ['<%= paths.test.ussd_pmtct %>']
            }
        }
    });

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

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

    grunt.registerTask('default', [
        'build',
        'test'
    ]);
};
<commit_msg>comment out Gruntfile tests not being used<commit_after>module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.initConfig({
        paths: {
            src: {
                app: {
                    ussd_clinic: 'src/ussd_clinic.js',
                    ussd_chw: 'src/ussd_chw.js',
                    ussd_public: 'src/ussd_public.js',
                    ussd_optout: 'src/ussd_optout.js',
                    sms_inbound: 'src/sms_inbound.js',
                    ussd_servicerating: 'src/ussd_servicerating.js',
                    ussd_nurse: 'src/ussd_nurse.js',
                    sms_nurse: 'src/sms_nurse.js',
                    ussd_pmtct: 'src/ussd_pmtct.js'
                },
                ussd_clinic: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_clinic %>',
                    'src/init.js'
                ],
                ussd_chw: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_chw %>',
                    'src/init.js'
                ],
                ussd_public: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_public %>',
                    'src/init.js'
                ],
                ussd_optout: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_optout %>',
                    'src/init.js'
                ],
                sms_inbound: [
                    'src/index.js',
                    '<%= paths.src.app.sms_inbound %>',
                    'src/init.js'
                ],
                ussd_servicerating: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_servicerating %>',
                    'src/init.js'
                ],
                ussd_nurse: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_nurse %>',
                    'src/init.js'
                ],
                sms_nurse: [
                    'src/index.js',
                    '<%= paths.src.app.sms_nurse %>',
                    'src/init.js'
                ],
                ussd_pmtct: [
                    'src/index.js',
                    '<%= paths.src.app.ussd_pmtct %>',
                    'src/init.js'
                ],
                all: [
                    'src/**/*.js'
                ]
            },
            dest: {
                ussd_clinic: 'go-app-ussd_clinic.js',
                ussd_chw: 'go-app-ussd_chw.js',
                ussd_public: 'go-app-ussd_public.js',
                ussd_optout: 'go-app-ussd_optout.js',
                sms_inbound: 'go-app-sms_inbound.js',
                ussd_servicerating: 'go-app-ussd_servicerating.js',
                ussd_nurse: 'go-app-ussd_nurse.js',
                sms_nurse: 'go-app-sms_nurse.js',
                ussd_pmtct: 'go-app-ussd_pmtct.js',
                ussd_pmtct_optout: 'go-app-ussd_pmtct_optout.js'
            },
            test: {
                ussd_clinic: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_clinic %>',
                    'test/ussd_clinic.test.js'
                ],
                ussd_chw: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_chw %>',
                    'test/ussd_chw.test.js'
                ],
                ussd_public: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_public %>',
                    'test/ussd_public.test.js'
                ],
                ussd_optout: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_optout %>',
                    'test/ussd_optout.test.js'
                ],
                sms_inbound: [
                    'test/setup.js',
                    '<%= paths.src.app.sms_inbound %>',
                    'test/sms_inbound.test.js'
                ],
                ussd_servicerating: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_servicerating %>',
                    'test/ussd_servicerating.test.js'
                ],
                ussd_nurse: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_nurse %>',
                    'test/ussd_nurse.test.js'
                ],
                sms_nurse: [
                    'test/setup.js',
                    '<%= paths.src.app.sms_nurse %>',
                    'test/sms_nurse.test.js'
                ],
                ussd_pmtct: [
                    'test/setup.js',
                    '<%= paths.src.app.ussd_pmtct %>',
                    'test/ussd_pmtct.test.js'
                ]
            }
        },

        jshint: {
            options: {jshintrc: '.jshintrc'},
            all: [
                'Gruntfile.js',
                '<%= paths.src.all %>'
            ]
        },

        watch: {
            src: {
                files: ['<%= paths.src.all %>'],
                tasks: ['build']
            }
        },

        concat: {
            ussd_clinic: {
                src: ['<%= paths.src.ussd_clinic %>'],
                dest: '<%= paths.dest.ussd_clinic %>'
            },
            ussd_chw: {
                src: ['<%= paths.src.ussd_chw %>'],
                dest: '<%= paths.dest.ussd_chw %>'
            },
            ussd_public: {
                src: ['<%= paths.src.ussd_public %>'],
                dest: '<%= paths.dest.ussd_public %>'
            },
            ussd_optout: {
                src: ['<%= paths.src.ussd_optout %>'],
                dest: '<%= paths.dest.ussd_optout %>'
            },
            sms_inbound: {
                src: ['<%= paths.src.sms_inbound %>'],
                dest: '<%= paths.dest.sms_inbound %>'
            },
            ussd_servicerating: {
                src: ['<%= paths.src.ussd_servicerating %>'],
                dest: '<%= paths.dest.ussd_servicerating %>'
            },
            ussd_nurse: {
                src: ['<%= paths.src.ussd_nurse %>'],
                dest: '<%= paths.dest.ussd_nurse %>'
            },
            sms_nurse: {
                src: ['<%= paths.src.sms_nurse %>'],
                dest: '<%= paths.dest.sms_nurse %>'
            },
            ussd_pmtct: {
                src: ['<%= paths.src.ussd_pmtct %>'],
                dest: '<%= paths.dest.ussd_pmtct %>'
            }
        },

        mochaTest: {
            options: {
                reporter: 'spec'
            },
            /* test_ussd_clinic: {
                src: ['<%= paths.test.ussd_clinic %>']
            },
            test_ussd_chw: {
                src: ['<%= paths.test.ussd_chw %>']
            },
            test_ussd_public: {
                src: ['<%= paths.test.ussd_public %>']
            },
            test_ussd_optout: {
                src: ['<%= paths.test.ussd_optout %>']
            },
            test_sms_inbound: {
                src: ['<%= paths.test.sms_inbound %>']
            },
            test_ussd_servicerating: {
                src: ['<%= paths.test.ussd_servicerating %>']
            },
            test_ussd_nurse: {
                src: ['<%= paths.test.ussd_nurse %>']
            },
            test_sms_nurse: {
                src: ['<%= paths.test.sms_nurse %>']
            }, */
            test_ussd_pmtct: {
                src: ['<%= paths.test.ussd_pmtct %>']
            }
        }
    });

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

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

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


<commit_before>'use strict';

var Mock = require('./bower_components/mockjs/dist/mock.js')
console.log(Mock.heredoc(function() {
    /*
______   _   _____   _                                    _
| ___ \ (_) /  ___| | |                                  (_)
| |_/ /  _  \ `--.  | |__     ___   _ __     __ _         _   ___
| ___ \ | |  `--. \ | '_ \   / _ \ | '_ \   / _` |       | | / __|
| |_/ / | | /\__/ / | | | | |  __/ | | | | | (_| |  _    | | \__ \
\____/  |_| \____/  |_| |_|  \___| |_| |_|  \__, | (_)   | | |___/
                                             __/ |      _/ |
                                            |___/      |__/
     */
}))

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            files: ['Gruntfile.js', 'package.json', 'src/*.js', 'test/*.js'],
            options: {
                jshintrc: '.jshintrc'
            }
        },
        concat: {
            dist: {
                options: {
                    separator: '\n',
                    process: function(src, filepath) {
                        var banner = '/*! ' + filepath + ' */\n';
                        var BEGEIN = '// BEGIN(BROWSER)\n',
                            END = '// END(BROWSER)';
                        var indexOfBEGEIN = src.indexOf(BEGEIN),
                            indexOfEND = src.indexOf(END);
                        if (indexOfBEGEIN != -1 && indexOfEND != -1) {
                            return banner + src.slice(indexOfBEGEIN + BEGEIN.length, indexOfEND)
                        }
                        return banner + src
                    }
                },
                src: [
                    'src/fix/prefix-1.js',
                    'src/expose.js',
                    'src/fix/prefix-2.js',

                    'src/loop.js',
                    'src/locator.js',
                    'src/ast.js',
                    'src/scan.js',
                    'src/flush.js',
                    'src/html.js',
                    'src/bisheng.js',

                    'src/fix/suffix.js'
                ],
                dest: 'dist/bisheng.js'
            }
        },
        nodeunit: {
            options: {
                verbose: true
            },
            all: ['test/nodeuinit/watch.js']
        },
        qunit: {
            files: ['test/*.html', '!test/table.html', '!test/crox.html']
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd hh:MM:ss TT Z") %> */\n'
            },
            dev: {
                options: {
                    beautify: true,
                    compress: false,
                    mangle: false,
                    preserveComments: 'all' // false all some
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**/*.js', '!**/*-min.js'],
                    dest: 'dist/',
                    ext: '.js'
                }]
            },
            release: {
                options: {
                    sourceMap: 'dist/bisheng-min.map'
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**/*.js', '!**/*-min.js'],
                    dest: 'dist/',
                    ext: '-min.js'
                }]
            }
        },
        connect: { // grunt connect:server:keepalive
            server: {
                options: {
                    // keepalive: true,
                    port: 5000,
                    base: '.',
                    hostname: '0.0.0.0'
                }
            }
        },
        watch: {
            dev: {
                files: ['<%= jshint.files %>', 'src/fix/*'], // , 'doc/*.md', 'doc/template.html'
                tasks: ['jshint', 'concat', 'uglify', 'qunit', 'markdown', 'cleaver'] // 'nodeunit'
            },
            markdown: {
                files: ['doc/*.md', 'doc/template.html', '!doc/what.md'],
                tasks: ['markdown']
            },
            cleaver: {
                files: ['doc/what.md'],
                tasks: ['cleaver']
            }
        },
        markdown: {
            options: {
                template: 'doc/template.html'
            },
            doc: {
                expand: true,
                cwd: 'doc/',
                src: ['*.md', '!what.md'],
                dest: 'doc/',
                ext: '.html'
            }
        },
        cleaver: {
            doc: {
                expand: true,
                cwd: 'doc/',
                src: ['what.md'],
                dest: 'doc/',
                ext: '.html'
            }
        }
    })

    grunt.loadNpmTasks('grunt-contrib-jshint')
    grunt.loadNpmTasks('grunt-contrib-nodeunit')
    grunt.loadNpmTasks('grunt-contrib-qunit')
    grunt.loadNpmTasks('grunt-contrib-watch')
    grunt.loadNpmTasks('grunt-contrib-connect')
    grunt.loadNpmTasks('grunt-contrib-concat')
    grunt.loadNpmTasks('grunt-contrib-uglify')
    grunt.loadNpmTasks('grunt-markdown')
    grunt.loadNpmTasks('grunt-cleaver')

    grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'qunit', 'markdown', 'cleaver', 'connect', 'watch']) // , 'nodeunit'
    grunt.registerTask('doc', ['markdown', 'cleaver', 'connect', 'watch'])
    grunt.registerTask('travis', ['jshint', 'qunit']) // grunt travis --verbose
};<commit_msg>为 doc/index.md 单独设置模板 doc/template_index.html<commit_after>'use strict';

var Mock = require('./bower_components/mockjs/dist/mock.js')
console.log(Mock.heredoc(function() {
    /*
______   _   _____   _                                    _
| ___ \ (_) /  ___| | |                                  (_)
| |_/ /  _  \ `--.  | |__     ___   _ __     __ _         _   ___
| ___ \ | |  `--. \ | '_ \   / _ \ | '_ \   / _` |       | | / __|
| |_/ / | | /\__/ / | | | | |  __/ | | | | | (_| |  _    | | \__ \
\____/  |_| \____/  |_| |_|  \___| |_| |_|  \__, | (_)   | | |___/
                                             __/ |      _/ |
                                            |___/      |__/
     */
}))

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            files: ['Gruntfile.js', 'package.json', 'src/*.js', 'test/*.js'],
            options: {
                jshintrc: '.jshintrc'
            }
        },
        concat: {
            dist: {
                options: {
                    separator: '\n',
                    process: function(src, filepath) {
                        var banner = '/*! ' + filepath + ' */\n';
                        var BEGEIN = '// BEGIN(BROWSER)\n',
                            END = '// END(BROWSER)';
                        var indexOfBEGEIN = src.indexOf(BEGEIN),
                            indexOfEND = src.indexOf(END);
                        if (indexOfBEGEIN != -1 && indexOfEND != -1) {
                            return banner + src.slice(indexOfBEGEIN + BEGEIN.length, indexOfEND)
                        }
                        return banner + src
                    }
                },
                src: [
                    'src/fix/prefix-1.js',
                    'src/expose.js',
                    'src/fix/prefix-2.js',

                    'src/loop.js',
                    'src/locator.js',
                    'src/ast.js',
                    'src/scan.js',
                    'src/flush.js',
                    'src/html.js',
                    'src/bisheng.js',

                    'src/fix/suffix.js'
                ],
                dest: 'dist/bisheng.js'
            }
        },
        nodeunit: {
            options: {
                verbose: true
            },
            all: ['test/nodeuinit/watch.js']
        },
        qunit: {
            files: ['test/*.html', '!test/table.html', '!test/crox.html']
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd hh:MM:ss TT Z") %> */\n'
            },
            dev: {
                options: {
                    beautify: true,
                    compress: false,
                    mangle: false,
                    preserveComments: 'all' // false all some
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**/*.js', '!**/*-min.js'],
                    dest: 'dist/',
                    ext: '.js'
                }]
            },
            release: {
                options: {
                    sourceMap: 'dist/bisheng-min.map'
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**/*.js', '!**/*-min.js'],
                    dest: 'dist/',
                    ext: '-min.js'
                }]
            }
        },
        connect: { // grunt connect:server:keepalive
            server: {
                options: {
                    // keepalive: true,
                    port: 5000,
                    base: '.',
                    hostname: '0.0.0.0'
                }
            }
        },
        watch: {
            dev: {
                files: ['<%= jshint.files %>', 'src/fix/*'], // , 'doc/*.md', 'doc/template.html'
                tasks: ['jshint', 'concat', 'uglify', 'qunit', 'markdown', 'cleaver'] // 'nodeunit'
            },
            markdown: {
                files: ['doc/*.md', 'doc/template.html', '!doc/what.md'],
                tasks: ['markdown']
            },
            cleaver: {
                files: ['doc/what.md'],
                tasks: ['cleaver']
            }
        },
        markdown: {
            index: {
                options: {
                    template: 'doc/template_index.html'
                },
                expand: true,
                cwd: 'doc/',
                src: ['index.md'],
                dest: 'doc/',
                ext: '.html'
            },
            doc: {
                options: {
                    template: 'doc/template.html'
                },
                expand: true,
                cwd: 'doc/',
                src: ['*.md', '!index.md', '!what.md'],
                dest: 'doc/',
                ext: '.html'
            }
        },
        cleaver: {
            doc: {
                expand: true,
                cwd: 'doc/',
                src: ['what.md'],
                dest: 'doc/',
                ext: '.html'
            }
        }
    })

    grunt.loadNpmTasks('grunt-contrib-jshint')
    grunt.loadNpmTasks('grunt-contrib-nodeunit')
    grunt.loadNpmTasks('grunt-contrib-qunit')
    grunt.loadNpmTasks('grunt-contrib-watch')
    grunt.loadNpmTasks('grunt-contrib-connect')
    grunt.loadNpmTasks('grunt-contrib-concat')
    grunt.loadNpmTasks('grunt-contrib-uglify')
    grunt.loadNpmTasks('grunt-markdown')
    grunt.loadNpmTasks('grunt-cleaver')

    grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'qunit', 'markdown', 'cleaver', 'connect', 'watch']) // , 'nodeunit'
    grunt.registerTask('doc', ['markdown', 'cleaver', 'connect', 'watch'])
    grunt.registerTask('travis', ['jshint', 'qunit']) // grunt travis --verbose
};<|endoftext|>


<commit_before>module.exports = function(grunt) {
  var path = require('path');

  grunt.initConfig({
    clean: [
      'dist'
    ],
    transpile: {
      app: {
        type: 'cjs',
        files: [{
          expand: true,
          src: ['bin/es6-module-packager', 'lib/**/*.js'],
          dest: 'tmp/transpiled/'
        }]
      }
    },
    es6ify: {
      app: {
        files: [{
          expand: true,
          cwd: 'tmp/transpiled/',
          src: ['bin/es6-module-packager', 'lib/**/*.js'],
          dest: 'dist/'
        }]
      }
    },
    jshint: {
      all: {
        src: [
          'Gruntfile.js',
          'lib/**/*.js'
        ]
      },
      options: {
        jshintrc: '.jshintrc',
        force: true
      }
    },
    simplemocha: {
      options: {
        globals: ['should'],
        timeout: 3000,
        ignoreLeaks: false
      },

      all: { src: ['test/*.js'] }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-es6-module-transpiler');
  grunt.loadNpmTasks('grunt-simple-mocha');

  // Load local tasks.
  grunt.task.loadTasks('./tasks');

  // Note not exposing a build + test endpoint as there are conflicts with
  // transpile + es6ify (waiting for https://github.com/google/traceur-compiler/pull/323)
  grunt.registerTask('test', ['simplemocha']);

  grunt.registerTask('default', ['test']);
};
<commit_msg>Update grunt for bin file<commit_after>module.exports = function(grunt) {
  var path = require('path');

  grunt.initConfig({
    clean: [
      'dist'
    ],
    jshint: {
      all: {
        src: [
          'Gruntfile.js',
          'lib/**/*.js'
        ]
      },
      options: {
        jshintrc: '.jshintrc',
        force: true
      }
    },
    transpile: {
      app: {
        type: 'cjs',
        files: [{
          expand: true,
          src: ['lib/**/*.js'],
          dest: 'tmp/transpiled/'
        }]
      }
    },
    es6ify: {
      app: {
        files: [{
          expand: true,
          cwd: 'tmp/transpiled/',
          src: ['lib/**/*.js'],
          dest: 'dist/'
        }]
      }
    },
    simplemocha: {
      options: {
        globals: ['should'],
        timeout: 3000,
        ignoreLeaks: false
      },

      all: { src: ['test/*.js'] }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-es6-module-transpiler');
  grunt.loadNpmTasks('grunt-simple-mocha');

  // Load local tasks.
  grunt.task.loadTasks('./tasks');

  // Note not exposing a build + test endpoint as there are conflicts with
  // transpile + es6ify (waiting for https://github.com/google/traceur-compiler/pull/323)
  grunt.registerTask('test', ['simplemocha']);

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


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

    var tasks = [
        'jshint',
        'ngAnnotate',
        'replace',
        'uglify',
        'copy'
    ];

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        banner: '/*\n' +
            '* <%= pkg.name %> <%= pkg.version %>\n' +
            '* Obogo (c) ' + new Date().getFullYear() + '\n' +
            '* https://github.com/webux/<%= pkg.filename %>\n' +
            '* License: MIT.\n' +
            '*/\n',
        jshint: {
            // define the files to lint
            files: ['src/**/*.js'],
            // configure JSHint (documented at http://www.jshint.com/docs/)
            options: {
                // more options here if you want to override JSHint defaults
                globals: {
                    loopfunc: false
                }
            }
        },
        copy: {
            build: {
                files: [
                    { expand: true, cwd: 'src/styles', src: ['*.css'], dest: 'build/css' }
                ]
            }
        },
        ngAnnotate: {
            build: {
                files: {
                    './build/<%= pkg.filename %>.js': [
                        'src/consts.js',
                        'src/**/*.js'
                    ]
                }
            }
        },
        replace: {
            "build": {
                options: {
                    patterns: [
                        {
                            match: 'moduleName',
                            replacement: '<%= pkg.packageName %>'
                        }
                    ]
                },
                files: [
                    {
                        src: ['./build/<%= pkg.filename %>.js'],
                        dest: './build/<%= pkg.filename %>.js'
                    },
                    {
                        src: ['./build/<%= pkg.filename %>.min.js'],
                        dest: './build/<%= pkg.filename %>.min.js'
                    }
                ]
            }
        },
        uglify: {
            build: {
                options: {
                    mangle: false,
                    compress: false,
                    preserveComments: 'some',
                    beautify: true,
                    exportAll: true,
                    banner: '<%= banner %>',
                    wrap: '<%= pkg.packageName %>'
                },
                files: {
                    './build/<%= pkg.filename %>.js': ['./build/<%= pkg.filename %>.js']
                }
            },
            build_min: {
                options: {
                    report: 'gzip',
                    wrap: '<%= pkg.packageName %>',
                    banner: '<%= banner %>'
                },
                files: {
                    './build/<%= pkg.filename %>.min.js': ['./build/<%= pkg.filename %>.js']
                }
            }
        }
    });

    // Load the plugin that provides the "uglify" task.
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-ng-annotate');
    grunt.loadNpmTasks('grunt-replace');

    grunt.registerTask('default', tasks);

};<commit_msg>renamed webux to obogo in github ref<commit_after>module.exports = function (grunt) {

    var tasks = [
        'jshint',
        'ngAnnotate',
        'replace',
        'uglify',
        'copy'
    ];

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        banner: '/*\n' +
            '* <%= pkg.name %> <%= pkg.version %>\n' +
            '* Obogo (c) ' + new Date().getFullYear() + '\n' +
            '* https://github.com/obogo/<%= pkg.filename %>\n' +
            '* License: MIT.\n' +
            '*/\n',
        jshint: {
            // define the files to lint
            files: ['src/**/*.js'],
            // configure JSHint (documented at http://www.jshint.com/docs/)
            options: {
                // more options here if you want to override JSHint defaults
                globals: {
                    loopfunc: false
                }
            }
        },
        copy: {
            build: {
                files: [
                    { expand: true, cwd: 'src/styles', src: ['*.css'], dest: 'build/css' }
                ]
            }
        },
        ngAnnotate: {
            build: {
                files: {
                    './build/<%= pkg.filename %>.js': [
                        'src/consts.js',
                        'src/**/*.js'
                    ]
                }
            }
        },
        replace: {
            "build": {
                options: {
                    patterns: [
                        {
                            match: 'moduleName',
                            replacement: '<%= pkg.packageName %>'
                        }
                    ]
                },
                files: [
                    {
                        src: ['./build/<%= pkg.filename %>.js'],
                        dest: './build/<%= pkg.filename %>.js'
                    },
                    {
                        src: ['./build/<%= pkg.filename %>.min.js'],
                        dest: './build/<%= pkg.filename %>.min.js'
                    }
                ]
            }
        },
        uglify: {
            build: {
                options: {
                    mangle: false,
                    compress: false,
                    preserveComments: 'some',
                    beautify: true,
                    exportAll: true,
                    banner: '<%= banner %>',
                    wrap: '<%= pkg.packageName %>'
                },
                files: {
                    './build/<%= pkg.filename %>.js': ['./build/<%= pkg.filename %>.js']
                }
            },
            build_min: {
                options: {
                    report: 'gzip',
                    wrap: '<%= pkg.packageName %>',
                    banner: '<%= banner %>'
                },
                files: {
                    './build/<%= pkg.filename %>.min.js': ['./build/<%= pkg.filename %>.js']
                }
            }
        }
    });

    // Load the plugin that provides the "uglify" task.
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-ng-annotate');
    grunt.loadNpmTasks('grunt-replace');

    grunt.registerTask('default', tasks);

};<|endoftext|>


<commit_before>// Generated on 2013-10-21 using generator-webapp 0.4.3
'use strict';

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

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

  // Project configuration.
  grunt.initConfig({
    // Metadata
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed MIT */\n',

    // Configurable paths
    yeoman: {
      bower: 'bower_components',
      src: 'src',
      test: 'spec',
      dist: 'dist',
      site: 'site'
    },

    coffee: {
      dist: {
        expand: true,
        cwd: '<%= yeoman.src %>/javascripts/',
        src: ['**/*.coffee'],
        dest: '.tmp/javascripts/',
        ext: '.js'
      },
      test: {
        expand: true,
        cwd: 'spec',
        src: ['**/*.coffee'],
        dest: '.tmp/spec/',
        ext: '.js'
      }
    },

    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          '<%= yeoman.dist %>/<%= pkg.name %>.css': 'src/stylesheets/browser.scss'
        }
      }
    },

    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true,
      },
      dist: {
        src: [
          '.tmp/**/*.js'
        ],
        dest: '<%= yeoman.dist %>/<%= pkg.name %>.js'
      }
    },

    copy: {
      test: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.test %>',
          dest: '.tmp/spec/',
          src: [
            '**/*.js',
          ]
        }]
      },
      site: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= yeoman.site %>',
            dest: '<%= yeoman.dist %>',
            src: [
              '**/*',
            ]
          },
          {
            expand: true,
            dot: true,
            cwd: '<%= yeoman.bower %>',
            dest: '<%= yeoman.dist %>',
            src: [
              '**/*',
            ]
          },
        ]
      }
    },

    browserify: {
      dist: {
        src: '.tmp/javascripts/browser.js',
        dest: '<%= yeoman.dist %>/<%= pkg.name %>.js'
      }
    },

    clean: {
      options: {
        // "no-write": true
      },
      server: {
        src: '.tmp'
      },
      dist: {
        src: '<%= yeoman.dist %>'
      }
    },

    jasmine: {
      specs: [
        '<%= yeoman.bower %>/jquery/jquery.js',
        '<%= yeoman.bower %>/underscore/underscore.js',
        '<%= yeoman.bower %>/ttm-coffeescript-utilities/dist/ttm-coffeescript-utilities.js',
        '<%= yeoman.bower %>/ttm-coffeescript-math/dist/ttm-coffeescript-math.js',
        '.tmp/spec/support/jasmine-jquery.js',
        '<%= yeoman.dist %>/<%= pkg.name %>.js',
        '.tmp/spec/support/spec_helpers.js',
        '.tmp/spec/**/*.js'
      ]
    },

    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        hostname: 'localhost'
      },
      serve: {
        options: {
          open: true,
          base: [
            '<%= yeoman.site %>',
            '<%= yeoman.dist %>'
          ]
        }
      }
    },

    watch: {
      coffee: {
        files: [
          '<%= yeoman.src %>/**/*.{coffee,scss}',
          '<%= yeoman.test %>/**/*.coffee',
        ],
        tasks: ['build'],
        options: {
          interrupt: false
        }
      }
    },

    uglify: {
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= pkg.name %>.min.js': '<%= yeoman.dist %>/<%= pkg.name %>.js'
        }
      }
    },

    cssmin: {
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= pkg.name %>.min.css': '<%= yeoman.dist %>/<%= pkg.name %>.css'
        }
      }
    },

    'gh-pages': {
      options: {
        base: '<%= yeoman.dist %>'
      },
      src: ['**']
    }
  });

  // Tasks
  grunt.registerTask('serve', ['build', 'connect:serve:keepalive']);

  grunt.registerTask('watch-serve', [
    'connect:serve', 'watch'
  ]);

  grunt.registerTask('build', [
    'clean',
    'coffee',
    'sass',
    'concat',
    'copy:spec',
    'browserify',
    'uglify',
    'cssmin',
    'copy:site'
  ]);

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

  grunt.registerTask('default', ['build']);
};
<commit_msg>Move watch and connect tasks to top of the Gruntfile<commit_after>// Generated on 2013-10-21 using generator-webapp 0.4.3
'use strict';

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

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

  // Project configuration.
  grunt.initConfig({
    // Metadata
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
      '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
      '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
      '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
      ' Licensed MIT */\n',

    // Configurable paths
    yeoman: {
      bower: 'bower_components',
      src: 'src',
      test: 'spec',
      dist: 'dist',
      site: 'site'
    },

    watch: {
      coffee: {
        files: [
          '<%= yeoman.src %>/**/*.{coffee,scss}',
          '<%= yeoman.test %>/**/*.coffee',
        ],
        tasks: ['build'],
        options: {
          interrupt: false
        }
      }
    },

    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        hostname: 'localhost'
      },
      serve: {
        options: {
          open: true,
          base: [
            '<%= yeoman.site %>',
            '<%= yeoman.dist %>'
          ]
        }
      }
    },

    coffee: {
      dist: {
        expand: true,
        cwd: '<%= yeoman.src %>/javascripts/',
        src: ['**/*.coffee'],
        dest: '.tmp/javascripts/',
        ext: '.js'
      },
      test: {
        expand: true,
        cwd: 'spec',
        src: ['**/*.coffee'],
        dest: '.tmp/spec/',
        ext: '.js'
      }
    },

    sass: {
      dist: {
        options: {
          style: 'compressed'
        },
        files: {
          '<%= yeoman.dist %>/<%= pkg.name %>.css': 'src/stylesheets/browser.scss'
        }
      }
    },

    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true,
      },
      dist: {
        src: [
          '.tmp/**/*.js'
        ],
        dest: '<%= yeoman.dist %>/<%= pkg.name %>.js'
      }
    },

    copy: {
      test: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.test %>',
          dest: '.tmp/spec/',
          src: [
            '**/*.js',
          ]
        }]
      },
      site: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= yeoman.site %>',
            dest: '<%= yeoman.dist %>',
            src: [
              '**/*',
            ]
          },
          {
            expand: true,
            dot: true,
            cwd: '<%= yeoman.bower %>',
            dest: '<%= yeoman.dist %>',
            src: [
              '**/*',
            ]
          },
        ]
      }
    },

    browserify: {
      dist: {
        src: '.tmp/javascripts/browser.js',
        dest: '<%= yeoman.dist %>/<%= pkg.name %>.js'
      }
    },

    clean: {
      options: {
        // "no-write": true
      },
      server: {
        src: '.tmp'
      },
      dist: {
        src: '<%= yeoman.dist %>'
      }
    },

    jasmine: {
      specs: [
        '<%= yeoman.bower %>/jquery/jquery.js',
        '<%= yeoman.bower %>/underscore/underscore.js',
        '<%= yeoman.bower %>/ttm-coffeescript-utilities/dist/ttm-coffeescript-utilities.js',
        '<%= yeoman.bower %>/ttm-coffeescript-math/dist/ttm-coffeescript-math.js',
        '.tmp/spec/support/jasmine-jquery.js',
        '<%= yeoman.dist %>/<%= pkg.name %>.js',
        '.tmp/spec/support/spec_helpers.js',
        '.tmp/spec/**/*.js'
      ]
    },

    uglify: {
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= pkg.name %>.min.js': '<%= yeoman.dist %>/<%= pkg.name %>.js'
        }
      }
    },

    cssmin: {
      dist: {
        files: {
          '<%= yeoman.dist %>/<%= pkg.name %>.min.css': '<%= yeoman.dist %>/<%= pkg.name %>.css'
        }
      }
    },

    'gh-pages': {
      options: {
        base: '<%= yeoman.dist %>'
      },
      src: ['**']
    }
  });

  // Tasks
  grunt.registerTask('serve', ['build', 'connect:serve:keepalive']);

  grunt.registerTask('watch-serve', [
    'connect:serve', 'watch'
  ]);

  grunt.registerTask('build', [
    'clean',
    'coffee',
    'sass',
    'concat',
    'copy:spec',
    'browserify',
    'uglify',
    'cssmin',
    'copy:site'
  ]);

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

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