<commit_before>/*!
 * Bootstrap's Gruntfile
 * http://getbootstrap.com
 * Copyright 2013-2014 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */

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

  // Force use of Unix newlines
  grunt.util.linefeed = '\n';

  RegExp.quote = function (string) {
    return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
  };

  var fs = require('fs');
  var path = require('path');
  var BsLessdocParser = require('./grunt/bs-lessdoc-parser.js');
  var generateRawFiles = require('./grunt/bs-raw-files-generator.js');

  // Project configuration.
  grunt.initConfig({

    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * TODC Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',
    // NOTE: This jqueryCheck code is duplicated in customizer.js; if making changes here, be sure to update the other copy too.
    jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n',

    // Bootstrap variables
    bootstrapDir: 'bootstrap',
    bootstrapGit: 'https://github.com/twbs/bootstrap.git',
    bootstrapVersion: 'v3.1.1',

    // Task configuration.
    clean: {
      dist: ['dist', 'docs/dist']
    },

    jshint: {
      options: {
        jshintrc: 'js/.jshintrc'
      },
      grunt: {
        options: {
          jshintrc: 'grunt/.jshintrc'
        },
        src: ['Gruntfile.js', 'grunt/*.js']
      },
      assets: {
        src: ['docs/assets/js/src/*.js', 'docs/assets/js/*.js', '!docs/assets/js/*.min.js']
      }
    },

    jscs: {
      options: {
        config: 'js/.jscsrc'
      },
      grunt: {
        src: '<%= jshint.grunt.src %>'
      },
      assets: {
        options: {
          requireCamelCaseOrUpperCaseIdentifiers: null
        },
        src: '<%= jshint.assets.src %>'
      }
    },

    uglify: {
      options: {
        preserveComments: 'some'
      },
      docsJs: {
        // NOTE: This src list is duplicated in footer.html; if making changes here, be sure to update the other copy too.
        src: [
          'docs/assets/js/vendor/select2.js',
          'docs/assets/js/vendor/holder.js',
          'docs/assets/js/vendor/ZeroClipboard.min.js',
          'docs/assets/js/src/application.js'
        ],
        dest: 'docs/assets/js/docs.min.js'
      }
    },

    less: {
      compileCore: {
        options: {
          strictMath: true,
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapURL: '<%= pkg.name %>.css.map',
          sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
        },
        src: 'less/todc-bootstrap.less',
        dest: 'dist/css/<%= pkg.name %>.css'
      }
    },

    autoprefixer: {
      options: {
        browsers: [
          'Android 2.3',
          'Android >= 4',
          'Chrome >= 20',
          'Firefox >= 24', // Firefox 24 is the latest ESR
          'Explorer >= 8',
          'iOS >= 6',
          'Opera >= 12',
          'Safari >= 6'
        ]
      },
      core: {
        options: {
          map: true
        },
        src: 'dist/css/<%= pkg.name %>.css'
      },
      docs: {
        src: 'docs/assets/css/src/docs.css'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      }
    },

    csslint: {
      options: {
        csslintrc: 'less/.csslintrc'
      },
      src: [
        'dist/css/todc-bootstrap.css'
      ],
      examples: [
        'docs/examples/**/*.css'
      ],
      docs: {
        options: {
          ids: false,
          'overqualified-elements': false
        },
        src: 'docs/assets/css/src/docs.css'
      }
    },

    cssmin: {
      options: {
        compatibility: 'ie8',
        keepSpecialComments: '*',
        noAdvanced: true

      },
      core: {
        files: {
          'dist/css/<%= pkg.name %>.min.css': 'dist/css/<%= pkg.name %>.css'
        }
      },
      docs: {
        src: [
          'docs/assets/css/src/docs.css',
          'docs/assets/css/src/pygments-manni.css',
          'docs/assets/css/src/select2.css'
        ],
        dest: 'docs/assets/css/docs.min.css'
      }
    },

    usebanner: {
      options: {
        position: 'top',
        banner: '<%= banner %>'
      },
      files: {
        src: 'dist/css/*.css'
      }
    },

    csscomb: {
      options: {
        config: 'less/.csscomb.json'
      },
      dist: {
        expand: true,
        cwd: 'dist/css/',
        src: ['*.css', '!*.min.css'],
        dest: 'dist/css/'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      },
      docs: {
        src: 'docs/assets/css/src/docs.css',
        dest: 'docs/assets/css/src/docs.css'
      }
    },

    copy: {
      bootstrap: {
        expand: true,
        flatten: false,
        cwd: '<%= bootstrapDir %>/dist',
        src: '**',
        dest: 'dist'
      },
      images: {
        expand: true,
        src: 'img/*',
        dest: 'dist'
      },
      docs: {
        expand: true,
        cwd: './dist',
        src: [
          'css/*',
          'js/*',
          'fonts/*',
          'img/*'
        ],
        dest: 'docs/dist'
      }
    },

    compress: {
      main: {
        options: {
          archive: 'dist/<%= pkg.name %>-<%= pkg.version %>-dist.zip',
          mode: 'zip',
          pretty: true
        },
        expand: true,
        cwd: 'dist',
        src: '**',
        dest: 'todc-bootstrap/'
      }
    },

    jekyll: {
      docs: {}
    },

    jade: {
      compile: {
        options: {
          pretty: true,
          data: function () {
            var filePath = path.join(__dirname, 'less/variables.less');
            var fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
            var parser = new BsLessdocParser(fileContent);
            return { sections: parser.parseFile() };
          }
        },
        files: {
          'docs/_includes/customizer-variables.html': 'docs/_jade/customizer-variables.jade',
          'docs/_includes/nav/customize.html': 'docs/_jade/customizer-nav.jade'
        }
      }
    },

    validation: {
      options: {
        charset: 'utf-8',
        doctype: 'HTML5',
        failHard: true,
        reset: true,
        relaxerror: [
          'Bad value X-UA-Compatible for attribute http-equiv on element meta.',
          'Element img is missing required attribute src.',
          'Attribute autocomplete not allowed on element input at this point.',
          'Attribute autocomplete not allowed on element button at this point.'
        ]
      },
      files: {
        src: '_gh_pages/**/*.html'
      }
    },

    watch: {
      less: {
        files: 'less/**/*.less',
        tasks: 'less'
      }
    },

    // checkout-bootstrap task
    shell: {
      gitclone: {
        command: 'git clone <%= bootstrapGit %> <%= bootstrapDir %>'
      },
      gitcheckout: {
        command: 'git checkout tags/<%= bootstrapVersion %>',
        options: {
          execOptions: {
            cwd: '<%= bootstrapDir %>'
          }
        }
      }
    },

    sed: {
      versionNumber: {
        pattern: (function () {
          var old = grunt.option('oldver');
          return old ? RegExp.quote(old) : old;
        })(),
        replacement: grunt.option('newver'),
        recursive: true
      }
    }
  });

  // These plugins provide necessary tasks.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
  require('time-grunt')(grunt);

  // Clone bootstrap and checkout the appropriate tag task.
  grunt.registerTask('checkout-bootstrap', 'shell');

  // Docs HTML validation task
  grunt.registerTask('validate-html', ['jekyll', 'validation']);

  // Test task.
  // var testSubtasks = ['dist-css', 'csslint', 'jshint', 'jscs', 'validate-html', 'build-customizer-html'];
  var testSubtasks = ['dist-css', 'csslint', 'jshint', 'jscs', 'validate-html'];
  grunt.registerTask('test', testSubtasks);

  // JS distribution task.
  grunt.registerTask('dist-js', 'uglify');

  // CSS distribution task.
  grunt.registerTask('less-compile', ['less:compileCore']);
  grunt.registerTask('dist-css', ['less-compile', 'autoprefixer', 'usebanner', 'csscomb', 'cssmin', 'dist-docs']);

  // Docs distribution task.
  grunt.registerTask('dist-docs', 'copy:docs');

  // Full distribution task.
  // grunt.registerTask('dist', ['clean', 'dist-css', 'dist-fonts', 'dist-js']);
  grunt.registerTask('dist', ['clean', 'dist-css', 'copy', 'dist-js']);

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

  // Version numbering task.
  // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
  // This can be overzealous, so its changes should always be manually reviewed!
  grunt.registerTask('change-version-number', 'sed');

  // task for building customizer
  grunt.registerTask('build-customizer', ['build-customizer-html', 'build-raw-files']);
  grunt.registerTask('build-customizer-html', 'jade');
  grunt.registerTask('build-raw-files', 'Add scripts/less files to customizer.', function () {
    var banner = grunt.template.process('<%= banner %>');
    generateRawFiles(grunt, banner);
  });
};
<commit_msg>Gruntfile: switch cssmin & jade tasks from `files` over to `src` & `dest`<commit_after>/*!
 * Bootstrap's Gruntfile
 * http://getbootstrap.com
 * Copyright 2013-2014 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */

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

  // Force use of Unix newlines
  grunt.util.linefeed = '\n';

  RegExp.quote = function (string) {
    return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
  };

  var fs = require('fs');
  var path = require('path');
  var BsLessdocParser = require('./grunt/bs-lessdoc-parser.js');
  var getLessVarsData = function () {
    var filePath = path.join(__dirname, 'less/variables.less');
    var fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
    var parser = new BsLessdocParser(fileContent);
    return { sections: parser.parseFile() };
  };
  var generateRawFiles = require('./grunt/bs-raw-files-generator.js');

  // Project configuration.
  grunt.initConfig({

    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * TODC Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',
    // NOTE: This jqueryCheck code is duplicated in customizer.js; if making changes here, be sure to update the other copy too.
    jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n',

    // Bootstrap variables
    bootstrapDir: 'bootstrap',
    bootstrapGit: 'https://github.com/twbs/bootstrap.git',
    bootstrapVersion: 'v3.1.1',

    // Task configuration.
    clean: {
      dist: ['dist', 'docs/dist']
    },

    jshint: {
      options: {
        jshintrc: 'js/.jshintrc'
      },
      grunt: {
        options: {
          jshintrc: 'grunt/.jshintrc'
        },
        src: ['Gruntfile.js', 'grunt/*.js']
      },
      assets: {
        src: ['docs/assets/js/src/*.js', 'docs/assets/js/*.js', '!docs/assets/js/*.min.js']
      }
    },

    jscs: {
      options: {
        config: 'js/.jscsrc'
      },
      grunt: {
        src: '<%= jshint.grunt.src %>'
      },
      assets: {
        options: {
          requireCamelCaseOrUpperCaseIdentifiers: null
        },
        src: '<%= jshint.assets.src %>'
      }
    },

    uglify: {
      options: {
        preserveComments: 'some'
      },
      docsJs: {
        // NOTE: This src list is duplicated in footer.html; if making changes here, be sure to update the other copy too.
        src: [
          'docs/assets/js/vendor/select2.js',
          'docs/assets/js/vendor/holder.js',
          'docs/assets/js/vendor/ZeroClipboard.min.js',
          'docs/assets/js/src/application.js'
        ],
        dest: 'docs/assets/js/docs.min.js'
      }
    },

    less: {
      compileCore: {
        options: {
          strictMath: true,
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapURL: '<%= pkg.name %>.css.map',
          sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
        },
        src: 'less/todc-bootstrap.less',
        dest: 'dist/css/<%= pkg.name %>.css'
      }
    },

    autoprefixer: {
      options: {
        browsers: [
          'Android 2.3',
          'Android >= 4',
          'Chrome >= 20',
          'Firefox >= 24', // Firefox 24 is the latest ESR
          'Explorer >= 8',
          'iOS >= 6',
          'Opera >= 12',
          'Safari >= 6'
        ]
      },
      core: {
        options: {
          map: true
        },
        src: 'dist/css/<%= pkg.name %>.css'
      },
      docs: {
        src: 'docs/assets/css/src/docs.css'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      }
    },

    csslint: {
      options: {
        csslintrc: 'less/.csslintrc'
      },
      src: [
        'dist/css/todc-bootstrap.css'
      ],
      examples: [
        'docs/examples/**/*.css'
      ],
      docs: {
        options: {
          ids: false,
          'overqualified-elements': false
        },
        src: 'docs/assets/css/src/docs.css'
      }
    },

    cssmin: {
      options: {
        compatibility: 'ie8',
        keepSpecialComments: '*',
        noAdvanced: true

      },
      minifyCore: {
        src: 'dist/css/<%= pkg.name %>.css',
        dest: 'dist/css/<%= pkg.name %>.min.css'
      },
      docs: {
        src: [
          'docs/assets/css/src/docs.css',
          'docs/assets/css/src/pygments-manni.css',
          'docs/assets/css/src/select2.css'
        ],
        dest: 'docs/assets/css/docs.min.css'
      }
    },

    usebanner: {
      options: {
        position: 'top',
        banner: '<%= banner %>'
      },
      files: {
        src: 'dist/css/*.css'
      }
    },

    csscomb: {
      options: {
        config: 'less/.csscomb.json'
      },
      dist: {
        expand: true,
        cwd: 'dist/css/',
        src: ['*.css', '!*.min.css'],
        dest: 'dist/css/'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      },
      docs: {
        src: 'docs/assets/css/src/docs.css',
        dest: 'docs/assets/css/src/docs.css'
      }
    },

    copy: {
      bootstrap: {
        expand: true,
        flatten: false,
        cwd: '<%= bootstrapDir %>/dist',
        src: '**',
        dest: 'dist'
      },
      images: {
        expand: true,
        src: 'img/*',
        dest: 'dist'
      },
      docs: {
        expand: true,
        cwd: './dist',
        src: [
          'css/*',
          'js/*',
          'fonts/*',
          'img/*'
        ],
        dest: 'docs/dist'
      }
    },

    compress: {
      main: {
        options: {
          archive: 'dist/<%= pkg.name %>-<%= pkg.version %>-dist.zip',
          mode: 'zip',
          pretty: true
        },
        expand: true,
        cwd: 'dist',
        src: '**',
        dest: 'todc-bootstrap/'
      }
    },

    jekyll: {
      docs: {}
    },

    jade: {
      options: {
        pretty: true,
        data: getLessVarsData
      },
      customizerVars: {
        src: 'docs/_jade/customizer-variables.jade',
        dest: 'docs/_includes/customizer-variables.html'
      },
      customizerNav: {
        src: 'docs/_jade/customizer-nav.jade',
        dest: 'docs/_includes/nav/customize.html'
      }
    },

    validation: {
      options: {
        charset: 'utf-8',
        doctype: 'HTML5',
        failHard: true,
        reset: true,
        relaxerror: [
          'Bad value X-UA-Compatible for attribute http-equiv on element meta.',
          'Element img is missing required attribute src.',
          'Attribute autocomplete not allowed on element input at this point.',
          'Attribute autocomplete not allowed on element button at this point.'
        ]
      },
      files: {
        src: '_gh_pages/**/*.html'
      }
    },

    watch: {
      less: {
        files: 'less/**/*.less',
        tasks: 'less'
      }
    },

    // checkout-bootstrap task
    shell: {
      gitclone: {
        command: 'git clone <%= bootstrapGit %> <%= bootstrapDir %>'
      },
      gitcheckout: {
        command: 'git checkout tags/<%= bootstrapVersion %>',
        options: {
          execOptions: {
            cwd: '<%= bootstrapDir %>'
          }
        }
      }
    },

    sed: {
      versionNumber: {
        pattern: (function () {
          var old = grunt.option('oldver');
          return old ? RegExp.quote(old) : old;
        })(),
        replacement: grunt.option('newver'),
        recursive: true
      }
    }
  });

  // These plugins provide necessary tasks.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
  require('time-grunt')(grunt);

  // Clone bootstrap and checkout the appropriate tag task.
  grunt.registerTask('checkout-bootstrap', 'shell');

  // Docs HTML validation task
  grunt.registerTask('validate-html', ['jekyll', 'validation']);

  // Test task.
  // var testSubtasks = ['dist-css', 'csslint', 'jshint', 'jscs', 'validate-html', 'build-customizer-html'];
  var testSubtasks = ['dist-css', 'csslint', 'jshint', 'jscs', 'validate-html'];
  grunt.registerTask('test', testSubtasks);

  // JS distribution task.
  grunt.registerTask('dist-js', 'uglify');

  // CSS distribution task.
  grunt.registerTask('less-compile', ['less:compileCore']);
  grunt.registerTask('dist-css', ['less-compile', 'autoprefixer', 'usebanner', 'csscomb', 'cssmin', 'dist-docs']);

  // Docs distribution task.
  grunt.registerTask('dist-docs', 'copy:docs');

  // Full distribution task.
  // grunt.registerTask('dist', ['clean', 'dist-css', 'dist-fonts', 'dist-js']);
  grunt.registerTask('dist', ['clean', 'dist-css', 'copy', 'dist-js']);

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

  // Version numbering task.
  // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
  // This can be overzealous, so its changes should always be manually reviewed!
  grunt.registerTask('change-version-number', 'sed');

  // task for building customizer
  grunt.registerTask('build-customizer', ['build-customizer-html', 'build-raw-files']);
  grunt.registerTask('build-customizer-html', 'jade');
  grunt.registerTask('build-raw-files', 'Add scripts/less files to customizer.', function () {
    var banner = grunt.template.process('<%= banner %>');
    generateRawFiles(grunt, banner);
  });
};
<|endoftext|>


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

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    ts: {
      browser: {
        src: ['src/browser/**/*.ts', 'spec/browser/**/*.ts'],
        outDir: 'build',
        options: {
          module: 'commonjs',
          sourceMap: true
        }
      },
      cli: {
        src: ['src/cli/**/*.ts', 'spec/cli/**/*.ts'],
        outDir: 'build',
        options: {
          module: 'commonjs',
          sourceMap: true
        }
      }
    },

    typescript: {
      browser: {
        src: ['src/browser/**/*.ts', 'spec/browser/**/*.ts'],
        dest: 'build',
        options: {
          module: 'commonjs'
        }
      },
      cli: {
        src: ['src/cli/**/*.ts', 'spec/cli/**/*.ts'],
        dest: 'build',
        options: {
          module: 'commonjs'
        }
      }
    },
    browserify: {
      browser: {
        files: {
          'build/src/darwin-browser.js': ['build/src/browser/**/*.js']
        }
      }
    },
    karma: {
      browser: {
        configFile: 'karma.conf.js',
        singleRun: true,
        browsers: ['PhantomJS']
      }
    },
    jasmine_node: {
      projectRoot: "build/spec/cli"
    }
  });

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-typescript');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-jasmine-node');

  grunt.registerTask('default', 'Building everything...', function() {
    grunt.task.run('browser');
    grunt.task.run('cli');
  });

  grunt.registerTask('browser', 'Build browser scripts...', function() {
    grunt.task.run('ts:browser');
    grunt.task.run('browserify:browser');
    grunt.task.run('karma:browser');
  });

  grunt.registerTask('cli', 'Build cli scripts...', function() {
    grunt.task.run('typescript:cli');
    grunt.task.run('jasmine_node');
  });

}<commit_msg>Fixed bad line in Gruntfile<commit_after>
module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    ts: {
      browser: {
        src: ['src/browser/**/*.ts', 'spec/browser/**/*.ts'],
        outDir: 'build',
        options: {
          module: 'commonjs',
          sourceMap: true
        }
      },
      cli: {
        src: ['src/cli/**/*.ts', 'spec/cli/**/*.ts'],
        outDir: 'build',
        options: {
          module: 'commonjs',
          sourceMap: true
        }
      }
    },

    typescript: {
      browser: {
        src: ['src/browser/**/*.ts', 'spec/browser/**/*.ts'],
        dest: 'build',
        options: {
          module: 'commonjs'
        }
      },
      cli: {
        src: ['src/cli/**/*.ts', 'spec/cli/**/*.ts'],
        dest: 'build',
        options: {
          module: 'commonjs'
        }
      }
    },
    browserify: {
      browser: {
        files: {
          'build/src/darwin-browser.js': ['build/src/browser/**/*.js']
        }
      }
    },
    karma: {
      browser: {
        configFile: 'karma.conf.js',
        singleRun: true,
        browsers: ['PhantomJS']
      }
    },
    jasmine_node: {
      projectRoot: "build/spec/cli"
    }
  });

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-typescript');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-jasmine-node');

  grunt.registerTask('default', 'Building everything...', function() {
    grunt.task.run('browser');
    grunt.task.run('cli');
  });

  grunt.registerTask('browser', 'Build browser scripts...', function() {
    grunt.task.run('typescript:browser');
    grunt.task.run('browserify:browser');
    grunt.task.run('karma:browser');
  });

  grunt.registerTask('cli', 'Build cli scripts...', function() {
    grunt.task.run('typescript:cli');
    grunt.task.run('jasmine_node');
  });

}<|endoftext|>


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

  var jsFiles = [
    'src/artoo.js',
    'src/plugins/jquery.simulate.js',
    'src/artoo.beep.js',
    'src/artoo.settings.js',
    'src/artoo.helpers.js',
    'src/artoo.hooks.js',
    'src/artoo.console.js',
    'src/artoo.injection.js',
    'src/artoo.countermeasures.js',
    'src/methods/artoo.methods.cache.js',
    'src/methods/artoo.methods.ajaxSpider.js',
    'src/methods/artoo.methods.autoExpand.js',
    'src/methods/artoo.methods.autoScroll.js',
    'src/methods/artoo.methods.instructions.js',
    'src/methods/artoo.methods.navigate.js',
    'src/methods/artoo.methods.save.js',
    'src/methods/artoo.methods.scrape.js',
    'src/methods/artoo.methods.store.js',
    'src/methods/artoo.methods.state.js',
    'src/artoo.init.js'
  ];

  function lintFilter(i) {
    return !~i.indexOf('plugins');
  }

  // Project configuration:
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    closureLint: {
      app: {
        closureLinterPath: '/usr/local/bin',
        command: 'gjslint',
        src: jsFiles.filter(lintFilter),
        options: {
          stdout: true,
          strict: true,
          opt: '--disable 6,13,110'
        }
      }
    },
    jshint: {
      all: jsFiles.filter(lintFilter),
      options: {
        '-W055': true,
        '-W040': true,
        '-W064': true,
        '-W061': true,
        '-W103': true,
        '-W002': true
      }
    },
    uglify: {
      prod: {
        files: {
          'build/artoo.min.js': jsFiles
        },
        options: {
          banner: '/* artoo.js - <%= pkg.description %> - Version: <%= pkg.version %> -  medialab SciencesPo */\n'
        }
      }
    },
    concat: {
      options: {
        separator: '\n'
      },
      dist: {
        src: jsFiles,
        dest: 'build/artoo.concat.js'
      }
    },
    watch: {
      script: {
        files: jsFiles,
        tasks: ['concat', 'uglify:prod']
      }
    },
    sed: {
      version: {
        recursive: true,
        path: 'test/',
        pattern: /<!-- START ARTOO IMPORTS -->[\s\S]*<!-- END ARTOO IMPORTS -->/g,
        replacement: ['<!-- START ARTOO IMPORTS -->'].concat(jsFiles.slice(0, -1).map(function(path) {
          return '  <script src="../' + path + '"></script>';
        }).concat('  <!-- END ARTOO IMPORTS -->')).join('\n')
      }
    },
    qunit: {
      all: {
        options: {
          urls: [
            './test/unit.html'
          ]
        }
      }
    },
    artoo: {
      dev: {
        options: {
          random: true,
          loadingText: null,
          url: '//localhost:8000/build/artoo.concat.js',
          settings: {
            debug: true,
            reload: true
          }
        },
        dest: './build/bookmarklet.dev.min.js'
      },
      prod: {
        options: {
          clipboard: false
        },
        dest: './build/bookmarklet.prod.min.js'
      }
    }
  });

  // Loading modules
  grunt.loadNpmTasks('grunt-closure-linter');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-artoo');
  grunt.loadNpmTasks('grunt-sed');

  // Default tasks
  grunt.registerTask(
    'default',
    [
      'closureLint',
      'jshint',
      'concat',
      'uglify',
      'sed',
      'qunit'
    ]
  );

  grunt.registerTask('bookmarklets', ['artoo']);
  grunt.registerTask('work', ['concat', 'watch:script']);
};
<commit_msg>Author in header<commit_after>module.exports = function(grunt) {

  var jsFiles = [
    'src/artoo.js',
    'src/plugins/jquery.simulate.js',
    'src/artoo.beep.js',
    'src/artoo.settings.js',
    'src/artoo.helpers.js',
    'src/artoo.hooks.js',
    'src/artoo.console.js',
    'src/artoo.injection.js',
    'src/artoo.countermeasures.js',
    'src/methods/artoo.methods.cache.js',
    'src/methods/artoo.methods.ajaxSpider.js',
    'src/methods/artoo.methods.autoExpand.js',
    'src/methods/artoo.methods.autoScroll.js',
    'src/methods/artoo.methods.instructions.js',
    'src/methods/artoo.methods.navigate.js',
    'src/methods/artoo.methods.save.js',
    'src/methods/artoo.methods.scrape.js',
    'src/methods/artoo.methods.store.js',
    'src/methods/artoo.methods.state.js',
    'src/artoo.init.js'
  ];

  function lintFilter(i) {
    return !~i.indexOf('plugins');
  }

  // Project configuration:
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    closureLint: {
      app: {
        closureLinterPath: '/usr/local/bin',
        command: 'gjslint',
        src: jsFiles.filter(lintFilter),
        options: {
          stdout: true,
          strict: true,
          opt: '--disable 6,13,110'
        }
      }
    },
    jshint: {
      all: jsFiles.filter(lintFilter),
      options: {
        '-W055': true,
        '-W040': true,
        '-W064': true,
        '-W061': true,
        '-W103': true,
        '-W002': true
      }
    },
    uglify: {
      prod: {
        files: {
          'build/artoo.min.js': jsFiles
        },
        options: {
          banner: '/* artoo.js - <%= pkg.description %> - Version: <%= pkg.version %> - Author: <%= pkg.author.name %> - medialab SciencesPo */\n'
        }
      }
    },
    concat: {
      options: {
        separator: '\n'
      },
      dist: {
        src: jsFiles,
        dest: 'build/artoo.concat.js'
      }
    },
    watch: {
      script: {
        files: jsFiles,
        tasks: ['concat', 'uglify:prod']
      }
    },
    sed: {
      version: {
        recursive: true,
        path: 'test/',
        pattern: /<!-- START ARTOO IMPORTS -->[\s\S]*<!-- END ARTOO IMPORTS -->/g,
        replacement: ['<!-- START ARTOO IMPORTS -->'].concat(jsFiles.slice(0, -1).map(function(path) {
          return '  <script src="../' + path + '"></script>';
        }).concat('  <!-- END ARTOO IMPORTS -->')).join('\n')
      }
    },
    qunit: {
      all: {
        options: {
          urls: [
            './test/unit.html'
          ]
        }
      }
    },
    artoo: {
      dev: {
        options: {
          random: true,
          loadingText: null,
          url: '//localhost:8000/build/artoo.concat.js',
          settings: {
            debug: true,
            reload: true
          }
        },
        dest: './build/bookmarklet.dev.min.js'
      },
      prod: {
        options: {
          clipboard: false
        },
        dest: './build/bookmarklet.prod.min.js'
      }
    }
  });

  // Loading modules
  grunt.loadNpmTasks('grunt-closure-linter');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-artoo');
  grunt.loadNpmTasks('grunt-sed');

  // Default tasks
  grunt.registerTask(
    'default',
    [
      'closureLint',
      'jshint',
      'concat',
      'uglify',
      'sed',
      'qunit'
    ]
  );

  grunt.registerTask('bookmarklets', ['artoo']);
  grunt.registerTask('work', ['concat', 'watch:script']);
};
<|endoftext|>


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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            main: {
                src: 'static/js/<%= pkg.name %>.js',
                dest: 'static/js/<%= pkg.name %>.min.js'
            }
        },
        less: {
            expanded: {
                options: {
                    paths: ["static/less"]
                },
                files: {
                    "static/css/<%= pkg.name %>.css": "static/less/<%= pkg.name %>.less"
                }
            },
            minified: {
                options: {
                    paths: ["static/css"],
                    cleancss: true
                },
                files: {
                    "static/css/<%= pkg.name %>.min.css": "static/less/<%= pkg.name %>.less"
                }
            }
        },
        banner: '/*!\n' +
            ' * <%= pkg.title %> v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Website based on ' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',
        usebanner: {
            dist: {
                options: {
                    position: 'top',
                    banner: '<%= banner %>'
                },
                files: {
                    src: ['static/css/<%= pkg.name %>.css', 'static/css/<%= pkg.name %>.min.css', 'static/js/<%= pkg.name %>.min.js']
                }
            }
        },
        watch: {
            scripts: {
                files: ['static/js/<%= pkg.name %>.js'],
                tasks: ['uglify'],
                options: {
                    spawn: false,
                },
            },
            less: {
                files: ['static/less/*.less'],
                tasks: ['less'],
                options: {
                    spawn: false,
                }
            },
        },
    });

    // Load the plugins.
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-banner');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // Default task(s).
    grunt.registerTask('default', ['uglify', 'less', 'usebanner']);
    //grunt.registerTask('develop', ['simplemocha', 'uglify', 'less', 'usebanner']);

};<commit_msg>Not using grunt anymore :(<commit_after><|endoftext|>


<commit_before>/**
 * sample Gruntfiles:
 * https://github.com/melonjs/melonJS
 * https://github.com/cabaret/grunt-starter/blob/master/Gruntfile.js
 */
module.exports = function (grunt) {
    'use strict';

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

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

        // Variables
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
                '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
                '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;' +
                ' Licensed <%= pkg.license %> */\n',

        // Tasks
        clean: {
            options:{
                force: true
            },
            dist: ['dist', 'tmp'],
            tmp: ['tmp'],
            all: [
                'tmp',
                'dist',
                '.sass-cache',
                'node_modules',
                'public/bower_components'
            ]
        },

        // Run predefined tasks whenever watched file patterns are added, changed or deleted.
        // https://github.com/gruntjs/grunt-contrib-watch
        watch: {
            options: {
                // https://github.com/gruntjs/grunt-contrib-watch
                livereload: true,
                atBegin: true //This option will trigger the run of each specified task at startup of the watcher.
            },
            //watch for sass files changing ; recompile them ; and reload browser
            compass: {
                files: ['public/scss/*.{scss,sass}'],
                tasks: ['compass:dev']
            },
            //watch for changes in pre-index.html ; recompile index.html ; and refresh browser page
            preindex: {
                files: ['public/pre-index.html'],
                tasks: ['preprocess:dev','replace:dev']
            }
        },

        //compile sass to css
       compass: {
            dist: {
              options: {
                sassDir: 'public/scss',
                cssDir: 'tmp/css',
                environment: 'production'
              }
            },
            dev: {
              options: {
                sassDir: 'public/scss',
                cssDir: 'public/css',
                sourcemap: true
              }
            }
        },

        cssmin: {
          add_banner: {
            options: {
              banner: '<%= banner %>',
              stripBanners: true
            },
            files: {
              'tmp/css/<%= pkg.name %>.min.css': ['tmp/css/main.css']
            }
          }
        },

        //unused
        htmlmin: {                                     // Task
            dist: {                                      // Target
              options: {                                 // Target options
                removeComments: true,
                collapseWhitespace: true,
                removeOptionalTags:true,
              },
              files: {                                   // Dictionary of files
                'dist/index.html': 'dist/index.html'     // 'destination': 'source'
              }
            },
            dev: {                                       // Another target
              files: {
                'public/index.html': 'public/pre-index.html'
              }
            }
        },

        // modifies files using anotations of exclude and ifs
        // in this gruntfile the functionality of variable replacing was achieved using the replace module instead
        preprocess:{
            options:{
                inline: true,
                context : {
                    DEBUG: true
                }
            },
            dist:{
                src: 'tmp/replaced-index.html',
                dest:'dist/index.html',
                options:{
                    context : {
                        DEBUG: false
                    }
                }
            },
            dev:{
                src: 'public/pre-index.html',
                dest:'public/index.html'
            }
        },

        //grunt clean:dist | grunt requirejs:compile
        requirejs: {
          compile: {
            options: {
                baseUrl: 'public',
                name: 'js/app',
                findNestedDependencies: true,  //truncates to output file all dependecies that are parsed so that you don't need to include them seperatly
                out: 'tmp/<%= pkg.name %>.js',
                mainConfigFile: 'public/js/require.config.js'
            }
          }
        },

        replace : {
            options : {
                patterns : [
                    {
                        match : /this\._super\(\s*([\w\.]+)\s*,\s*"(\w+)"\s*(,\s*)?/g,
                        replacement : "$1.prototype.$2.apply(this$3"
                    },
                    {
                        match: 'timestamp',
                        replacement: '<%= new Date().getTime() %>'
                    }
                ],
                prefix : "@",
                force : true
            },

            dist : {
                options : {
                    variables : {
                        'VERSION' : '<%= pkg.version %>',
                        'APP_NAME' : '<%= pkg.name %>.min'
                    },
                },
                files : [
                    {
                        expand : true,
                        flatten : true,
                        src : [ '<%= requirejs.compile.options.out %>' ],
                        dest : 'tmp/replaced/'
                    },
                    { src: ['public/pre-index.html'], dest: 'tmp/replaced-index.html'}
                ]
            },
            dev : {
                options : {
                    variables : {
                        'VERSION' : '<%= pkg.version %>',
                        'APP_NAME' : 'app'
                    },
                },
                files : [
                    {
                        src : [ '<%= preprocess.dev.dest %>' ],
                        dest : '<%= preprocess.dev.dest %>'
                    }
                ]
            }
        },

        uglify : {
            options : {
                report : 'min',
                preserveComments : 'some',
                banner: '<%= banner %>',
                stripBanners: true
            },
            dist : {
                files : {
                    'dist/js/<%= pkg.name %>.min.js' : ['tmp/replaced/<%= pkg.name %>.js']
                }
            }
        },

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

            dist : {
                files : {
                    src : [ 'public/js' ]
                }
            }
        },

        copy: {
            dist: {
                files: [
                    {expand: true, cwd: 'public/', src: ['img/**'], dest: 'dist/'},
                    {expand: true, cwd: 'public/bower_components', src: ['**'], dest: 'dist/bower_components'},
                   // {expand: true, cwd: 'public/templates', src: ['**'], dest: 'dist/templates'},
                    {expand: true, cwd: 'tmp/css/', src: ['<%= pkg.name %>.min.css'], dest: 'dist/css'}
                ]
            },
            preindex: {
                src: 'pre-index.html',
                dest: 'index.html'
            }
        }

    });

