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

  // Define the browser to test with Sauce Labs
  var platforms = {
    'Windows 8.1': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['11']
    },
    'Windows 8': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['10']
    },
    'Windows 7': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['9', '10', '11']
    },
    'OS X 10.8': {
      iPhone: ['6.0'],
      safari: ['6']
    },
    'OS X 10.9': {
      iPhone: ['8.1'],
      iPad: ['8.1'],
      safari: ['7']
    },
    'OS X 10.10': {
      safari: ['8']
    },
    Linux: {
      chrome: ['38', '39'],
      firefox: ['33', '34'],
      android: ['4.0', '4.4']
    }
  };

  var sauceBrowsers = [];

  for (var platform in platforms) {
    var browsers = platforms[platform];
    for (var browser in browsers) {
      var versions = browsers[browser];
      for (var i = 0; i < versions.length; i++) {
        sauceBrowsers.push([platform, browser, versions[i]]);
      }
    }
  }

  // Define more options
  var qunitTestsUrl = 'http://127.0.0.1:9999/test/index.html';

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsonlint: {
      all: {
        src: [
          'package.json',
          '.jshintrc',
          'src/.jshintrc',
          'test/tests/.jshintrc'
        ]
      }
    },
    jshint: {
      all: {
        src: [
          'Gruntfile.js',
          'build/**/*.js',
          'src/**/*.js',
          'test/tests/**/*.js'
        ],
        options: {
          jshintrc: true
        }
      }
    },
    connect: {
      temp: {
        options: {
          port: 9999
        }
      },
      local: {
        options: {
          port: 9999,
          open: qunitTestsUrl,
          keepalive: true
        }
      }
    },
    'saucelabs-qunit': {
      full: {
        options: {
          browsers: sauceBrowsers,
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 3,
          tags: ['master'],
          testname: 'Firebolt QUnit full test',
          tunnelTimeout: 5,
          urls: [qunitTestsUrl]
        }
      },
      simple: {
        options: {
          browsers: [sauceBrowsers[1]],
          concurrency: 3,
          tags: ['master'],
          testname: 'Firebolt QUnit simple test',
          tunnelTimeout: 5,
          urls: [qunitTestsUrl]
        }
      },
      custom: {
        options: {
          browsers: [ ['OS X 10.8', 'iPhone', '6.0'] ],
          concurrency: 3,
          tags: ['master'],
          testname: 'Firebolt QUnit custom test',
          tunnelTimeout: 5,
          urls: [qunitTestsUrl]
        }
      }
    },
    copy: {
      all: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! Firebolt v<%= pkg.version %> | (c)2014 Nathan Woltman | fireboltjs.com/license */',
        sourceMap: true,
        sourceMapName: 'dist/firebolt.min.map'
      },
      build: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.min.js'
      }
    },
    compare_size: {
      files: [
        'dist/firebolt.js',
        'dist/firebolt.min.js'
      ],
      options: {
        cache: 'build/.sizecache.json',
        compress: {
          gz: function(contents) {
            return require('gzip-js').zip(contents, {}).length;
          }
        }
      }
    }
  });

  // Load the Grunt plugins
  require('load-grunt-tasks')(grunt);

  // Load custom build tasks
  grunt.loadTasks('build');

  /* Register tasks */
  grunt.registerTask('lint', ['jsonlint', 'jshint']);
  grunt.registerTask('dev', ['lint', 'connect:local']);
  grunt.registerTask('cleanbuild', ['tasks.cleandist', 'copy', 'uglify']);
  grunt.registerTask('build', ['lint', 'cleanbuild', 'compare_size']);
  grunt.registerTask('release', ['lint', 'cleanbuild', 'tasks.release']);

  // Only connect to Sauce if the user has Sauce credentials
  if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
    grunt.registerTask('test', ['lint', 'connect:temp', 'saucelabs-qunit:simple']);
    grunt.registerTask('fulltest', ['lint', 'connect:temp', 'saucelabs-qunit:full']);
    grunt.registerTask('customtest', ['connect:temp', 'saucelabs-qunit:custom']);
  } else {
    grunt.registerTask('test', ['lint', 'connect:local']); // Same as dev
    grunt.registerTask('fulltest', ['lint', 'tasks.nofulltest']);
  }

  // Default: run everything
  grunt.registerTask('default', ['fulltest', 'cleanbuild', 'compare_size', 'tasks.release']);
};
<commit_msg>Reduced concurrency of Sauce tests to 1<commit_after>module.exports = function(grunt) {
  'use strict';

  // Define the browser to test with Sauce Labs
  var platforms = {
    'Windows 8.1': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['11']
    },
    'Windows 8': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['10']
    },
    'Windows 7': {
      chrome: ['38', '39'],
      firefox: ['32', '33'],
      'internet explorer': ['9', '10', '11']
    },
    'OS X 10.8': {
      iPhone: ['6.0'],
      safari: ['6']
    },
    'OS X 10.9': {
      iPhone: ['8.1'],
      iPad: ['8.1'],
      safari: ['7']
    },
    'OS X 10.10': {
      safari: ['8']
    },
    Linux: {
      chrome: ['38', '39'],
      firefox: ['33', '34'],
      android: ['4.0', '4.4']
    }
  };

  var sauceBrowsers = [];

  for (var platform in platforms) {
    var browsers = platforms[platform];
    for (var browser in browsers) {
      var versions = browsers[browser];
      for (var i = 0; i < versions.length; i++) {
        sauceBrowsers.push([platform, browser, versions[i]]);
      }
    }
  }

  // Define more options
  var qunitTestsUrl = 'http://127.0.0.1:9999/test/index.html';

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsonlint: {
      all: {
        src: [
          'package.json',
          '.jshintrc',
          'src/.jshintrc',
          'test/tests/.jshintrc'
        ]
      }
    },
    jshint: {
      all: {
        src: [
          'Gruntfile.js',
          'build/**/*.js',
          'src/**/*.js',
          'test/tests/**/*.js'
        ],
        options: {
          jshintrc: true
        }
      }
    },
    connect: {
      temp: {
        options: {
          port: 9999
        }
      },
      local: {
        options: {
          port: 9999,
          open: qunitTestsUrl,
          keepalive: true
        }
      }
    },
    'saucelabs-qunit': {
      full: {
        options: {
          browsers: sauceBrowsers,
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit full test',
          urls: [qunitTestsUrl]
        }
      },
      simple: {
        options: {
          browsers: [sauceBrowsers[1]],
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit simple test',
          urls: [qunitTestsUrl]
        }
      },
      custom: {
        options: {
          browsers: [ ['OS X 10.8', 'iPhone', '6.0'] ],
          concurrency: 1,
          tags: ['master'],
          testname: 'Firebolt QUnit custom test',
          urls: [qunitTestsUrl]
        }
      }
    },
    copy: {
      all: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! Firebolt v<%= pkg.version %> | (c)2014 Nathan Woltman | fireboltjs.com/license */',
        sourceMap: true,
        sourceMapName: 'dist/firebolt.min.map'
      },
      build: {
        src: 'src/firebolt.js',
        dest: 'dist/firebolt.min.js'
      }
    },
    compare_size: {
      files: [
        'dist/firebolt.js',
        'dist/firebolt.min.js'
      ],
      options: {
        cache: 'build/.sizecache.json',
        compress: {
          gz: function(contents) {
            return require('gzip-js').zip(contents, {}).length;
          }
        }
      }
    }
  });

  // Load the Grunt plugins
  require('load-grunt-tasks')(grunt);

  // Load custom build tasks
  grunt.loadTasks('build');

  /* Register tasks */
  grunt.registerTask('lint', ['jsonlint', 'jshint']);
  grunt.registerTask('dev', ['lint', 'connect:local']);
  grunt.registerTask('cleanbuild', ['tasks.cleandist', 'copy', 'uglify']);
  grunt.registerTask('build', ['lint', 'cleanbuild', 'compare_size']);
  grunt.registerTask('release', ['lint', 'cleanbuild', 'tasks.release']);

  // Only connect to Sauce if the user has Sauce credentials
  if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
    grunt.registerTask('test', ['lint', 'connect:temp', 'saucelabs-qunit:simple']);
    grunt.registerTask('fulltest', ['lint', 'connect:temp', 'saucelabs-qunit:full']);
    grunt.registerTask('customtest', ['connect:temp', 'saucelabs-qunit:custom']);
  } else {
    grunt.registerTask('test', ['lint', 'connect:local']); // Same as dev
    grunt.registerTask('fulltest', ['lint', 'tasks.nofulltest']);
  }

  // Default: run everything
  grunt.registerTask('default', ['fulltest', 'cleanbuild', 'compare_size', 'tasks.release']);
};
<|endoftext|>


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

  grunt.initConfig({
    watch : {
      files: ['ngReact.js', 'tests/*.js'],
      tasks: ['uglify', 'karma:background:run'],
    },
    uglify: {
      build : {
        options: {
          mangle: {
            except: ['angular', 'React']
          },
          compress: true,
          wrap: true
        },
        files: {
          'ngReact.min.js' : 'ngReact.js'
        }
      }
    },
    karma: {
      options: {
        configFile: 'karma.config.js'
      },
      background: {
        autoWatch: false,
        background: true,
        singleRun: false
      },
      single: {
        autoWatch: false,
        singleRun: true
      }
    },
    docco: {
      build : {
        src: ['ngReact.js'],
        options: {
          output: 'docs/'
        }
      }
    }
  });

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

  grunt.registerTask('default', ['uglify', 'karma:single']);

  grunt.registerTask('build', ['uglify']);
  grunt.registerTask('test', ['karma:single']);
  grunt.registerTask('docs', ['docco']);
};<commit_msg>remove uglify options<commit_after>module.exports = function(grunt) {

  grunt.initConfig({
    watch : {
      files: ['ngReact.js', 'tests/*.js'],
      tasks: ['uglify', 'karma:background:run'],
    },
    uglify: {
      build : {
        options: {
          mangle: {
            except: ['angular', 'React']
          }
        },
        files: {
          'ngReact.min.js' : 'ngReact.js'
        }
      }
    },
    karma: {
      options: {
        configFile: 'karma.config.js'
      },
      background: {
        autoWatch: false,
        background: true,
        singleRun: false
      },
      single: {
        autoWatch: false,
        singleRun: true
      }
    },
    docco: {
      build : {
        src: ['ngReact.js'],
        options: {
          output: 'docs/'
        }
      }
    }
  });

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

  grunt.registerTask('default', ['uglify', 'karma:single']);

  grunt.registerTask('build', ['uglify']);
  grunt.registerTask('test', ['karma:single']);
  grunt.registerTask('docs', ['docco']);
};
<|endoftext|>


