<commit_before>// Generated on 2014-01-28 using generator-webapp 0.4.7
'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) {

    // Load grunt tasks automatically
    require('load-grunt-tasks')(grunt);

    // Time how long tasks take. Can help when optimizing build times
    require('time-grunt')(grunt);

    // Define the configuration for all the tasks
    grunt.initConfig({

        // Project settings
        yeoman: {
            // Configurable paths
            app: 'app',
            prod: 'prod',
            dist: '<%= yeoman.prod %>/static'
        },

        // Watches files for changes and runs tasks based on the changed files
        watch: {
            js: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            jstest: {
                files: ['test/spec/{,*/}*.js'],
                tasks: ['test:watch']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            compass: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server', 'autoprefixer']
            },
            styles: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
                tasks: ['newer:copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,*/}*.html',
                    '.tmp/styles/{,*/}*.css',
                    '<%= yeoman.app %>/images/{,*/}*.{gif,jpeg,jpg,png,svg,webp}'
                ]
            }
        },

        // The actual grunt server settings
        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            test: {
                options: {
                    port: 9001,
                    base: [
                        '.tmp',
                        'test',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            dist: {
                options: {
                    open: true,
                    base: '<%= yeoman.dist %>',
                    livereload: false
                }
            }
        },

        // Empties folders to start fresh
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },

        // Make sure code styles are up to par and there are no obvious mistakes
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },

        // Mocha testing framework configuration options
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
                }
            }
        },

        // Compiles Sass to CSS and generates necessary files if requested
        compass: {
            options: {
                sassDir: '<%= yeoman.app %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.app %>/images',
                javascriptsDir: '<%= yeoman.app %>/scripts',
                fontsDir: '<%= yeoman.app %>/styles/fonts',
                importPath: '<%= yeoman.app %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false,
                assetCacheBuster: false
            },
            dist: {
                options: {
                    generatedImagesDir: '<%= yeoman.dist %>/images/generated'
                }
            },
            server: {
                options: {
                    debugInfo: true
                }
            }
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },

        // Automatically inject Bower components into the HTML file
        'bower-install': {
            app: {
                html: '<%= yeoman.app %>/index.html',
                ignorePath: '<%= yeoman.app %>/'
            }
        },

        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{gif,jpeg,jpg,png,webp}',
                        '<%= yeoman.dist %>/styles/fonts/{,*/}*.*'
                    ]
                }
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: '<%= yeoman.app %>/index.html'
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            options: {
                assetsDirs: ['<%= yeoman.dist %>']
            },
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
        },

        // The following *-min tasks produce minified files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: {
                    collapseBooleanAttributes: true,
                    collapseWhitespace: true,
                    removeAttributeQuotes: true,
                    removeCommentsFromCDATA: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.dist %>',
                    src: '{,*/}*.html',
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },

        // By default, your `index.html`'s <!-- Usemin block --> will take care of
        // minification. These next options are pre-configured if you do not wish
        // to use the Usemin blocks.
        // cssmin: {
        //     dist: {
        //         files: {
        //             '<%= yeoman.dist %>/styles/main.css': [
        //                 '.tmp/styles/{,*/}*.css',
        //                 '<%= yeoman.app %>/styles/{,*/}*.css'
        //             ]
        //         }
        //     }
        // },
        // uglify: {
        //     dist: {
        //         files: {
        //             '<%= yeoman.dist %>/scripts/scripts.js': [
        //                 '<%= yeoman.dist %>/scripts/scripts.js'
        //             ]
        //         }
        //     }
        // },
        // concat: {
        //     dist: {}
        // },

        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '.htaccess',
                        'images/{,*/}*.webp',
                        '{,*/}*.html',
                        'styles/fonts/{,*/}*.*'
                    ]
                }]
            },
            styles: {
                expand: true,
                dot: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            },
            // this task is a hack until grunt-django enables
            // rewriting templates so that app/bower_components
            // can be used directly
            devscripts: {
                expand: true,
                dot: true,
                cwd: '<%= yeoman.dist %>/scripts',
                dest: '.tmp/scripts/',
                src: 'plugins.js'
            },
            // copy all the non-frontend stuff into the production folder
            prod:{
                src: ['*', '**', '!app/**', '!prod/**', '!node_modules/**',
                      '!test/**', '!Gruntfile.js', '!{bower,package}.json',
                      '!{,*/}{.*,*~,\#*\#,*.pyc,*.sqlite3,__pycache__/**}'],
                dest: '<%= yeoman.prod %>/'
            }
        },

        // Generates a custom Modernizr build that includes only the tests you
        // reference in your app
        modernizr: {
            devFile: '<%= yeoman.app %>/bower_components/modernizr/modernizr.js',
            outputFile: '<%= yeoman.dist %>/bower_components/modernizr/modernizr.js',
            files: [
                '<%= yeoman.dist %>/scripts/{,*/}*.js',
                '<%= yeoman.dist %>/styles/{,*/}*.css',
                '!<%= yeoman.dist %>/scripts/vendor/*'
            ],
            uglify: true
        },

        // Run some tasks in parallel to speed up build process
        concurrent: {
            server: [
                'compass:server',
                'copy:styles'
            ],
            test: [
                'copy:styles'
            ],
            dist: [
                'compass',
                'copy:styles',
                'imagemin',
                'svgmin'
            ]
        },

        buildcontrol: {
            options: {
                dir: '<%= yeoman.prod %>',
                commit: true,
                //push: true,
                message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
            },
            prod: {
                options: {
                    //remote: '',
                    branch: 'prod'
                }
            }
        }
    });

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

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

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

    grunt.registerTask('test', function(target) {
        if (target !== 'watch') {
            grunt.task.run([
                'clean:server',
                'concurrent:test',
                'autoprefixer',
            ]);
        }

        grunt.task.run([
            'connect:test',
            'mocha'
        ]);
    });

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'cssmin',
        'uglify',
        'copy:dist',
        'modernizr',
        // 'rev', // needs grunt-django
        'usemin',
        'htmlmin'
    ]);

    grunt.registerTask('publish', [
        'copy:prod',
        'buildcontrol:prod'
    ]);

    grunt.registerTask('default', [
        'newer:jshint',
        'test',
        'build'
    ]);
};
<commit_msg>push prod to github<commit_after>// Generated on 2014-01-28 using generator-webapp 0.4.7
'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) {

    // Load grunt tasks automatically
    require('load-grunt-tasks')(grunt);

    // Time how long tasks take. Can help when optimizing build times
    require('time-grunt')(grunt);

    // Define the configuration for all the tasks
    grunt.initConfig({

        // Project settings
        yeoman: {
            // Configurable paths
            app: 'app',
            prod: 'prod',
            dist: '<%= yeoman.prod %>/static'
        },

        // Watches files for changes and runs tasks based on the changed files
        watch: {
            js: {
                files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            jstest: {
                files: ['test/spec/{,*/}*.js'],
                tasks: ['test:watch']
            },
            gruntfile: {
                files: ['Gruntfile.js']
            },
            compass: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server', 'autoprefixer']
            },
            styles: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
                tasks: ['newer:copy:styles', 'autoprefixer']
            },
            livereload: {
                options: {
                    livereload: '<%= connect.options.livereload %>'
                },
                files: [
                    '<%= yeoman.app %>/{,*/}*.html',
                    '.tmp/styles/{,*/}*.css',
                    '<%= yeoman.app %>/images/{,*/}*.{gif,jpeg,jpg,png,svg,webp}'
                ]
            }
        },

        // The actual grunt server settings
        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                // Change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    open: true,
                    base: [
                        '.tmp',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            test: {
                options: {
                    port: 9001,
                    base: [
                        '.tmp',
                        'test',
                        '<%= yeoman.app %>'
                    ]
                }
            },
            dist: {
                options: {
                    open: true,
                    base: '<%= yeoman.dist %>',
                    livereload: false
                }
            }
        },

        // Empties folders to start fresh
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },

        // Make sure code styles are up to par and there are no obvious mistakes
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: require('jshint-stylish')
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },

        // Mocha testing framework configuration options
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
                }
            }
        },

        // Compiles Sass to CSS and generates necessary files if requested
        compass: {
            options: {
                sassDir: '<%= yeoman.app %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.app %>/images',
                javascriptsDir: '<%= yeoman.app %>/scripts',
                fontsDir: '<%= yeoman.app %>/styles/fonts',
                importPath: '<%= yeoman.app %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false,
                assetCacheBuster: false
            },
            dist: {
                options: {
                    generatedImagesDir: '<%= yeoman.dist %>/images/generated'
                }
            },
            server: {
                options: {
                    debugInfo: true
                }
            }
        },

        // Add vendor prefixed styles
        autoprefixer: {
            options: {
                browsers: ['last 1 version']
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: '.tmp/styles/',
                    src: '{,*/}*.css',
                    dest: '.tmp/styles/'
                }]
            }
        },

        // Automatically inject Bower components into the HTML file
        'bower-install': {
            app: {
                html: '<%= yeoman.app %>/index.html',
                ignorePath: '<%= yeoman.app %>/'
            }
        },

        // Renames files for browser caching purposes
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{gif,jpeg,jpg,png,webp}',
                        '<%= yeoman.dist %>/styles/fonts/{,*/}*.*'
                    ]
                }
            }
        },

        // Reads HTML for usemin blocks to enable smart builds that automatically
        // concat, minify and revision files. Creates configurations in memory so
        // additional tasks can operate on them
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: '<%= yeoman.app %>/index.html'
        },

        // Performs rewrites based on rev and the useminPrepare configuration
        usemin: {
            options: {
                assetsDirs: ['<%= yeoman.dist %>']
            },
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
        },

        // The following *-min tasks produce minified files in the dist folder
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{gif,jpeg,jpg,png}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        htmlmin: {
            dist: {
                options: {
                    collapseBooleanAttributes: true,
                    collapseWhitespace: true,
                    removeAttributeQuotes: true,
                    removeCommentsFromCDATA: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.dist %>',
                    src: '{,*/}*.html',
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },

        // By default, your `index.html`'s <!-- Usemin block --> will take care of
        // minification. These next options are pre-configured if you do not wish
        // to use the Usemin blocks.
        // cssmin: {
        //     dist: {
        //         files: {
        //             '<%= yeoman.dist %>/styles/main.css': [
        //                 '.tmp/styles/{,*/}*.css',
        //                 '<%= yeoman.app %>/styles/{,*/}*.css'
        //             ]
        //         }
        //     }
        // },
        // uglify: {
        //     dist: {
        //         files: {
        //             '<%= yeoman.dist %>/scripts/scripts.js': [
        //                 '<%= yeoman.dist %>/scripts/scripts.js'
        //             ]
        //         }
        //     }
        // },
        // concat: {
        //     dist: {}
        // },

        // Copies remaining files to places other tasks can use
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '.htaccess',
                        'images/{,*/}*.webp',
                        '{,*/}*.html',
                        'styles/fonts/{,*/}*.*'
                    ]
                }]
            },
            styles: {
                expand: true,
                dot: true,
                cwd: '<%= yeoman.app %>/styles',
                dest: '.tmp/styles/',
                src: '{,*/}*.css'
            },
            // this task is a hack until grunt-django enables
            // rewriting templates so that app/bower_components
            // can be used directly
            devscripts: {
                expand: true,
                dot: true,
                cwd: '<%= yeoman.dist %>/scripts',
                dest: '.tmp/scripts/',
                src: 'plugins.js'
            },
            // copy all the non-frontend stuff into the production folder
            prod:{
                src: ['*', '**', '!app/**', '!prod/**', '!node_modules/**',
                      '!test/**', '!Gruntfile.js', '!{bower,package}.json',
                      '!{,*/}{.*,*~,\#*\#,*.pyc,*.sqlite3,__pycache__/**}'],
                dest: '<%= yeoman.prod %>/'
            }
        },

        // Generates a custom Modernizr build that includes only the tests you
        // reference in your app
        modernizr: {
            devFile: '<%= yeoman.app %>/bower_components/modernizr/modernizr.js',
            outputFile: '<%= yeoman.dist %>/bower_components/modernizr/modernizr.js',
            files: [
                '<%= yeoman.dist %>/scripts/{,*/}*.js',
                '<%= yeoman.dist %>/styles/{,*/}*.css',
                '!<%= yeoman.dist %>/scripts/vendor/*'
            ],
            uglify: true
        },

        // Run some tasks in parallel to speed up build process
        concurrent: {
            server: [
                'compass:server',
                'copy:styles'
            ],
            test: [
                'copy:styles'
            ],
            dist: [
                'compass',
                'copy:styles',
                'imagemin',
                'svgmin'
            ]
        },

        buildcontrol: {
            options: {
                dir: '<%= yeoman.prod %>',
                commit: true,
                push: true,
                message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
            },
            prod: {
                options: {
                    remote: 'git@github.com:kermit666/posterwall.git',
                    branch: 'prod'
                }
            }
        }
    });

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

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

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

    grunt.registerTask('test', function(target) {
        if (target !== 'watch') {
            grunt.task.run([
                'clean:server',
                'concurrent:test',
                'autoprefixer',
            ]);
        }

        grunt.task.run([
            'connect:test',
            'mocha'
        ]);
    });

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'autoprefixer',
        'concat',
        'cssmin',
        'uglify',
        'copy:dist',
        'modernizr',
        // 'rev', // needs grunt-django
        'usemin',
        'htmlmin'
    ]);

    grunt.registerTask('publish', [
        'copy:prod',
        'buildcontrol:prod'
    ]);

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


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    nodeunit: {
      all: ['test/**/*Test.js']
    },
    jshint: {
      all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
      options: {
        jshintrc: '.jshintrc'
      }
    },
    watch: {
      gruntfile: {
        files: 'Gruntfile.js',
        tasks: ['jshint:gruntfile'],
        options: {
          nocase: true
        }
      },
      src: {
        files: ['lib/**/*.js', 'test/**/*.js', 'Gruntfile.js'],
        tasks: ['default']
      }
    }
  });

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

  // Default
  grunt.registerTask('default', ['jshint', 'nodeunit']);
  grunt.registerTask('travis', ['jshint', 'nodeunit']);

  // Testing
  grunt.registerTask('test', ['nodeunit']);
};
<commit_msg>added white space to gruntfile to trigger build for travalizit<commit_after>module.exports = function(grunt) {
  'use strict';

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    nodeunit: {
      all: ['test/**/*Test.js']
    },
    jshint: {
      all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
      options: {
        jshintrc: '.jshintrc'
      }
    },
    watch: {
      gruntfile: {
        files: 'Gruntfile.js',
        tasks: ['jshint:gruntfile'],
        options: {
          nocase: true
        }
      },
      src: {
        files: ['lib/**/*.js', 'test/**/*.js', 'Gruntfile.js'],
        tasks: ['default']
      }
    }
  });

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

  // Default
  grunt.registerTask('default', ['jshint', 'nodeunit']);
  grunt.registerTask('travis', ['jshint', 'nodeunit']);

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