/////////////////////////////////////////////////////////////////////////////////////////////////

    grunt.registerTask('default', [
        'watch' // preprocess html and reload page
                // compass watch sass files and livereload
    ]);
    grunt.registerTask('build', [
        'clean:dist',    //delete directories: tmp, dist
        'compass:dist',  //compile sass to tmp dir
        'cssmin',        //minify + add banner + copy to dist dir
        //'jshint:dist',   //jsHint js source files under public/js
        'requirejs',     //compile to tmp dir a single js file according to require config
        'replace:dist',  //replace in html file, variables with values, eg: appName and version + cacheBust and copy to tmp dir
        'preprocess:dist', //preprocess html ifs according to annotations and copy to dist dir
        'uglify',       // uglify and add banner to the js file generated in tmp by require
        'copy:dist',    // copy to dist dir: public/img and tmp/css dir
        'clean:tmp'     // delete tmp dir
    ]);
    grunt.registerTask('hard-reset', ['clean:all']);

};<commit_msg>gruntfile copy<commit_after>/**
 * sample Gruntfiles:
 * https://github.com/melonjs/melonJS
 * https://github.com/cabaret/grunt-starter/blob/master/Gruntfile.js
 */
module.exports = function (grunt) {
    'use strict';

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

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

        // Variables
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
                '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
                '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;' +
                ' Licensed <%= pkg.license %> */\n',

        // Tasks
        clean: {
            options:{
                force: true
            },
            dist: ['dist', 'tmp'],
            tmp: ['tmp'],
            all: [
                'tmp',
                'dist',
                '.sass-cache',
                'node_modules',
                'public/bower_components'
            ]
        },

        // Run predefined tasks whenever watched file patterns are added, changed or deleted.
        // https://github.com/gruntjs/grunt-contrib-watch
        watch: {
            options: {
                // https://github.com/gruntjs/grunt-contrib-watch
                livereload: true,
                atBegin: true //This option will trigger the run of each specified task at startup of the watcher.
            },
            //watch for sass files changing ; recompile them ; and reload browser
            compass: {
                files: ['public/scss/*.{scss,sass}'],
                tasks: ['compass:dev']
            },
            //watch for changes in pre-index.html ; recompile index.html ; and refresh browser page
            preindex: {
                files: ['public/pre-index.html'],
                tasks: ['preprocess:dev','replace:dev']
            }
        },

        //compile sass to css
       compass: {
            dist: {
              options: {
                sassDir: 'public/scss',
                cssDir: 'tmp/css',
                environment: 'production'
              }
            },
            dev: {
              options: {
                sassDir: 'public/scss',
                cssDir: 'public/css',
                sourcemap: true
              }
            }
        },

        cssmin: {
          add_banner: {
            options: {
              banner: '<%= banner %>',
              stripBanners: true
            },
            files: {
              'tmp/css/<%= pkg.name %>.min.css': ['tmp/css/main.css']
            }
          }
        },

        //unused
        htmlmin: {                                     // Task
            dist: {                                      // Target
              options: {                                 // Target options
                removeComments: true,
                collapseWhitespace: true,
                removeOptionalTags:true,
              },
              files: {                                   // Dictionary of files
                'dist/index.html': 'dist/index.html'     // 'destination': 'source'
              }
            },
            dev: {                                       // Another target
              files: {
                'public/index.html': 'public/pre-index.html'
              }
            }
        },

        // modifies files using anotations of exclude and ifs
        // in this gruntfile the functionality of variable replacing was achieved using the replace module instead
        preprocess:{
            options:{
                inline: true,
                context : {
                    DEBUG: true
                }
            },
            dist:{
                src: 'tmp/replaced-index.html',
                dest:'dist/index.html',
                options:{
                    context : {
                        DEBUG: false
                    }
                }
            },
            dev:{
                src: 'public/pre-index.html',
                dest:'public/index.html'
            }
        },

        //grunt clean:dist | grunt requirejs:compile
        requirejs: {
          compile: {
            options: {
                baseUrl: 'public',
                name: 'js/app',
                findNestedDependencies: true,  //truncates to output file all dependecies that are parsed so that you don't need to include them seperatly
                out: 'tmp/<%= pkg.name %>.js',
                mainConfigFile: 'public/js/require.config.js'
            }
          }
        },

        replace : {
            options : {
                patterns : [
                    {
                        match : /this\._super\(\s*([\w\.]+)\s*,\s*"(\w+)"\s*(,\s*)?/g,
                        replacement : "$1.prototype.$2.apply(this$3"
                    },
                    {
                        match: 'timestamp',
                        replacement: '<%= new Date().getTime() %>'
                    }
                ],
                prefix : "@",
                force : true
            },

            dist : {
                options : {
                    variables : {
                        'VERSION' : '<%= pkg.version %>',
                        'APP_NAME' : '<%= pkg.name %>.min'
                    },
                },
                files : [
                    {
                        expand : true,
                        flatten : true,
                        src : [ '<%= requirejs.compile.options.out %>' ],
                        dest : 'tmp/replaced/'
                    },
                    { src: ['public/pre-index.html'], dest: 'tmp/replaced-index.html'}
                ]
            },
            dev : {
                options : {
                    variables : {
                        'VERSION' : '<%= pkg.version %>',
                        'APP_NAME' : 'app'
                    },
                },
                files : [
                    {
                        src : [ '<%= preprocess.dev.dest %>' ],
                        dest : '<%= preprocess.dev.dest %>'
                    }
                ]
            }
        },

        uglify : {
            options : {
                report : 'min',
                preserveComments : 'some',
                banner: '<%= banner %>',
                stripBanners: true
            },
            dist : {
                files : {
                    'dist/js/<%= pkg.name %>.min.js' : ['tmp/replaced/<%= pkg.name %>.js']
                }
            }
        },

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

            dist : {
                files : {
                    src : [ 'public/js' ]
                }
            }
        },

        copy: {
            dist: {
                files: [
                    {expand: true, cwd: 'public/', src: ['img/**'], dest: 'dist/'},
                    {expand: true, cwd: 'public/bower_components', src: ['**'], dest: 'dist/bower_components'},
                    {expand: true, cwd: '', src: ['CNAME','README.md'], dest: 'dist/'},
                    {expand: true, cwd: 'tmp/css/', src: ['<%= pkg.name %>.min.css'], dest: 'dist/css'}
                ]
            },
            preindex: {
                src: 'pre-index.html',
                dest: 'index.html'
            }
        }

    });