<commit_before>'use strict';

const MongoDb = require('mongodb').Db;
const Promise = require('bluebird');
const _ = require('underscore');

const MongotronCursor = require('lib/utils/mongotronCursor');
const mongoUtils = require('lib/utils/mongoUtils');
const errors = require('lib/errors');

const DEFAULT_PAGE_SIZE = 50;

/** @class */
class Collection {
  /**
   * @param {Object} database - MongoDb object
   * @param {Object} options
   * @param {String} options.name - name of the collection
   * @param {String} options.serverName - name of the server
   * @param {String} options.databaseName - name of the database
   */
  constructor(database, options) {
    if (!(database instanceof MongoDb)) console.error('Collection ctor - database is not an instance of MongoDb');

    options = options || {};

    var _this = this;
    _this.id = options.id;
    _this.name = options.name;
    _this.connection = options.connection;
    _this.database = options.database;
    _this.serverName = options.serverName;
    _this.databaseName = options.databaseName;
    _this._dbCollection = database.collection(_this.name);
  }

  /**
   * @param {Object} doc
   */
  insertOne(doc) {
    if (!doc) return Promise.reject(new errors.InvalidArugmentError('doc is required'));

    let cursor = this._dbCollection.insertOne(doc);

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} [query] - mongo query
   * @param {Object} [options] - mongo query options
   */
  find(query, options) {
    options = options || {};

    let stream = options.stream;
    delete options.stream;

    let cursor = this._dbCollection.find(query, options);

    if (options.skip) cursor.skip(Number(options.skip));
    cursor.limit(options.limit ? Number(options.limit) : DEFAULT_PAGE_SIZE);

    if (stream === true) {
      cursor.stream();
    }

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} [options] - mongo query options
   */
  count(query, options) {
    if (!query) return Promise.reject(new errors.InvalidArugmentError('query is required'));
    options = options || {};

    let cursor = this._dbCollection.count(query, options);

    if (options.skip) cursor.skip(Number(options.skip));
    cursor.limit(options.limit ? Number(options.limit) : DEFAULT_PAGE_SIZE);

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} [options] - mongo query options
   */
  deleteMany(query, options) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));
      options = options || {};

      this._dbCollection.deleteMany(query, options, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} Mongo ObjectId
   */
  deleteById(objectId) {
    return new Promise((resolve, reject) => {
      if (!objectId) return reject(new errors.InvalidArugmentError('objectId is required'));

      this._dbCollection.deleteOne({
        _id: objectId
      }, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} query - mongo query
   */
  deleteOne(query) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));

      this._dbCollection.deleteOne(query, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} [pipeline] - mongo pipeline
   * @param {Object} [options] - mongo pipeline options
   */
  aggregate(pipeline, options) {
    if (!_.isArray(pipeline)) return Promise.reject('pipeline must be an array');
    options = options || {};

    let stream = options.stream;
    delete options.stream;

    //always return as a cursor
    options.cursor = {};

    let cursor = this._dbCollection.aggregate(pipeline, options);

    if (options.skip) cursor.skip(Number(options.skip));
    cursor.limit(options.limit ? Number(options.limit) : DEFAULT_PAGE_SIZE);

    if (stream === true) {
      cursor.stream();
    }

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} updates - updates to apply
   * @param {Object} [options] - mongo query options
   */
  updateMany(query, updates, options) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));
      if (!updates) return reject(new errors.InvalidArugmentError('updates is required'));
      options = options || {};

      this._dbCollection.updateMany(query, updates, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} Mongo ObjectId
   * @param {Object} updates - updates to apply
   * @param {Object} [options] - mongo query options
   */
  updateById(objectId, updates, options) {
    return new Promise((resolve, reject) => {
      if (!objectId) return reject(new errors.InvalidArugmentError('objectId is required'));
      if (!updates) return reject(new errors.InvalidArugmentError('updates is required'));
      if (!mongoUtils.isObjectId(objectId)) return reject(new errors.InvalidArugmentError('objectId must be an instance of ObjectId'));
      options = options || {};

      this._dbCollection.updateOne({
        _id: objectId
      }, updates, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} updates - updates to apply
   * @param {Object} [options] - mongo query options
   */
  updateOne(query, updates, options) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));
      if (!updates) return reject(new errors.InvalidArugmentError('updates is required'));
      options = options || {};

      this._dbCollection.updateOne(query, updates, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * Drop the collection
   */
  drop() {
    return new Promise((resolve, reject) => {
      this._dbCollection.drop((err) => {
        if (err) return reject(err);
        return resolve(null);
      });
    });
  }
}

module.exports = Collection;
<commit_msg>don’t allow stream in find method, should use cursor.stream instead<commit_after>'use strict';

const MongoDb = require('mongodb').Db;
const Promise = require('bluebird');
const _ = require('underscore');

const MongotronCursor = require('lib/utils/mongotronCursor');
const mongoUtils = require('lib/utils/mongoUtils');
const errors = require('lib/errors');

const DEFAULT_PAGE_SIZE = 50;

/** @class */
class Collection {
  /**
   * @param {Object} database - MongoDb object
   * @param {Object} options
   * @param {String} options.name - name of the collection
   * @param {String} options.serverName - name of the server
   * @param {String} options.databaseName - name of the database
   */
  constructor(database, options) {
    if (!(database instanceof MongoDb)) console.error('Collection ctor - database is not an instance of MongoDb');

    options = options || {};

    var _this = this;
    _this.id = options.id;
    _this.name = options.name;
    _this.connection = options.connection;
    _this.database = options.database;
    _this.serverName = options.serverName;
    _this.databaseName = options.databaseName;
    _this._dbCollection = database.collection(_this.name);
  }

  /**
   * @param {Object} doc
   */
  insertOne(doc) {
    if (!doc) return Promise.reject(new errors.InvalidArugmentError('doc is required'));

    let cursor = this._dbCollection.insertOne(doc);

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} [query] - mongo query
   * @param {Object} [options] - mongo query options
   */
  find(query, options) {
    options = options || {};

    let cursor = this._dbCollection.find(query, options);

    if (options.skip) cursor.skip(Number(options.skip));
    cursor.limit(options.limit ? Number(options.limit) : DEFAULT_PAGE_SIZE);

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} [options] - mongo query options
   */
  count(query, options) {
    if (!query) return Promise.reject(new errors.InvalidArugmentError('query is required'));
    options = options || {};

    let cursor = this._dbCollection.count(query, options);

    if (options.skip) cursor.skip(Number(options.skip));
    cursor.limit(options.limit ? Number(options.limit) : DEFAULT_PAGE_SIZE);

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} [options] - mongo query options
   */
  deleteMany(query, options) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));
      options = options || {};

      this._dbCollection.deleteMany(query, options, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} Mongo ObjectId
   */
  deleteById(objectId) {
    return new Promise((resolve, reject) => {
      if (!objectId) return reject(new errors.InvalidArugmentError('objectId is required'));

      this._dbCollection.deleteOne({
        _id: objectId
      }, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} query - mongo query
   */
  deleteOne(query) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));

      this._dbCollection.deleteOne(query, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} [pipeline] - mongo pipeline
   * @param {Object} [options] - mongo pipeline options
   */
  aggregate(pipeline, options) {
    if (!_.isArray(pipeline)) return Promise.reject('pipeline must be an array');
    options = options || {};

    let stream = options.stream;
    delete options.stream;

    //always return as a cursor
    options.cursor = {};

    let cursor = this._dbCollection.aggregate(pipeline, options);

    if (options.skip) cursor.skip(Number(options.skip));
    cursor.limit(options.limit ? Number(options.limit) : DEFAULT_PAGE_SIZE);

    if (stream === true) {
      cursor.stream();
    }

    return new MongotronCursor(cursor);
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} updates - updates to apply
   * @param {Object} [options] - mongo query options
   */
  updateMany(query, updates, options) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));
      if (!updates) return reject(new errors.InvalidArugmentError('updates is required'));
      options = options || {};

      this._dbCollection.updateMany(query, updates, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} Mongo ObjectId
   * @param {Object} updates - updates to apply
   * @param {Object} [options] - mongo query options
   */
  updateById(objectId, updates, options) {
    return new Promise((resolve, reject) => {
      if (!objectId) return reject(new errors.InvalidArugmentError('objectId is required'));
      if (!updates) return reject(new errors.InvalidArugmentError('updates is required'));
      if (!mongoUtils.isObjectId(objectId)) return reject(new errors.InvalidArugmentError('objectId must be an instance of ObjectId'));
      options = options || {};

      this._dbCollection.updateOne({
        _id: objectId
      }, updates, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * @param {Object} query - mongo query
   * @param {Object} updates - updates to apply
   * @param {Object} [options] - mongo query options
   */
  updateOne(query, updates, options) {
    return new Promise((resolve, reject) => {
      if (!query) return reject(new errors.InvalidArugmentError('query is required'));
      if (!updates) return reject(new errors.InvalidArugmentError('updates is required'));
      options = options || {};

      this._dbCollection.updateOne(query, updates, (err, result) => {
        if (err) return reject(err);
        return resolve(result);
      });
    });
  }

  /**
   * Drop the collection
   */
  drop() {
    return new Promise((resolve, reject) => {
      this._dbCollection.drop((err) => {
        if (err) return reject(err);
        return resolve(null);
      });
    });
  }
}

module.exports = Collection;
<|endoftext|>


<commit_before>'use strict';

var path            = require( 'path' )
  , fs              = require( 'fs' )
  , packageJson     = require( __dirname + '/package.json' )
  , merge           = require( 'deepmerge' )
  , getModulePaths  = require( path.join( __dirname, 'lib', 'utils', 'getModulePaths.js' ) )
  , helpers         = require( path.join( __dirname, 'lib', 'utils', 'helpers.js' ) )

// Cleanup the NODE_PATH for module loading
process.env.NODE_PATH = helpers.nodePath();

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

    // Create the project wide
    var gruntConfig = {
        watch: {
            tests: {
                files: [ 'lib/**/*.js', 'modules/**/*.js' ],
                tasks: [ 'mochaTest:ci' ]
            }
        },
        nodemon: {
            web: {
                script: 'app.js',
                options: {
                    file: 'app.js',
                    ignoredFiles: [ 'README.md', 'node_modules/**' ],
                    watchedExtensions: [ 'js' ],
                    watchedFolders: [ 'lib','modules' ],
                    delayTime: 1,
                    cwd: __dirname
                }
            }
        },
        mochaTest: {
            unit: {
                options: {
                    require: [ 'chai' ],
                    reporter: 'spec',
                    timeout: 5000
                },
                src: [ 'tests/unit/test.utils.bootstrapEnv.js', 'tests/unit/test.utils.moduleLoader.js', 'tests/unit/test.class.Module.js', 'tests/unit/test.class.Controller.js', 'tests/unit/test.class.Service.js', 'tests/unit/*.js' ].concat( getModulePaths( 'tests', 'unit', '*.js' ) )
            },
            e2e: {
                options: {
                    require: 'chai',
                    reporter: 'spec'
                },
                src: [ 'tests/integration/*.js' ].concat( getModulePaths( 'tests', 'integration', '*.js' ) )
            },
            ci: {
                options: {
                    require: 'chai',
                    reporter: 'min'
                },
                src: [ 'tests/**/*.js' ].concat( getModulePaths( 'tests', 'unit', '*.js' ), getModulePaths( 'tests', 'integration', '*.js' ) )
            }
        },
        concurrent: {
            servers: {
                tasks: [ 'server:web' ],
                options: {
                    logConcurrentOutput: true
                }
            }
        }
    };

    // Module's Gruntfiles.js
    var callbacks = [];

    // Load all modules Gruntfiles.js
    packageJson.bundledDependencies.forEach(function( moduleName ) {
        var moduleGruntfile = [ path.resolve( __dirname ), 'modules', moduleName, 'Gruntfile.js' ].join( path.sep );
        if ( fs.existsSync( moduleGruntfile ) ) {
            var gruntfile = require( moduleGruntfile )( grunt );

            // Merge (deep) the grunt config objects
            gruntConfig = merge( gruntConfig, gruntfile[ 0 ] );

            // Add the register function to our callbacks
            callbacks.push( gruntfile[ 1 ] );
        }
    });

    // Initialize the config
    grunt.initConfig( gruntConfig );

    // Fire the callbacks and allow the modules to register their tasks
    callbacks.forEach( function( cb ) {
        cb( grunt );
    });

    // Register all project wide tasks with grunt
    grunt.registerTask( 'test', [ 'mochaTest:unit', 'mochaTest:e2e', 'db' ] );
    grunt.registerTask( 'test:unit', [ 'mochaTest:unit', 'db' ] );
    grunt.registerTask( 'test:e2e', [ 'mochaTest:e2e', 'db' ] );
    grunt.registerTask( 'test:ci', [ 'watch:tests' ] );
    grunt.registerTask( 'server', [ 'concurrent:servers' ] );
    grunt.registerTask( 'server:web', [ 'nodemon:web' ] );
    grunt.registerTask( 'serve', [ 'server'] );
    grunt.registerTask( 'default', [ 'server'] );
};<commit_msg>feat(jshint): Configure JSHint<commit_after>'use strict';

var path            = require( 'path' )
  , fs              = require( 'fs' )
  , packageJson     = require( __dirname + '/package.json' )
  , merge           = require( 'deepmerge' )
  , getModulePaths  = require( path.join( __dirname, 'lib', 'utils', 'getModulePaths.js' ) )
  , helpers         = require( path.join( __dirname, 'lib', 'utils', 'helpers.js' ) )

// Cleanup the NODE_PATH for module loading
process.env.NODE_PATH = helpers.nodePath();

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

    // Create the project wide
    var gruntConfig = {
        watch: {
            tests: {
                files: [ 'lib/**/*.js', 'modules/**/*.js' ],
                tasks: [ 'mochaTest:ci' ]
            }
        },
        nodemon: {
            web: {
                script: 'app.js',
                options: {
                    file: 'app.js',
                    ignoredFiles: [ 'README.md', 'node_modules/**' ],
                    watchedExtensions: [ 'js' ],
                    watchedFolders: [ 'lib','modules' ],
                    delayTime: 1,
                    cwd: __dirname
                }
            }
        },
        mochaTest: {
            unit: {
                options: {
                    require: [ 'chai' ],
                    reporter: 'spec',
                    timeout: 5000
                },
                src: [ 'tests/unit/test.utils.bootstrapEnv.js', 'tests/unit/test.utils.moduleLoader.js', 'tests/unit/test.class.Module.js', 'tests/unit/test.class.Controller.js', 'tests/unit/test.class.Service.js', 'tests/unit/*.js' ].concat( getModulePaths( 'tests', 'unit', '*.js' ) )
            },
            e2e: {
                options: {
                    require: 'chai',
                    reporter: 'spec'
                },
                src: [ 'tests/integration/*.js' ].concat( getModulePaths( 'tests', 'integration', '*.js' ) )
            },
            ci: {
                options: {
                    require: 'chai',
                    reporter: 'min'
                },
                src: [ 'tests/**/*.js' ].concat( getModulePaths( 'tests', 'unit', '*.js' ), getModulePaths( 'tests', 'integration', '*.js' ) )
            }
        },
        concurrent: {
            servers: {
                tasks: [ 'server:web' ],
                options: {
                    logConcurrentOutput: true
                }
            }
        },
        jshint: {
            options: {
                jshintrc:       '.jshintrc',
                reporter:       require( 'jshint-stylish' ),
                ignores: [
                    './modules/**/test*/**/*.js'
                ]
            },
            all:              [
                './Gruntfile.js',
                './index.js',
                './app.js',
                './lib/**/*.js',
                getModulePaths( '*.js' )
            ]
        }
    };

    // Module's Gruntfiles.js
    var callbacks = [];

    // Load all modules Gruntfiles.js
    packageJson.bundledDependencies.forEach(function( moduleName ) {
        var moduleGruntfile = [ path.resolve( __dirname ), 'modules', moduleName, 'Gruntfile.js' ].join( path.sep );
        if ( fs.existsSync( moduleGruntfile ) ) {
            var gruntfile = require( moduleGruntfile )( grunt );

            // Merge (deep) the grunt config objects
            gruntConfig = merge( gruntConfig, gruntfile[ 0 ] );

            // Add the register function to our callbacks
            callbacks.push( gruntfile[ 1 ] );
        }
    });

    // Initialize the config
    grunt.initConfig( gruntConfig );

    // Fire the callbacks and allow the modules to register their tasks
    callbacks.forEach( function( cb ) {
        cb( grunt );
    });

    // Register all project wide tasks with grunt
    grunt.registerTask( 'test', [ 'mochaTest:unit', 'mochaTest:e2e', 'db' ] );
    grunt.registerTask( 'test:unit', [ 'mochaTest:unit', 'db' ] );
    grunt.registerTask( 'test:e2e', [ 'mochaTest:e2e', 'db' ] );
    grunt.registerTask( 'test:ci', [ 'watch:tests' ] );
    grunt.registerTask( 'server', [ 'concurrent:servers' ] );
    grunt.registerTask( 'server:web', [ 'nodemon:web' ] );
    grunt.registerTask( 'serve', [ 'server'] );
    grunt.registerTask( 'default', [ 'server'] );
};<|endoftext|>


<commit_before>const child_process = require("child_process");
const fs = require("fs");

module.exports = function(grunt) {
  var pkg = grunt.file.readJSON('package.json');

  var betaVersion = pkg.version.toString() + "." + process.env.TRAVIS_BUILD_NUMBER;

  grunt.initConfig({
    pkg: pkg,

    compress: {
      // Zip up the extension
      chrome: {
        options: {
          archive: 'dist/chrome.zip'
        },
        files: [{
          expand: true,
          cwd: 'dist',
          src: [
            '**',
            '!data',
            '!chrome.zip',
            '!.htaccess',
            '!stats.html'
          ],
          dest: '/',
          filter: 'isFile'
        }, ]
      }
    },

    // See https://github.com/c301/grunt-webstore-upload
    webstore_upload: {
      accounts: {
        // This is set up by environment variables from Travis. To
        // push locally, create a file with these variables defined
        // and source it before running "grunt publish:beta". E.g.:
        //
        // ./beta_credentials:
        //
        // export CHROME_CLIENT_ID="foo"
        // export CHROME_SECRET="bar"
        // export CHROME_REFRESH_TOKEN="baz"
        //
        // Then run "source ./beta_credentials; grunt publish_chrome_beta"
        //
        // To set up these variables to be available in Travis:
        // travis encrypt CHROME_CLIENT_ID=super_secret --add env.matrix
        // travis encrypt CHROME_SECRET=super_secret --add env.matrix
        // travis encrypt CHROME_REFRESH_TOKEN=super_secret --add env.matrix
        default: { //account under this section will be used by default
          publish: true, //publish item right after uploading. default false
          client_id: process.env.CHROME_CLIENT_ID,
          client_secret: process.env.CHROME_SECRET,
          refresh_token: process.env.CHROME_REFRESH_TOKEN
        }
      },
      extensions: {
        release: {
          appID: "apghicjnekejhfancbkahkhdckhdagna",
          publish: false,
          zip: "dist/chrome.zip"
        },
        beta: {
          appID: "mkiipknpfaacbjdagdeppdacpgpdjklc",
          zip: "dist/chrome.zip"
        }
      }
    },

    // Tasks for uploading the website versions
    rsync: {
      options: {
        //dryRun: true,
        args: ["--verbose"],
        exclude: ["chrome.zip", "stats.html"],
        host: process.env.REMOTE_HOST,
        port: 2222,
        recursive: true,
        deleteAll: true,
        ssh: true,
        privateKey: 'config/dim_travis.rsa',
        sshCmdArgs: ["-o StrictHostKeyChecking=no"]
      },
      beta: {
        options: {
          src: "dist/",
          dest: process.env.REMOTE_PATH + "beta"
        }
      },
      prod: {
        options: {
          src: "dist/",
          dest: process.env.REMOTE_PATH + "prod"
        }
      }
    },

    precompress: {
      web: {
        src: "dist/**/*.{js,html,css,json,map,ttf,eot,svg}"
      }
    }
  });

  grunt.loadNpmTasks('grunt-webstore-upload');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-rsync');

  grunt.registerTask('update_chrome_beta_manifest', function() {
    var manifest = grunt.file.readJSON('dist/manifest.json');
    manifest.name = manifest.name + " Beta";
    manifest.version = betaVersion;
    grunt.file.write('dist/manifest.json', JSON.stringify(manifest));
  });

  grunt.registerTask('update_chrome_release_manifest', function() {
    var manifest = grunt.file.readJSON('dist/manifest.json');
    manifest.version = pkg.version;
    grunt.file.write('dist/manifest.json', JSON.stringify(manifest));
  });

  grunt.registerMultiTask(
    'precompress',
    'Create gzip and brotli versions of web assets',
    function() {
      const done = this.async();
      const promises = [];
      this.filesSrc.forEach(function(file) {
        promises.push(new Promise(function(resolve, reject) {
          child_process.exec("gzip -c --no-name " + file + " > " + file + ".gz", function(error, stdout, stderr) {
            if (error) {
              grunt.log.writeln("gzip " + file + " => error: " + stdout + stderr);
              reject(error);
            } else {
              grunt.log.writeln("gzip " + file + " => success");
              resolve();
            }
          });
        }));

        promises.push(new Promise(function(resolve, reject) {
          child_process.execFile("brotli/brotli", [file], function(error, stdout, stderr) {
            if (error) {
              grunt.log.writeln("brotli " + file + " => error: " + stdout + stderr);
              reject(error);
            } else {
              grunt.log.writeln("brotli " + file + " => success");
              resolve();
            }
          });
        }).then(function() {
          return new Promise(function(resolve, reject) {
            fs.chmod(file + ".br", 0644, resolve);
          });
        }));
      });

      Promise.all(promises).then(done);
    }
  );

  grunt.registerTask('publish_beta', [
    'update_chrome_beta_manifest',
    'compress:chrome',
    'log_beta_version',
    'webstore_upload:beta',
    'precompress',
    'rsync:beta'
  ]);

  grunt.registerTask('publish_release', [
    'update_chrome_release_manifest',
    'compress:chrome',
    'log_release_version',
    'webstore_upload:release',
    'precompress',
    'rsync:prod'
  ]);

  grunt.registerTask('log_beta_version', function() {
    grunt.log.ok("New Beta version is " + betaVersion);
  });

  grunt.registerTask('log_release_version', function() {
    grunt.log.ok("New production version is " + pkg.version);
  });
};
<commit_msg>Enable publish for release extension<commit_after>const child_process = require("child_process");
const fs = require("fs");

module.exports = function(grunt) {
  var pkg = grunt.file.readJSON('package.json');

  var betaVersion = pkg.version.toString() + "." + process.env.TRAVIS_BUILD_NUMBER;

  grunt.initConfig({
    pkg: pkg,

    compress: {
      // Zip up the extension
      chrome: {
        options: {
          archive: 'dist/chrome.zip'
        },
        files: [{
          expand: true,
          cwd: 'dist',
          src: [
            '**',
            '!data',
            '!chrome.zip',
            '!.htaccess',
            '!stats.html'
          ],
          dest: '/',
          filter: 'isFile'
        }, ]
      }
    },

    // See https://github.com/c301/grunt-webstore-upload
    webstore_upload: {
      accounts: {
        // This is set up by environment variables from Travis. To
        // push locally, create a file with these variables defined
        // and source it before running "grunt publish:beta". E.g.:
        //
        // ./beta_credentials:
        //
        // export CHROME_CLIENT_ID="foo"
        // export CHROME_SECRET="bar"
        // export CHROME_REFRESH_TOKEN="baz"
        //
        // Then run "source ./beta_credentials; grunt publish_chrome_beta"
        //
        // To set up these variables to be available in Travis:
        // travis encrypt CHROME_CLIENT_ID=super_secret --add env.matrix
        // travis encrypt CHROME_SECRET=super_secret --add env.matrix
        // travis encrypt CHROME_REFRESH_TOKEN=super_secret --add env.matrix
        default: { //account under this section will be used by default
          publish: true, //publish item right after uploading. default false
          client_id: process.env.CHROME_CLIENT_ID,
          client_secret: process.env.CHROME_SECRET,
          refresh_token: process.env.CHROME_REFRESH_TOKEN
        }
      },
      extensions: {
        release: {
          appID: "apghicjnekejhfancbkahkhdckhdagna",
          zip: "dist/chrome.zip"
        },
        beta: {
          appID: "mkiipknpfaacbjdagdeppdacpgpdjklc",
          zip: "dist/chrome.zip"
        }
      }
    },

    // Tasks for uploading the website versions
    rsync: {
      options: {
        //dryRun: true,
        args: ["--verbose"],
        exclude: ["chrome.zip", "stats.html"],
        host: process.env.REMOTE_HOST,
        port: 2222,
        recursive: true,
        deleteAll: true,
        ssh: true,
        privateKey: 'config/dim_travis.rsa',
        sshCmdArgs: ["-o StrictHostKeyChecking=no"]
      },
      beta: {
        options: {
          src: "dist/",
          dest: process.env.REMOTE_PATH + "beta"
        }
      },
      prod: {
        options: {
          src: "dist/",
          dest: process.env.REMOTE_PATH + "prod"
        }
      }
    },

    precompress: {
      web: {
        src: "dist/**/*.{js,html,css,json,map,ttf,eot,svg}"
      }
    }
  });

  grunt.loadNpmTasks('grunt-webstore-upload');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-rsync');

  grunt.registerTask('update_chrome_beta_manifest', function() {
    var manifest = grunt.file.readJSON('dist/manifest.json');
    manifest.name = manifest.name + " Beta";
    manifest.version = betaVersion;
    grunt.file.write('dist/manifest.json', JSON.stringify(manifest));
  });

  grunt.registerTask('update_chrome_release_manifest', function() {
    var manifest = grunt.file.readJSON('dist/manifest.json');
    manifest.version = pkg.version;
    grunt.file.write('dist/manifest.json', JSON.stringify(manifest));
  });

  grunt.registerMultiTask(
    'precompress',
    'Create gzip and brotli versions of web assets',
    function() {
      const done = this.async();
      const promises = [];
      this.filesSrc.forEach(function(file) {
        promises.push(new Promise(function(resolve, reject) {
          child_process.exec("gzip -c --no-name " + file + " > " + file + ".gz", function(error, stdout, stderr) {
            if (error) {
              grunt.log.writeln("gzip " + file + " => error: " + stdout + stderr);
              reject(error);
            } else {
              grunt.log.writeln("gzip " + file + " => success");
              resolve();
            }
          });
        }));

        promises.push(new Promise(function(resolve, reject) {
          child_process.execFile("brotli/brotli", [file], function(error, stdout, stderr) {
            if (error) {
              grunt.log.writeln("brotli " + file + " => error: " + stdout + stderr);
              reject(error);
            } else {
              grunt.log.writeln("brotli " + file + " => success");
              resolve();
            }
          });
        }).then(function() {
          return new Promise(function(resolve, reject) {
            fs.chmod(file + ".br", 0644, resolve);
          });
        }));
      });

      Promise.all(promises).then(done);
    }
  );

  grunt.registerTask('publish_beta', [
    'update_chrome_beta_manifest',
    'compress:chrome',
    'log_beta_version',
    'webstore_upload:beta',
    'precompress',
    'rsync:beta'
  ]);

  grunt.registerTask('publish_release', [
    'update_chrome_release_manifest',
    'compress:chrome',
    'log_release_version',
    'webstore_upload:release',
    'precompress',
    'rsync:prod'
  ]);

  grunt.registerTask('log_beta_version', function() {
    grunt.log.ok("New Beta version is " + betaVersion);
  });

  grunt.registerTask('log_release_version', function() {
    grunt.log.ok("New production version is " + pkg.version);
  });
};
<|endoftext|>


<commit_before>'use strict';
// js-hint options. See the complete list of options [here](http://jshint.com/docs/options/)
var jshintOptions = {
  nonew: true,
  plusplus: true,
  curly: true,
  latedef: true,
  maxdepth: 6,
  unused: true,
  noarg: true,
  trailing: true,
  indent: 4,
  forin: true,
  noempty: true,
  quotmark: true,
  maxparams: 6,
  node: true,
  eqeqeq: true,
  strict: true,
  undef: true,
  bitwise: true,
  newcap: true,
  immed: true,
  camelcase: true,
  maxcomplexity: 7,
  maxlen: 120,
  nonbsp: true,
  freeze: true
};
module.exports = function (grunt) {
  // loading the npm task
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-docco');
  grunt.loadNpmTasks('grunt-gh-pages');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-contrib-clean');
  // Project configuration.
  grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      clean: [
        '.coverage',
        '.test',
        '.cache'
      ],
      jshint: {
        lib: {
          src: [
            'lib/**/*.js',
            'Gruntfile.js',
            'package.json'
          ],
          options: jshintOptions
        }
      },
      karma: {
        testAMD: {
          frameworks: [
            'requirejs',
            'mocha',
            'chai'
          ],
          files: [
            {
              src: [
                'node_modules/accessibility-developer-tools/dist/js/axs_testing.js',
                'node_modules/requirejs/require.js',
                'test/require-config.js'
              ],
              served: true,
              included: true
            },
            {
              src: [
                'test/amd-specs.js',
                'lib/**/*.js',
                'node_modules/jquery/dist/jquery.js'
              ],
              served: true,
              included: false
            }
          ],
          plugins: [
            'karma-requirejs',
            'karma-chai',
            'karma-mocha',
            'karma-mocha-reporter',
            'karma-phantomjs-launcher'
          ]
        },
        testCommonJs: {
          frameworks: [
            'optimizer',
            'mocha'
          ],
          optimizer: {
            minify: false,
            bundlingEnabled: false,
            cacheProfile: 'development',
            tempdir: '.test',
            ignore: 'node_modules/accessibility-developer-tools/**'
          },
          files: [
            {
              src: [
                'test/commonjs-specs.js',
                'node_modules/accessibility-developer-tools/dist/js/axs_testing.js'
              ]
            }
          ],
          plugins: [
            'karma-chai',
            'karma-mocha',
            'karma-optimizer',
            'karma-mocha-reporter',
            'karma-phantomjs-launcher'
          ]
        },
        testScriptTag: {
          frameworks: [
            'mocha',
            'chai'
          ],
          files: [
            {
              src: [
                'node_modules/jquery/dist/jquery.js',
                'node_modules/accessibility-developer-tools/dist/js/axs_testing.js',
                'lib/index.js',
                'test/script-tag-specs.js'
              ]
            }
          ],
          plugins: [
            'karma-chai',
            'karma-mocha',
            'karma-mocha-reporter',
            'karma-phantomjs-launcher'
          ],
          client: {
            mocha: {
              ui: 'bdd'
            }
          }
        },
        options: {
          browsers: [
            'PhantomJS'
          ],
          client: {
            mocha: {
              timeout: 500,
              ui: 'bdd'
            }
          },
          singleRun: true,
          reporters: [
            'mocha'
          ]
        }
      },
      // Configure a mochaTest task
      mochaTest: {
        test: {
          options: {
            reporter: 'spec'
          },
          src: [
            'test/nodejs-specs.js'
          ]
        }
      },
      docco: {
        debug: {
          src: [
            'lib/**',
            'README.md'
          ],
          options: {
            output: '.docs/'
          }
        }
      },
      'gh-pages': {
        options: {
          base: '.docs',
          // GH_TOKEN is the environment variable holding the access token for the repository
          repo: 'https://' + process.env.GH_TOKEN + '@github.com/pranavjha/chai-a11y.git',
          clone: '.gh_pages',
          message: 'auto commit chai-a11y on <%= grunt.template.today("yyyy-mm-dd") %>',
          // This configuration will suppress logging and sanitize error messages.
          silent: true,
          user: {
            name: 'Pranav Jha',
            email: 'jha.pranav.s@gmail.com'
          }
        },
        src: [
          '**'
        ]
      }
    }
  );
  grunt.registerTask('test', [
    'jshint',
    'mochaTest',
    'karma'
  ]);
  grunt.registerTask('document', [
    'docco'
  ]);
};
<commit_msg>moved to temp files to server<commit_after>'use strict';
// js-hint options. See the complete list of options [here](http://jshint.com/docs/options/)
var jshintOptions = {
  nonew: true,
  plusplus: true,
  curly: true,
  latedef: true,
  maxdepth: 6,
  unused: true,
  noarg: true,
  trailing: true,
  indent: 4,
  forin: true,
  noempty: true,
  quotmark: true,
  maxparams: 6,
  node: true,
  eqeqeq: true,
  strict: true,
  undef: true,
  bitwise: true,
  newcap: true,
  immed: true,
  camelcase: true,
  maxcomplexity: 7,
  maxlen: 120,
  nonbsp: true,
  freeze: true
};
module.exports = function (grunt) {
  // loading the npm task
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-docco');
  grunt.loadNpmTasks('grunt-gh-pages');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-contrib-clean');
  // Project configuration.
  grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      clean: [
        '.coverage',
        '.test',
        '.cache'
      ],
      jshint: {
        lib: {
          src: [
            'lib/**/*.js',
            'Gruntfile.js',
            'package.json'
          ],
          options: jshintOptions
        }
      },
      karma: {
        testAMD: {
          frameworks: [
            'requirejs',
            'mocha',
            'chai'
          ],
          files: [
            {
              src: [
                'node_modules/accessibility-developer-tools/dist/js/axs_testing.js',
                'node_modules/requirejs/require.js',
                'test/require-config.js'
              ],
              served: true,
              included: true
            },
            {
              src: [
                'test/amd-specs.js',
                'lib/**/*.js',
                'node_modules/jquery/dist/jquery.js'
              ],
              served: true,
              included: false
            }
          ],
          plugins: [
            'karma-requirejs',
            'karma-chai',
            'karma-mocha',
            'karma-mocha-reporter',
            'karma-phantomjs-launcher'
          ]
        },
        testCommonJs: {
          frameworks: [
            'optimizer',
            'mocha'
          ],
          optimizer: {
            minify: false,
            bundlingEnabled: false,
            cacheProfile: 'development',
            tempdir: '.test',
            ignore: 'node_modules/accessibility-developer-tools/**',
            plugins: []
          },
          files: [
            {
              src: [
                'test/commonjs-specs.js',
                'node_modules/accessibility-developer-tools/dist/js/axs_testing.js'
              ]
            }
          ],
          plugins: [
            'karma-chai',
            'karma-mocha',
            'karma-optimizer',
            'karma-mocha-reporter',
            'karma-phantomjs-launcher'
          ]
        },
        testScriptTag: {
          frameworks: [
            'mocha',
            'chai'
          ],
          files: [
            {
              src: [
                'node_modules/jquery/dist/jquery.js',
                'node_modules/accessibility-developer-tools/dist/js/axs_testing.js',
                'lib/index.js',
                'test/script-tag-specs.js'
              ]
            }
          ],
          plugins: [
            'karma-chai',
            'karma-mocha',
            'karma-mocha-reporter',
            'karma-phantomjs-launcher'
          ],
          client: {
            mocha: {
              ui: 'bdd'
            }
          }
        },
        options: {
          browsers: [
            'PhantomJS'
          ],
          client: {
            mocha: {
              timeout: 500,
              ui: 'bdd'
            }
          },
          singleRun: true,
          reporters: [
            'mocha'
          ]
        }
      },
      // Configure a mochaTest task
      mochaTest: {
        test: {
          options: {
            reporter: 'spec'
          },
          src: [
            'test/nodejs-specs.js'
          ]
        }
      },
      docco: {
        debug: {
          src: [
            'lib/**',
            'README.md'
          ],
          options: {
            output: '.docs/'
          }
        }
      },
      'gh-pages': {
        options: {
          base: '.docs',
          // GH_TOKEN is the environment variable holding the access token for the repository
          repo: 'https://' + process.env.GH_TOKEN + '@github.com/pranavjha/chai-a11y.git',
          clone: '.gh_pages',
          message: 'auto commit chai-a11y on <%= grunt.template.today("yyyy-mm-dd") %>',
          // This configuration will suppress logging and sanitize error messages.
          silent: true,
          user: {
            name: 'Pranav Jha',
            email: 'jha.pranav.s@gmail.com'
          }
        },
        src: [
          '**'
        ]
      }
    }
  );
  grunt.registerTask('test', [
    'jshint',
    'mochaTest',
    'karma'
  ]);
  grunt.registerTask('document', [
    'docco'
  ]);
};
<|endoftext|>