<commit_before>var __lc = {};
__lc.license = 1083735;

function setupLiveChat() {
    // this is where we pass custom variables to livechat;
    // only pass the client id assigned by WHMCS for now
    __lc.params = [
        { name: 'client_id', value: livechat_client_id },
        { name: 'plan_type', value: livechat_plan_type},
        { name: 'station_url', value: livechat_station_url}
    ];

    var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
    lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
}

$(document).ready(function() {
    setupLiveChat();

    var lcLoadListener = setInterval(function() {
        var ifr = document.getElementById('livechat-compact-container');
        if (ifr) {
            LC_API.on_chat_state_changed = function(data) {
                if (data.state == 'offline') {
                    $('body > .wrapper').css('padding-bottom', 10);
                } else {
                    $('body > .wrapper').css('padding-bottom', 40);
                }
            };
            clearInterval(lcLoadListener);
        }
    }, 100);
});<commit_msg>SAAS-1101 - add workaround for pages obstructed by livechat box<commit_after>var __lc = {};
__lc.license = 1083735;

function setupLiveChat() {
    // this is where we pass custom variables to livechat;
    // only pass the client id assigned by WHMCS for now
    __lc.params = [
        { name: 'client_id', value: livechat_client_id },
        { name: 'plan_type', value: livechat_plan_type},
        { name: 'station_url', value: livechat_station_url}
    ];

    var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
    lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
}

$(document).ready(function() {
    setupLiveChat();

    var lcLoadListener = setInterval(function() {
        var ifr = document.getElementById('livechat-compact-container');
        if (ifr) {
            LC_API.on_chat_state_changed = function(data) {
                // Hacky... select elements on pages that have different layouts separately
                $('body > .wrapper, #stream_form > div, #his-tabs').css('padding-bottom', (data.state == 'offline') ? 10 : 40);
            };
            clearInterval(lcLoadListener);
        }
    }, 100);
});<|endoftext|>


<commit_before>/* jshint node:true */