/////////////////////////////////////////////////////////////////////////////////////////////////

    grunt.registerTask('default', [
        'watch' // preprocess html and reload page
                // compass watch sass files and livereload
    ]);
    grunt.registerTask('build', [
        'clean:dist',    //delete directories: tmp, dist
        'compass:dist',  //compile sass to tmp dir
        'cssmin',        //minify + add banner + copy to dist dir
        //'jshint:dist',   //jsHint js source files under public/js
        'requirejs',     //compile to tmp dir a single js file according to require config
        'replace:dist',  //replace in html file, variables with values, eg: appName and version + cacheBust and copy to tmp dir
        'preprocess:dist', //preprocess html ifs according to annotations and copy to dist dir
        'uglify',       // uglify and add banner to the js file generated in tmp by require
        'copy:dist',    // copy to dist dir: public/img and tmp/css dir
        'clean:tmp'     // delete tmp dir
    ]);
    grunt.registerTask('hard-reset', ['clean:all']);

};<|endoftext|>


<commit_before>/*
 * grunt-jscomplexity
 * https://github.com/slyg/grunt-jscomplexity
 *
 * Copyright (c) 2014 Sylvain Faucherand
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

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

    // Configuration to be run (and then tested).
    'jscomplexity-threshold': {

      passing : {
        src : [
          './tasks/',
          './tmp/'
        ],
        options : {
          complexity : 2000
        }
      },

      failing : {
        src : [
          './tasks/',
          './tmp/'
        ],
        options : {
          complexity : 1000
        }
      }

    }

  });

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

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

  // By default, lint and run all tests.
  grunt.registerTask('default', ['jshint']);

};
<commit_msg>Improve jshint task coverage<commit_after>/*
 * grunt-jscomplexity
 * https://github.com/slyg/grunt-jscomplexity
 *
 * Copyright (c) 2014 Sylvain Faucherand
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

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

    // Configuration to be run (and then tested).
    'jscomplexity-threshold': {

      passing : {
        src : [
          './tasks/',
          './tmp/'
        ],
        options : {
          complexity : 2000
        }
      },

      failing : {
        src : [
          './tasks/',
          './tmp/'
        ],
        options : {
          complexity : 1000
        }
      }

    }

  });

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

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

  // By default, lint and run all tests.
  grunt.registerTask('default', ['jshint']);

};
<|endoftext|>


<commit_before>// Generated on 2014-03-19 using generator-angular 0.7.1
'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: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    'sails-linker': {
      defaultOptions: {
        options: {
          startTag: '<!--SCRIPTS-->',
          endTag: '<!--SCRIPTS END-->',
          fileTmpl: '<script src="%s"></script>',
          appRoot: 'app/'
        },
        files: {
          // Target-specific file lists and/or options go here.
          'app/index.html': ['app/scripts/**/*.js',
            '!app/scripts/famous.angular.js',
            '!app/scripts/famous/**/*.js',
            '!app/scripts/famous-utilities/**/*.js',
            '!app/scripts/famous-transitions/**/*.js']
        }
      }
    },

    pkg: grunt.file.readJSON('package.json'),
    concat: {
      options: {
        stripBanners: true,
        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */',
      },
      dist: {
        src: ['<%= yeoman.app %>/scripts/directives/**/*'],
        dest: 'dist/famous.angular.js'
      }
    },

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

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

    // 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/famous/**/*.js'
      ],
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

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

    // 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 app
    '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/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= 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: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>'
      }
    },

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

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

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // 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',
            '*.html',
            'views/{,*/}*.html',
            'bower_components/**/*',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

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

    // 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: {}
    // },

    // Test settings
    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      }
    }
  });

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

    grunt.task.run([
      'clean:server',
      'bower-install',
      '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', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma'
  ]);

  grunt.registerTask('build', [
    'clean:dist',
    'bower-install',
    'useminPrepare',
    'autoprefixer',
    'concat',
    'ngmin',
    'rev'
  ]);

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


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

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

    // Metadata.
    meta: {
      distPath:       'dist/',
      docsPath:       'docs/dist/',
      docsAssetsPath: 'docs/assets/'
    },

    banner: '/*\n' +
            ' * =====================================================\n' +
            ' * Ratchet v<%= pkg.version %>\n' +
            ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= _.pluck(pkg.licenses, "url").join(", ") %>\n' +
            ' *\n' +
            ' * V<%= pkg.version %> designed by @connors.\n' +
            ' * =====================================================\n' +
            ' */\n',

    concat: {
      options: {
        banner: '<%= banner %>'
      },
      ratchet: {
        src: [
          'js/modals.js',
          'js/popovers.js',
          'js/push.js',
          'js/segmented-controllers.js',
          'js/sliders.js',
          'js/toggles.js'
        ],
        dest: '<%= meta.distPath %><%= pkg.name %>.js'
      },
      docs: {
        src: '<%= meta.distPath %><%= pkg.name %>.js',
        dest: '<%= meta.docsPath %><%= pkg.name %>.js'
      }
    },

    sass: {
      options: {
        banner: '<%= banner %>',
        style: 'expanded',
      },
      dist: {
        files: {
          '<%= meta.distPath %><%= pkg.name %>.css': 'sass/ratchet.scss',
          '<%= meta.distPath %><%= pkg.name %>-theme-ios.css': 'sass/theme-ios.scss',
          '<%= meta.distPath %><%= pkg.name %>-theme-android.css': 'sass/theme-android.scss',
          '<%= meta.docsAssetsPath %>css/docs.css': 'sass/docs.scss'
        }
      }
    },

    copy: {
      docs: {
        expand: true,
        cwd: 'dist',
        src: [
          '*'
        ],
        dest: 'docs/dist'
      }
    },

    watch: {
      scripts: {
        files: [
          '<%= meta.srcPath %>/**/*.scss'
        ],
        tasks: ['sass']
      }
    }
  });

  // Load the plugins
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jekyll');

  // Default task(s).
  grunt.registerTask('default', ['sass', 'concat', 'copy']);
  grunt.registerTask('build', ['sass', 'concat', 'copy']);
};
<commit_msg>add licensing header to Gruntfile<commit_after>/* ----------------------------------
 * Ratchet's Gruntfile
 * Licensed under The MIT License
 * http://opensource.org/licenses/MIT
 * ---------------------------------- */