<commit_before>export default function(tx, file) {
  let imageUrl = URL.createObjectURL(file)
  let mimeData = file.type.split('/')
  let fig = tx.createElement('fig')
  fig.append(
   tx.createElement('object-id').text(fig.id),
   tx.createElement('title').text('Figure title'),
   tx.createElement('caption').append(
     tx.createElement('p').text('Figure caption')
   ),
   tx.createElement('graphic').attr({
     'mime-subtype': mimeData[1],
     'mimetype': mimeData[0],
     'xlink:href': imageUrl
   })
  )
  return fig
}
<commit_msg>Remove InsertFigure.<commit_after><|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
  var srcFiles = [
    'Gruntfile.js',
    'app.js',
    'api_modules/*.js',
    'tests/*.js',
    'schemas/*.js',
    'routes/*.js'
  ];

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsbeautifier: {
      files: srcFiles,
      options: {
        js: {
          braceStyle: "collapse",
          breakChainedMethods: true,
          e4x: true,
          evalCode: false,
          indentChar: " ",
          indentLevel: 0,
          indentSize: 2,
          indentWithTabs: false,
          jslintHappy: true,
          keepArrayIndentation: false,
          keepFunctionIndentation: false,
          maxPreserveNewlines: 10,
          preserveNewlines: true,
          spaceBeforeConditional: true,
          spaceInParen: false,
          unescapeStrings: false,
          wrapLineLength: 80,
          goodStuff: true
        }
      }
    },
    jshint: {
      files: srcFiles,
      options: {
        console: true,
        modules: true,
        document: true,
        bitwise: true,
        curly: true,
        eqeqeq: true,
        immed: true,
        indent: 2,
        latedef: true,
        newcap: true,
        noarg: true,
        nonew: true,
        quotmark: "single",
        undef: true,
        unused: true,
        strict: true,
        trailing: true,
        maxlen: 80
      }
    }
  });

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

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

};
<commit_msg>Fixed the jshint config<commit_after>'use strict';