module.exports = function (grunt) {
	// load all grunt tasks matching the `grunt-*` pattern
	require('load-grunt-tasks')(grunt);

	grunt.initConfig({

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

		jshint: {
			options: grunt.file.readJSON( '.jshintrc' ),
			grunt: {
				src: [
					'Gruntfile.js'
				]
			},
			plugin: {
				src: [
					'assets/js/voting.js'
				]
			}
		},

		uglify: {
			options: {
				preserveComments: 'some'
			},
			modules: {
				files: {
					'assets/js/modules/growl/javascripts/jquery.growl.min.js': ['assets/js/modules/growl/javascripts/jquery.growl.js']
				}
			},
			plugin: {
				files: {
					'assets/js/voting.min.js': ['assets/js/voting.js']
				}
			}
		},

		// Generates a POT file for translators.
		makepot: {
			target: {
				options: {
					type: 'wp-plugin',
					domainPath: 'languages',
					exclude: ['node_modules/.*'],
					processPot: function( pot, options ) {
						pot.headers['report-msgid-bugs-to'] = 'support@humanmade.co.uk';
						pot.headers['last-translator'] = 'Human Made Limited';
						pot.headers['language-team'] = 'Human Made Limited';
						return pot;
					}
				}
			}
		},

		// Creates an MD version of the README file
		wp_readme_to_markdown: {
			your_target: {
				files: {
					'README.md': 'README.txt'
				}
			}
		},

		shell: {
			commit: {
				command: 'git add . --all && git commit -m "Version <%= pkg.version %>"'
			},
			tag: {
				command: 'git tag -a <%= pkg.version %> -m "Version <%= pkg.version %>"'
			}
		},

		copy: {
			build: {
				files: [
					{
						expand: true,
						cwd: '.',
						src: [
							'**/*',
							'!**/.{svn,git,bowerrc,jshintrc,travis.yml,gitignore}/**',
							'!**/.DS_Store/**',
							'!**composer{.json,.lock}**',
							'!**package.json**',
							'!**Gruntfile.js**',
							'!**README.md**',
							'!**phpunit**',
							'!**/node_modules/**',
							'!**/wp-assets/**',
							'!**/tests/**',
							'!**/build/**',
							'!**/inc/lib/twig/twig/{test,doc}/**'
						],
						dest: 'build'
					}
				]
			}
		},

		clean:{
			build: {
				src: [ 'build' ]
			}
		},

		replace: {
			classVersion: {
				src: [
					'inc/class-comment-popularity.php'
				],
				overwrite: true,
				replacements: [ {
					from: /^const HMN_CP_PLUGIN_VERSION = '.*';$/m,
					to: "const HMN_CP_PLUGIN_VERSION '<%= pkg.version %>';"
				} ]
			},
			pluginsVersion: {
				src: [
					'comment-popularity.php'
				],
				overwrite: true,
				replacements: [ {
					from: /^Version: .*$/m,
					to: 'Version: <%= pkg.version %>'
				} ]
			},
			readmeVersion: {
				src: [
					'README.txt'
				],
				overwrite: true,
				replacements: [ {
					from: /^Stable tag: .*$/m,
					to: 'Stable tag: <%= pkg.version %>'
				} ]
			}
		},

		bump: {
			options: {
				files: [ 'package.json' ],
				updateConfigs: [ 'pkg' ],
				commit: false
			}
		},

		other: {
			changelog: 'changelog.md'
		},

		// Creates an MD version of the README file
		wp_readme_to_markdown: {
			your_target: {
				files: {
					'README.md': 'README.txt'
				}
			}
		},

		// Deploys a new version to the svn WordPress.org repo.
		wp_deploy: {
			deploy: {
				options: {
					plugin_slug: 'comment-popularity',
					svn_user: 'pauldewouters',
					build_dir: 'build',
					assets_dir: 'wp-assets'
				}
			}
		}

	});

	grunt.registerTask('minify', ['newer:uglify:modules','newer:uglify:plugin']);
	grunt.registerTask('lint', ['newer:jshint:grunt','newer:jshint:plugin']);

	// Top level function to build a new release
	grunt.registerTask( 'release', function( releaseType ) {
		if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
			grunt.fail.fatal( 'Please specify the release type (e.g., "grunt release:patch")' );
		} else {
			// Check to make sure the log exists
			grunt.task.run( 'log:' + releaseType );

			// Bump the version numbers
			grunt.task.run( 'bumpto:' + releaseType );

			// Create the .pot file
			grunt.task.run( 'makepot' );

			// Build the SASS and scripts
			grunt.task.run( 'default' );

			// Zip it up
			grunt.task.run( 'package' );

			// Commit and tag version update
			//grunt.task.run( 'shell:commit' );
			//grunt.task.run( 'shell:tag' );
		}
	} );

	// Default task(s).
	grunt.registerTask( 'default', [ 'minify', 'uglify' ] );

	// Bump the version to the specified value; e.g., "grunt bumpto:patch"
	grunt.registerTask( 'bumpto', function( releaseType ) {
		if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
			grunt.fail.fatal( 'Please specify the bump type (e.g., "grunt bumpto:patch")' );
		} else {
			grunt.task.run( 'bump-only:' + releaseType );

			// Update the version numbers
			grunt.task.run( 'replace' );
		}
	} );

	// Prompt for the changelog
	grunt.registerTask( 'log', function( releaseType ) {
		var semver = require( 'semver' ),
			changelog,
			newVersion = semver.inc( grunt.config.get( 'pkg' ).version, releaseType),
			regex = new RegExp( '^## ' + newVersion, 'gm' ); // Match the version number (e.g., "# 1.2.3")

		if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
			grunt.log.writeln().fail( 'Please choose a valid version type (minor, major, or patch)' );
		} else {
			// Get the new version
			changelog = grunt.file.read( grunt.config.get( 'other' ).changelog );

			if ( changelog.match( regex ) ) {
				grunt.log.ok( 'v' + newVersion + ' changlelog entry found' );
			} else {
				grunt.fail.fatal( 'Please enter a changelog entry for v' + newVersion );
			}
		}
	} );

	// Package a new release
	grunt.registerTask( 'package', [
		'copy:build',
		'compress:build',
		'clean:build'
	] );
};<commit_msg>Igonre contributing.md from build<commit_after>/* jshint node:true */