module.exports = function(grunt) {

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

    // Metadata.
    meta: {
      distPath:       'dist/',
      docsPath:       'docs/dist/',
      docsAssetsPath: 'docs/assets/'
    },

    banner: '/*\n' +
            ' * =====================================================\n' +
            ' * Ratchet v<%= pkg.version %>\n' +
            ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= _.pluck(pkg.licenses, "url").join(", ") %>\n' +
            ' *\n' +
            ' * V<%= pkg.version %> designed by @connors.\n' +
            ' * =====================================================\n' +
            ' */\n',

    concat: {
      options: {
        banner: '<%= banner %>'
      },
      ratchet: {
        src: [
          'js/modals.js',
          'js/popovers.js',
          'js/push.js',
          'js/segmented-controllers.js',
          'js/sliders.js',
          'js/toggles.js'
        ],
        dest: '<%= meta.distPath %><%= pkg.name %>.js'
      },
      docs: {
        src: '<%= meta.distPath %><%= pkg.name %>.js',
        dest: '<%= meta.docsPath %><%= pkg.name %>.js'
      }
    },

    sass: {
      options: {
        banner: '<%= banner %>',
        style: 'expanded',
      },
      dist: {
        files: {
          '<%= meta.distPath %><%= pkg.name %>.css': 'sass/ratchet.scss',
          '<%= meta.distPath %><%= pkg.name %>-theme-ios.css': 'sass/theme-ios.scss',
          '<%= meta.distPath %><%= pkg.name %>-theme-android.css': 'sass/theme-android.scss',
          '<%= meta.docsAssetsPath %>css/docs.css': 'sass/docs.scss'
        }
      }
    },

    copy: {
      docs: {
        expand: true,
        cwd: 'dist',
        src: [
          '*'
        ],
        dest: 'docs/dist'
      }
    },

    watch: {
      scripts: {
        files: [
          '<%= meta.srcPath %>/**/*.scss'
        ],
        tasks: ['sass']
      }
    }
  });

  // Load the plugins
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-jekyll');

  // Default task(s).
  grunt.registerTask('default', ['sass', 'concat', 'copy']);
  grunt.registerTask('build', ['sass', 'concat', 'copy']);
};
<|endoftext|>


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

	require('jit-grunt')(grunt, {
		cachebreaker : 	'grunt-cache-breaker',
		replace: 		'grunt-text-replace'
	});

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

		developmentPath: 'dev',
		productionPath: 'dist',
		modulePath: 'git_submodules',

		compass: {
			options: {
				cssDir: 'assets/css',
				sassDir: 'assets/sass',
				imagesDir: 'assets/img',
				javascriptsDir: 'assets/js',
				fontsDir: 'assets/webfonts',
				relativeAssets: true,
				quiet: true,
				require : [
					'sass-globbing',
				]
			},
			development: {
				options: {
					basePath: '<%= developmentPath %>/',
					environment: 'development',
					outputStyle: 'expanded',
					noLineComments: false,
					sourcemap: true
				}
			}
		},

		svgstore: {
			development: {
				files: {
					'<%= productionPath %>/assets/img/layout/svg-sprite.svg': [
						'<%= developmentPath %>/assets/img/layout/svg/**/*.svg'
					]
				},
				options: {
					cleanup: true,
					cleanupdefs: true,
					prefix : 'glyph-',
					inheritviewbox: true
				}
			}
		},

		concat: {
			options: {
				separator: ';',
				sourceMap: true
			},
			modules : {
				src: (function () {
					var cwd = "<%= modulePath %>/";
					var files = [
						"**/tipi.*.js",
					];

					files = files.map(function (file) {
						return cwd + file;
					});

					return files;
				}()),
				dest: '<%= productionPath %>/assets/js/lib/tipi/tipi.js',
			}
		},

		zetzer: {
			options: {
				partials: "<%= developmentPath %>/inc/partials/",
				templates: "<%= developmentPath %>/inc/templates/"
			},
			development: {
				files: [{
					expand: true,
					cwd: '<%= developmentPath %>/',
					src: '*.html',
					dest: '<%= productionPath %>/',
					ext: '.html',
					flatten: false
				}]
			},
			modules: {
				files: [{
					expand: true,
					cwd: '<%= modulePath %>/',
					src: 'tipi.*/*.html',
					dest: '<%= productionPath %>/pages/',
					ext: '.html',
					flatten: false
				}]
			}
		},

		clean: {
			development: {
				src: [
					'<%= productionPath %>'
				]
			}
		},

		copy: {
			development: {
				expand: true,
				cwd: '<%= developmentPath %>/',
				src: [
					'assets/**'
				],
				dest: '<%= productionPath %>/'
			},
			img: {
				expand: true,
				cwd: '<%= developmentPath %>/',
				src: [
					'assets/**/*.{.png,jpg,gif,svg}'
				],
				dest: '<%= productionPath %>/'
			}
		},

		combine_mq: {
			production: {
				expand: true,
				cwd: '<%= developmentPath %>/assets/css/',
				src: ['**/*.css', '!**/*.min.css'],
				dest: '<%= developmentPath %>/assets/css/'
			}
		},

		cssmin: {
			production: {
				files: [{
					expand: true,
					cwd: '<%= developmentPath %>/assets/css',
					src: ['*.css', '!*.min.css'],
					dest: '<%= productionPath %>/assets/css',
					ext: '.min.css'
				}]
			}
		},

		image: {
			production: {
				options: {
					jpegRecompress: true,
					jpegoptim: true,
					mozjpeg: true,
					svgo: true
				},
				files: [{
					expand: true,
					cwd: '<%= productionPath %>/assets/img/',
					src: ['**/*.{png,jpg,gif,svg}'],
					dest: '<%= productionPath %>/assets/img/'
				}]
			}
		},

		replace: {
			production: {
				src: ['<%= productionPath%>/**/*.html'],
				dest: '<%= productionPath%>/',
				replacements: [
					{
						from: 'tipi.css',
						to: 'tipi.min.css'
					},
					{
						from: 'main.js',
						to: 'main.min.js'
					},
					{
						from: 'tipi.js',
						to: 'tipi.min.js'
					}
				]
			}
		},

		cachebreaker: {
			production: {
				options: {
					match: [
						'cached',
						'css/*/tipi.min.css',
						'js/*/tipi.min.js'
					]
				},
				files: {
					src: [
						'<%= productionPath %>/**/*.html'
					]
				}
			}
		},

		watch: {
			options: {
				interrupt: true,
			},
			scss: {
				files: [
					'<%= developmentPath %>/assets/sass/**/*.scss',
					'<%= modulePath %>/**/*.scss',

					'!**/node_modules/**',
				],
				tasks: [
					'compass:development',
					'svgstore:development'
				],
				options: {
					spawn : true
				}
			},
			img: {
				files: [
					'<%= developmentPath %>/assets/img/**/*.{png,jpg,gif,svg}',

					'!**/node_modules/**'
				],
				tasks: [
					'newer:copy:img'
				],
				options : {
					event: ['added', 'deleted']
				}
			},
			svg: {
				files: [
					'<%= developmentPath %>/**/*.svg'
				],
				tasks: [
					'svgstore:development'
				]
			},
			js: {
				files: [
					'<%= modulePath %>/**/tipi.*.js'
				],
				tasks: [
					'concat:modules'
				]
			},
			html: {
				files: [
					'<%= developmentPath %>/**/*.html',
					'<%= modulePath %>/tipi.*/*.html'
				],
				tasks: [
					'zetzer:development',
					'zetzer:modules',
				]
			},
			reload: {
				files: [
					'<%= productionPath %>/**/*.css'
				],
				options : {
					livereload : true,
					livereloadOnError: false
				}
			},
			config: {
				files : [
					'Gruntfile.js'
				],
				options : {
					reload : true
				}
			}
		},

		connect: {
			development: {
				options: {
					port: 8000,
					base: '<%= productionPath %>',
					livereload: true,
					open: {
						target: 'http://localhost:8000'
					}
				}
			}
		},

		concurrent: {
			development: [
				'compass:development',
				'svgstore:development',
				'concat:modules',
				'zetzer:development',
				'zetzer:modules',
			],
			production: [
				'combine_mq:production',
				'cssmin:production',
				'newer:image:production'
			]
		}
	});

	grunt.registerTask(
		'default', [
			'clean:development',
			'concurrent:development',
			'copy:development'
		]
	);

	grunt.registerTask(
		'serve', [
			'clean:development',
			'concurrent:development',
			'copy:development',
			'connect:development',
			'watch'
		]
	);

	grunt.registerTask(
		'build', [
			'clean:development',
			'concurrent:development',
			'copy:development',
			'concurrent:production',
			'replace:production',
			'cachebreaker:production'
		]
	);
};<commit_msg>Fix: Move compiled files to the production folder<commit_after>module.exports = function(grunt) {

	require('jit-grunt')(grunt, {
		cachebreaker : 	'grunt-cache-breaker',
		replace: 		'grunt-text-replace'
	});

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

		developmentPath: 'dev',
		productionPath: 'dist',
		modulePath: 'git_submodules',

		compass: {
			options: {
				cssDir: 'assets/css',
				sassDir: 'assets/sass',
				imagesDir: 'assets/img',
				javascriptsDir: 'assets/js',
				fontsDir: 'assets/webfonts',
				relativeAssets: true,
				quiet: true,
				require : [
					'sass-globbing',
				]
			},
			development: {
				options: {
					basePath: '<%= developmentPath %>/',
					environment: 'development',
					outputStyle: 'expanded',
					noLineComments: false,
					sourcemap: true
				}
			}
		},

		svgstore: {
			development: {
				files: {
					'<%= productionPath %>/assets/img/layout/svg-sprite.svg': [
						'<%= developmentPath %>/assets/img/layout/svg/**/*.svg'
					]
				},
				options: {
					cleanup: true,
					cleanupdefs: true,
					prefix : 'glyph-',
					inheritviewbox: true
				}
			}
		},

		concat: {
			options: {
				separator: ';',
				sourceMap: true
			},
			modules : {
				src: (function () {
					var cwd = "<%= modulePath %>/";
					var files = [
						"**/tipi.*.js",
					];

					files = files.map(function (file) {
						return cwd + file;
					});

					return files;
				}()),
				dest: '<%= productionPath %>/assets/js/lib/tipi/tipi.js',
			}
		},

		zetzer: {
			options: {
				partials: "<%= developmentPath %>/inc/partials/",
				templates: "<%= developmentPath %>/inc/templates/"
			},
			development: {
				files: [{
					expand: true,
					cwd: '<%= developmentPath %>/',
					src: '*.html',
					dest: '<%= productionPath %>/',
					ext: '.html',
					flatten: false
				}]
			},
			modules: {
				files: [{
					expand: true,
					cwd: '<%= modulePath %>/',
					src: 'tipi.*/*.html',
					dest: '<%= productionPath %>/pages/',
					ext: '.html',
					flatten: false
				}]
			}
		},

		clean: {
			development: {
				src: [
					'<%= productionPath %>'
				]
			}
		},

		copy: {
			development: {
				expand: true,
				cwd: '<%= developmentPath %>/',
				src: [
					'assets/**'
				],
				dest: '<%= productionPath %>/'
			},
			img: {
				expand: true,
				cwd: '<%= developmentPath %>/',
				src: [
					'assets/**/*.{.png,jpg,gif,svg}'
				],
				dest: '<%= productionPath %>/'
			}
		},

		combine_mq: {
			production: {
				expand: true,
				cwd: '<%= developmentPath %>/assets/css/',
				src: ['**/*.css', '!**/*.min.css'],
				dest: '<%= developmentPath %>/assets/css/'
			}
		},

		cssmin: {
			production: {
				files: [{
					expand: true,
					cwd: '<%= developmentPath %>/assets/css',
					src: ['*.css', '!*.min.css'],
					dest: '<%= productionPath %>/assets/css',
					ext: '.min.css'
				}]
			}
		},

		image: {
			production: {
				options: {
					jpegRecompress: true,
					jpegoptim: true,
					mozjpeg: true,
					svgo: true
				},
				files: [{
					expand: true,
					cwd: '<%= productionPath %>/assets/img/',
					src: ['**/*.{png,jpg,gif,svg}'],
					dest: '<%= productionPath %>/assets/img/'
				}]
			}
		},

		replace: {
			production: {
				src: ['<%= productionPath%>/**/*.html'],
				dest: '<%= productionPath%>/',
				replacements: [
					{
						from: 'tipi.css',
						to: 'tipi.min.css'
					},
					{
						from: 'main.js',
						to: 'main.min.js'
					},
					{
						from: 'tipi.js',
						to: 'tipi.min.js'
					}
				]
			}
		},

		cachebreaker: {
			production: {
				options: {
					match: [
						'cached',
						'css/*/tipi.min.css',
						'js/*/tipi.min.js'
					]
				},
				files: {
					src: [
						'<%= productionPath %>/**/*.html'
					]
				}
			}
		},

		watch: {
			options: {
				interrupt: true,
			},
			scss: {
				files: [
					'<%= developmentPath %>/assets/sass/**/*.scss',
					'<%= modulePath %>/**/*.scss',

					'!**/node_modules/**',
				],
				tasks: [
					'compass:development',
					'svgstore:development',
					'newer:copy:development'
				],
				options: {
					spawn : true
				}
			},
			img: {
				files: [
					'<%= developmentPath %>/assets/img/**/*.{png,jpg,gif,svg}',

					'!**/node_modules/**'
				],
				tasks: [
					'newer:copy:img'
				],
				options : {
					event: ['added', 'deleted']
				}
			},
			svg: {
				files: [
					'<%= developmentPath %>/**/*.svg'
				],
				tasks: [
					'svgstore:development',
					'newer:copy:development'
				]
			},
			js: {
				files: [
					'<%= modulePath %>/**/tipi.*.js'
				],
				tasks: [
					'concat:modules'
				]
			},
			html: {
				files: [
					'<%= developmentPath %>/**/*.html',
					'<%= modulePath %>/tipi.*/*.html'
				],
				tasks: [
					'zetzer:development',
					'zetzer:modules',
				]
			},
			reload: {
				files: [
					'<%= productionPath %>/**/*.css'
				],
				options : {
					livereload : true,
					livereloadOnError: false
				}
			},
			config: {
				files : [
					'Gruntfile.js'
				],
				options : {
					reload : true
				}
			}
		},

		connect: {
			development: {
				options: {
					port: 8000,
					base: '<%= productionPath %>',
					livereload: true,
					open: {
						target: 'http://localhost:8000'
					}
				}
			}
		},

		concurrent: {
			development: [
				'compass:development',
				'svgstore:development',
				'concat:modules',
				'zetzer:development',
				'zetzer:modules',
			],
			production: [
				'combine_mq:production',
				'cssmin:production',
				'newer:image:production'
			]
		}
	});

	grunt.registerTask(
		'default', [
			'clean:development',
			'concurrent:development',
			'copy:development'
		]
	);

	grunt.registerTask(
		'serve', [
			'clean:development',
			'concurrent:development',
			'copy:development',
			'connect:development',
			'watch'
		]
	);

	grunt.registerTask(
		'build', [
			'clean:development',
			'concurrent:development',
			'copy:development',
			'concurrent:production',
			'replace:production',
			'cachebreaker:production'
		]
	);
};<|endoftext|>


