<commit_before>var ghdeploy = require('./tasks/ghdeploy');
var packager = require('./tasks/packager');

// List module files in order so that calls to require() work right:
var libFiles = [
  __dirname + '/lib/fxpay/init_module.js',
  __dirname + '/lib/fxpay/utils.js',
  __dirname + '/lib/fxpay/settings.js',
  __dirname + '/lib/fxpay/api.js',
  __dirname + '/lib/fxpay/jwt.js',
  __dirname + '/lib/fxpay/pay.js',
  __dirname + '/lib/fxpay/products.js',
  __dirname + '/lib/fxpay/receipts.js',
  __dirname + '/lib/fxpay/adapter.js',
  __dirname + '/lib/fxpay/index.js',
];

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    jshint: {
      options: { jshintrc: __dirname + '/.jshintrc' },
      files: [
        'Gruntfile.js',
        'lib/*.js',
        'lib/*/*.js',
        'tests/*.js',
      ],
    },

    karma: {
      options: {
        files: libFiles.slice(0).concat([
          'tests/helper.js',
          // Allow an optional pattern for test files with --tests.
          {pattern: grunt.option('tests') || 'tests/test*.js',
           included: true}
        ])
      },
      dev: {
        configFile: 'karma.conf.js',
        autoWatch: true
      },
      run: {
        configFile: 'karma.conf.js',
        singleRun: true
      },
    },

    uglify: {
      options: {
        sourceMap: true
      },
      minned: {
        files: {
          'build/fxpay.min.js': 'build/fxpay.debug.js',
        }
      },
      debug: {
        options: {
          beautify: {
            'beautify': true,
            'indent_level': 2
          },
          compress: false,
          mangle: false,
          preserveComments: true,
          sourceMap: false,
        },
        files: {
          'build/fxpay.debug.js': libFiles,
        }
      }

    },

    usebanner: {
      chaff: {
        options: {
          position: 'top',
          banner: ")]}'",
          linebreak: true
        },
        files: {
          src: ['build/fxpay.min.js.map']
        }
      }
    },

    bump: {
      options: {
        // The pattern 'version': '..' will be updated in all these files.
        files: ['bower.json', 'lib/fxpay/settings.js', 'package.json'],
        commit: false,
        createTag: false,
        push: false,
      }
    },

    clean: {
      build: [
        'build/*.js',
        'build/*.map',
        'dist/*.js',
        'dist/*.map'
      ],
    },

    copy: {
      main: {
        cwd: 'build/',
        src: ['*.js', '*.map'],
        dest: 'dist/',
        filter: 'isFile',
        expand: true,
      }
    },

  });

  // Always show stack traces when Grunt prints out an uncaught exception.
  grunt.option('stack', true);

  grunt.loadNpmTasks('grunt-banner');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-karma');

  grunt.registerTask('ghdeploy',
                     'publish example site to github pages',
                     ghdeploy.createTask(grunt, __dirname,
                                         {removeFiles: ['node_modules']}));

  grunt.registerTask('createpackage',
                     'create a packaged example app',
                     packager.createTask(grunt, __dirname));
  grunt.registerTask('package', ['compress', 'createpackage']);

  // The `compress` step builds a debug version first and then uses that as
  // the source for the minified version.
  grunt.registerTask('compress', [
    'uglify:debug', 'uglify:minned', 'usebanner:chaff']);
  grunt.registerTask('test', ['jshint', 'compress', 'karma:run']);
  grunt.registerTask('release', ['clean', 'compress', 'copy']);

  grunt.registerTask('default', 'test');
};
<commit_msg>Fix jshint warning on Gruntfile<commit_after>var ghdeploy = require('./tasks/ghdeploy');
var packager = require('./tasks/packager');

// List module files in order so that calls to require() work right:
var libFiles = [
  __dirname + '/lib/fxpay/init_module.js',
  __dirname + '/lib/fxpay/utils.js',
  __dirname + '/lib/fxpay/settings.js',
  __dirname + '/lib/fxpay/api.js',
  __dirname + '/lib/fxpay/jwt.js',
  __dirname + '/lib/fxpay/pay.js',
  __dirname + '/lib/fxpay/products.js',
  __dirname + '/lib/fxpay/receipts.js',
  __dirname + '/lib/fxpay/adapter.js',
  __dirname + '/lib/fxpay/index.js',
];

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    jshint: {
      options: { jshintrc: __dirname + '/.jshintrc' },
      files: [
        'Gruntfile.js',
        'lib/*.js',
        'lib/*/*.js',
        'tests/*.js',
      ],
    },

    karma: {
      options: {
        files: libFiles.slice(0).concat([
          'tests/helper.js',
          // Allow an optional pattern for test files with --tests.
          {pattern: grunt.option('tests') || 'tests/test*.js',
           included: true}
        ])
      },
      dev: {
        configFile: 'karma.conf.js',
        autoWatch: true
      },
      run: {
        configFile: 'karma.conf.js',
        singleRun: true
      },
    },

    uglify: {
      options: {
        sourceMap: true
      },
      minned: {
        files: {
          'build/fxpay.min.js': 'build/fxpay.debug.js',
        }
      },
      debug: {
        options: {
          beautify: {
            'beautify': true,
            'indent_level': 2
          },
          compress: false,
          mangle: false,
          preserveComments: true,
          sourceMap: false,
        },
        files: {
          'build/fxpay.debug.js': libFiles,
        }
      }

    },

    usebanner: {
      chaff: {
        options: {
          position: 'top',
          banner: ")]}'",
          linebreak: true
        },
        files: {
          src: ['build/fxpay.min.js.map']
        }
      }
    },

    bump: {
      options: {
        // The pattern 'version': '..' will be updated in all these files.
        files: ['bower.json', 'lib/fxpay/settings.js', 'package.json'],
        commit: false,
        createTag: false,
        push: false,
      }
    },

    clean: {
      build: [
        'build/*.js',
        'build/*.map',
        'dist/*.js',
        'dist/*.map'
      ],
    },

    copy: {
      main: {
        cwd: 'build/',
        src: ['*.js', '*.map'],
        dest: 'dist/',
        filter: 'isFile',
        expand: true,
      }
    },

  });

  // Always show stack traces when Grunt prints out an uncaught exception.
  grunt.option('stack', true);

  grunt.loadNpmTasks('grunt-banner');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-karma');

  grunt.registerTask('ghdeploy',
                     'publish example site to github pages',
                     ghdeploy.createTask(grunt, __dirname,
                                         {removeFiles: ['node_modules']}));

  grunt.registerTask('createpackage',
                     'create a packaged example app',
                     packager.createTask(grunt, __dirname));
  grunt.registerTask('package', ['compress', 'createpackage']);

  // The `compress` step builds a debug version first and then uses that as
  // the source for the minified version.
  grunt.registerTask('compress',
    ['uglify:debug', 'uglify:minned', 'usebanner:chaff']);
  grunt.registerTask('test', ['jshint', 'compress', 'karma:run']);
  grunt.registerTask('release', ['clean', 'compress', 'copy']);

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


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

    'use strict';

    if (grunt.option('help')) {
        // Load all tasks so they can be viewed in the help: grunt -h or --help.
        require('load-grunt-tasks')(grunt);
    } else {
        // Use jit-grunt to only load necessary tasks for each invocation of grunt.
        require('jit-grunt')(grunt);
    }

    grunt.config.merge({
        watch: {
            sass: {
                files: [
                    '**/*.sass'
                ],
                tasks: [
                    'sass'
                ]
            },
            svgstore: {
                files: [
                    'images/icons/**/*.svg'
                ],
                tasks: 'svgstore:main'
            }
        },
        sass: {
            options: {
                sourceMap: true,
                sourceMapContents: true,
                includePaths: [
                    'sass'
                ]
            },
            dev: {
                files: {
                   'stylesheets/main.css': 'sass/main.sass'
                }
            }
        },
        svgstore: {
            options: {
                prefix: 'svg-', // This will prefix each ID
                svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG
                    viewBox: '0 0 100 100',
                    xmlns: 'http://www.w3.org/2000/svg'
                }
            },
            main: {
                dest: 'images/svg-defs.svg',
                src: ['images/icons/**/*.svg']
            }
        }
    });

    // - - - T A S K S - - -

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

    grunt.registerTask('dev', function () {
        grunt.task.run([
            'sass',
            'svgstore',
            'watch'
        ]);
    });

    grunt.registerTask('build', function () {
        var tasks = [
            'sass',
            'svgstore'
        ];
        grunt.task.run(tasks);
    });

}
<commit_msg>Rewrite grunt tasks to be array instead of function<commit_after>module.exports = function (grunt) {

    'use strict';

    if (grunt.option('help')) {
        // Load all tasks so they can be viewed in the help: grunt -h or --help.
        require('load-grunt-tasks')(grunt);
    } else {
        // Use jit-grunt to only load necessary tasks for each invocation of grunt.
        require('jit-grunt')(grunt);
    }

    grunt.config.merge({
        watch: {
            sass: {
                files: [
                    '**/*.sass'
                ],
                tasks: [
                    'sass'
                ]
            },
            svgstore: {
                files: [
                    'images/icons/**/*.svg'
                ],
                tasks: 'svgstore:main'
            }
        },
        sass: {
            options: {
                sourceMap: true,
                sourceMapContents: true,
                includePaths: [
                    'sass'
                ]
            },
            dev: {
                files: {
                   'stylesheets/main.css': 'sass/main.sass'
                }
            }
        },
        svgstore: {
            options: {
                prefix: 'svg-', // This will prefix each ID
                svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG
                    viewBox: '0 0 100 100',
                    xmlns: 'http://www.w3.org/2000/svg'
                }
            },
            main: {
                dest: 'images/svg-defs.svg',
                src: ['images/icons/**/*.svg']
            }
        }
    });

    // - - - T A S K S - - -

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

    grunt.registerTask('dev', [
        'sass',
        'svgstore',
        'watch'
    ]);

    grunt.registerTask('build', [
        'sass',
        'svgstore'
    ]);

}
<|endoftext|>