module.exports = function (grunt) {
	// load all grunt tasks matching the `grunt-*` pattern
	require('load-grunt-tasks')(grunt);

	grunt.initConfig({

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

		jshint: {
			options: grunt.file.readJSON( '.jshintrc' ),
			grunt: {
				src: [
					'Gruntfile.js'
				]
			},
			plugin: {
				src: [
					'assets/js/voting.js'
				]
			}
		},

		uglify: {
			options: {
				preserveComments: 'some'
			},
			modules: {
				files: {
					'assets/js/modules/growl/javascripts/jquery.growl.min.js': ['assets/js/modules/growl/javascripts/jquery.growl.js']
				}
			},
			plugin: {
				files: {
					'assets/js/voting.min.js': ['assets/js/voting.js']
				}
			}
		},

		// Generates a POT file for translators.
		makepot: {
			target: {
				options: {
					type: 'wp-plugin',
					domainPath: 'languages',
					exclude: ['node_modules/.*'],
					processPot: function( pot, options ) {
						pot.headers['report-msgid-bugs-to'] = 'support@humanmade.co.uk';
						pot.headers['last-translator'] = 'Human Made Limited';
						pot.headers['language-team'] = 'Human Made Limited';
						return pot;
					}
				}
			}
		},

		// Creates an MD version of the README file
		wp_readme_to_markdown: {
			your_target: {
				files: {
					'README.md': 'README.txt'
				}
			}
		},

		shell: {
			commit: {
				command: 'git add . --all && git commit -m "Version <%= pkg.version %>"'
			},
			tag: {
				command: 'git tag -a <%= pkg.version %> -m "Version <%= pkg.version %>"'
			}
		},

		copy: {
			build: {
				files: [
					{
						expand: true,
						cwd: '.',
						src: [
							'**/*',
							'!**/.{svn,git,bowerrc,jshintrc,travis.yml,gitignore}/**',
							'!**/.DS_Store/**',
							'!**composer{.json,.lock}**',
							'!**package.json**',
							'!**Gruntfile.js**',
							'!**{CONTRIBUTING,README}.md**',
							'!**phpunit**',
							'!**/node_modules/**',
							'!**/wp-assets/**',
							'!**/tests/**',
							'!**/build/**',
							'!**/inc/lib/twig/twig/{test,doc}/**'
						],
						dest: 'build'
					}
				]
			}
		},

		clean:{
			build: {
				src: [ 'build' ]
			}
		},

		replace: {
			classVersion: {
				src: [
					'inc/class-comment-popularity.php'
				],
				overwrite: true,
				replacements: [ {
					from: /^const HMN_CP_PLUGIN_VERSION = '.*';$/m,
					to: "const HMN_CP_PLUGIN_VERSION '<%= pkg.version %>';"
				} ]
			},
			pluginsVersion: {
				src: [
					'comment-popularity.php'
				],
				overwrite: true,
				replacements: [ {
					from: /^Version: .*$/m,
					to: 'Version: <%= pkg.version %>'
				} ]
			},
			readmeVersion: {
				src: [
					'README.txt'
				],
				overwrite: true,
				replacements: [ {
					from: /^Stable tag: .*$/m,
					to: 'Stable tag: <%= pkg.version %>'
				} ]
			}
		},

		bump: {
			options: {
				files: [ 'package.json' ],
				updateConfigs: [ 'pkg' ],
				commit: false
			}
		},

		other: {
			changelog: 'changelog.md'
		},

		// Creates an MD version of the README file
		wp_readme_to_markdown: {
			your_target: {
				files: {
					'README.md': 'README.txt'
				}
			}
		},

		// Deploys a new version to the svn WordPress.org repo.
		wp_deploy: {
			deploy: {
				options: {
					plugin_slug: 'comment-popularity',
					svn_user: 'pauldewouters',
					build_dir: 'build',
					assets_dir: 'wp-assets'
				}
			}
		}

	});

	grunt.registerTask('minify', ['newer:uglify:modules','newer:uglify:plugin']);
	grunt.registerTask('lint', ['newer:jshint:grunt','newer:jshint:plugin']);

	// Top level function to build a new release
	grunt.registerTask( 'release', function( releaseType ) {
		if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
			grunt.fail.fatal( 'Please specify the release type (e.g., "grunt release:patch")' );
		} else {
			// Check to make sure the log exists
			grunt.task.run( 'log:' + releaseType );

			// Bump the version numbers
			grunt.task.run( 'bumpto:' + releaseType );

			// Create the .pot file
			grunt.task.run( 'makepot' );

			// Build the SASS and scripts
			grunt.task.run( 'default' );

			// Zip it up
			grunt.task.run( 'package' );

			// Commit and tag version update
			//grunt.task.run( 'shell:commit' );
			//grunt.task.run( 'shell:tag' );
		}
	} );

	// Default task(s).
	grunt.registerTask( 'default', [ 'minify', 'uglify' ] );

	// Bump the version to the specified value; e.g., "grunt bumpto:patch"
	grunt.registerTask( 'bumpto', function( releaseType ) {
		if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
			grunt.fail.fatal( 'Please specify the bump type (e.g., "grunt bumpto:patch")' );
		} else {
			grunt.task.run( 'bump-only:' + releaseType );

			// Update the version numbers
			grunt.task.run( 'replace' );
		}
	} );

	// Prompt for the changelog
	grunt.registerTask( 'log', function( releaseType ) {
		var semver = require( 'semver' ),
			changelog,
			newVersion = semver.inc( grunt.config.get( 'pkg' ).version, releaseType),
			regex = new RegExp( '^## ' + newVersion, 'gm' ); // Match the version number (e.g., "# 1.2.3")

		if ( 'minor' !== releaseType && 'major' !== releaseType && 'patch' !== releaseType ) {
			grunt.log.writeln().fail( 'Please choose a valid version type (minor, major, or patch)' );
		} else {
			// Get the new version
			changelog = grunt.file.read( grunt.config.get( 'other' ).changelog );

			if ( changelog.match( regex ) ) {
				grunt.log.ok( 'v' + newVersion + ' changlelog entry found' );
			} else {
				grunt.fail.fatal( 'Please enter a changelog entry for v' + newVersion );
			}
		}
	} );

	// Package a new release
	grunt.registerTask( 'package', [
		'copy:build',
		'compress:build',
		'clean:build'
	] );
};<|endoftext|>


<commit_before>// kouto-swiss gruntfile

"use strict";

module.exports = function( grunt ) {

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

    grunt.initConfig( {
        "mochacli": {
            "options": {
                "require": [ "should" ],
                "reporter": "spec",
                "inline-diffs": true,
            },
            "tests": {
                "src": "test/runner.js",
            },
        },
        "clean": {
            "docs": [ "docs/**" ],
        },
        "stylus": {
            "options": {
                "compress": true,
                "use": [ require( "./lib/kouto-swiss.js" ) ],
            },
            "docs": {
                "files": {
                    "docs/assets/css/styles.css": "src/stylus/styles.styl",
                },
            },
        },
        "pug": {
            "options": {
                "compress": true,
            },
            "website": {
                "options": {
                    "data": {
                        "pkg": grunt.file.readJSON( "package.json" ),
                        "index": grunt.file.readJSON( "src/docs/index.json" ),
                        "utils": require( __dirname + "/src/js/utils.js" ),
                    },
                },
                "files": {
                    "docs/index.html": "src/pug/index.pug",
                },
            },
        },
        "copy": {
            "cname": {
                "src": "src/CNAME",
                "dest": "docs/CNAME",
            },
        },
        "connect": {
            "docs": {
                "options": {
                    "port": 5555,
                    "hostname": "*",
                    "base": "./docs",
                    "keepalive": true,
                    "livereload": true,
                },
            },
        },
        "concurrent": {
            "docs": {
                "tasks": [ "connect:docs", "watch" ],
                "options": {
                    "logConcurrentOutput": true,
                },
            },
        },
        "watch": {
            "options": {
                "livereload": true,
            },
            "pug": {
                "files": "src/pug/**/*.pug",
                "tasks": [ "pug" ],
            },
            "styles": {
                "files": "src/stylus/**/*.styl",
                "tasks": [ "stylus" ],
            },
            "docs": {
                "files": "_docs/**/*.md",
                "tasks": [ "pug" ],
            },
        },
    } );

    grunt.registerTask( "default", [
        "clean",
        "pug",
        // "stylus",
        "copy",
    ] );

    grunt.registerTask( "test", [
        "mochacli",
    ] );

    grunt.registerTask( "preview", [
        "default",
        "connect:docs",
    ] );

    grunt.registerTask( "work", [
        "default",
        "concurrent",
    ] );

    grunt.registerTask( "build", [
        "default",
    ] );
};
<commit_msg>Enable stylus task<commit_after>// kouto-swiss gruntfile

"use strict";