<commit_before>var child_process = require('child_process');

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

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

  var pkg = require('./package.json');
  var protractorConfig = grunt.option('protractorConfig') || 'ui/common/tests/ci.conf.js';

  var config = pkg.gruntConfig || {};

  config.grunt = grunt;
  config.pkg = pkg;
  config.protractorConfig = protractorConfig;

  var browserifyConf = { };

  require('./ui/admin/grunt/config/browserify')(config, browserifyConf);
  require('./ui/tasklist/grunt/config/browserify')(config, browserifyConf);
  require('./ui/cockpit/grunt/config/browserify')(config, browserifyConf);

  var babelConf = { };
  require('./ui/admin/grunt/config/babel')(config, babelConf);
  require('./ui/tasklist/grunt/config/babel')(config, babelConf);
  require('./ui/cockpit/grunt/config/babel')(config, babelConf);

  var copyConf = require('./grunt/config/copy');
  require('./ui/admin/grunt/config/copy')(config, copyConf);
  require('./ui/cockpit/grunt/config/copy')(config, copyConf);
  require('./ui/tasklist/grunt/config/copy')(config, copyConf);

  var lessConf = { };
  require('./grunt/config/less')(config, lessConf, {
    appName: 'admin',
    sourceDir: pkg.gruntConfig.adminSourceDir,
    buildTarget: pkg.gruntConfig.adminBuildTarget
  });
  require('./grunt/config/less')(config, lessConf, {
    appName: 'admin',
    sourceDir: pkg.gruntConfig.pluginSourceDir + '/admin/plugins',
    buildTarget: pkg.gruntConfig.pluginBuildTarget + '/admin/app',
    plugin: true
  });

  require('./grunt/config/less')(config, lessConf, {
    appName: 'cockpit',
    sourceDir: pkg.gruntConfig.cockpitSourceDir,
    buildTarget: pkg.gruntConfig.cockpitBuildTarget
  });
  require('./grunt/config/less')(config, lessConf, {
    appName: 'cockpit',
    sourceDir: pkg.gruntConfig.pluginSourceDir + '/cockpit/plugins',
    buildTarget: pkg.gruntConfig.pluginBuildTarget + '/cockpit/app',
    plugin: true
  });

  require('./grunt/config/less')(config, lessConf, {
    appName: 'tasklist',
    sourceDir: pkg.gruntConfig.tasklistSourceDir,
    buildTarget: pkg.gruntConfig.tasklistBuildTarget
  });
  require('./grunt/config/less')(config, lessConf, {
    appName: 'tasklist',
    sourceDir: pkg.gruntConfig.pluginSourceDir + '/tasklist/plugins',
    buildTarget: pkg.gruntConfig.pluginBuildTarget + '/tasklist/app',
    plugin: true
  });

  var localesConf = { };
  require('./grunt/config/localescompile')(config, localesConf, {
    appName: 'tasklist',
    sourceDir: pkg.gruntConfig.tasklistSourceDir,
    buildTarget: pkg.gruntConfig.tasklistBuildTarget
  });

  var watchConf = {
    commons_styles: {
      options: {
        liverreload: false,
      },
      files: [
        'ui/common/styles/**/*.less',
        'node_modules/camunda-commons-ui/{lib,resources}/**/*.less'
      ],
      tasks: ['less']
    }
  };
  require('./ui/tasklist/grunt/config/watch')(config, watchConf);
  require('./ui/cockpit/grunt/config/watch')(config, watchConf);
  require('./ui/admin/grunt/config/watch')(config, watchConf);

  var uglifyConf = {};
  require('./grunt/config/uglify')(config, uglifyConf);
  require('./ui/admin/grunt/config/uglify')(config, uglifyConf);
  require('./ui/tasklist/grunt/config/uglify')(config, uglifyConf);
  require('./ui/cockpit/grunt/config/uglify')(config, uglifyConf);

  grunt.initConfig({
    buildMode:        'dev',

    pkg:              pkg,

    browserify:       browserifyConf,

    persistify:       browserifyConf,

    copy:             copyConf,

    less:             lessConf,

    localescompile:   localesConf,

    uglify:           uglifyConf,

    babel:            babelConf,

    clean:            require('./grunt/config/clean')(config),

    watch:            watchConf,

    ensureLibs: {
      thirdParty: {}
    },

    protractor:       require('./grunt/config/protractor')(config)
  });

  require('camunda-commons-ui/grunt/tasks/localescompile')(grunt);
  require('camunda-commons-ui/grunt/tasks/persistify')(grunt);
  require('camunda-commons-ui/grunt/tasks/ensureLibs')(grunt);

