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

  'use strict';

  grunt.initConfig({

    /**
     * Pull in the package.json file so we can read its metadata.
     */
    pkg: grunt.file.readJSON('package.json'),

    /**
     *
     *  Pull in environment-specific vars
     *
     */
    env: grunt.file.readJSON('config.json'),

    /**
     * https://github.com/gruntjs/grunt-contrib-less
     */
    less: {
        development: {
            options: {
                paths: ['<%= env.frontEndPath %>/css/less', '<%= env.frontEndPath %>/css/less/module'],
                yuicompress: true
            },
            files: {
                "<%= env.frontEndPath %>/css/style.min.css": "<%= env.frontEndPath %>/css/less/main.less"
            }
        }
    },

    /**
     * Docco is that nifty biz that Backbone has for its annotated source
     *
     * https://github.com/eliias/grunt-docco
     */
    docco: {
        src: ['<%= env.frontEndPath %>/js/source/*.js', '<%= env.frontEndPath %>/js/source/views/*.js'],
        options: {
            output: '<%= env.frontEndPath %>/docs/v/head'
        }
    },

    /**
     * JSHint: https://github.com/gruntjs/grunt-contrib-jshint
     *
     * Validate files with JSHint.
     * Below are options that conform to idiomatic.js standards.
     * Feel free to add/remove your favorites: http://www.jshint.com/docs/#options
     */
    jshint: {
      options: {
        camelcase: true,
        curly: true,
        eqeqeq: true,
        forin: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        quotmark: true,
        undef: true,
        strict: true,
        unused: true,
        boss: true,
        browser: true,
        globalstrict: true,
        sub: true,
        globals: {
          jQuery: true,
          $: true,
          Backbone: true,
          _: true,
          require: true,
          define: true,
          subhead: true,
          toc: true,
          sidebar: true,
          regContent: true
        }
      },
      all: ['<%= env.frontEndPath %>/js/source/*.js', '<%= env.frontEndPath %>/js/source/views/*.js', '!<%= env.frontEndPath %>/js/source/build.js', '!<%= env.frontEndPath %>/js/source/require.config.js']
    },

    /**
     * Jasmine: https://github.com/gruntjs/grunt-contrib-jasmine
     *
     * Run jasmine specs headlessly through PhantomJS.
     * jQuery and Jasmine jQuery is included for your pleasure: https://github.com/velesin/jasmine-jquery
     */
    jasmine: {
      all: {
        src: '<%= env.frontEndPath %>/js/source',
        options: {
          template: require('grunt-template-jasmine-requirejs'),
          specs: '<%= env.frontEndPath %>/js/tests/specs/*.js',
          templateOptions: {
            requireConfig: {
              baseUrl: '<%= env.frontEndPath %>/js/source',
              paths: {
                underscore: './lib/underscore',
                backbone: './lib/backbone',
                jquery: './lib/jquery-1.9.1',
                samplejson: '../tests/grunt/js/fixtures/sample-json',
                'jquery-scrollstop': './lib/jquery.scrollstop',
                'jquery-hoverIntent': './lib/jquery.hoverIntent',
                'definition-view': './views/definition-view',
                'interpretation-view': './views/interpretation-view',
                'regs-fixed-el-view': './views/regs-fixed-el-view',
                'sub-head-view': './views/sub-head-view',
                'regs-view': './views/regs-view',
                'toc-view': './views/toc-view',
                'sidebar-view': './views/sidebar-view',
                'sidebar-head-view': './views/sidebar-head-view',
                'content-view': './views/content-view',
                'konami': './lib/konami'
              },
              shim: {
                underscore: {
                  exports: '_'
                },
                backbone: {
                  deps: ['underscore'],
                  exports: 'Backbone'
                },
                konami: {
                    exports: 'Konami'
                }
              }
            }
          }
        }
      }
    },

    plato: {
        all: {
            options: {
                jshint : grunt.file.readJSON('.jshintrc')
            },
            files: {
                src: ['<%= env.frontEndPath %>/js/source/*.js', '<%= env.frontEndPath %>/js/source/views/*.js'],
            }
        }
    },

    /**
     * Watch: https://github.com/gruntjs/grunt-contrib-watch
     *
     * Run predefined tasks whenever watched file patterns are added, changed or deleted.
     * Add files to monitor below.
     */
    watch: {
      gruntfile: {
        files: ['Gruntfile.js', '<%= recess.dist.src %>', '<%= env.frontEndPath %>/css/*.less', '<%= jasmine.options.specs %>'],
        tasks: ['build']
      }
    },

    /**
     *
     * https://npmjs.org/package/grunt-ghost
     *
     * Functional testing w/ Phantom, Casper
     *
     */
    ghost: {
        dist: {
            filesSrc: ['<%= env.frontEndPath %>/js/tests/functional/*.js'],
            options: {
                args: {
                    testUrl: '<%= env.testUrl %>'
                },
                direct: true,
                verbose: true,
                logLevel: 'debug'
            }
        }
    },

    requirejs: {
        compile: {
            options: {
                baseUrl: '<%= env.frontEndPath %>/js/source',
                mainConfigFile: '<%= env.frontEndPath %>/js/source/build.js',
                dir: "<%= env.frontEndPath %>/js/built",
                modules: [ {name: "regulations"} ],
                paths: {
                    jquery: './lib/jquery-1.9.1',
                    underscore: './lib/underscore',
                    backbone: './lib/backbone',
                    'jquery-scrollstop': './lib/jquery.scrollstop',
                    'definition-view': './views/definition-view',
                    'interpretation-view': './views/interpretation-view',
                    'regs-fixed-el-view': './views/regs-fixed-el-view',
                    'sub-head-view': './views/sub-head-view',
                    'regs-view': './views/regs-view',
                    'toc-view': './views/toc-view',
                    'sidebar-view': './views/sidebar-view',
                    'sidebar-head-view': './views/sidebar-head-view',
                    'content-view': './views/content-view',
                    'konami': './lib/konami'
                },
                shim: {
                    underscore: {
                        deps: ['jquery'],
                        exports: '_'
                    },
                    backbone: {
                        deps: ['underscore', 'jquery'],
                        exports: 'Backbone'
                    },
                    konami: {
                        exports: 'Konami'
                    }
                }
            }
        }
    }
  });

  /**
   * The above tasks are loaded here.
   */
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-notify');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-ghost');
    grunt.loadNpmTasks('grunt-docco2');
    grunt.loadNpmTasks('grunt-plato');

    /**
    * Create task aliases by registering new tasks
    */
    grunt.registerTask('test', ['jshint', 'jasmine']);
    grunt.registerTask('build', ['test', 'requirejs', 'less', 'docco']);
    grunt.registerTask('squish', ['requirejs', 'less']);
};
<commit_msg>adding url to gruntfile for plato<commit_after>module.exports = function(grunt) {

  'use strict';

  grunt.initConfig({

    /**
     * Pull in the package.json file so we can read its metadata.
     */
    pkg: grunt.file.readJSON('package.json'),

    /**
     *
     *  Pull in environment-specific vars
     *
     */
    env: grunt.file.readJSON('config.json'),

    /**
     * https://github.com/gruntjs/grunt-contrib-less
     */
    less: {
        development: {
            options: {
                paths: ['<%= env.frontEndPath %>/css/less', '<%= env.frontEndPath %>/css/less/module'],
                yuicompress: true
            },
            files: {
                "<%= env.frontEndPath %>/css/style.min.css": "<%= env.frontEndPath %>/css/less/main.less"
            }
        }
    },

    /**
     * Docco is that nifty biz that Backbone has for its annotated source
     *
     * https://github.com/eliias/grunt-docco
     */
    docco: {
        src: ['<%= env.frontEndPath %>/js/source/*.js', '<%= env.frontEndPath %>/js/source/views/*.js'],
        options: {
            output: '<%= env.frontEndPath %>/docs/v/head'
        }
    },

    /**
     * JSHint: https://github.com/gruntjs/grunt-contrib-jshint
     *
     * Validate files with JSHint.
     * Below are options that conform to idiomatic.js standards.
     * Feel free to add/remove your favorites: http://www.jshint.com/docs/#options
     */
    jshint: {
      options: {
        camelcase: true,
        curly: true,
        eqeqeq: true,
        forin: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        quotmark: true,
        undef: true,
        strict: true,
        unused: true,
        boss: true,
        browser: true,
        globalstrict: true,
        sub: true,
        globals: {
          jQuery: true,
          $: true,
          Backbone: true,
          _: true,
          require: true,
          define: true,
          subhead: true,
          toc: true,
          sidebar: true,
          regContent: true
        }
      },
      all: ['<%= env.frontEndPath %>/js/source/*.js', '<%= env.frontEndPath %>/js/source/views/*.js', '!<%= env.frontEndPath %>/js/source/build.js', '!<%= env.frontEndPath %>/js/source/require.config.js']
    },

    /**
     * Jasmine: https://github.com/gruntjs/grunt-contrib-jasmine
     *
     * Run jasmine specs headlessly through PhantomJS.
     * jQuery and Jasmine jQuery is included for your pleasure: https://github.com/velesin/jasmine-jquery
     */
    jasmine: {
      all: {
        src: '<%= env.frontEndPath %>/js/source',
        options: {
          template: require('grunt-template-jasmine-requirejs'),
          specs: '<%= env.frontEndPath %>/js/tests/specs/*.js',
          templateOptions: {
            requireConfig: {
              baseUrl: '<%= env.frontEndPath %>/js/source',
              paths: {
                underscore: './lib/underscore',
                backbone: './lib/backbone',
                jquery: './lib/jquery-1.9.1',
                samplejson: '../tests/grunt/js/fixtures/sample-json',
                'jquery-scrollstop': './lib/jquery.scrollstop',
                'jquery-hoverIntent': './lib/jquery.hoverIntent',
                'definition-view': './views/definition-view',
                'interpretation-view': './views/interpretation-view',
                'regs-fixed-el-view': './views/regs-fixed-el-view',
                'sub-head-view': './views/sub-head-view',
                'regs-view': './views/regs-view',
                'toc-view': './views/toc-view',
                'sidebar-view': './views/sidebar-view',
                'sidebar-head-view': './views/sidebar-head-view',
                'content-view': './views/content-view',
                'konami': './lib/konami'
              },
              shim: {
                underscore: {
                  exports: '_'
                },
                backbone: {
                  deps: ['underscore'],
                  exports: 'Backbone'
                },
                konami: {
                    exports: 'Konami'
                }
              }
            }
          }
        }
      }
    },

    /**
     * https://github.com/jsoverson/grunt-plato
     */
    plato: {
        all: {
            options: {
                jshint : grunt.file.readJSON('.jshintrc')
            },
            files: {
                src: ['<%= env.frontEndPath %>/js/source/*.js', '<%= env.frontEndPath %>/js/source/views/*.js'],
            }
        }
    },

    /**
     * Watch: https://github.com/gruntjs/grunt-contrib-watch
     *
     * Run predefined tasks whenever watched file patterns are added, changed or deleted.
     * Add files to monitor below.
     */
    watch: {
      gruntfile: {
        files: ['Gruntfile.js', '<%= recess.dist.src %>', '<%= env.frontEndPath %>/css/*.less', '<%= jasmine.options.specs %>'],
        tasks: ['build']
      }
    },

    /**
     *
     * https://npmjs.org/package/grunt-ghost
     *
     * Functional testing w/ Phantom, Casper
     *
     */
    ghost: {
        dist: {
            filesSrc: ['<%= env.frontEndPath %>/js/tests/functional/*.js'],
            options: {
                args: {
                    testUrl: '<%= env.testUrl %>'
                },
                direct: true,
                verbose: true,
                logLevel: 'debug'
            }
        }
    },

    requirejs: {
        compile: {
            options: {
                baseUrl: '<%= env.frontEndPath %>/js/source',
                mainConfigFile: '<%= env.frontEndPath %>/js/source/build.js',
                dir: "<%= env.frontEndPath %>/js/built",
                modules: [ {name: "regulations"} ],
                paths: {
                    jquery: './lib/jquery-1.9.1',
                    underscore: './lib/underscore',
                    backbone: './lib/backbone',
                    'jquery-scrollstop': './lib/jquery.scrollstop',
                    'definition-view': './views/definition-view',
                    'interpretation-view': './views/interpretation-view',
                    'regs-fixed-el-view': './views/regs-fixed-el-view',
                    'sub-head-view': './views/sub-head-view',
                    'regs-view': './views/regs-view',
                    'toc-view': './views/toc-view',
                    'sidebar-view': './views/sidebar-view',
                    'sidebar-head-view': './views/sidebar-head-view',
                    'content-view': './views/content-view',
                    'konami': './lib/konami'
                },
                shim: {
                    underscore: {
                        deps: ['jquery'],
                        exports: '_'
                    },
                    backbone: {
                        deps: ['underscore', 'jquery'],
                        exports: 'Backbone'
                    },
                    konami: {
                        exports: 'Konami'
                    }
                }
            }
        }
    }
  });

  /**
   * The above tasks are loaded here.
   */
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-notify');
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-ghost');
    grunt.loadNpmTasks('grunt-docco2');
    grunt.loadNpmTasks('grunt-plato');

    /**
    * Create task aliases by registering new tasks
    */
    grunt.registerTask('test', ['jshint', 'jasmine']);
    grunt.registerTask('build', ['test', 'requirejs', 'less', 'docco']);
    grunt.registerTask('squish', ['requirejs', 'less']);
};
<|endoftext|>


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

    // Project configuration.
    grunt.initConfig({

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

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

        browserify: {
            main: {
                files: {
                    'dist/highland.js': ['lib/index.js']
                },
                options: {
                    standalone: 'highland'
                }
            },
            'test-browser': {
                files: {
                    'test/bundle.js': ['test/browser.js']
                }
            }
        },

        nodeunit: {
            all: ['test/test.js']
        },

        watch: {
            all: {
                files: ['lib/index.js'],
                tasks: ['test']
            }
        },

        'gh-pages': {
            options: {
                base: 'docs'
            },
            src: ['**']
        },

        bump: {
            options: {
                files: ['package.json', 'bower.json'],
                updateConfigs: ['pkg'],
                pushTo: 'origin',
                commit: true,
                commitMessage: 'Release %VERSION%',
                commitFiles: ['package.json', 'bower.json'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'Version %VERSION%'
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-gh-pages');
    grunt.loadNpmTasks('grunt-bump');

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

    grunt.registerTask('test', ['jshint:all', 'nodeunit:all']);
    grunt.registerTask('default', ['browserify:main', 'docs']);

};
<commit_msg>Add grunt tasks for full release process<commit_after>module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({

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

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

        browserify: {
            main: {
                files: {
                    'dist/highland.js': ['lib/index.js']
                },
                options: {
                    standalone: 'highland'
                }
            },
            'test-browser': {
                files: {
                    'test/bundle.js': ['test/browser.js']
                }
            }
        },

        nodeunit: {
            all: ['test/test.js']
        },

        watch: {
            all: {
                files: ['lib/index.js'],
                tasks: ['test']
            }
        },

        'gh-pages': {
            options: {
                base: 'docs'
            },
            src: ['**']
        },

        bump: {
            options: {
                files: ['package.json', 'bower.json'],
                updateConfigs: ['pkg'],
                pushTo: 'origin',
                commit: true,
                commitMessage: 'Release %VERSION%',
                commitFiles: ['package.json', 'bower.json'],
                createTag: true,
                tagName: '%VERSION%',
                tagMessage: 'Version %VERSION%'
            }
        },
        'npm-publish': {
            options: {
                // list of tasks that are required before publishing
                requires: [],
                // if the workspace is dirty, abort publishing
                // (to avoid publishing local changes)
                abortIfDirty: true,
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-browserify');
    grunt.loadNpmTasks('grunt-gh-pages');
    grunt.loadNpmTasks('grunt-bump');
    grunt.loadNpmTasks('grunt-npm');

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

    grunt.registerTask('release:patch', [
        'test',
        'build',
        'bump:patch',
        'npm-publish',
        'gh-pages'
    ]);
    grunt.registerTask('release:minor', [
        'test',
        'build',
        'bump:minor',
        'npm-publish',
        'gh-pages'
    ]);
    grunt.registerTask('release:major', [
        'test',
        'build',
        'bump:major',
        'npm-publish',
        'gh-pages'
    ]);

    grunt.registerTask('test', ['jshint:all', 'nodeunit:all']);
    grunt.registerTask('build', ['browserify:main', 'docs']);
    grunt.registerTask('default', ['build']);

};
<|endoftext|>


<commit_before>// var angular = require('./node_modules/angular/');
// import angular from './node_modules/angular';
module.exports = function (grunt) {
  var watchDelayMs = 100;
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    clean: {
      folder: ['dist']
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      build: ['src/**/*.js']
    },
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: ['src/app.config.js', 'src/app.js', 'src/app.filter.js', 'src/app.services.js'],
        dest: 'dist/main.js'
      }
    },
    uglify: {
      options: {
        stripBanners: true,
        banner: '// <%= pkg.name %> - <%= pkg.author %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd hh:MM:ss") %>\n',
      },
      comparejs: {
        files: [
          {
            expand: true,
            cwd: 'src',
            src: '*/*.js',
            dest: 'dist',
            ext: '.js'
          },
          {
            'dist/main.js': ['<%= concat.dist.dest %>']
          }
        ]
      }
    },
    less: {
      transform: {
        files: [
          {
            expand: true,
            cwd: 'src/less',
            src: '*.less',
            dest: 'dist/css',
            ext: '.css'
          }
        ]
      }
    },
    imagemin: {
      dynamic: {
        files: [
          {
            expand: true,
            cwd: 'src/img',
            src: '*.{jpg,png,gif}',
            dest: 'dist/img'
          }
        ]
      }
    },
    cssmin: {
      target: {
        files: [
          {
            expand: true,
            cwd: 'dist/css',
            src: '*.css',
            dest: 'dist/css'
          }
        ]
      }
    },
    copy: {
      main: {
        files: [
          {
            expand: true,
            cwd: 'src',
            src: '**/*.{html,htm}',
            dest: 'dist'
          },
          {
            expand: true,
            cwd: 'node_modules/angular',
            src: 'angular.min.js',
            dest: 'dist/js/angular'
          }
        ]
      }
    },
    connect: {
      server: {
        options: {
          port: 8080,
          base: 'dist'
        }
      }
    },
    watch: {
      jshint: {
        files: 'src/**/*.js',
        tasks: ['jshint:build'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      copy: {
        files: 'src/**/*.{html,htm}',
        tasks: ['copy:main'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      concat: {
        files: 'src/*.js',
        tasks: ['concat:dist'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      uglify: {
        files: ['src/*/*.js', 'dist/main.js'],
        tasks: ['uglify:comparejs'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      imagemin: {
        files: 'src/img/*.{jpg,png,gif}',
        tasks: ['imagemin:dynamic'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      less: {
        files: 'src/less/*.less',
        tasks: ['less:transform'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      cssmin: {
        files: 'dist/css/*.css',
        tasks: ['cssmin:target'],
        options: {
          debounceDelay: watchDelayMs
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['clean', 'jshint', 'copy', 'concat', 'uglify', 'imagemin', 'less', 'cssmin', 'watch']);
}<commit_msg>grunt config<commit_after>module.exports = function (grunt) {
  var watchDelayMs = 100;
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    clean: {
      folder: ['dist']
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      build: ['src/**/*.js']
    },
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: ['src/app.config.js', 'src/app.js', 'src/app.filter.js', 'src/app.services.js'],
        dest: 'dist/main.js'
      }
    },
    uglify: {
      options: {
        stripBanners: true,
        banner: '// <%= pkg.name %> - <%= pkg.author %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd hh:MM:ss") %>\n',
      },
      comparejs: {
        files: [
          {
            expand: true,
            cwd: 'src',
            src: '*/*.js',
            dest: 'dist',
            ext: '.js'
          },
          {
            'dist/main.js': ['<%= concat.dist.dest %>']
          }
        ]
      }
    },
    less: {
      transform: {
        files: [
          {
            expand: true,
            cwd: 'src/less',
            src: '*.less',
            dest: 'dist/css',
            ext: '.css'
          }
        ]
      }
    },
    imagemin: {
      dynamic: {
        files: [
          {
            expand: true,
            cwd: 'src/img',
            src: '*.{jpg,png,gif}',
            dest: 'dist/img'
          }
        ]
      }
    },
    cssmin: {
      target: {
        files: [
          {
            expand: true,
            cwd: 'dist/css',
            src: '*.css',
            dest: 'dist/css'
          }
        ]
      }
    },
    copy: {
      main: {
        files: [
          {
            expand: true,
            cwd: 'src',
            src: '**/*.{html,htm}',
            dest: 'dist'
          },
          {
            expand: true,
            cwd: 'node_modules/angular',
            src: 'angular.min.js',
            dest: 'dist/js/angular'
          }
        ]
      }
    },
    connect: {
      server: {
        options: {
          port: 8080,
          base: 'dist',
          open: {
            target: 'http://localhost:8080',
            appName: 'open',
            callback: function () {}
          }
        }
      }
    },
    watch: {
      jshint: {
        files: 'src/**/*.js',
        tasks: ['jshint:build'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      copy: {
        files: 'src/**/*.{html,htm}',
        tasks: ['copy:main'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      concat: {
        files: 'src/*.js',
        tasks: ['concat:dist'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      uglify: {
        files: ['src/*/*.js', 'dist/main.js'],
        tasks: ['uglify:comparejs'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      imagemin: {
        files: 'src/img/*.{jpg,png,gif}',
        tasks: ['imagemin:dynamic'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      less: {
        files: 'src/less/*.less',
        tasks: ['less:transform'],
        options: {
          debounceDelay: watchDelayMs
        }
      },
      cssmin: {
        files: 'dist/css/*.css',
        tasks: ['cssmin:target'],
        options: {
          debounceDelay: watchDelayMs
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['clean', 'jshint', 'copy', 'concat', 'uglify', 'imagemin', 'less', 'cssmin', 'watch']);
}<|endoftext|>


<commit_before>// Generated on 2014-11-03 using generator-angular 0.9.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);

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

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

    // Project settings
    yeoman: appConfig,

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

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

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

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

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

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      }
    },

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

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

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

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

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        },
        {
          expand: true,
          cwd: '<%= yeoman.app %>/floorplans',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/floorplans'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: ['*.js', '!oldieshim.js'],
          dest: '.tmp/concat/scripts'
        }]
      }
    },

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

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'x3dom.js',
            'x3dom.css',
            'sensor.x3d',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*',
            'binGeo/*',
            'floorplans/*',
            'sensor_data/*',
            'panorama/*',
            'panorama/*/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: 'bower_components/bootstrap/dist',
          src: 'fonts/*',
          dest: '<%= yeoman.dist %>'
        }, {
          expand: true,
          cwd: 'bower_components/angular-ui-grid',
          src: ['ui-grid.ttf',
              'ui-grid.woff'],
          dest: '<%= yeoman.dist %>/styles'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

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

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

  });

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

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

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

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

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

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>Remove image file renaming<commit_after>// Generated on 2014-11-03 using generator-angular 0.9.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);

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

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

    // Project settings
    yeoman: appConfig,

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

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

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

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

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

    // Automatically inject Bower components into the app
    wiredep: {
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

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

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

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

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        },
        {
          expand: true,
          cwd: '<%= yeoman.app %>/floorplans',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/floorplans'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ng-annotate tries to make the code safe for minification automatically
    // by using the Angular long form for dependency injection.
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: ['*.js', '!oldieshim.js'],
          dest: '.tmp/concat/scripts'
        }]
      }
    },

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

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'x3dom.js',
            'x3dom.css',
            'sensor.x3d',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*',
            'binGeo/*',
            'floorplans/*',
            'sensor_data/*',
            'panorama/*',
            'panorama/*/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: 'bower_components/bootstrap/dist',
          src: 'fonts/*',
          dest: '<%= yeoman.dist %>'
        }, {
          expand: true,
          cwd: 'bower_components/angular-ui-grid',
          src: ['ui-grid.ttf',
              'ui-grid.woff'],
          dest: '<%= yeoman.dist %>/styles'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

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

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

  });

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

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

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

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

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

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


<commit_before>'use strict';

var request = require('request');

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

	var reloadPort = 35729, files;

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

		shell: {
			mongodb: {
				command: 'sudo mongod --dbpath ./data/db',
				options: {
					async: true
				}
			}
		},

		develop: {
			server: {
				file: 'app.js',
				env: {
					port: 3000
				}
			}
		},

		watch: {
			options: {
				nospawn: true,
				livereload: reloadPort
			},

			handlebars: {
				files: ['views/**/*.hbs'],
				tasks: ['develop', 'delayed-livereload']
			},

			js: {
				files: [
					'app.js',
					'controllers/**/*.js',
					'models/**/*.js',
					'config/*.js'
				],
				tasks: ['delayed-livereload']
			},

			node: {
				files: [
					'app.js',
					'controllers/**/*.js',
					'models/**/*.js',
					'config/*.js'
				],
				tasks: ['develop', 'delayed-livereload']
			}
		}
	});

	grunt.loadNpmTasks('grunt-shell-spawn');
	grunt.config.requires('watch.js.files');
	files = grunt.config('watch.js.files');
	files = grunt.file.expand(files);

	grunt.registerTask('delayed-livereload', 'Live reload after the node server has restarted.', function () {
		var done = this.async();
		setTimeout(function () {
			request.get('http://localhost:' + reloadPort + '/changed?files=' + files.join(','),  function(err, res) {
				var reloaded = !err && res.statusCode === 200;
				if(reloaded) {
					grunt.log.ok('Delayed live reload successful.');
				} else {
					grunt.log.error('Unable to make a delayed live reload.');
					done(reloaded);
				}
			});
		}, 500);
	});

	grunt.registerTask('default', ['shell:mongodb', 'develop', 'watch']);
};
<commit_msg>Removed gruntfile;<commit_after><|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({

        files: {
            lib: ['lib/**/*.js'],
            bin: ['bin/*'],
            config: ['config/**/*'],
            unit_tests: ['test/Unit/**/*.js'],
            gruntfile: ['Gruntfile.js'],

            // Composites of above
            src: ['lib/**/*.js', 'bin/*', 'test/**/*.js'],
            all: ['lib/**/*.js', 'bin/*', 'config/**/*', 'test/**/*.js', 'Gruntfile.js', 'package.json'],

            html: ['html/*.html']
        },

        // Set Environment
        env: {
            test: {
                NODE_ENV: 'test'
            }
        },

        // Maybe remove this, istanbul covers it nicely
        mochaTest: {
            options: {
                reporter: 'spec'
            },
            src: '<%= files.unit_lstests %>'
        },

        // Istanbul code coverage
        mocha_istanbul: {
            coverage: {
                src: '<%= files.unit_tests %>',
                options: {
                    coverageFolder: 'coverage/unit_tests',
                    print: 'detail'
                }
            }
        },

        // Run jshint
        jshint: {
            options: {
                reporter: require('jshint-stylish'),
                jshintrc: '.jshintrc',

            },
            src: {
                src: '<%= files.src %>'
            },
            jshintrc: {
                src: '.jshintrc'
            },
        },

        // run jshint/tests/coverage when anything changes
        watch: {
            all: {
                files: '<%= files.all %>',
                tasks: ['coverage']
            },
            jshintrc: {
                files: '.jshintrc',
                tasks: ['jshint']
            }
        },

        // restart the server when anything changes
        nodemon: {
            dev: {
                script: 'bin/flowTrack',
                options: {
                    ignore: ['node_modules/**', 'coverage/**'],
                    delay: 4000,
                    verbose: true
                }
            }
        },

        //Install and copy bower libs
        bowercopy: {
            options: {
                clean: true,
                srcPrefix: 'bower_components',
            },
            task: {
                options: {
                    destPrefix: 'www/bower_components'
                },
                files: {
                    'angular': 'angular'
                }

            }
        },

        // Wire bower dependencies
        wiredep: {
            options: {
                directory: 'www/bower_components',
            },
            task: {
                src: ['www/html/*.html'],
            }
        },

    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-wiredep');
    grunt.loadNpmTasks('grunt-bowercopy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.loadNpmTasks('grunt-env');

    // Default task.
    grunt.registerTask('default', ['env:test', 'jshint:src']);
    grunt.registerTask('coverage', ['env:test', 'jshint:src', 'mocha_istanbul:coverage']);
    grunt.registerTask('test', ['env:test', 'mochaTest']);

};<commit_msg>Turn off verbose nodemon<commit_after>'use strict';

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({

        files: {
            lib: ['lib/**/*.js'],
            bin: ['bin/*'],
            config: ['config/**/*'],
            unit_tests: ['test/Unit/**/*.js'],
            gruntfile: ['Gruntfile.js'],

            // Composites of above
            src: ['lib/**/*.js', 'bin/*', 'test/**/*.js'],
            all: ['lib/**/*.js', 'bin/*', 'config/**/*', 'test/**/*.js', 'Gruntfile.js', 'package.json'],

            html: ['html/*.html']
        },

        // Set Environment
        env: {
            test: {
                NODE_ENV: 'test'
            }
        },

        // Maybe remove this, istanbul covers it nicely
        mochaTest: {
            options: {
                reporter: 'spec'
            },
            src: '<%= files.unit_lstests %>'
        },

        // Istanbul code coverage
        mocha_istanbul: {
            coverage: {
                src: '<%= files.unit_tests %>',
                options: {
                    coverageFolder: 'coverage/unit_tests',
                    print: 'detail'
                }
            }
        },

        // Run jshint
        jshint: {
            options: {
                reporter: require('jshint-stylish'),
                jshintrc: '.jshintrc',

            },
            src: {
                src: '<%= files.src %>'
            },
            jshintrc: {
                src: '.jshintrc'
            },
        },

        // run jshint/tests/coverage when anything changes
        watch: {
            all: {
                files: '<%= files.all %>',
                tasks: ['coverage']
            },
            jshintrc: {
                files: '.jshintrc',
                tasks: ['jshint']
            }
        },

        // restart the server when anything changes
        nodemon: {
            dev: {
                script: 'bin/flowTrack',
                options: {
                    ignore: ['node_modules/**', 'coverage/**'],
                    delay: 4000,
                }
            }
        },

        //Install and copy bower libs
        bowercopy: {
            options: {
                clean: true,
                srcPrefix: 'bower_components',
            },
            task: {
                options: {
                    destPrefix: 'www/bower_components'
                },
                files: {
                    'angular': 'angular'
                }

            }
        },

        // Wire bower dependencies
        wiredep: {
            options: {
                directory: 'www/bower_components',
            },
            task: {
                src: ['www/html/*.html'],
            }
        },

    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-wiredep');
    grunt.loadNpmTasks('grunt-bowercopy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-nodemon');
    grunt.loadNpmTasks('grunt-env');

    // Default task.
    grunt.registerTask('default', ['env:test', 'jshint:src']);
    grunt.registerTask('coverage', ['env:test', 'jshint:src', 'mocha_istanbul:coverage']);
    grunt.registerTask('test', ['env:test', 'mochaTest']);
};<|endoftext|>


<commit_before>(function () {
  'use strict';

  var
    moment = require('moment'),
    yaml = require('js-yaml');

  module.exports = function (grunt) {
    var
      writeDoc = function (file, template, obj) {
        if (!grunt.file.exists(file) ||
            !moment(yaml.safeLoad(grunt.file.read(file).match(/---\n((.|\n)*)\n---/m)[1]).date).isSame(moment(obj.date))) {
          console.log('Writing to ' + file);

          grunt.file.write(file, grunt.template.process(template, { data: obj }));
        }
      },
      getIdArray = function (str, sort) {
        try {
          var idArray = str.match(/\[[a-z][\w\-]*\]/g).map(function (id) {
            return id.match(/[\w\-]+/g)[0];
          });

          return sort ? idArray.sort() : idArray;
        } catch (error) {
          return null;
        }
      };

    grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      banner: '/*!\n' +
              ' * <%= pkg.name %> v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
              ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
              ' * Licensed under <%= pkg.license %> (<%= pkg.homepage %>/blob/master/LICENSE)\n' +
              ' */\n',

      clean: {
        fontconfig: ['fontconfig']
      },
      less: {
        print: {
          files: {
            'public_html/css/tp-print.min.css': '_site/_less/tp-print.less'
          },
          options: {
            banner: '<%= banner %>',
            compress: true,
            strictMath: true,
            strictUnits: true
          }
        },
        screen: {
          files: {
            'public_html/css/tp.min.css': '_site/_less/tp-screen.less'
          },
          options: {
            banner: '<%= banner %>',
            compress: true,
            strictMath: true,
            strictUnits: true
          }
        }
      },
      http: {
        special_rules: {
          options: {
            url: 'http://miniwars.co.uk/netea-json/special_rules',
            callback: function (error, response, body) {
              var template = grunt.file.read('grunt-templates/special_rule.md');

              JSON.parse(body).forEach(function (sr) {
                if (sr.rule_netea_url !== '') {
                  writeDoc(
                    '_site/_special_rules/' + sr.rule_netea_url + '.md',
                    template,
                    {
                      date: moment(sr.edit_date).format(),

                      name: sr.title,
                      abbr: sr.rule_abbreviation,

                      content: sr.special_rule_details
                    }
                  );
                }
              });
            }
          }
        },
        units: {
          options: {
            url: 'http://miniwars.co.uk/netea-json/units',
            callback: function (error, response, body) {
              var template = grunt.file.read('grunt-templates/unit.md');

              JSON.parse(body).forEach(function (u) {
                if (u.url_title !== '') {
                  writeDoc(
                    '_site/_units/' + u.url_title + '.md',
                    template,
                    {
                      date: moment(u.edit_date).format(),

                      name: u.title,
                      type: u.miniatures_netea[0].netea_type,
                      speed: u.miniatures_netea[0].netea_speed,
                      armour: u.miniatures_netea[0].netea_armour,
                      cc: u.miniatures_netea[0].netea_cc,
                      ff: u.miniatures_netea[0].netea_ff,

                      weapons: u.netea_weapons.map(function (w) {
                        return {
                          id: getIdArray(w.netea_weapon_weapon),
                          multiplier: w.netea_weapon_multiplier,
                          arc: w.netea_weapon_arc
                        };
                      }),

                      special_rules: getIdArray(u.miniatures_netea[0].netea_attributes),
                      notes: u.miniatures_netea[0].netea_notes.replace(/[\r\n]/g, ' ')// remove replace
                    }
                  );
                }
              });
            }
          }
        },
        weapons: {
          options: {
            url: 'http://miniwars.co.uk/netea-json/weapons',
            callback: function (error, response, body) {
              var template = grunt.file.read('grunt-templates/weapon.md');

              JSON.parse(body).forEach(function (w) {
                if (w.url_title !== '') {
                  writeDoc(
                    '_site/_weapons/' + w.url_title + '.md',
                    template,
                    {
                      date: moment(w.edit_date).format(),

                      name: w.title,
                      modes: w.weapon_details.map(function (m) {
                        return {
                          boolean: m.weapon_boolean,
                          range: m.weapon_range,
                          firepower: m.weapon_firepower,
                          special_rules: getIdArray(m.weapon_abilities, true)
                        };
                      })
                    }
                  );
                }
              });
            }
          }
        }
      },
      pdf: (function () {
        var obj = {
            'tournament-pack': {
              input: 'public_html/tournament-pack/index.html',
              output: 'tournament-pack'
            }
          };

        grunt.file.mkdir('public_html/army-lists');

        grunt.file.recurse('public_html/army-lists', function (abspath, rootdir, subdir, filename) {
          filename = filename.replace(/\.html$/, '');

          obj[filename] = {
            input: abspath,
            output: filename
          };
        });

        return obj;
      }()),
      shell: {
        options: { stderr: false },

        jekyll: { command: 'jekyll build' },
        prince: {
          command: [
            'prince --script=public_html/js/tp-print.min.js --style=public_html/css/tp-print.min.css -o public_html/pdfs/netea-<%= grunt.config("output") %>.pdf <%= grunt.config("input") %>',
            'sed -i "0,/\\/Annots /{s~/Annots \\[\\([0-9]\\+ 0 R \\)\\{2\\}~/Annots [~}" public_html/pdfs/netea-<%= grunt.config("output") %>.pdf'
          ].join('&&')
        }
      },
      uglify: {
        options: {
          banner: '<%= banner %>',
          mangle: false
        },
        print: {
          files: { 'public_html/js/tp-print.min.js': [
            'bower_components/jquery/dist/jquery.js',
            '_site/_js/tp.js'
          ]}
        },
        screen: {
          files: { 'public_html/js/tp.min.js': [
            'bower_components/jquery/dist/jquery.js',
            '_site/_js/delayed-resize.js',
            '_site/_js/delayed-scroll.js',
            '_site/_js/tp.js',
            '_site/_js/tp-screen.js'
          ]}
        }
      },
      watch: {
        less: {
          files: ['_site/_less/**/*.less'],
          tasks: ['less']
        },
        html: {
          files: ['public_html/index.html'],
          tasks: ['less', 'uglify']
        },
        uglify: {
          files: ['_site/_js/**/*.js'],
          tasks: ['uglify']
        }
      }
    });

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-http');
    grunt.loadNpmTasks('grunt-shell');

    grunt.registerTask('default', ['shell:jekyll', 'less', 'uglify', 'pdf', 'clean:fontconfig']);

    grunt.registerMultiTask('pdf', function () {
      grunt.file.mkdir('public_html/pdfs');

      grunt.config('input', this.data.input);
      grunt.config('output', this.data.output);

      grunt.task.run(['shell:prince']);
    });
  };
}());<commit_msg>added sort flag to unit special rules<commit_after>(function () {
  'use strict';

  var
    moment = require('moment'),
    yaml = require('js-yaml');

  module.exports = function (grunt) {
    var
      writeDoc = function (file, template, obj) {
        if (!grunt.file.exists(file) ||
            !moment(yaml.safeLoad(grunt.file.read(file).match(/---\n((.|\n)*)\n---/m)[1]).date).isSame(moment(obj.date))) {
          console.log('Writing to ' + file);

          grunt.file.write(file, grunt.template.process(template, { data: obj }));
        }
      },
      getIdArray = function (str, sort) {
        try {
          var idArray = str.match(/\[[a-z][\w\-]*\]/g).map(function (id) {
            return id.match(/[\w\-]+/g)[0];
          });

          return sort ? idArray.sort() : idArray;
        } catch (error) {
          return null;
        }
      };

    grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      banner: '/*!\n' +
              ' * <%= pkg.name %> v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
              ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
              ' * Licensed under <%= pkg.license %> (<%= pkg.homepage %>/blob/master/LICENSE)\n' +
              ' */\n',

      clean: {
        fontconfig: ['fontconfig']
      },
      less: {
        print: {
          files: {
            'public_html/css/tp-print.min.css': '_site/_less/tp-print.less'
          },
          options: {
            banner: '<%= banner %>',
            compress: true,
            strictMath: true,
            strictUnits: true
          }
        },
        screen: {
          files: {
            'public_html/css/tp.min.css': '_site/_less/tp-screen.less'
          },
          options: {
            banner: '<%= banner %>',
            compress: true,
            strictMath: true,
            strictUnits: true
          }
        }
      },
      http: {
        special_rules: {
          options: {
            url: 'http://miniwars.co.uk/netea-json/special_rules',
            callback: function (error, response, body) {
              var template = grunt.file.read('grunt-templates/special_rule.md');

              JSON.parse(body).forEach(function (sr) {
                if (sr.rule_netea_url !== '') {
                  writeDoc(
                    '_site/_special_rules/' + sr.rule_netea_url + '.md',
                    template,
                    {
                      date: moment(sr.edit_date).format(),

                      name: sr.title,
                      abbr: sr.rule_abbreviation,

                      content: sr.special_rule_details
                    }
                  );
                }
              });
            }
          }
        },
        units: {
          options: {
            url: 'http://miniwars.co.uk/netea-json/units',
            callback: function (error, response, body) {
              var template = grunt.file.read('grunt-templates/unit.md');

              JSON.parse(body).forEach(function (u) {
                if (u.url_title !== '') {
                  writeDoc(
                    '_site/_units/' + u.url_title + '.md',
                    template,
                    {
                      date: moment(u.edit_date).format(),

                      name: u.title,
                      type: u.miniatures_netea[0].netea_type,
                      speed: u.miniatures_netea[0].netea_speed,
                      armour: u.miniatures_netea[0].netea_armour,
                      cc: u.miniatures_netea[0].netea_cc,
                      ff: u.miniatures_netea[0].netea_ff,

                      weapons: u.netea_weapons.map(function (w) {
                        return {
                          id: getIdArray(w.netea_weapon_weapon),
                          multiplier: w.netea_weapon_multiplier,
                          arc: w.netea_weapon_arc
                        };
                      }),

                      special_rules: getIdArray(u.miniatures_netea[0].netea_attributes, true),
                      notes: u.miniatures_netea[0].netea_notes.replace(/[\r\n]/g, ' ')// remove replace
                    }
                  );
                }
              });
            }
          }
        },
        weapons: {
          options: {
            url: 'http://miniwars.co.uk/netea-json/weapons',
            callback: function (error, response, body) {
              var template = grunt.file.read('grunt-templates/weapon.md');

              JSON.parse(body).forEach(function (w) {
                if (w.url_title !== '') {
                  writeDoc(
                    '_site/_weapons/' + w.url_title + '.md',
                    template,
                    {
                      date: moment(w.edit_date).format(),

                      name: w.title,
                      modes: w.weapon_details.map(function (m) {
                        return {
                          boolean: m.weapon_boolean,
                          range: m.weapon_range,
                          firepower: m.weapon_firepower,
                          special_rules: getIdArray(m.weapon_abilities, true)
                        };
                      })
                    }
                  );
                }
              });
            }
          }
        }
      },
      pdf: (function () {
        var obj = {
            'tournament-pack': {
              input: 'public_html/tournament-pack/index.html',
              output: 'tournament-pack'
            }
          };

        grunt.file.mkdir('public_html/army-lists');

        grunt.file.recurse('public_html/army-lists', function (abspath, rootdir, subdir, filename) {
          filename = filename.replace(/\.html$/, '');

          obj[filename] = {
            input: abspath,
            output: filename
          };
        });

        return obj;
      }()),
      shell: {
        options: { stderr: false },

        jekyll: { command: 'jekyll build' },
        prince: {
          command: [
            'prince --script=public_html/js/tp-print.min.js --style=public_html/css/tp-print.min.css -o public_html/pdfs/netea-<%= grunt.config("output") %>.pdf <%= grunt.config("input") %>',
            'sed -i "0,/\\/Annots /{s~/Annots \\[\\([0-9]\\+ 0 R \\)\\{2\\}~/Annots [~}" public_html/pdfs/netea-<%= grunt.config("output") %>.pdf'
          ].join('&&')
        }
      },
      uglify: {
        options: {
          banner: '<%= banner %>',
          mangle: false
        },
        print: {
          files: { 'public_html/js/tp-print.min.js': [
            'bower_components/jquery/dist/jquery.js',
            '_site/_js/tp.js'
          ]}
        },
        screen: {
          files: { 'public_html/js/tp.min.js': [
            'bower_components/jquery/dist/jquery.js',
            '_site/_js/delayed-resize.js',
            '_site/_js/delayed-scroll.js',
            '_site/_js/tp.js',
            '_site/_js/tp-screen.js'
          ]}
        }
      },
      watch: {
        less: {
          files: ['_site/_less/**/*.less'],
          tasks: ['less']
        },
        html: {
          files: ['public_html/index.html'],
          tasks: ['less', 'uglify']
        },
        uglify: {
          files: ['_site/_js/**/*.js'],
          tasks: ['uglify']
        }
      }
    });

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-http');
    grunt.loadNpmTasks('grunt-shell');

    grunt.registerTask('default', ['shell:jekyll', 'less', 'uglify', 'pdf', 'clean:fontconfig']);

    grunt.registerMultiTask('pdf', function () {
      grunt.file.mkdir('public_html/pdfs');

      grunt.config('input', this.data.input);
      grunt.config('output', this.data.output);

      grunt.task.run(['shell:prince']);
    });
  };
}());<|endoftext|>


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

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

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

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

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

  // Project configuration.
  grunt.initConfig({

    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * TODC Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',
    jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n',

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

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

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

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

    uglify: {
      docsJs: {
        options: {
          preserveComments: 'some'
        },
        src: [
          'docs/assets/js/_vendor/select2.js',
          'docs/assets/js/_vendor/holder.js',
          'docs/assets/js/_src/application.js'
        ],
        dest: 'docs/assets/js/docs.min.js'
      }
    },

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

    autoprefixer: {
      options: {
        browsers: ['last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12']
      },
      core: {
        options: {
          map: true
        },
        src: 'dist/css/<%= pkg.name %>.css'
      },
      docs: {
        src: 'docs/assets/css/_src/docs.css'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      }
    },

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

    cssmin: {
      options: {
        compatibility: 'ie8',
        keepSpecialComments: '*',
        noAdvanced: true
      },
      docs: {
        src: [
          'docs/assets/css/_src/docs.css',
          'docs/assets/css/_src/pygments-manni.css',
          'docs/assets/css/_src/select2.css'
        ],
        dest: 'docs/assets/css/docs.min.css'
      }
    },

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

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

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

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

    jekyll: {
      docs: {}
    },

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  grunt.registerTask('build-glyphicons-data', function () { generateGlyphiconsData.call(this, grunt); });

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

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

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

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

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

  // Project configuration.
  grunt.initConfig({

    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * TODC Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',
    jqueryCheck: 'if (typeof jQuery === \'undefined\') { throw new Error(\'Bootstrap\\\'s JavaScript requires jQuery\') }\n\n',

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

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

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

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

    uglify: {
      docsJs: {
        options: {
          preserveComments: 'some'
        },
        src: [
          'docs/assets/js/_vendor/select2.js',
          'docs/assets/js/_vendor/holder.js',
          'docs/assets/js/_src/application.js'
        ],
        dest: 'docs/assets/js/docs.min.js'
      }
    },

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

    autoprefixer: {
      options: {
        browsers: ['last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12']
      },
      core: {
        options: {
          map: true
        },
        src: 'dist/css/<%= pkg.name %>.css'
      },
      docs: {
        src: 'docs/assets/css/_src/docs.css'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      }
    },

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

    cssmin: {
      options: {
        compatibility: 'ie8',
        keepSpecialComments: '*'
      },
      docs: {
        src: [
          'docs/assets/css/_src/docs.css',
          'docs/assets/css/_src/pygments-manni.css',
          'docs/assets/css/_src/select2.css'
        ],
        dest: 'docs/assets/css/docs.min.css'
      }
    },

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

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

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

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

    jekyll: {
      docs: {}
    },

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  grunt.registerTask('build-glyphicons-data', function () { generateGlyphiconsData.call(this, grunt); });

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