module.exports = function( grunt ) {

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

    grunt.initConfig( {
        "mochacli": {
            "options": {
                "require": [ "should" ],
                "reporter": "spec",
                "inline-diffs": true,
            },
            "tests": {
                "src": "test/runner.js",
            },
        },
        "clean": {
            "docs": [ "docs/**" ],
        },
        "stylus": {
            "options": {
                "compress": true,
                "use": [ require( "./lib/kouto-swiss.js" ) ],
            },
            "docs": {
                "files": {
                    "docs/assets/css/styles.css": "src/stylus/styles.styl",
                },
            },
        },
        "pug": {
            "options": {
                "compress": true,
            },
            "website": {
                "options": {
                    "data": {
                        "pkg": grunt.file.readJSON( "package.json" ),
                        "index": grunt.file.readJSON( "src/docs/index.json" ),
                        "utils": require( __dirname + "/src/js/utils.js" ),
                    },
                },
                "files": {
                    "docs/index.html": "src/pug/index.pug",
                },
            },
        },
        "copy": {
            "cname": {
                "src": "src/CNAME",
                "dest": "docs/CNAME",
            },
        },
        "connect": {
            "docs": {
                "options": {
                    "port": 5555,
                    "hostname": "*",
                    "base": "./docs",
                    "keepalive": true,
                    "livereload": true,
                },
            },
        },
        "concurrent": {
            "docs": {
                "tasks": [ "connect:docs", "watch" ],
                "options": {
                    "logConcurrentOutput": true,
                },
            },
        },
        "watch": {
            "options": {
                "livereload": true,
            },
            "pug": {
                "files": "src/pug/**/*.pug",
                "tasks": [ "pug" ],
            },
            "styles": {
                "files": "src/stylus/**/*.styl",
                "tasks": [ "stylus" ],
            },
            "docs": {
                "files": "_docs/**/*.md",
                "tasks": [ "pug" ],
            },
        },
    } );

    grunt.registerTask( "default", [
        "clean",
        "pug",
        "stylus",
        "copy",
    ] );

    grunt.registerTask( "test", [
        "mochacli",
    ] );

    grunt.registerTask( "preview", [
        "default",
        "connect:docs",
    ] );

    grunt.registerTask( "work", [
        "default",
        "concurrent",
    ] );

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


<commit_before>/*
* grunt-iojs-api-docs
* https://github.com/nodenica/grunt-iojs-api-docs.git
*
* Copyright (c) 2015 Paulo McNally <paulomcnally@gmail.com>
* Licensed under the MIT license.
*/

'use strict';

var version = '5.9.0';

module.exports = function(grunt) {
  // load all npm grunt tasks
  require('load-grunt-tasks')(grunt);
  // Project configuration.
  grunt.initConfig({
    // Configuration to be run (and then tested).
    docs: {
      'default_options': {
        options: {
          version: version,
          dest: './dest/'
        },

      }
    },
    copy: {
      main: {
        files: [
          // includes files within path
          {
            expand: true,
            cwd: 'dest/' + version,
            src: [ '**' ],
            dest: '/home/polin/github/nodenica/node-documentation-android-pro/app/src/main/assets/en'
          },
          {
            expand: true,
            cwd: 'dest/' + version,
            src: [ '**' ],
            dest: '/home/polin/github/nodenica/node-documentation-android-free/app/src/main/assets/en'
          }
        ],
      },
    }
  });
  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');
  // By default, lint and run all tests.
  grunt.registerTask('default', [
    'docs',
    'copy'
  ]);
};
<commit_msg>5.9.1<commit_after>/*
* grunt-iojs-api-docs
* https://github.com/nodenica/grunt-iojs-api-docs.git
*
* Copyright (c) 2015 Paulo McNally <paulomcnally@gmail.com>
* Licensed under the MIT license.
*/

'use strict';

var version = '5.9.1';

module.exports = function(grunt) {
  // load all npm grunt tasks
  require('load-grunt-tasks')(grunt);
  // Project configuration.
  grunt.initConfig({
    // Configuration to be run (and then tested).
    docs: {
      'default_options': {
        options: {
          version: version,
          dest: './dest/'
        },

      }
    },
    copy: {
      main: {
        files: [
          // includes files within path
          {
            expand: true,
            cwd: 'dest/' + version,
            src: [ '**' ],
            dest: '/home/polin/github/nodenica/node-documentation-android-pro/app/src/main/assets/en'
          },
          {
            expand: true,
            cwd: 'dest/' + version,
            src: [ '**' ],
            dest: '/home/polin/github/nodenica/node-documentation-android-free/app/src/main/assets/en'
          }
        ],
      },
    }
  });
  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');
  // By default, lint and run all tests.
  grunt.registerTask('default', [
    'docs',
    'copy'
  ]);
};
<|endoftext|>


<commit_before>#!/usr/bin/env node
/*!
 * -----------
 * SCGDB®-Data
 * -----------
 * Data of SCGDB — A manually curated dedicated schizosaccharomyces comparative genome database.
 * ______________________________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * ______________________________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ______________________________________________________________________________________________
 *
 * @date      : 18-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * ______________________________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "SCGDB®-Data".
 * ______________________________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";

// To load required Node module.
// -----------------------------
var os         = require('os');
var fs         = require('fs');
<commit_msg>Initial commit<commit_after>#!/usr/bin/env node
/*!
 * -----------
 * SCGDB®-Data
 * -----------
 * Data of SCGDB — A manually curated dedicated schizosaccharomyces comparative genome database.
 * ______________________________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * ______________________________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ______________________________________________________________________________________________
 *
 * @date      : 18-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * ______________________________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "SCGDB®-Data".
 * ______________________________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";

// To load required Node module.
// -----------------------------
var os         = require('os');
var fs         = require('fs');

// To load required NPM modules.
// -----------------------------
var chalk      = require('chalk');
<|endoftext|>


<commit_before>/*
Copyright 2012 Adobe Systems Inc.;
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*global module:false*/

var path = require('path'),
    debug = require('debug')('build'),
    chromiumSrc = process.env.CHROMIUM_SRC;

module.exports = function(grunt) {

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

        topcoat: {
            download: {
                options: {
                    srcPath: "src/",
                    repos: "<%= pkg.topcoat %>"
                }
            }
        },

        unzip: {
            controls: {
                src: "src/controls/*.zip",
                dest: "src/controls"
            },
            theme: {
                src: "src/*.zip",
                dest: "src/"
            }
        },

        //     stylus: getCompileData(grunt),
        //        cssmin: {
        //            minify: {
        //                files: getMinificationData(grunt)
        //            }
        //        },
        clean: {
            src: ['src'],
            release: ['release'],
            docs: ['docs'],
            zip: ['src/*.zip', 'src/controls/*.zip', 'src/**/skins/*.zip']
        },

        copy: {
            dist: {
                files: [{
                    expand: true,
                    flatten: true,
                    src: 'src/**/font/**',
                    dest: 'release/font/'
                }, {
                    expand: true,
                    flatten: true,
                    src: 'src/**/img/*',
                    dest: 'release/img'
                }]
            },
            docs: {
                files: [{
                    expand: true,
                    flatten: true,
                    src: 'src/**/font/**',
                    dest: 'docs/font/'
                }, {
                    expand: true,
                    flatten: true,
                    src: 'src/**/img/*',
                    dest: 'docs/img'
                }]
            }
        },

        /* telemetry task, added here because grunt.js file in subfolder can't load Npm tasks */
        telemetry: {
            files: [{
                expand: true,
                cwd: 'test/perf/telemetry/perf/',
                src: ['**'],
                dest: path.join(chromiumSrc, 'tools/perf/')
            }, {
                src: ['release/**'],
                dest: path.join(chromiumSrc, 'tools/perf/page_sets/topcoat/')
            }, {
                expand: true,
                cwd: 'components/topcoat-button/',
                src: ['release/**'],
                dest: path.join(chromiumSrc, 'tools/perf/page_sets/topcoat/')
            }]
        },

        jade: {
            telemetry: {
                options: {
                    data: {
                        debug: false,
                        pretty: true
                    }
                },
                files: [{ //todo see if expandMapping can be used instead of listing them all - https://github.com/gruntjs/grunt-contrib/issues/95
                    dest: path.join(chromiumSrc, "tools/perf/page_sets/topcoat/topcoat_buttons.html"),
                    src: "test/perf/telemetry/perf/page_sets/topcoat/topcoat_buttons.jade"
                }, {
                    dest: path.join(chromiumSrc, "tools/perf/page_sets/topcoat/topcoat_buttons_no_theme.html"),
                    src: "test/perf/telemetry/perf/page_sets/topcoat/topcoat_buttons_no_theme.jade"
                }]
            }
        },

        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                unused: true,
                boss: true,
                eqnull: true,
                browser: true,
                globals: {
                    jQuery: true
                }
            },
            gruntfile: {
                src: 'Gruntfile.js'
            },
            lib_test: {
                src: ['lib/**/*.js', 'test/**/*.js']
            }
        },

        watch: {
            files: ['src/style/*.styl'],
            tasks: ['stylus']
        },

        styleguide: {
            docs: {
                files: {
                    'docs/styleguide': ['release/css/*.css', '!release/css/*.min.css']
                }
            }
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-stylus');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jade');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-topcoat');
    grunt.loadNpmTasks('grunt-zip');
    grunt.loadNpmTasks('grunt-styleguide');
    grunt.loadNpmTasks('grunt-contrib-cssmin');

    // Default task.
    grunt.registerTask('default', ['clean', 'topcoat', 'unzip', 'clean:zip', 'initStylus', 'stylus', 'initCssmin', 'cssmin', 'copy:dist', 'styleguide', 'copy:docs']);
    grunt.registerTask('dist', ['stylus', 'cssmin', 'copy:dist', 'styleguide', 'copy:docs']);
    grunt.registerTask('docs', ['clean:docs', 'stylus', 'styleguide', 'copy:docs']);

    grunt.registerTask('check_chromium_src', "Internal task to store CHROMIUM_SRC env var into chromiumSrc", function() {
        if (!chromiumSrc) {
            grunt.fail.warn("Please set the CHROMIUM_SRC env var to the root of your chromium sources(ends in /src)");
        } else {
            grunt.log.writeln("CHROMIUM_SRC points to " + chromiumSrc.cyan);
        }
    });

    grunt.registerTask('telemetry', ['check_chromium_src', 'jade:telemetry', 'copy:telemetry']);
    grunt.registerTask('telemetry-submit', 'Submit telemetry test results', function() {

        var exec = require("child_process").exec,
            commandToBeExecuted = 'git log --pretty=format:"%H %ai" | head -n 1',
            done = this.async();

        exec(commandToBeExecuted, function(error, stdout, stderr) {
            if (error) {
                grunt.log.error('Error');
                console.log(error);
                done();
            } else {

                var path = grunt.option('path'),
                    device = grunt.option('device'),
                    test = grunt.option('test');

                if (!path) {
                    console.log('No path file specified');
                    console.log('Usage: grunt telemetry-submit --path=path_to_output_file [--test= Test name ] [--device= Device type ]');
                } else {
                    var submitData = require('./test / perf / telemetry / lib / submitData ');
                    submitData(stdout, path, {
                        device: device,
                        test: test
                    });
                }
            }
        });

    });

    grunt.registerTask('initStylus', 'Re-initializes task data for after assets are loaded', function() {
        debug('INIT STYLUS:', getCompileData(grunt));
        grunt.config('stylus', getCompileData(grunt));
    });

    grunt.registerTask('initCssmin', 'Initializes the cssmin task once files are present', function() {
        debug('INIT CSSMIN:', getMinificationData(grunt));
        grunt.config('cssmin', getMinificationData(grunt));
    });

};