module.exports = function (grunt) {
  var srcFiles = [
    'Gruntfile.js',
    'app.js',
    'api_modules/*.js',
    'tests/*.js',
    'schemas/*.js',
    'routes/*.js'
  ];

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jsbeautifier: {
      files: srcFiles,
      options: {
        js: {
          braceStyle: "collapse",
          breakChainedMethods: true,
          e4x: true,
          evalCode: false,
          indentChar: " ",
          indentLevel: 0,
          indentSize: 2,
          indentWithTabs: false,
          jslintHappy: true,
          keepArrayIndentation: false,
          keepFunctionIndentation: false,
          maxPreserveNewlines: 10,
          preserveNewlines: true,
          spaceBeforeConditional: true,
          spaceInParen: false,
          unescapeStrings: false,
          wrapLineLength: 80,
          goodStuff: true

        }
      }
    },
    jshint: {
      files: srcFiles,
      options: {
        bitwise: true,
        curly: true,
        eqeqeq: true,
        immed: true,
        indent: 2,
        latedef: true,
        newcap: true,
        noarg: true,
        nonew: true,
        quotmark: "single",
        undef: true,
        unused: true,
        strict: true,
        trailing: true,
        maxlen: 80,
        globals: {
          console: true,
          require: true
        }
      }
    }
  });

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

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

};
<|endoftext|>


<commit_before>// Generated on 2015-03-09 using generator-angular 0.9.2
'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);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

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

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', '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: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          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: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.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
    wiredep: {
      options: {
        cwd: '<%= yeoman.app %>'
      },
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

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

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        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 %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

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

    // The following *-min tasks will produce minified files in the dist folder
    // 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'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    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,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    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',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      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: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

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

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

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

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>Structure: Fix yeoman grunt task<commit_after>// Generated on 2015-03-09 using generator-angular 0.9.2
'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);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

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

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', '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: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          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: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.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
    wiredep: {
      options: {
        cwd: './'
      },
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

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

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        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 %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

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

    // The following *-min tasks will produce minified files in the dist folder
    // 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'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    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,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    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',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      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: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

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

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

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

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

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