<commit_before>// Generated on 2014-03-14 using generator-webapp 0.4.8
'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);

  // Turn on the stack trace by default
  grunt.option('stack', true);

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

    // Project settings
    config: {
      // Configurable paths
      app: 'app',
      dist: 'dist'
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      jade: {
        files: ['<%= config.app %>/{,*/}*.jade'],
        tasks: ['jade']
      },
      bower: {
        files: ['bower.json'],
        tasks: ['bowerInstall']
      },
      coffee: {
        files: ['<%= config.app %>/scripts/{,*/}*.{coffee,litcoffee,coffee.md}'],
        tasks: ['coffee:dist', 'jshint:all']
      },
      js: {
        files: ['<%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:copy:server']
      },
      gruntfile: {
        files: ['Gruntfile.js'],
        tasks: ['jshint:gruntfile']
      },
      compass: {
        files: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      styles: {
        files: ['<%= config.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:server', 'autoprefixer']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '.tmp/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '.tmp/scripts/{,*/}*.js',
          '<%= config.app %>/images/{,*/}*'
        ]
      }
    },

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

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

    // Compile Jade to HTML
    jade: {
      options: {
        pretty: true
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>',
          dest: '<%= config.dist %>',
          src: '*.jade',
          ext: '.html'
        }]
      },
      server: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>',
          dest: '.tmp',
          src: '*.jade',
          ext: '.html'
        }]
      }
    },

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

    // Compiles CoffeeScript to JavaScript
    coffee: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/scripts',
          src: '{,*/}*.{coffee,litcoffee,coffee.md}',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        config: 'config.rb'
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

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

    // Automatically inject Bower components into the HTML file
    bowerInstall: {
      app: {
        src: ['<%= config.app %>/{,*/}*.jade'],
        ignorePath: '<%= config.app %>/',
        exclude: ['<%= config.app %>/bower_components/bootstrap-sass/vendor/assets/javascripts/bootstrap.js', ],
      },
      sass: {
        src: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= config.app %>/bower_components/'
      },
      replace: {
        js: '<script src="{{filePath}}"></script>',
        scss: '<link rel="stylesheet" href="{{filePath}}" />'
      }
    },

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

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

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%= config.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true,
          removeCommentsFromCDATA: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true,
          removeRedundantAttributes: true,
          useShortDoctype: true
        },
        files: [{
          expand: true,
          cwd: '<%= config.dist %>',
          src: '{,*/}*.html',
          dest: '<%= config.dist %>'
        }]
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= config.app %>',
            dest: '<%= config.dist %>',
            src: [
              '*.{ico,png,txt,svg}',
              '.htaccess',
              'images/{,*/}*.{webp,svg}',
              'fonts/{,*/}*.*'
            ]
          }
        ]
      },
      server: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= config.app %>/styles',
            dest: '.tmp/styles/',
            src: '{,*/}*.css'
          },{
            // Copy any javascript files to the temo directory
            expand: true,
            dot: true,
            cwd: '<%= config.app %>/scripts',
            dest: '.tmp/scripts/',
            src: '{,*/}*.js'
          }
        ]
      }
    },

    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        push: true,
        pushTo: 'origin',
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        commitFiles: ['<%= bump.options.files %>', 'CHANGELOG.md'],
        commitMessage: 'Bumped version to v%VERSION%'
      }
    },

    changelog: {
      options: {
        editor: 'atom -w'
      }
    },

    // Run some tasks in parallel to speed up build process
    concurrent: {
      options: {
        logConcurrentOutput: true,
        limit: 5
      },
      server: [
        'compass:server',
        'newer:coffee',
        'newer:copy:server',
      ],
      dist: [
        'coffee',
        'compass',
        'copy:server',
        'imagemin'
      ]
    }
  });

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

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

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

  grunt.registerTask('default', [
    'clean:dist',
    'jade:dist',
    'useminPrepare',
    'concurrent:dist',
    'jshint:all',
    'autoprefixer',
    'concat',
    'cssmin',
    'uglify',
    'copy:dist',
    'usemin',
    'htmlmin'
  ]);

};
<commit_msg>feat: add changelog and version bump<commit_after>// Generated on 2014-03-14 using generator-webapp 0.4.8
'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);

  // Turn on the stack trace by default
  grunt.option('stack', true);

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

    // Project settings
    config: {
      // Configurable paths
      app: 'app',
      dist: 'dist'
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      jade: {
        files: ['<%= config.app %>/{,*/}*.jade'],
        tasks: ['jade']
      },
      bower: {
        files: ['bower.json'],
        tasks: ['bowerInstall']
      },
      coffee: {
        files: ['<%= config.app %>/scripts/{,*/}*.{coffee,litcoffee,coffee.md}'],
        tasks: ['coffee:dist', 'jshint:all']
      },
      js: {
        files: ['<%= config.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:copy:server']
      },
      gruntfile: {
        files: ['Gruntfile.js'],
        tasks: ['jshint:gruntfile']
      },
      compass: {
        files: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      styles: {
        files: ['<%= config.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:server', 'autoprefixer']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '.tmp/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '.tmp/scripts/{,*/}*.js',
          '<%= config.app %>/images/{,*/}*'
        ]
      }
    },

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

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

    // Compile Jade to HTML
    jade: {
      options: {
        pretty: true
      },
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>',
          dest: '<%= config.dist %>',
          src: '*.jade',
          ext: '.html'
        }]
      },
      server: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>',
          dest: '.tmp',
          src: '*.jade',
          ext: '.html'
        }]
      }
    },

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

    // Compiles CoffeeScript to JavaScript
    coffee: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/scripts',
          src: '{,*/}*.{coffee,litcoffee,coffee.md}',
          dest: '.tmp/scripts',
          ext: '.js'
        }]
      },
    },

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        config: 'config.rb'
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

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

    // Automatically inject Bower components into the HTML file
    bowerInstall: {
      app: {
        src: ['<%= config.app %>/{,*/}*.jade'],
        ignorePath: '<%= config.app %>/',
        exclude: ['<%= config.app %>/bower_components/bootstrap-sass/vendor/assets/javascripts/bootstrap.js', ],
      },
      sass: {
        src: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: '<%= config.app %>/bower_components/'
      },
      replace: {
        js: '<script src="{{filePath}}"></script>',
        scss: '<link rel="stylesheet" href="{{filePath}}" />'
      }
    },

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

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

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= config.app %>/images',
          src: '{,*/}*.{gif,jpeg,jpg,png}',
          dest: '<%= config.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: false,
          removeCommentsFromCDATA: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true,
          removeRedundantAttributes: true,
          useShortDoctype: false
        },
        files: [{
          expand: true,
          cwd: '<%= config.dist %>',
          src: '{,*/}*.html',
          dest: '<%= config.dist %>'
        }]
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= config.app %>',
            dest: '<%= config.dist %>',
            src: [
              '*.{ico,png,txt,svg}',
              '.htaccess',
              'images/{,*/}*.{webp,svg}',
              'fonts/{,*/}*.*'
            ]
          }
        ]
      },
      server: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= config.app %>/styles',
            dest: '.tmp/styles/',
            src: '{,*/}*.css'
          },{
            // Copy any javascript files to the temo directory
            expand: true,
            dot: true,
            cwd: '<%= config.app %>/scripts',
            dest: '.tmp/scripts/',
            src: '{,*/}*.js'
          }
        ]
      }
    },

    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        push: true,
        pushTo: 'origin',
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'Version %VERSION%',
        commitFiles: ['<%= bump.options.files %>', 'CHANGELOG.md'],
        commitMessage: 'Bumped version to v%VERSION%'
      }
    },

    changelog: {
      options: {
        editor: 'atom -w'
      }
    },

    // Run some tasks in parallel to speed up build process
    concurrent: {
      options: {
        logConcurrentOutput: true,
        limit: 5
      },
      server: [
        'compass:server',
        'newer:coffee',
        'newer:copy:server',
      ],
      dist: [
        'coffee',
        'compass',
        'copy:server',
        'imagemin'
      ]
    }
  });

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

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

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

  grunt.registerTask('default', [
    'clean:dist',
    'jade:dist',
    'useminPrepare',
    'concurrent:dist',
    'jshint:all',
    'autoprefixer',
    'concat',
    'cssmin',
    'uglify',
    'copy:dist',
    'usemin',
    'htmlmin'
  ]);

};
<|endoftext|>