var getMinificationData = function(grunt) {
        var minificationData = {};
        files = grunt.file.expand('release/css/*.css', '!release/css/*.min.css');
        grunt.util._.forEach(files, function(file) {
            minificationData[file.split('.').join('.min.')] = file;
        });

        return minificationData;
    };

var getCompileData = function(grunt) {
        var compileData = {},
            themeFiles = grunt.file.expand('src/**/src/theme-*.styl'),
            stylusPathData = getStylusPathData(grunt);

        grunt.util._.forEach(themeFiles, function(theme) {
            compileData[theme] = {
                options: {
                    paths: stylusPathData,
                    import: getStylusImportData(grunt, theme),
                    compress: false
                },
                files: getStylusFilesData(grunt, theme)
            }
        });

        debug('COMPILE:', compileData);

        return compileData;
    };

var getStylusPathData = function(grunt) {
        var mixinPath = grunt.file.expand('src/controls/**/src/mixins');

        debug("PATH:", mixinPath);

        return mixinPath;
    };

var getStylusImportData = function(grunt, theme) {
        var mixinFiles = grunt.file.expand('src/controls/**/src/mixins/*.styl'),
            importData = mixinFiles.concat([theme]);

        debug("IMPORT:", importData);

        return importData;
    };

var getStylusFilesData = function(grunt, theme) {
        var fileData = {},
            releasePath = 'release/css',
            skinsPath = 'src/**/skins/**/src/*.styl';

        var releaseFile = releasePath + theme.split('/')[3].split('.styl').join('.css'),
            files = [skinsPath, theme];

        fileData['release/css/' + theme.split('/')[3].split('.styl').join('.css')] = files;

        return fileData;
    };
<commit_msg>Removing unused code<commit_after>/*
Copyright 2012 Adobe Systems Inc.;
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/*global module:false*/

var path = require('path'),
    debug = require('debug')('build'),
    chromiumSrc = process.env.CHROMIUM_SRC;

module.exports = function(grunt) {

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

        topcoat: {
            download: {
                options: {
                    srcPath: "src/",
                    repos: "<%= pkg.topcoat %>"
                }
            }
        },

        unzip: {
            controls: {
                src: "src/controls/*.zip",
                dest: "src/controls"
            },
            theme: {
                src: "src/*.zip",
                dest: "src/"
            }
        },

        clean: {
            src: ['src'],
            release: ['release'],
            docs: ['docs'],
            zip: ['src/*.zip', 'src/controls/*.zip', 'src/**/skins/*.zip']
        },

        copy: {
            dist: {
                files: [{
                    expand: true,
                    flatten: true,
                    src: 'src/**/font/**',
                    dest: 'release/font/'
                }, {
                    expand: true,
                    flatten: true,
                    src: 'src/**/img/*',
                    dest: 'release/img'
                }]
            },
            docs: {
                files: [{
                    expand: true,
                    flatten: true,
                    src: 'src/**/font/**',
                    dest: 'docs/font/'
                }, {
                    expand: true,
                    flatten: true,
                    src: 'src/**/img/*',
                    dest: 'docs/img'
                }]
            }
        },

        /* telemetry task, added here because grunt.js file in subfolder can't load Npm tasks */
        telemetry: {
            files: [{
                expand: true,
                cwd: 'test/perf/telemetry/perf/',
                src: ['**'],
                dest: path.join(chromiumSrc, 'tools/perf/')
            }, {
                src: ['release/**'],
                dest: path.join(chromiumSrc, 'tools/perf/page_sets/topcoat/')
            }, {
                expand: true,
                cwd: 'components/topcoat-button/',
                src: ['release/**'],
                dest: path.join(chromiumSrc, 'tools/perf/page_sets/topcoat/')
            }]
        },

        jade: {
            telemetry: {
                options: {
                    data: {
                        debug: false,
                        pretty: true
                    }
                },
                files: [{ //todo see if expandMapping can be used instead of listing them all - https://github.com/gruntjs/grunt-contrib/issues/95
                    dest: path.join(chromiumSrc, "tools/perf/page_sets/topcoat/topcoat_buttons.html"),
                    src: "test/perf/telemetry/perf/page_sets/topcoat/topcoat_buttons.jade"
                }, {
                    dest: path.join(chromiumSrc, "tools/perf/page_sets/topcoat/topcoat_buttons_no_theme.html"),
                    src: "test/perf/telemetry/perf/page_sets/topcoat/topcoat_buttons_no_theme.jade"
                }]
            }
        },

        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                unused: true,
                boss: true,
                eqnull: true,
                browser: true,
                globals: {
                    jQuery: true
                }
            },
            gruntfile: {
                src: 'Gruntfile.js'
            },
            lib_test: {
                src: ['lib/**/*.js', 'test/**/*.js']
            }
        },

        watch: {
            files: ['src/style/*.styl'],
            tasks: ['stylus']
        },

        styleguide: {
            docs: {
                files: {
                    'docs/styleguide': ['release/css/*.css', '!release/css/*.min.css']
                }
            }
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-stylus');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jade');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-topcoat');
    grunt.loadNpmTasks('grunt-zip');
    grunt.loadNpmTasks('grunt-styleguide');
    grunt.loadNpmTasks('grunt-contrib-cssmin');

    // Default task.
    grunt.registerTask('default', ['clean', 'topcoat', 'unzip', 'clean:zip', 'initStylus', 'stylus', 'initCssmin', 'cssmin', 'copy:dist', 'styleguide', 'copy:docs']);
    grunt.registerTask('dist', ['stylus', 'cssmin', 'copy:dist', 'styleguide', 'copy:docs']);
    grunt.registerTask('docs', ['clean:docs', 'stylus', 'styleguide', 'copy:docs']);

    grunt.registerTask('check_chromium_src', "Internal task to store CHROMIUM_SRC env var into chromiumSrc", function() {
        if (!chromiumSrc) {
            grunt.fail.warn("Please set the CHROMIUM_SRC env var to the root of your chromium sources(ends in /src)");
        } else {
            grunt.log.writeln("CHROMIUM_SRC points to " + chromiumSrc.cyan);
        }
    });

    grunt.registerTask('telemetry', ['check_chromium_src', 'jade:telemetry', 'copy:telemetry']);
    grunt.registerTask('telemetry-submit', 'Submit telemetry test results', function() {

        var exec = require("child_process").exec,
            commandToBeExecuted = 'git log --pretty=format:"%H %ai" | head -n 1',
            done = this.async();

        exec(commandToBeExecuted, function(error, stdout, stderr) {
            if (error) {
                grunt.log.error('Error');
                console.log(error);
                done();
            } else {

                var path = grunt.option('path'),
                    device = grunt.option('device'),
                    test = grunt.option('test');

                if (!path) {
                    console.log('No path file specified');
                    console.log('Usage: grunt telemetry-submit --path=path_to_output_file [--test= Test name ] [--device= Device type ]');
                } else {
                    var submitData = require('./test / perf / telemetry / lib / submitData ');
                    submitData(stdout, path, {
                        device: device,
                        test: test
                    });
                }
            }
        });

    });

    grunt.registerTask('initStylus', 'Re-initializes task data for after assets are loaded', function() {
        debug('INIT STYLUS:', getCompileData(grunt));
        grunt.config('stylus', getCompileData(grunt));
    });

    grunt.registerTask('initCssmin', 'Initializes the cssmin task once files are present', function() {
        debug('INIT CSSMIN:', getMinificationData(grunt));
        grunt.config('cssmin', getMinificationData(grunt));
    });

};

var getMinificationData = function(grunt) {
        var minificationData = {};
        files = grunt.file.expand('release/css/*.css', '!release/css/*.min.css');
        grunt.util._.forEach(files, function(file) {
            minificationData[file.split('.').join('.min.')] = file;
        });

        return minificationData;
    };

var getCompileData = function(grunt) {
        var compileData = {},
            themeFiles = grunt.file.expand('src/**/src/theme-*.styl'),
            stylusPathData = getStylusPathData(grunt);

        grunt.util._.forEach(themeFiles, function(theme) {
            compileData[theme] = {
                options: {
                    paths: stylusPathData,
                    import: getStylusImportData(grunt, theme),
                    compress: false
                },
                files: getStylusFilesData(grunt, theme)
            }
        });

        debug('COMPILE:', compileData);

        return compileData;
    };

var getStylusPathData = function(grunt) {
        var mixinPath = grunt.file.expand('src/controls/**/src/mixins');

        debug("PATH:", mixinPath);

        return mixinPath;
    };