grunt.registerTask('build', function(mode, app) {

    if(typeof app !== 'undefined') {
      console.log(' ------------  will build ' + app + ' -------------');
      var objs = [browserifyConf, copyConf, lessConf, localesConf, watchConf, uglifyConf];
      for(var i = 0; i < objs.length; i++) {
        var obj = objs[i];
        for (var key in obj) {
          if (obj.hasOwnProperty(key) && key.toLowerCase().indexOf(app) === -1 && key !== 'options' &&
                                         key.toLowerCase().indexOf('webapp') === -1 &&
                                         key.toLowerCase().indexOf('sdk') === -1) {
              delete obj[key];
          }
        }
      }
    }

    grunt.config.data.buildMode = mode || 'prod';

    var tasksToRun = [
      'clean',
      'ensureLibs',
      'persistify',
      'copy',
      'less'
    ];

    if(typeof app === 'undefined' || app === 'tasklist') {
      tasksToRun.push('localescompile');
    }

    if(grunt.config.data.buildMode === 'prod' || process.env.IE) {
      tasksToRun.push('babel');
    }

    if(grunt.config.data.buildMode === 'prod') {
      tasksToRun.push('uglify');
    }

    grunt.task.run(tasksToRun);

  });

  grunt.registerTask('auto-build', function(app) {
    if(app) {
      grunt.task.run([
        'build:dev:' + app,
        'watch'
      ]);
    } else {
      grunt.task.run([
        'build:dev',
        'watch'
      ]);
    }
  });

  grunt.registerTask('ensureSelenium', function() {
    // async task
    var done = this.async();

    child_process.execFile('node', [__dirname + '/node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager', '--chrome', 'update'], function(err) {
      done();
    });
  });

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

  grunt.registerTask('test-e2e', ['ensureSelenium', 'protractor:e2e']);
};
<commit_msg>chore(build): produce warning when trying to incremental build IE<commit_after>var child_process = require('child_process');

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

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

  var pkg = require('./package.json');
  var protractorConfig = grunt.option('protractorConfig') || 'ui/common/tests/ci.conf.js';

  var config = pkg.gruntConfig || {};

  config.grunt = grunt;
  config.pkg = pkg;
  config.protractorConfig = protractorConfig;

  var browserifyConf = { };

  require('./ui/admin/grunt/config/browserify')(config, browserifyConf);
  require('./ui/tasklist/grunt/config/browserify')(config, browserifyConf);
  require('./ui/cockpit/grunt/config/browserify')(config, browserifyConf);

  var babelConf = { };
  require('./ui/admin/grunt/config/babel')(config, babelConf);
  require('./ui/tasklist/grunt/config/babel')(config, babelConf);
  require('./ui/cockpit/grunt/config/babel')(config, babelConf);

  var copyConf = require('./grunt/config/copy');
  require('./ui/admin/grunt/config/copy')(config, copyConf);
  require('./ui/cockpit/grunt/config/copy')(config, copyConf);
  require('./ui/tasklist/grunt/config/copy')(config, copyConf);

  var lessConf = { };
  require('./grunt/config/less')(config, lessConf, {
    appName: 'admin',
    sourceDir: pkg.gruntConfig.adminSourceDir,
    buildTarget: pkg.gruntConfig.adminBuildTarget
  });
  require('./grunt/config/less')(config, lessConf, {
    appName: 'admin',
    sourceDir: pkg.gruntConfig.pluginSourceDir + '/admin/plugins',
    buildTarget: pkg.gruntConfig.pluginBuildTarget + '/admin/app',
    plugin: true
  });

  require('./grunt/config/less')(config, lessConf, {
    appName: 'cockpit',
    sourceDir: pkg.gruntConfig.cockpitSourceDir,
    buildTarget: pkg.gruntConfig.cockpitBuildTarget
  });
  require('./grunt/config/less')(config, lessConf, {
    appName: 'cockpit',
    sourceDir: pkg.gruntConfig.pluginSourceDir + '/cockpit/plugins',
    buildTarget: pkg.gruntConfig.pluginBuildTarget + '/cockpit/app',
    plugin: true
  });

  require('./grunt/config/less')(config, lessConf, {
    appName: 'tasklist',
    sourceDir: pkg.gruntConfig.tasklistSourceDir,
    buildTarget: pkg.gruntConfig.tasklistBuildTarget
  });
  require('./grunt/config/less')(config, lessConf, {
    appName: 'tasklist',
    sourceDir: pkg.gruntConfig.pluginSourceDir + '/tasklist/plugins',
    buildTarget: pkg.gruntConfig.pluginBuildTarget + '/tasklist/app',
    plugin: true
  });

  var localesConf = { };
  require('./grunt/config/localescompile')(config, localesConf, {
    appName: 'tasklist',
    sourceDir: pkg.gruntConfig.tasklistSourceDir,
    buildTarget: pkg.gruntConfig.tasklistBuildTarget
  });

  var watchConf = {
    commons_styles: {
      options: {
        liverreload: false,
      },
      files: [
        'ui/common/styles/**/*.less',
        'node_modules/camunda-commons-ui/{lib,resources}/**/*.less'
      ],
      tasks: ['less']
    }
  };
  require('./ui/tasklist/grunt/config/watch')(config, watchConf);
  require('./ui/cockpit/grunt/config/watch')(config, watchConf);
  require('./ui/admin/grunt/config/watch')(config, watchConf);

  var uglifyConf = {};
  require('./grunt/config/uglify')(config, uglifyConf);
  require('./ui/admin/grunt/config/uglify')(config, uglifyConf);
  require('./ui/tasklist/grunt/config/uglify')(config, uglifyConf);
  require('./ui/cockpit/grunt/config/uglify')(config, uglifyConf);

  grunt.initConfig({
    buildMode:        'dev',

    pkg:              pkg,

    browserify:       browserifyConf,

    persistify:       browserifyConf,

    copy:             copyConf,

    less:             lessConf,

    localescompile:   localesConf,

    uglify:           uglifyConf,

    babel:            babelConf,

    clean:            require('./grunt/config/clean')(config),

    watch:            watchConf,

    ensureLibs: {
      thirdParty: {}
    },

    protractor:       require('./grunt/config/protractor')(config)
  });

  require('camunda-commons-ui/grunt/tasks/localescompile')(grunt);
  require('camunda-commons-ui/grunt/tasks/persistify')(grunt);
  require('camunda-commons-ui/grunt/tasks/ensureLibs')(grunt);