<commit_before>/* eslint-disable valid-jsdoc */
import React, { PropTypes } from 'react'
import cx from 'classnames'

import META from '../../utils/Meta'
import Dropdown from '../../modules/Dropdown/Dropdown'

/**
 * A <Select /> is sugar for <Dropdown selection />.
 * @see Dropdown
 */
const Select = ({ className, ...rest }) => {
  const classes = cx('sd-select', className)

  return <Dropdown {...rest} className={classes} selection />
}

Select.propTypes = {
  /** Classes to add to the className. */
  className: PropTypes.string,
}

Select._meta = {
  library: META.library.stardust,
  name: 'Select',
  type: META.type.addon,
}

export default Select
<commit_msg>refactor(Select): use named function<commit_after>/* eslint-disable valid-jsdoc */
import React, { PropTypes } from 'react'
import cx from 'classnames'

import META from '../../utils/Meta'
import Dropdown from '../../modules/Dropdown/Dropdown'

/**
 * A <Select /> is sugar for <Dropdown selection />.
 * @see Dropdown
 */
function Select({ className, ...rest }) {
  const classes = cx('sd-select', className)

  return <Dropdown {...rest} className={classes} selection />
}

Select.propTypes = {
  /** Classes to add to the className. */
  className: PropTypes.string,
}

Select._meta = {
  library: META.library.stardust,
  name: 'Select',
  type: META.type.addon,
}

export default Select
<|endoftext|>