var getStylusImportData = function(grunt, theme) {
        var mixinFiles = grunt.file.expand('src/controls/**/src/mixins/*.styl'),
            importData = mixinFiles.concat([theme]);

        debug("IMPORT:", importData);

        return importData;
    };

var getStylusFilesData = function(grunt, theme) {
        var fileData = {},
            releasePath = 'release/css',
            skinsPath = 'src/**/skins/**/src/*.styl';

        var releaseFile = releasePath + theme.split('/')[3].split('.styl').join('.css'),
            files = [skinsPath, theme];

        fileData['release/css/' + theme.split('/')[3].split('.styl').join('.css')] = files;

        return fileData;
    };
<|endoftext|>


<commit_before>/**
 * Gruntfile for freedom.js
 *
 * Here are the common tasks used:
 * build
 *  - Lint and compile freedom.js
 *  - (default Grunt task)
 *  - This must be run before ANY karma task (because of connect:default)
 *  - Unit tests only run on PhantomJS
 * demo
 *  - Build freedom.js, and start a web server for seeing demos at
 *    http://localhost:8000/demo
 * test
 *  - Build freedom.js, and run all unit tests on
 *    Chrome, Firefox, and PhantomJS
 * debug
 *  - Same as test, except keeps the browsers open
 *    and reruns tests on watched file changes.
 *  - Used to debug unit tests
 * ci
 *  - Do everything that Travis CI should do
 *  - Lint, compile, and unit test freedom.js on phantom.js
 *  - Run all tests on saucelabs.com
 *  - Report coverage to coveralls.io
 **/

var FILES = {
  srcCore: [
    'src/*.js',
      'src/link/*.js',
      'src/proxy/*.js',
      'interface/*.js'
  ],
  srcPlatform: [
    'providers/core/*.js'
  ],
  specCoreUnit: [
    'spec/src/*.spec.js'
  ],
  specPlatformUnit: [
    'spec/providers/core/**/*.spec.js'
  ],
  srcProvider: [
    'providers/oauth/*.js',
    'providers/social/websocket-server/*.js',
    'providers/social/loopback/*.js',
    'providers/storage/**/*.js',
    'providers/transport/**/*.js'
  ],
  specProviderUnit: [
    'spec/providers/social/**/*.unit.spec.js',
    'spec/providers/storage/**/*.unit.spec.js',
    'spec/providers/transport/**/*.unit.spec.js'
  ],
  specProviderIntegration: [
    'spec/providers/*.integration.spec.js',
    'spec/providers/storage/*.integration.spec.js'
  ],
  specAll: ['spec/**/*.spec.js'],
  freedom: [
    'freedom.js'
  ]
};

var CUSTOM_LAUNCHER = {
  sauce_chrome_34: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: '34',
    platform: 'OS X 10.9'
  },
  sauce_chrome_33: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: '33',
    platform: 'Windows 7'
  },
  sauce_firefox: {
    base: 'SauceLabs',
    browserName: 'firefox',
    version: '29'
  }
};

module.exports = function (grunt) {
  /**
   * GRUNT CONFIG
   **/
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    karma: {
      options: {
        // NOTE: need to run 'connect:default' to serve files
        configFile: 'karma.conf.js',
      },
      single: { singleRun: true, autoWatch: false },
      watch: {
        singleRun: false,
        autoWatch: true,
        reporters: ['progress', 'story'],
        preprocessors: {},
        coverageReporter: {}
      },
      phantom: {
        browsers: ['PhantomJS'],
        singleRun: true,
        autoWatch: false
      },
      saucelabs: {
        browsers: ['sauce_chrome_34', 'sauce_chrome_33'],//, 'sauce_firefox'],
        singleRun: true,
        autoWatch: false,
        reporters: ['dots', 'saucelabs'],
        sauceLabs: {
          testName: 'freedom.js',
          username: 'freedomjs',
          accessKey: process.env.SAUCEKEY,
          build: process.env.TRAVIS_BUILD_NUMBER,
          tags: [
            '<%= gitinfo.local.branch.current.name %>',
            '<%= gitinfo.local.branch.current.shortSHA %>',
            '<%= gitinfo.local.branch.current.currentUser %>',
            '<%= gitinfo.local.branch.current.lastCommitAuthor %>',
            '<%= gitinfo.local.branch.current.lastCommitTime %>',
          ],
        },
        customLaunchers: CUSTOM_LAUNCHER
      }
    },
    jshint: {
      beforeconcat: {
        files: { src: FILES.srcCore.concat(FILES.srcPlatform) },
        options: {
          jshintrc: true
        }
      },
      providers: FILES.srcProvider,
      demo: ['demo/**/*.js', '!demo/**/third-party/**'],
      options: {
        '-W069': true
      }
    },
    browserify: {
      freedom: {
        files: {
          'freedom.js': ['src/util/workerEntry.js']
        },
        options: {
          transform: ['folderify'],
          postBundleCB: function(err, src, next) {
            next(err, require('fs').readFileSync('src/util/header.txt') + src);
          }
        }
      },
      frame: {
        files: {
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        },
        options: {
          transform: ['folderify']
        }
      },
      jasmine_unit: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit),
        },
        options: {
          transform: ['folderify', ['browserify-istanbul', {
            // Note: bundle must be ignored,
            ignore: ['**/spec/**', '**/providers/**', '**/src/bundle.js']
          }]]
        }
      },
      jasmine_full: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit,
            FILES.specProviderIntegration),
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        },
        options: {
          transform: ['folderify', ['browserify-istanbul', {
            ignore: ['**/spec/**', '**/providers/**', '**/src/bundle.js']
          }]]
        }
      },
      options: {
        ignore: ['ws']
      }
    },
    clean: ['freedom.js', 'freedom.js.map', 'freedom.min.js', 'freedom.min.js.map', 'spec.js', 'spec/helper/frame.js'],
    yuidoc: {
      compile: {
        name: '<%= pkg.name %>',
        description: '<%= pkg.description %>',
        version: '<%= pkg.version %>',
        options: {
          paths: 'src/',
          outdir: 'tools/doc/'
        }
      }
    },
    coveralls: {
      report: {
        src: 'tools/coverage/PhantomJS**/*lcov.info'
      }
    },
    connect: {
      default: {
        options: {
          port: 8000,
          keepalive: false
        }
      },
      keepalive: {
        options: {
          port: 8000,
          keepalive: true
        }
      },
      demo: {
        options: {
          port: 8000,
          keepalive: true,
          base: ["./","demo/"],
          open: "http://localhost:8000/demo/"
        }
      }
    },
    gitinfo: {},
    bump: {
      options: {
        files: ['package.json'],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true,
        pushTo: 'origin'
      }
    },
    'npm-publish': {
      options: {
        // list of tasks that are required before publishing
        requires: [],
        // if the workspace is dirty, abort publishing (to avoid publishing local changes)
        abortIfDirty: true,
      }
    }

  });

  // Load tasks.
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-yuidoc');
  grunt.loadNpmTasks('grunt-coveralls');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-gitinfo');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-npm');

  // Default tasks.
  grunt.registerTask('build', [
    'jshint',
    'browserify:freedom',
    'gitinfo',
  ]);
  grunt.registerTask('unit', [
    'browserify:frame',
    'browserify:jasmine_unit',
    'connect:default',
    'karma:phantom'
  ]);
  grunt.registerTask('test', [
    'jshint',
    'browserify:frame',
    'browserify:jasmine_full',
    'connect:default',
    'karma:single'
  ]);
  grunt.registerTask('debug', [
    'build',
    'connect:default',
    'browserify:jasmine_full',
    'karma:watch'
  ]);
  grunt.registerTask('demo', [
    'browserify:freedom',
    'connect:demo',
  ]);

  if (process.env.TRAVIS_JOB_NUMBER) {
    var jobParts = process.env.TRAVIS_JOB_NUMBER.split('.');
    //When run from Travis from jobs *.1
    if (jobParts.length > 1 && jobParts[1] == '1') {
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_unit',
        'connect:default',
        'karma:phantom',
        'karma:saucelabs',
        'coveralls:report'
      ]);
    } else {  //When run from Travis from jobs *.2, *.3, etc.
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_unit',
        'connect:default',
        'karma:phantom'
      ]);
    }
  } else {  //When run from command-line
    grunt.registerTask('ci', [
      'browserify:frame',
      'browserify:jasmine_unit',
      'connect:default',
      'karma:phantom',
      'karma:saucelabs',
    ]);
  }

  grunt.registerTask('release', function(arg) {
    if (arguments.length === 0) {
      arg = 'patch';
    }
    grunt.task.run([
      'default',
      'bump:'+arg,
      'npm-publish'
    ]);
  });

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