grunt.registerTask('build', function(mode, app) {

    if(typeof app !== 'undefined') {
      console.log(' ------------  will build ' + app + ' -------------');
      var objs = [browserifyConf, copyConf, lessConf, localesConf, watchConf, uglifyConf, babelConf];
      for(var i = 0; i < objs.length; i++) {
        var obj = objs[i];
        for (var key in obj) {
          if (obj.hasOwnProperty(key) && key.toLowerCase().indexOf(app) === -1 && key !== 'options' &&
                                         key.toLowerCase().indexOf('webapp') === -1 &&
                                         key.toLowerCase().indexOf('sdk') === -1) {
              delete obj[key];
          }
        }
      }
    }

    grunt.config.data.buildMode = mode || 'prod';

    var tasksToRun = [
      'clean',
      'ensureLibs',
      'persistify',
      'copy',
      'less'
    ];

    if(typeof app === 'undefined' || app === 'tasklist') {
      tasksToRun.push('localescompile');
    }

    if(grunt.config.data.buildMode === 'prod' || process.env.IE) {
      tasksToRun.push('babel');
    }

    if(grunt.config.data.buildMode === 'prod') {
      tasksToRun.push('uglify');
    }

    grunt.task.run(tasksToRun);

  });

  grunt.registerTask('auto-build', function(app) {
    if(process.env.IE) {
      grunt.warn('IE compatible incremental build is not supported.');
    }
    if(app) {
      grunt.task.run([
        'build:dev:' + app,
        'watch'
      ]);
    } else {
      grunt.task.run([
        'build:dev',
        'watch'
      ]);
    }
  });

  grunt.registerTask('ensureSelenium', function() {
    // async task
    var done = this.async();

    child_process.execFile('node', [__dirname + '/node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager', '--chrome', 'update'], function(err) {
      done();
    });
  });

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

  grunt.registerTask('test-e2e', ['ensureSelenium', 'protractor:e2e']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt){
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            all: ['Gruntfile.js', 'src/*.js']
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
            },
            build: {
                src: 'src/index.js',
                dest: 'dist/<%= pkg.name %>.min.js'
            }
        },
        concat: {
            option: {
                separator: ';',
            },
            dist: {
                src: ['src/index.js'],
                dest: 'dist/<%= pkg.name %>.js'
            }
        },
        watch: {
            files: ['src/*.js'],
            tasks: ['concat', 'uglify'],
            options: {
                spawn: false,
                interrupt: true,
                debounceDelay: 100
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.registerTask('test', ['jshint']);
    grunt.registerTask('default', ['jshint', 'concat', 'uglify']);
};
<commit_msg>Remove trailing comma from gruntfile<commit_after>module.exports = function(grunt){
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
            all: ['Gruntfile.js', 'src/*.js']
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
            },
            build: {
                src: 'src/index.js',
                dest: 'dist/<%= pkg.name %>.min.js'
            }
        },
        concat: {
            option: {
                separator: ';'
            },
            dist: {
                src: ['src/index.js'],
                dest: 'dist/<%= pkg.name %>.js'
            }
        },
        watch: {
            files: ['src/*.js'],
            tasks: ['concat', 'uglify'],
            options: {
                spawn: false,
                interrupt: true,
                debounceDelay: 100
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');

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