<commit_before>"use strict";
module.exports = function(grunt) {
    var fs = require("fs");
    // Load all grunt-* modules in package.json
    require("load-grunt-tasks")(grunt);
    // Read in local environment variables
    var config = {
        jsdoc: "jsdoc",
        jsdoc_private: false,
        jsdoc_required_version: "3.2.2",
        jsdoc_template_dir: undefined,
        mocha_grep: "",
        rst2html: "rst2html"
    };

    // Try to load a local configuration file.
    var local_config = {};
    try {
        local_config = require('./local.grunt');
    }
    catch (e) {
        if (e.code !== "MODULE_NOT_FOUND")
            throw e;
    }
    // Override defaults with any variables from commandline environment,
    // then from a local.grunt.js configuration file
    for(var i in config) {
        var opt_name = i.replace("_", "-");
        var opt = grunt.option(opt_name);
        if (opt !== undefined) {
            console.log(i + " set from command line to " + opt);
            config[i] = opt;
        }
        else if (local_config[i] !== undefined) {
            console.log(i + " set from local.grunt to " + local_config[i]);
            config[i] = local_config[i];
        }
    }

    // Set the files that will overwrite or supplement files in the
    // jsdoc template.
    var jsdoc_custom_template_files =
            grunt.file.expand({filter: "isFile", cwd: "misc/jsdoc_template"},
                              ["**/*"]);

    // Set up a list of strings for excluding files when grunt-copy
    // copies jsdoc template defaults (for correct grunt-newer
    // operation)
    var jsdoc_template_exclude_files = jsdoc_custom_template_files.map(
        function (element) {
        return "!" + element;
    });

    // Check that the local version of JSDoc is the same or better
    // than the version deemed required for proper output.
    // This is a callback used by the grunt-shell task.
    var version_re = /(\d+)(?:\.(\d+)(?:\.(\d+))?)?/;
    var required_re = new RegExp("^" + version_re.source + "$");
    function checkJSDocVersion(err, stdout, stderr, callback) {
        if (err)
            grunt.fail.warn(err);

        var req_version_match =
                config.jsdoc_required_version.match(required_re);
        if (!req_version_match)
            grunt.fail.warn('Incorrect version specification: "' +
                            config.required_jsdoc_version + '".');

        var version_match_list = version_re.exec(stdout);
        if (!version_match_list)
            grunt.fail.warn("Could not determine local JSDoc version.");

        for (i = 1; i < req_version_match.length; ++i) {
            if (Number(req_version_match[i]) > Number(version_match_list[i]))
                grunt.fail.warn("Local JSDoc version is too old: " +
                                version_match_list[0] + " < " +
                                req_version_match[0] + ".");
        }
        callback();
    }

    var meta_jsdoc = {
            src: ["lib/**/*.js", "doc/api_intro.md", "package.json"],
            template_src: ["build/jsdoc_template/**"],
            dest: "build/api"
    };

    grunt.initConfig({
        copy: {
            build: {
                files: [
                    { src: ["package.json",
                            "bin/*",
                            "lib/**/*.js",
                            "lib/**/*.xsl",
                            "!lib/salve/parse.js"],
                      dest: "build/dist/" }
                ]
            },
            jsdoc_default_template_files: {
                files: [
                    { cwd: config.jsdoc_template_dir,
                      src: ["**/*"].concat(jsdoc_template_exclude_files),
                      dest: "build/jsdoc_template/",
                      expand: true
                    }
                ]
            },
            jsdoc_custom_template_files: {
                files: [
                    {   cwd: "misc/jsdoc_template/",
                        src: jsdoc_custom_template_files,
                        dest: "build/jsdoc_template/",
                        filter: "isFile",
                        expand: true
                    }
                ]
            },
            gh_pages_build: {
                files: [
                    { cwd: "build/api/",
                      src: ["**/*"],
                      dest: "gh-pages-build",
                      expand: true
                    }
                ]
            }
        },
        mkdir: {
            build: {
                options: {
                    create: ['build/tmp']
                }
            }
        },
        // When grunt 0.4.3 is released, verify that it can preserve
        // permissions when copying and get rid of this.
        chmod: {
            src: "build/dist/bin/*",
            options: {
                mode: "755"
            }
        },
        clean: {
            build: ["build/"],
            readme: ["README.html"]
        },
        // This is a task created purely for the sake of running jsdoc
        // if either of the following is true: the files composing the
        // source of the documentation changed, or the template
        // changed.
        meta_jsdoc_task: {
            build: {
                src: meta_jsdoc.src.concat(meta_jsdoc.template_src)
            }
        },
        jsdoc: {
            build: {
                jsdoc: config.jsdoc,
                src: meta_jsdoc.src,
                dest: meta_jsdoc.dest,
                options: {
//                    destination: "build/api",
                    private: config.jsdoc_private,
                    config: "jsdoc.conf.json"
                }
            }
        },
        shell: {
            readme: {
                src: "README.rst",
                dest: "README.html",
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                },
                command: config.rst2html + " README.rst README.html"
            },
            semver: {
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                },
                command: "semver-sync -v"
            },
            test_jsdoc: {
                command: config.jsdoc + " -v",
                options: {
                    failOnError: true,
                    callback: checkJSDocVersion

                }
            },
            regexp: {
                src: "lib/salve/datatypes/regexp.jison",
                dest: "build/tmp/regexp.js",
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                },
                command:
                "node_modules/.bin/jison " +
                    "-m amd -o build/tmp/regexp.js " +
                    "lib/salve/datatypes/regexp.jison"
            }
        },
        mochaTest: {
            options:  {
                grep: new RegExp(config.mocha_grep)
            },
            src: ["test/*.js"]
        },
        fix_jison: {
            regexp: {
                src: "build/tmp/regexp.js",
                dest: "build/dist/lib/salve/datatypes/regexp.js"
            }
        }
    });
    grunt.registerTask("jsdoc_template_exists", function() {
        if (!config.jsdoc_template_dir ||
            !grunt.file.exists(config.jsdoc_template_dir, "publish.js")) {
            grunt.fail.warn("JSDoc default template directory " +
                                     "invalid or not provided.");
        }
    });
    grunt.registerTask("default", ["newer:copy:build", "mkdir:build",
                                   "newer:shell:regexp",
                                   "newer:fix_jison:regexp",
                                   "npmignore",
                                   "chmod"]);

    grunt.registerMultiTask("fix_jison", function () {
        if (this.files.length !== 1 || this.files[0].src.length !== 1) {
            grunt.log.error("needs exactly one source file.");
            return false;
        }

        var src = this.files[0].src[0];
        var dest = this.files[0].dest;
        var data = fs.readFileSync(src).toString();

        // This is enough to trigger RequireJS's CommonJS sugar handling.
        data = data.replace(/^\s*define\(\[\], function\s*\(\s*\)\s*\{/m,
                            "define(function (require) {");
        fs.writeFileSync(dest, data);
        return undefined;
    });

    grunt.registerTask("npmignore", function () {
        var data = "bin/parse.js";
        fs.writeFileSync("build/dist/.npmignore", data);
    });

    grunt.registerTask("copy_jsdoc_template",
                       ["jsdoc_template_exists",
                        "newer:copy:jsdoc_default_template_files",
                        "newer:copy:jsdoc_custom_template_files"
                       ]);
    grunt.registerTask("create_jsdocs", ["shell:test_jsdoc",
                                         "copy_jsdoc_template",
                                         "newer:meta_jsdoc_task:build"]);

    grunt.registerMultiTask("meta_jsdoc_task", function () {
        grunt.task.run("jsdoc:build");
    });

    grunt.registerTask("doc", ["create_jsdocs",
                               "newer:shell:readme"]);
    grunt.registerTask("gh-pages-build", ["create_jsdocs",
                                          "newer:copy:gh_pages_build"]);
    grunt.registerTask("test", ["default", "shell:semver", "mochaTest"]);
    //  grunt-contrib-clean is its own task: "grunt clean"
};
<commit_msg>Added pack, install_test and publish targets.<commit_after>"use strict";
module.exports = function(grunt) {
    var fs = require("fs");
    // Load all grunt-* modules in package.json
    require("load-grunt-tasks")(grunt);
    // Read in local environment variables
    var config = {
        jsdoc: "jsdoc",
        jsdoc_private: false,
        jsdoc_required_version: "3.2.2",
        jsdoc_template_dir: undefined,
        mocha_grep: "",
        rst2html: "rst2html"
    };

    // Try to load a local configuration file.
    var local_config = {};
    try {
        local_config = require('./local.grunt');
    }
    catch (e) {
        if (e.code !== "MODULE_NOT_FOUND")
            throw e;
    }
    // Override defaults with any variables from commandline environment,
    // then from a local.grunt.js configuration file
    for(var i in config) {
        var opt_name = i.replace("_", "-");
        var opt = grunt.option(opt_name);
        if (opt !== undefined) {
            console.log(i + " set from command line to " + opt);
            config[i] = opt;
        }
        else if (local_config[i] !== undefined) {
            console.log(i + " set from local.grunt to " + local_config[i]);
            config[i] = local_config[i];
        }
    }

    // Set the files that will overwrite or supplement files in the
    // jsdoc template.
    var jsdoc_custom_template_files =
            grunt.file.expand({filter: "isFile", cwd: "misc/jsdoc_template"},
                              ["**/*"]);

    // Set up a list of strings for excluding files when grunt-copy
    // copies jsdoc template defaults (for correct grunt-newer
    // operation)
    var jsdoc_template_exclude_files = jsdoc_custom_template_files.map(
        function (element) {
        return "!" + element;
    });

    // Check that the local version of JSDoc is the same or better
    // than the version deemed required for proper output.
    // This is a callback used by the grunt-shell task.
    var version_re = /(\d+)(?:\.(\d+)(?:\.(\d+))?)?/;
    var required_re = new RegExp("^" + version_re.source + "$");
    function checkJSDocVersion(err, stdout, stderr, callback) {
        if (err)
            grunt.fail.warn(err);

        var req_version_match =
                config.jsdoc_required_version.match(required_re);
        if (!req_version_match)
            grunt.fail.warn('Incorrect version specification: "' +
                            config.required_jsdoc_version + '".');

        var version_match_list = version_re.exec(stdout);
        if (!version_match_list)
            grunt.fail.warn("Could not determine local JSDoc version.");

        for (i = 1; i < req_version_match.length; ++i) {
            if (Number(req_version_match[i]) > Number(version_match_list[i]))
                grunt.fail.warn("Local JSDoc version is too old: " +
                                version_match_list[0] + " < " +
                                req_version_match[0] + ".");
        }
        callback();
    }

    var meta_jsdoc = {
            src: ["lib/**/*.js", "doc/api_intro.md", "package.json"],
            template_src: ["build/jsdoc_template/**"],
            dest: "build/api"
    };

    grunt.initConfig({
        copy: {
            build: {
                files: [
                    { src: ["package.json",
                            "bin/*",
                            "lib/**/*.js",
                            "lib/**/*.xsl",
                            "!lib/salve/parse.js"],
                      dest: "build/dist/" }
                ]
            },
            jsdoc_default_template_files: {
                files: [
                    { cwd: config.jsdoc_template_dir,
                      src: ["**/*"].concat(jsdoc_template_exclude_files),
                      dest: "build/jsdoc_template/",
                      expand: true
                    }
                ]
            },
            jsdoc_custom_template_files: {
                files: [
                    {   cwd: "misc/jsdoc_template/",
                        src: jsdoc_custom_template_files,
                        dest: "build/jsdoc_template/",
                        filter: "isFile",
                        expand: true
                    }
                ]
            },
            gh_pages_build: {
                files: [
                    { cwd: "build/api/",
                      src: ["**/*"],
                      dest: "gh-pages-build",
                      expand: true
                    }
                ]
            }
        },
        mkdir: {
            build: {
                options: {
                    create: ['build/tmp']
                }
            },
            install_test: {
                options: {
                    create: ["build/install_test"]
                }
            }
        },
        // When grunt 0.4.3 is released, verify that it can preserve
        // permissions when copying and get rid of this.
        chmod: {
            src: "build/dist/bin/*",
            options: {
                mode: "755"
            }
        },
        clean: {
            build: ["build/"],
            readme: ["README.html"],
            install_test: ["build/install_test/"]
        },
        // This is a task created purely for the sake of running jsdoc
        // if either of the following is true: the files composing the
        // source of the documentation changed, or the template
        // changed.
        meta_jsdoc_task: {
            build: {
                src: meta_jsdoc.src.concat(meta_jsdoc.template_src)
            }
        },
        jsdoc: {
            build: {
                jsdoc: config.jsdoc,
                src: meta_jsdoc.src,
                dest: meta_jsdoc.dest,
                options: {
//                    destination: "build/api",
                    private: config.jsdoc_private,
                    config: "jsdoc.conf.json"
                }
            }
        },
        shell: {
            readme: {
                src: "README.rst",
                dest: "README.html",
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                },
                command: config.rst2html + " README.rst README.html"
            },
            semver: {
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                },
                command: "semver-sync -v"
            },
            test_jsdoc: {
                command: config.jsdoc + " -v",
                options: {
                    failOnError: true,
                    callback: checkJSDocVersion

                }
            },
            regexp: {
                src: "lib/salve/datatypes/regexp.jison",
                dest: "build/tmp/regexp.js",
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                },
                command:
                "node_modules/.bin/jison " +
                    "-m amd -o build/tmp/regexp.js " +
                    "lib/salve/datatypes/regexp.jison"
            },
            pack: {
                options: {
                    stdout: false,
                    stderr: true,
                    failOnError: true,
                    execOptions: {
                        cwd: "build"
                    },
                    callback: function (err, stdout, stderr, cb) {
                        if (err)
                            grunt.fail.warn(err);

                        grunt.config.set("pack_name", stdout.trim());
                        cb();
                    }
                },
                command: "npm pack dist"
            },
            install_test: {
                options: {
                    stderr: true,
                    failOnError: true,
                    execOptions: {
                        cwd: "build/install_test"
                    }
                },
                command: "npm install ../<%= pack_name %>"
            },
            publish: {
                options: {
                    stderr: true,
                    failOnError: true,
                    execOptions: {
                        cwd: "build"
                    }
                },
                command: "npm publish <%= pack_name %>"
            }
        },
        mochaTest: {
            options:  {
                grep: new RegExp(config.mocha_grep)
            },
            src: ["test/*.js"]
        },
        fix_jison: {
            regexp: {
                src: "build/tmp/regexp.js",
                dest: "build/dist/lib/salve/datatypes/regexp.js"
            }
        }
    });
    grunt.registerTask("jsdoc_template_exists", function() {
        if (!config.jsdoc_template_dir ||
            !grunt.file.exists(config.jsdoc_template_dir, "publish.js")) {
            grunt.fail.warn("JSDoc default template directory " +
                                     "invalid or not provided.");
        }
    });
    grunt.registerTask("default", ["newer:copy:build", "mkdir:build",
                                   "newer:shell:regexp",
                                   "newer:fix_jison:regexp",
                                   "npmignore",
                                   "chmod"]);

    grunt.registerTask("install_test", ["shell:pack",
                                        "clean:install_test",
                                        "mkdir:install_test",
                                        "shell:install_test",
                                        "clean:install_test"]);

    grunt.registerTask("publish", ["install_test", "shell:publish"]);

    grunt.registerMultiTask("fix_jison", function () {
        if (this.files.length !== 1 || this.files[0].src.length !== 1) {
            grunt.log.error("needs exactly one source file.");
            return false;
        }

        var src = this.files[0].src[0];
        var dest = this.files[0].dest;
        var data = fs.readFileSync(src).toString();

        // This is enough to trigger RequireJS's CommonJS sugar handling.
        data = data.replace(/^\s*define\(\[\], function\s*\(\s*\)\s*\{/m,
                            "define(function (require) {");
        fs.writeFileSync(dest, data);
        return undefined;
    });

    grunt.registerTask("npmignore", function () {
        var data = "bin/parse.js";
        fs.writeFileSync("build/dist/.npmignore", data);
    });

    grunt.registerTask("copy_jsdoc_template",
                       ["jsdoc_template_exists",
                        "newer:copy:jsdoc_default_template_files",
                        "newer:copy:jsdoc_custom_template_files"
                       ]);
    grunt.registerTask("create_jsdocs", ["shell:test_jsdoc",
                                         "copy_jsdoc_template",
                                         "newer:meta_jsdoc_task:build"]);

    grunt.registerMultiTask("meta_jsdoc_task", function () {
        grunt.task.run("jsdoc:build");
    });

    grunt.registerTask("doc", ["create_jsdocs",
                               "newer:shell:readme"]);
    grunt.registerTask("gh-pages-build", ["create_jsdocs",
                                          "newer:copy:gh_pages_build"]);
    grunt.registerTask("test", ["default", "shell:semver", "mochaTest"]);
    //  grunt-contrib-clean is its own task: "grunt clean"
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
  var config = {
    defaults: {
      cachePath: 'cache',
      concurrencyLimit: 128,
      // Maximum cache age in seconds. Can be set to 0 to force refresh every
      // time. If set to -1, cached files never expire and are always used.
      maxCacheAge: 6 * 60 * 60,
      destFolder: 'app/api',
      // Pretty-print JSON with '\t', uglify JSON with ''.
      // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#space_argument
      jsonSpace: grunt.option('target') === 'dist' ? '' : '\t'
    },
    bulletinModules: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'bulletinModulesRaw.json',
        ivleApi: grunt.file.readJSON('ivleApi.json')
      },
      semester0: {
        options: {
          semester: '0'
        }
      },
      semester1: {
        options: {
          semester: '1'
        }
      },
      semester2: {
        options: {
          semester: '2'
        }
      },
      semester3: {
        options: {
          semester: '3'
        }
      },
      semester4: {
        options: {
          semester: '4'
        }
      }
    },
    cors: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'corsRaw.json',
        destLessonTypes: 'lessonTypes.json',
        types: ['Module', 'GEM', 'SSM', 'UEM', 'CFM']
      },
      currentSemester: {
        options: {
          baseUrl: 'https://myaces.nus.edu.sg/cors/jsp/report/'
        }
      }
    },
    corsBiddingStats: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: -1,
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'corsBiddingStatsRaw.json'
      }
    },
    examTimetable: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        jquery: 'jquery.min.js',
        destFileName: 'examTimetableRaw.json'
      },
      ay2014to2015sem1: {
        options: {
          academicYear: '2014/2015',
          semester: '1'
        }
      },
      ay2014to2015sem2: {
        options: {
          academicYear: '2014/2015',
          semester: '2'
        }
      }
    },
    ivle: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        concurrencyLimit: '<%= defaults.concurrencyLimit %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        srcFolder: '<%= defaults.destFolder %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'ivleRaw.json',
        ivleApi: grunt.file.readJSON('ivleApi.json')
      }
    },
    moduleTimetableDelta: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'moduleTimetableDeltaRaw.json',
        ivleApi: grunt.file.readJSON('ivleApi.json')
      }
    },
    consolidate: {
      options: {
        jsonSpace: '<%= defaults.jsonSpace %>',
        srcFolder: '<%= defaults.destFolder %>',
        destFileName: 'consolidatedRaw.json'
      }
    },
    normalize: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'modules.json',
        destFacultyDepartments: 'facultyDepartments.json'
      }
    },
    split: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destModuleCodes: 'moduleCodes.json',
        destModuleList: 'moduleList.json',
        destModuleInformation: 'moduleInformation.json',
        destSubfolder: 'modules'
      }
    },
    joinSems: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>'
      },
      ay2014to2015sem1: {
        options: {
          academicYear: '2014/2015',
          semester: '1'
        }
      }
    },
    splitSems: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>'
      },
      ay2014to2015: {
        options: {
          academicYear: '2014/2015'
        }
      }
    },
    rsync: {
      options: {
        args: ['-cruv']
      },
      'api.nusmods.com': {
        options: {
          src: '<%= defaults.destFolder %>/*',
          dest: '~/api.nusmods.com'
        }
      }
    },
    shell: {
      runPrereqParser: {
        command: function (academicYearAndSem) {
          var path = require('path'),
              config = grunt.config('normalize').options,
              matches = academicYearAndSem.match(/ay(20\d\d)to(20\d\d)(?:sem(\d))?/);
          var dataPath = path.join(
            '..',
            config.srcFolder,           //default source folder
            matches[1]+'-'+matches[2],  //academic year
            matches[3] || '',           //semester if present
            config.destFileName         //normalized file name
          );
          return 'python init_parsing.py ' + dataPath;
        },
        options: {
          execOptions: {
            cwd: 'tasks'
          }
        }
      }
    }
  };

  var AY_START = 2014;
  var AY_END = 2015;

  // Generate task targets.
  ['ivle', 'consolidate', 'normalize', 'split'].forEach(function (task) {
    for (var ay = AY_START; ay < AY_END; ay++) {
      for (var sem = 1; sem < 5; sem++) {
        config[task]['ay' + ay + 'to' + (ay + 1) + 'sem' + sem] = {
          options: {
            academicYear: ay + '/' + (ay + 1),
            semester: sem.toString()
          }
        };
      }
    }
  });

  grunt.initConfig(config);

  // Ensure that cache folder is created.
  grunt.file.mkdir(grunt.config('defaults').cachePath);

  grunt.loadNpmTasks('grunt-rsync');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadTasks('tasks');

  // Takes about half an hour.
  grunt.registerTask('all', [
    'bulletinModules',
    'cors',
    'corsBiddingStats',
    'examTimetable',
    'moduleTimetableDelta',
    'ivle',
    'consolidate',
    'normalize',

    // for backward compatibility, can remove when all code is using combined
    // semester info
    'shell:runPrereqParser:ay2014to2015sem1',

    'split',
    'joinSems',
    'shell:runPrereqParser:ay2014to2015',
    'splitSems'
  ]);

  grunt.registerTask('default', 'all');
};
<commit_msg>Rename 'all' task to default since there are no more individual sem tasks<commit_after>'use strict';