module.exports.FILES = FILES;
module.exports.CUSTOM_LAUNCHER = CUSTOM_LAUNCHER;
<commit_msg>attempts at coverage<commit_after>/**
 * Gruntfile for freedom.js
 *
 * Here are the common tasks used:
 * build
 *  - Lint and compile freedom.js
 *  - (default Grunt task)
 *  - This must be run before ANY karma task (because of connect:default)
 *  - Unit tests only run on PhantomJS
 * demo
 *  - Build freedom.js, and start a web server for seeing demos at
 *    http://localhost:8000/demo
 * test
 *  - Build freedom.js, and run all unit tests on
 *    Chrome, Firefox, and PhantomJS
 * debug
 *  - Same as test, except keeps the browsers open
 *    and reruns tests on watched file changes.
 *  - Used to debug unit tests
 * ci
 *  - Do everything that Travis CI should do
 *  - Lint, compile, and unit test freedom.js on phantom.js
 *  - Run all tests on saucelabs.com
 *  - Report coverage to coveralls.io
 **/

var FILES = {
  srcCore: [
    'src/*.js',
      'src/link/*.js',
      'src/proxy/*.js',
      'interface/*.js'
  ],
  srcPlatform: [
    'providers/core/*.js'
  ],
  specCoreUnit: [
    'spec/src/*.spec.js'
  ],
  specPlatformUnit: [
    'spec/providers/core/**/*.spec.js'
  ],
  srcProvider: [
    'providers/oauth/*.js',
    'providers/social/websocket-server/*.js',
    'providers/social/loopback/*.js',
    'providers/storage/**/*.js',
    'providers/transport/**/*.js'
  ],
  specProviderUnit: [
    'spec/providers/social/**/*.unit.spec.js',
    'spec/providers/storage/**/*.unit.spec.js',
    'spec/providers/transport/**/*.unit.spec.js'
  ],
  specProviderIntegration: [
    'spec/providers/*.integration.spec.js',
    'spec/providers/storage/*.integration.spec.js'
  ],
  specAll: ['spec/**/*.spec.js'],
  freedom: [
    'freedom.js'
  ]
};

var CUSTOM_LAUNCHER = {
  sauce_chrome_34: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: '34',
    platform: 'OS X 10.9'
  },
  sauce_chrome_33: {
    base: 'SauceLabs',
    browserName: 'chrome',
    version: '33',
    platform: 'Windows 7'
  },
  sauce_firefox: {
    base: 'SauceLabs',
    browserName: 'firefox',
    version: '29'
  }
};

module.exports = function (grunt) {
  /**
   * GRUNT CONFIG
   **/
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    karma: {
      options: {
        // NOTE: need to run 'connect:default' to serve files
        configFile: 'karma.conf.js',
      },
      single: { singleRun: true, autoWatch: false },
      watch: {
        singleRun: false,
        autoWatch: true,
        reporters: ['progress', 'story'],
        preprocessors: {},
        coverageReporter: {}
      },
      phantom: {
        browsers: ['PhantomJS'],
        singleRun: true,
        autoWatch: false
      },
      saucelabs: {
        browsers: ['sauce_chrome_34', 'sauce_chrome_33'],//, 'sauce_firefox'],
        singleRun: true,
        autoWatch: false,
        reporters: ['dots', 'saucelabs'],
        sauceLabs: {
          testName: 'freedom.js',
          username: 'freedomjs',
          accessKey: process.env.SAUCEKEY,
          build: process.env.TRAVIS_BUILD_NUMBER,
          tags: [
            '<%= gitinfo.local.branch.current.name %>',
            '<%= gitinfo.local.branch.current.shortSHA %>',
            '<%= gitinfo.local.branch.current.currentUser %>',
            '<%= gitinfo.local.branch.current.lastCommitAuthor %>',
            '<%= gitinfo.local.branch.current.lastCommitTime %>',
          ],
        },
        customLaunchers: CUSTOM_LAUNCHER
      }
    },
    jshint: {
      beforeconcat: {
        files: { src: FILES.srcCore.concat(FILES.srcPlatform) },
        options: {
          jshintrc: true
        }
      },
      providers: FILES.srcProvider,
      demo: ['demo/**/*.js', '!demo/**/third-party/**'],
      options: {
        '-W069': true
      }
    },
    browserify: {
      freedom: {
        files: {
          'freedom.js': ['src/util/workerEntry.js']
        },
        options: {
          transform: ['folderify'],
          postBundleCB: function(err, src, next) {
            next(err, require('fs').readFileSync('src/util/header.txt') + src);
          }
        }
      },
      frame: {
        files: {
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        },
        options: {
          transform: ['folderify']
        }
      },
      jasmine_unit: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit),
        },
        options: {
          transform: ['folderify']
        }
      },
      jasmine_coverage: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit),
        },
        options: {
          transform: ['folderify', ['browserify-istanbul', {
            // Note: bundle must be ignored,
            ignore: ['**/spec/**', '**/providers/**', '**/src/bundle.js']
          }]]
        }
      },
      jasmine_full: {
        files: {
          'spec.js': FILES.specCoreUnit.concat(
            FILES.specPlatformUnit,
            FILES.specProviderUnit,
            FILES.specProviderIntegration),
          'spec/helper/frame.js': ['src/util/frameEntry.js']
        },
        options: {
          transform: ['folderify']
        }
      },
      options: {
        ignore: ['ws']
      }
    },
    clean: ['freedom.js', 'freedom.js.map', 'freedom.min.js', 'freedom.min.js.map', 'spec.js', 'spec/helper/frame.js'],
    yuidoc: {
      compile: {
        name: '<%= pkg.name %>',
        description: '<%= pkg.description %>',
        version: '<%= pkg.version %>',
        options: {
          paths: 'src/',
          outdir: 'tools/doc/'
        }
      }
    },
    coveralls: {
      report: {
        src: 'tools/coverage/PhantomJS**/*lcov.info'
      }
    },
    connect: {
      default: {
        options: {
          port: 8000,
          keepalive: false
        }
      },
      keepalive: {
        options: {
          port: 8000,
          keepalive: true
        }
      },
      demo: {
        options: {
          port: 8000,
          keepalive: true,
          base: ["./","demo/"],
          open: "http://localhost:8000/demo/"
        }
      }
    },
    gitinfo: {},
    bump: {
      options: {
        files: ['package.json'],
        commit: true,
        commitMessage: 'Release v%VERSION%',
        commitFiles: ['package.json'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: true,
        pushTo: 'origin'
      }
    },
    'npm-publish': {
      options: {
        // list of tasks that are required before publishing
        requires: [],
        // if the workspace is dirty, abort publishing (to avoid publishing local changes)
        abortIfDirty: true,
      }
    }

  });

  // Load tasks.
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-yuidoc');
  grunt.loadNpmTasks('grunt-coveralls');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-gitinfo');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-npm');

  // Default tasks.
  grunt.registerTask('build', [
    'jshint',
    'browserify:freedom',
    'gitinfo',
  ]);
  grunt.registerTask('unit', [
    'browserify:frame',
    'browserify:jasmine_unit',
    'connect:default',
    'karma:phantom'
  ]);
  grunt.registerTask('test', [
    'jshint',
    'browserify:frame',
    'browserify:jasmine_full',
    'connect:default',
    'karma:single'
  ]);
  grunt.registerTask('debug', [
    'build',
    'connect:default',
    'browserify:jasmine_full',
    'karma:watch'
  ]);
  grunt.registerTask('demo', [
    'browserify:freedom',
    'connect:demo',
  ]);

  if (process.env.TRAVIS_JOB_NUMBER) {
    var jobParts = process.env.TRAVIS_JOB_NUMBER.split('.');
    //When run from Travis from jobs *.1
    if (jobParts.length > 1 && jobParts[1] == '1') {
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_coverage',
        'connect:default',
        'karma:phantom',
        'karma:saucelabs',
        'coveralls:report'
      ]);
    } else {  //When run from Travis from jobs *.2, *.3, etc.
      grunt.registerTask('ci', [
        'browserify:frame',
        'browserify:jasmine_unit',
        'connect:default',
        'karma:phantom'
      ]);
    }
  } else {  //When run from command-line
    grunt.registerTask('ci', [
      'browserify:frame',
      'browserify:jasmine_unit',
      'connect:default',
      'karma:phantom',
      'karma:saucelabs',
    ]);
  }

  grunt.registerTask('release', function(arg) {
    if (arguments.length === 0) {
      arg = 'patch';
    }
    grunt.task.run([
      'default',
      'bump:'+arg,
      'npm-publish'
    ]);
  });

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

module.exports.FILES = FILES;
module.exports.CUSTOM_LAUNCHER = CUSTOM_LAUNCHER;
<|endoftext|>