module.exports = function (grunt) {
  var config = {
    defaults: {
      cachePath: 'cache',
      concurrencyLimit: 128,
      // Maximum cache age in seconds. Can be set to 0 to force refresh every
      // time. If set to -1, cached files never expire and are always used.
      maxCacheAge: 6 * 60 * 60,
      destFolder: 'app/api',
      // Pretty-print JSON with '\t', uglify JSON with ''.
      // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#space_argument
      jsonSpace: grunt.option('target') === 'dist' ? '' : '\t'
    },
    bulletinModules: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'bulletinModulesRaw.json',
        ivleApi: grunt.file.readJSON('ivleApi.json')
      },
      semester0: {
        options: {
          semester: '0'
        }
      },
      semester1: {
        options: {
          semester: '1'
        }
      },
      semester2: {
        options: {
          semester: '2'
        }
      },
      semester3: {
        options: {
          semester: '3'
        }
      },
      semester4: {
        options: {
          semester: '4'
        }
      }
    },
    cors: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'corsRaw.json',
        destLessonTypes: 'lessonTypes.json',
        types: ['Module', 'GEM', 'SSM', 'UEM', 'CFM']
      },
      currentSemester: {
        options: {
          baseUrl: 'https://myaces.nus.edu.sg/cors/jsp/report/'
        }
      }
    },
    corsBiddingStats: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: -1,
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'corsBiddingStatsRaw.json'
      }
    },
    examTimetable: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        jquery: 'jquery.min.js',
        destFileName: 'examTimetableRaw.json'
      },
      ay2014to2015sem1: {
        options: {
          academicYear: '2014/2015',
          semester: '1'
        }
      },
      ay2014to2015sem2: {
        options: {
          academicYear: '2014/2015',
          semester: '2'
        }
      }
    },
    ivle: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        concurrencyLimit: '<%= defaults.concurrencyLimit %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        srcFolder: '<%= defaults.destFolder %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'ivleRaw.json',
        ivleApi: grunt.file.readJSON('ivleApi.json')
      }
    },
    moduleTimetableDelta: {
      options: {
        cachePath: '<%= defaults.cachePath %>',
        maxCacheAge: '<%= defaults.maxCacheAge %>',
        destFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'moduleTimetableDeltaRaw.json',
        ivleApi: grunt.file.readJSON('ivleApi.json')
      }
    },
    consolidate: {
      options: {
        jsonSpace: '<%= defaults.jsonSpace %>',
        srcFolder: '<%= defaults.destFolder %>',
        destFileName: 'consolidatedRaw.json'
      }
    },
    normalize: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destFileName: 'modules.json',
        destFacultyDepartments: 'facultyDepartments.json'
      }
    },
    split: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>',
        destModuleCodes: 'moduleCodes.json',
        destModuleList: 'moduleList.json',
        destModuleInformation: 'moduleInformation.json',
        destSubfolder: 'modules'
      }
    },
    joinSems: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>'
      },
      ay2014to2015sem1: {
        options: {
          academicYear: '2014/2015',
          semester: '1'
        }
      }
    },
    splitSems: {
      options: {
        srcFolder: '<%= defaults.destFolder %>',
        jsonSpace: '<%= defaults.jsonSpace %>'
      },
      ay2014to2015: {
        options: {
          academicYear: '2014/2015'
        }
      }
    },
    rsync: {
      options: {
        args: ['-cruv']
      },
      'api.nusmods.com': {
        options: {
          src: '<%= defaults.destFolder %>/*',
          dest: '~/api.nusmods.com'
        }
      }
    },
    shell: {
      runPrereqParser: {
        command: function (academicYearAndSem) {
          var path = require('path'),
              config = grunt.config('normalize').options,
              matches = academicYearAndSem.match(/ay(20\d\d)to(20\d\d)(?:sem(\d))?/);
          var dataPath = path.join(
            '..',
            config.srcFolder,           //default source folder
            matches[1]+'-'+matches[2],  //academic year
            matches[3] || '',           //semester if present
            config.destFileName         //normalized file name
          );
          return 'python init_parsing.py ' + dataPath;
        },
        options: {
          execOptions: {
            cwd: 'tasks'
          }
        }
      }
    }
  };

  var AY_START = 2014;
  var AY_END = 2015;

  // Generate task targets.
  ['ivle', 'consolidate', 'normalize', 'split'].forEach(function (task) {
    for (var ay = AY_START; ay < AY_END; ay++) {
      for (var sem = 1; sem < 5; sem++) {
        config[task]['ay' + ay + 'to' + (ay + 1) + 'sem' + sem] = {
          options: {
            academicYear: ay + '/' + (ay + 1),
            semester: sem.toString()
          }
        };
      }
    }
  });

  grunt.initConfig(config);

  // Ensure that cache folder is created.
  grunt.file.mkdir(grunt.config('defaults').cachePath);

  grunt.loadNpmTasks('grunt-rsync');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadTasks('tasks');

  grunt.registerTask('default', [
    'bulletinModules',
    'cors',
    'corsBiddingStats',
    'examTimetable',
    'moduleTimetableDelta',
    'ivle',
    'consolidate',
    'normalize',

    // for backward compatibility, can remove when all code is using combined
    // semester info
    'shell:runPrereqParser:ay2014to2015sem1',

    'split',
    'joinSems',
    'shell:runPrereqParser:ay2014to2015',
    'splitSems'
  ]);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    less: {
      options: {
        paths: "src/css",
      },
      dev: {
        files: {
          "src/css/vde.css": "src/css/vde.less"
        }
      }
    },
    karma: {
      unit: {
        options: {
          frameworks: ['jasmine'],
          files: [
            "src/js/lib/jquery.min-1.9.0.js",
            "src/js/lib/jquery-migrate-1.2.1.js",
            "src/js/lib/jquery.event.drag-2.2.js",
            "src/js/lib/jquery.event.drop-2.2.js",
            "src/js/lib/jquery-ui.min-1.9.0.js",
            "src/js/lib/bootstrap.min.js",
            "src/js/lib/jquery.dataTables-1.9.4.js",
            "src/js/lib/datatables/FixedColumns.js",
            "src/js/lib/d3.v3.min.js",
            "src/js/lib/vega-1.3.3.js",
            "src/js/lib/angular-1.2.10.min.js",
            "src/js/lib/angular-1.2.10-mocks.js",
            "src/js/lib/bootstrap-colorpicker-module.js",
            "src/js/lib/inflector.js",
            "src/js/lib/sortable.js",
            "src/js/lib/indexeddb.js",

            "src/js/app/vde.js",
            "src/js/app/timeline.js",
            "src/js/app/draggable.js",
            "src/js/app/groups.js",
            "src/js/app/inspectors.js",
            "src/js/app/pipelines.js",
            "src/js/app/data.js",
            "src/js/app/export.js",

            "src/js/vis/Vis.js",
            "src/js/vis/iVis.js",
            "src/js/vis/Callback.js",
            "src/js/vis/Pipeline.js",
            "src/js/vis/Field.js",
            "src/js/vis/Mark.js",
            "src/js/vis/marks/Group.js",
            "src/js/vis/marks/Rect.js",
            "src/js/vis/marks/Symbol.js",
            "src/js/vis/marks/Arc.js",
            "src/js/vis/marks/Line.js",
            "src/js/vis/marks/Area.js",
            "src/js/vis/marks/Text.js",
            "src/js/vis/Scale.js",
            "src/js/vis/Axis.js",
            "src/js/vis/Transform.js",
            "src/js/vis/transforms/Sort.js",
            "src/js/vis/transforms/Filter.js",
            "src/js/vis/transforms/Formula.js",
            "src/js/vis/transforms/Pie.js",
            "src/js/vis/transforms/Facet.js",
            "src/js/vis/transforms/Stack.js",
            "src/js/vis/transforms/Geo.js",
            "src/js/vis/transforms/Force.js",
            "src/js/vis/transforms/Stats.js",
            "src/js/vis/transforms/Window.js",

            "tests/unit/**/*.js"
          ]
        }
      }
    },
    protractor: {
      options: {
        configFile: "tests.js", // Default config file
        keepAlive: true, // If false, the grunt process stops when the test fails.
        noColor: false, // If true, protractor will not use colors in its output.
        args: {
          // Arguments passed to the command
        }
      },
      dev: {
        options: {
          configFile: "tests.js", // Target-specific config file
          args: {} // Target-specific arguments
        }
      },
    },
    'http-server': {
      dev: {
        // the server root directory
        root: "src",

        port: 8080,
        host: "localhost",

        cache: 1,
        showDir : true,
        autoIndex: true,
        defaultExt: "html",

        // run in parallel with other tasks
        runInBackground: true
      },
      'stay-open': {
        root: "src",
        port: 8080,
        host: 'localhost',

        cache: 1,
        showDir: true,
        autoIndex: true,
        defaultExt: "html",

        runInBackground: false
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-protractor-runner');
  grunt.loadNpmTasks('grunt-http-server');
  grunt.loadNpmTasks('grunt-karma');

  grunt.registerTask('test', ['build', 'http-server:dev', 'protractor']);
  grunt.registerTask('build', ['less']);
  grunt.registerTask('serve', ['build', 'http-server:stay-open'])
};<commit_msg>Simplified file includes in Karma test runner<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    less: {
      options: {
        paths: "src/css",
      },
      dev: {
        files: {
          "src/css/vde.css": "src/css/vde.less"
        }
      }
    },
    karma: {
      unit: {
        options: {
          frameworks: ['jasmine'],
          //All of the files that the app needs. The order is important --
          //many files depend on others.
          files: [
            "src/js/lib/jquery.min-1.9.0.js",
            "src/js/lib/**/jquery*.js",
            "src/js/lib/bootstrap.min.js",
            "src/js/lib/bootstrap-colorpicker-module.js",
            "src/js/lib/datatables/FixedColumns.js",
            "src/js/lib/d3.v3.min.js",
            "src/js/lib/vega-1.3.3.js",
            "src/js/lib/angular-1.2.10.min.js",
            "src/js/lib/angular-1.2.10-mocks.js",
            "src/js/lib/inflector.js",
            "src/js/lib/sortable.js",
            "src/js/lib/indexeddb.js",

            "src/js/app/vde.js",
            "src/js/app/**/*.js",

            "src/js/vis/Vis.js",
            "src/js/vis/iVis.js",
            "src/js/vis/Callback.js",
            "src/js/vis/Pipeline.js",
            "src/js/vis/Field.js",
            "src/js/vis/Mark.js",
            "src/js/vis/marks/Group.js",
            "src/js/vis/marks/Rect.js",
            "src/js/vis/marks/Symbol.js",
            "src/js/vis/marks/Arc.js",
            "src/js/vis/marks/Line.js",
            "src/js/vis/marks/Area.js",
            "src/js/vis/marks/Text.js",
            "src/js/vis/Scale.js",
            "src/js/vis/Axis.js",
            "src/js/vis/Transform.js",
            "src/js/vis/transforms/**/*.js",

            "tests/unit/**/*.js"
          ]
        }
      }
    },
    protractor: {
      options: {
        configFile: "tests.js", // Default config file
        keepAlive: true, // If false, the grunt process stops when the test fails.
        noColor: false, // If true, protractor will not use colors in its output.
        args: {
          // Arguments passed to the command
        }
      },
      dev: {
        options: {
          configFile: "tests.js", // Target-specific config file
          args: {} // Target-specific arguments
        }
      },
    },
    'http-server': {
      dev: {
        // the server root directory
        root: "src",

        port: 8080,
        host: "localhost",

        cache: 1,
        showDir : true,
        autoIndex: true,
        defaultExt: "html",

        // run in parallel with other tasks
        runInBackground: true
      },
      'stay-open': {
        root: "src",
        port: 8080,
        host: 'localhost',

        cache: 1,
        showDir: true,
        autoIndex: true,
        defaultExt: "html",

        runInBackground: false
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-protractor-runner');
  grunt.loadNpmTasks('grunt-http-server');
  grunt.loadNpmTasks('grunt-karma');

  grunt.registerTask('test', ['build', 'http-server:dev', 'protractor']);
  grunt.registerTask('build', ['less']);
  grunt.registerTask('serve', ['build', 'http-server:stay-open'])
};<|endoftext|>


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

    // Project configuration
    grunt.initConfig({

        connect: {
            server: {
                options: {
                    port: "9001"
                }
            }
        },

        jasmine: {
            src: [
                "src/libs/EventEmitter.js",
                "src/applait.finder.js"
            ],
            options: {
                specs: "tests/*Spec.js",
                host: "http://127.0.0.1:9001"
            }
        },

        jshint: {
            all: ["src/applait.finder.js"],
            options: {
                jshintrc: ".jshintrc"
            }
        },

        uglify: {
            options: {
                compress: true,
                preserveComments: "some",
                mangle: false
            },
            build: {
                src: ["./src/libs/EventEmitter.js", "./src/applait.finder.js"],
                dest: "./applait.finder.min.js"
            }
        },

        jsdoc: {
            dist: {
                src: ["./src/", "./README.md"],
                options: {
                    destination: "./docs/",
                    configure: "jsdoc.conf.json"
                }
            }
        }

    });

    // Load plugins
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-jsdoc");
    grunt.loadNpmTasks("grunt-contrib-connect");

    // Register tests
    grunt.registerTask("test", ["connect", "jshint", "jasmine"]);

    // Register docs
    grunt.registerTask("docs", ["jsdoc"]);

    // Register build tasks
    grunt.registerTask("build", ["test", "docs", "uglify"]);

    // Run tests by default
    grunt.registerTask("default", ["test"]);
};
<commit_msg>Apply linting to tests<commit_after>module.exports = function (grunt) {

    // Project configuration
    grunt.initConfig({

        connect: {
            server: {
                options: {
                    port: "9001"
                }
            }
        },

        jasmine: {
            src: [
                "src/libs/EventEmitter.js",
                "src/applait.finder.js"
            ],
            options: {
                specs: "tests/*Spec.js",
                host: "http://127.0.0.1:9001"
            }
        },

        jshint: {
            all: ["src/applait.finder.js", "tests/*.js"],
            options: {
                jshintrc: ".jshintrc"
            }
        },

        uglify: {
            options: {
                compress: true,
                preserveComments: "some",
                mangle: false
            },
            build: {
                src: ["./src/libs/EventEmitter.js", "./src/applait.finder.js"],
                dest: "./applait.finder.min.js"
            }
        },

        jsdoc: {
            dist: {
                src: ["./src/", "./README.md"],
                options: {
                    destination: "./docs/",
                    configure: "jsdoc.conf.json"
                }
            }
        }

    });

    // Load plugins
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-jsdoc");
    grunt.loadNpmTasks("grunt-contrib-connect");

    // Register tests
    grunt.registerTask("test", ["connect", "jshint", "jasmine"]);

    // Register docs
    grunt.registerTask("docs", ["jsdoc"]);

    // Register build tasks
    grunt.registerTask("build", ["test", "docs", "uglify"]);

    // Run tests by default
    grunt.registerTask("default", ["test"]);
};
<|endoftext|>


<commit_before>"use strict";

angular.module('arethusa.search').directive('searchByString', [
  'search',
  function(search) {
    return {
      restrict: 'A',
      scope: {},
      link: function(scope, element, attrs) {
        scope.search = search;
      },
      templateUrl: 'templates/arethusa.search/search_by_string.html'
    };
  }
]);
<commit_msg>Add watches to searchByString directive<commit_after>"use strict";

angular.module('arethusa.search').directive('searchByString', [
  'search',
  'state',
  function(search, state) {
    return {
      restrict: 'A',
      scope: {},
      link: function(scope, element, attrs) {
        scope.search = search;
        scope.state = state;

        // Mind that the following watches aren't active all the time!
        // When it is used from within the search plugins template, and it
        // is inactive through ngIf, they won't fire. This is generally a good
        // thing and we won't delete this code: We can still use it on isolation,
        // or we might at some point display it together with plugins that can
        // edit text.
        // Right now only the artificialToken plugin does this: Both are never
        // shown at the same time, which means this watches actually never fire
        // right now.

        var stringWatches = {};
        function initStringWatch(token, id) {
          var childScope = scope.$new();
          childScope.token = token;
          childScope.$watch('token.string', function(newVal, oldVal) {
            if (newVal !== oldVal) {
              search.removeTokenFromIndex(token.id, oldVal);
              search.collectTokenString(search.strings, id, token);
            }
          });
          stringWatches[id] = childScope;
        }

        function initStringWatches() {
          angular.forEach(state.tokens, initStringWatch);
        }

        function removeStringWatch(scope) {
          scope.$destroy();
        }

        function destroyStringWatch() {
          angular.forEach(stringWatches, removeStringWatch);
          stringWatches = {};
        }

        scope.$watch('state.tokens', function(newVal, oldVal) {
          initStringWatches();
        });
      },
      templateUrl: 'templates/arethusa.search/search_by_string.html'
    };
  }
]);
<|endoftext|>


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

    var libpath = require('path');

    grunt.initConfig({
        clean: {
            dist: 'dist/',
            lib : 'lib/',
            tmp : 'tmp/'
        },

        copy: {
            tmp: {
                expand : true,
                flatten: true,
                src    : 'tmp/src/*.js',
                dest   : 'lib/'
            }
        },

        concat: {
            dist_with_locales: {
                src: ['dist/dust-intl.js', 'dist/locale-data/*.js'],
                dest: 'dist/dust-intl-with-locales.js'
            }
        },

        jshint: {
            all: ['index.js', 'src/*.js', '!src/en.js', 'tests/*.js']
        },

        extract_cldr_data: {
            options: {
                fields : ['second', 'minute', 'hour', 'day', 'month', 'year'],
                plurals: true
            },

            src_en: {
                dest: 'src/en.js',

                options: {
                    locales: ['en'],
                    prelude: '// GENERATED FILE\n',

                    wrapEntry: function (entry) {
                        return 'export default ' + entry + ';';
                    }
                }
            },

            lib_all: {
                dest: 'lib/locales.js',

                options: {
                    prelude: [
                        '// GENERATED FILE',
                        'var DustIntl = require("./helpers");\n\n'
                    ].join('\n'),

                    wrapEntry: function (entry) {
                        return 'DustIntl.__addLocaleData(' + entry + ');';
                    }
                }
            },

            dist_all: {
                dest: 'dist/locale-data/',

                options: {
                    wrapEntry: function (entry) {
                        return 'DustIntl.__addLocaleData(' + entry + ');';
                    }
                }
            }
        },

        bundle_jsnext: {
            dest: 'dist/dust-intl.js',

            options: {
                namespace: 'DustIntl'
            }
        },

        cjs_jsnext: {
            dest: 'tmp/'
        },

        uglify: {
            options: {
                preserveComments: 'some'
            },

            dist: {
                options: {
                    sourceMap              : true,
                    sourceMapIn            : 'dist/dust-intl.js.map',
                    sourceMapIncludeSources: true
                },

                files: {
                    'dist/dust-intl.min.js': [
                        'dist/dust-intl.js'
                    ]
                }
            },

            dist_with_locales: {
                files: {
                    'dist/dust-intl-with-locales.min.js': [
                        'dist/dust-intl-with-locales.js'
                    ]
                }
            }
        },

        connect: {
            server: {
                options: {
                    base: '.',
                    port: 9999
                }
            }
        },

        'saucelabs-mocha': {
            all: {
                options: {
                    urls: ['http://127.0.0.1:9999/tests/smoke/index.html'],
                    build: process.env.TRAVIS_BUILD_NUMBER,
                    sauceConfig: {
                        'record-video': false,
                        'capture-html': false,
                        'record-screenshots': false,
                        'command-timeout': 60
                    },
                    throttled: 3,
                    browsers: [
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows XP',
                            version: '7'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 7',
                            version: '8'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 7',
                            version: '9'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 8',
                            version: '10'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 8.1',
                            version: '11'
                        },
                        {
                            browserName: 'chrome',
                            platform: 'Windows 7',
                            version: '37'
                        },
                        {
                            browserName: 'firefox',
                            platform: 'Windows 7',
                            version: '32'
                        },
                        {
                            browserName: 'iphone',
                            platform: 'OS X 10.9',
                            version: '7.1'
                        },
                        {
                            browserName: 'android',
                            platform: 'Linux',
                            version: '4.4'
                        },
                        {
                            browserName: 'safari',
                            platform: 'OS X 10.9',
                            version: '7'
                        }
                    ]
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-bundle-jsnext-lib');
    grunt.loadNpmTasks('grunt-extract-cldr-data');
    grunt.loadNpmTasks('grunt-saucelabs');
    grunt.loadNpmTasks('grunt-contrib-connect');

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

    grunt.registerTask('cldr', ['extract_cldr_data']);

    grunt.registerTask('compile', [
        'jshint',
        'bundle_jsnext',
        'concat:dist_with_locales',
        'uglify',
        'cjs_jsnext',
        'copy:tmp'
    ]);

    grunt.registerTask('default', [
        'clean',
        'cldr',
        'compile'
    ]);
};
<commit_msg>Fix URL to browser test page<commit_after>module.exports = function (grunt) {

    var libpath = require('path');

    grunt.initConfig({
        clean: {
            dist: 'dist/',
            lib : 'lib/',
            tmp : 'tmp/'
        },

        copy: {
            tmp: {
                expand : true,
                flatten: true,
                src    : 'tmp/src/*.js',
                dest   : 'lib/'
            }
        },

        concat: {
            dist_with_locales: {
                src: ['dist/dust-intl.js', 'dist/locale-data/*.js'],
                dest: 'dist/dust-intl-with-locales.js'
            }
        },

        jshint: {
            all: ['index.js', 'src/*.js', '!src/en.js', 'tests/*.js']
        },

        extract_cldr_data: {
            options: {
                fields : ['second', 'minute', 'hour', 'day', 'month', 'year'],
                plurals: true
            },

            src_en: {
                dest: 'src/en.js',

                options: {
                    locales: ['en'],
                    prelude: '// GENERATED FILE\n',

                    wrapEntry: function (entry) {
                        return 'export default ' + entry + ';';
                    }
                }
            },

            lib_all: {
                dest: 'lib/locales.js',

                options: {
                    prelude: [
                        '// GENERATED FILE',
                        'var DustIntl = require("./helpers");\n\n'
                    ].join('\n'),

                    wrapEntry: function (entry) {
                        return 'DustIntl.__addLocaleData(' + entry + ');';
                    }
                }
            },

            dist_all: {
                dest: 'dist/locale-data/',

                options: {
                    wrapEntry: function (entry) {
                        return 'DustIntl.__addLocaleData(' + entry + ');';
                    }
                }
            }
        },

        bundle_jsnext: {
            dest: 'dist/dust-intl.js',

            options: {
                namespace: 'DustIntl'
            }
        },

        cjs_jsnext: {
            dest: 'tmp/'
        },

        uglify: {
            options: {
                preserveComments: 'some'
            },

            dist: {
                options: {
                    sourceMap              : true,
                    sourceMapIn            : 'dist/dust-intl.js.map',
                    sourceMapIncludeSources: true
                },

                files: {
                    'dist/dust-intl.min.js': [
                        'dist/dust-intl.js'
                    ]
                }
            },

            dist_with_locales: {
                files: {
                    'dist/dust-intl-with-locales.min.js': [
                        'dist/dust-intl-with-locales.js'
                    ]
                }
            }
        },

        connect: {
            server: {
                options: {
                    base: '.',
                    port: 9999
                }
            }
        },

        'saucelabs-mocha': {
            all: {
                options: {
                    urls: ['http://127.0.0.1:9999/tests/index.html'],
                    build: process.env.TRAVIS_BUILD_NUMBER,
                    sauceConfig: {
                        'record-video': false,
                        'capture-html': false,
                        'record-screenshots': false,
                        'command-timeout': 60
                    },
                    throttled: 3,
                    browsers: [
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows XP',
                            version: '7'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 7',
                            version: '8'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 7',
                            version: '9'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 8',
                            version: '10'
                        },
                        {
                            browserName: 'internet explorer',
                            platform: 'Windows 8.1',
                            version: '11'
                        },
                        {
                            browserName: 'chrome',
                            platform: 'Windows 7',
                            version: '37'
                        },
                        {
                            browserName: 'firefox',
                            platform: 'Windows 7',
                            version: '32'
                        },
                        {
                            browserName: 'iphone',
                            platform: 'OS X 10.9',
                            version: '7.1'
                        },
                        {
                            browserName: 'android',
                            platform: 'Linux',
                            version: '4.4'
                        },
                        {
                            browserName: 'safari',
                            platform: 'OS X 10.9',
                            version: '7'
                        }
                    ]
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-bundle-jsnext-lib');
    grunt.loadNpmTasks('grunt-extract-cldr-data');
    grunt.loadNpmTasks('grunt-saucelabs');
    grunt.loadNpmTasks('grunt-contrib-connect');

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

    grunt.registerTask('cldr', ['extract_cldr_data']);

    grunt.registerTask('compile', [
        'jshint',
        'bundle_jsnext',
        'concat:dist_with_locales',
        'uglify',
        'cjs_jsnext',
        'copy:tmp'
    ]);

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


<commit_before>module.exports = function(grunt) {
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks("grunt-docco");

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

    contribBanner:
      "// <%= pkg.name %> v<%= pkg.version %>\n" +
      "// =========================\n\n" +
      "// > <%= pkg.homepage %>\n" +
      "// > (c) 2013 Michael Fogus, DocumentCloud and Investigative Reporters & Editors\n" +
      "// > <%= pkg.name %> may be freely distributed under the <%= pkg.license %> license.\n\n",

    concat: {
      all: {
        src: "underscore.*.js",
        dest: "dist/underscore-contrib.js",
        options: { banner: "<%= contribBanner %>" }
      }
    },

    uglify: {
      all: {
        files: { "dist/underscore-contrib.min.js": "dist/underscore-contrib.js" },
        options: { banner: "<%= contribBanner %>" }
      }
    },

    qunit: {
      main: ['test/index.html'],
      concat: ['test/dist-concat.html'],
      min: ['test/dist-min.html']
    },

    jshint: {
      all: [
        "*.js",
        "test/*.js"
      ],
      options: {
        indent: 2,     // Indent by 2 spaces
        eqnull: true,  // Allow 'x == null' convention
        "-W058": false // Allow 'new Constructor' without parens
      }
    },

    watch: {
      test: {
        files: [
          "underscore.*.js",
          "test/*.js"
        ],
        tasks: ["test"]
      }
    },

    docco: {
      docs: {
        src: ['docs/*.md'],
        options: {
          output: 'docs/'
        }
      },
      examples: {
        src: ['examples/*.md'],
        options: {
          output: 'examples/'
        }
      },
    }
  });

  grunt.registerTask("test", ["jshint", "qunit:main"]);
  grunt.registerTask("dist", ["concat", "uglify"]);
  grunt.registerTask('default', ['test']);
  grunt.registerTask('dist', ['test', 'concat', 'qunit:concat', 'uglify', 'qunit:min']);
};
<commit_msg>Enforce ES3 compatibility.<commit_after>module.exports = function(grunt) {
  grunt.loadNpmTasks("grunt-contrib-concat");
  grunt.loadNpmTasks("grunt-contrib-uglify");
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks("grunt-docco");

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

    contribBanner:
      "// <%= pkg.name %> v<%= pkg.version %>\n" +
      "// =========================\n\n" +
      "// > <%= pkg.homepage %>\n" +
      "// > (c) 2013 Michael Fogus, DocumentCloud and Investigative Reporters & Editors\n" +
      "// > <%= pkg.name %> may be freely distributed under the <%= pkg.license %> license.\n\n",

    concat: {
      all: {
        src: "underscore.*.js",
        dest: "dist/underscore-contrib.js",
        options: { banner: "<%= contribBanner %>" }
      }
    },

    uglify: {
      all: {
        files: { "dist/underscore-contrib.min.js": "dist/underscore-contrib.js" },
        options: { banner: "<%= contribBanner %>" }
      }
    },

    qunit: {
      main: ['test/index.html'],
      concat: ['test/dist-concat.html'],
      min: ['test/dist-min.html']
    },

    jshint: {
      all: [
        "*.js",
        "test/*.js"
      ],
      options: {
        es3: true,
        indent: 2,     // Indent by 2 spaces
        eqnull: true,  // Allow 'x == null' convention
        "-W058": false // Allow 'new Constructor' without parens
      }
    },

    watch: {
      test: {
        files: [
          "underscore.*.js",
          "test/*.js"
        ],
        tasks: ["test"]
      }
    },

    docco: {
      docs: {
        src: ['docs/*.md'],
        options: {
          output: 'docs/'
        }
      },
      examples: {
        src: ['examples/*.md'],
        options: {
          output: 'examples/'
        }
      },
    }
  });

  grunt.registerTask("test", ["jshint", "qunit:main"]);
  grunt.registerTask("dist", ["concat", "uglify"]);
  grunt.registerTask('default', ['test']);
  grunt.registerTask('dist', ['test', 'concat', 'qunit:concat', 'uglify', 'qunit:min']);
};
<|endoftext|>