<commit_before>var path = require('path');
var fs = require('fs');

module.exports = function(grunt) {
  function getBanner(isDemo, isBin) {
    return (isBin ? '#!/usr/bin/env node\n' : '') +
      '/*!\n' +
      ' * <%= pkg.name %>' + (isDemo ? '-demo' : '') + ' - v<%= pkg.version %>\n' +
      ' * @copyright 2015-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
      ' * @author Nick Wronski <nick@javascript.com>\n' +
      ' */';
  }
  function getCmdString(cmd, args) {
    if (!args) args = '';
    const binPath = path.normalize(`node_modules/.bin/${cmd}`);
    return `${binPath} ${customArgs[cmd]} ${args}`.trim();
  }
  const customArgs = {
    mocha: 'test/**/*-spec.js --colors --bail --compilers=js:babel-core/register',
    pegjs: `--trace --cache --optimize size --allowed-start-rules 'start,start_streaming' --output src/parser.js src/grammar.pegjs`
  };

  const tmpDir = './.tmp/';
  if (!fs.existsSync(tmpDir)){
    fs.mkdirSync(tmpDir);
  }
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    babel: {
      options: {
        compact: true,
        comments: false,
        presets: ['es2015'],
        plugins: ['add-module-exports']
      },
      build: {
        options: {
          sourceMaps: 'inline'
        },
        files: [{
          src: ['*.js'],
          expand: true,
          cwd: 'src/',
          dest: '.tmp/'
        }]
      },
      demo: {
        options: {
          sourceMaps: false
        },
        files: [{
          src: ['*.js'],
          expand: true,
          cwd: 'src/',
          dest: '.tmp/'
        }]
      },

      bin: {
        files: {
          'bin/sqlite-parser': 'src/bin/sqlite-parser.js'
        }
      }
    },

    browserify: {
      dist: {
        options: {
          browserifyOptions: {
            debug: true,
            standalone: 'sqliteParser'
          }
        },
        src: ['index.js'],
        dest: 'dist/sqlite-parser.js'
      },
      interactive: {
        options: {
          alias: {
            'codemirror': './node_modules/codemirror/lib/codemirror',
            'foldcode': './node_modules/codemirror/addon/fold/foldcode',
            'foldgutter': './node_modules/codemirror/addon/fold/foldgutter',
            'brace-fold': './node_modules/codemirror/addon/fold/brace-fold',
            'panel': './node_modules/codemirror/addon/display/panel',
            'mode-javascript': './node_modules/codemirror/mode/javascript/javascript',
            'mode-sql': './node_modules/codemirror/mode/sql/sql',
            'sqlite-parser': './.tmp/index.js',
            './streaming': './.tmp/streaming-shim.js'
          },
        },
        require: [
          'node_modules/codemirror/lib/codemirror',
          'node_modules/codemirror/addon/fold/foldcode',
          'node_modules/codemirror/addon/fold/foldgutter',
          'node_modules/codemirror/addon/fold/brace-fold',
          'node_modules/codemirror/addon/display/panel',
          'node_modules/codemirror/mode/javascript/javascript',
          'node_modules/codemirror/mode/sql/sql'
        ],
        src: ['src/demo/demo.js'],
        dest: '.tmp/sqlite-parser-demo.js'
      }
    },

    copy: {
      release: {
        files: [{
          filter: 'isFile',
          expand: true,
          cwd: '.tmp/',
          src: [
            'index.js', 'parser.js', 'streaming.js', 'streaming-shim.js', 'tracer.js'
          ],
          dest: 'lib/'
        }]
      },
      interactive: {
        files: [{
          src: ['index.html'],
          expand: true,
          cwd: 'src/demo/',
          dest: '.tmp/'
        }],
      },
      demo: {
        src: ['*.{html,css}'],
        expand: true,
        cwd: '.tmp/',
        dest: 'demo/'
      }
    },

    clean: {
      build: ['.tmp/*.js', 'lib/**/*', 'src/parser.js'],
      interactive: ['.tmp/*.css'],
      demo: ['demo/**/*'],
      bin: ['bin/**/*'],
      testProcess: ['test/sql/official-suite/**/*.sql']
    },

    shell: {
      build: {
        options: {
          failOnError: true
        },
        command: getCmdString('pegjs')
      },
      test: {
        options: {
          failOnError: true
        },
        command: getCmdString('mocha', '--reporter=list')
      },
      testAll: {
        options: {
          failOnError: true
        },
        command: `ALL_TESTS=true ${getCmdString('mocha', '--reporter=list --timeout=90000')}`
      },
      debug: {
        options: {
          failOnError: false,
          debounceDelay: 500,
          forever: true
        },
        command: `DEBUG=true ${getCmdString('mocha', '--reporter=list')}`
      },
      rewrite: {
        options: {
          failOnError: true
        },
        command: `REWRITE=true ${getCmdString('mocha', '--reporter=list')}`
      },
      testProcess: {
        options: {
          failOnError: true,
          execOptions: {
            cwd: path.normalize(`${process.cwd()}/test/misc/`)
          }
        },
        command: `sh process-tests.sh`
      }
    },

    connect: {
      server: {
        options: {
          port: 8080,
          base: '.tmp',
          livereload: true
        }
      }
    },

    watch: {
      test: {
        options: {
          debounceDelay: 250,
          livereload: false
        },
        files: [
          'test/**/*.js', 'src/*.js', 'src/*.pegjs',
          'test/sql/**/*.sql', 'test/json/**/*.json', 'Gruntfile.js'
        ],
        tasks: [ 'test' ]
      },
      debug: {
        options: {
          debounceDelay: 250,
          livereload: false
        },
        files: [
          'test/**/*.js', 'src/*.js', 'src/*.pegjs',
          'test/sql/**/*.sql', 'test/json/**/*.json', 'Gruntfile.js'
        ],
        tasks: ['build', 'shell:debug']
      },
      interactive: {
        options: {
          debounceDelay: 1000,
          livereload: {
            directory: '.tmp/',
            port: 35729
          },
        },
        files: [
          'src/**/*.{js,css,html,pegjs}', 'Gruntfile.js'
        ],
        tasks: ['interactive']
      }
    },

    uglify: {
      options: {
        screwIE8: true,
        mangle: {
          except: ['sqliteParser']
        },
      },
      demo: {
        files: {
          'demo/sqlite-parser-demo.js': ['.tmp/sqlite-parser-demo.js']
        }
      },
      bin: {
        files: {
          'bin/sqlite-parser': ['bin/sqlite-parser']
        }
      }
    },

    cssmin: {
      interactive: {
        options: {
          processImport: true
        },
        files: {
          '.tmp/sqlite-parser-demo.css': [
            'node_modules/codemirror/lib/codemirror.css',
            'node_modules/codemirror/addon/fold/foldgutter.css',
            'node_modules/codemirror/theme/monokai.css',
            'src/demo/demo.css'
          ]
        }
      }
    },

    usebanner: {
      options: {
        position: 'top',
        linebreak: true
      },
      release: {
        options: {
          banner: getBanner(false)
        },
        files: [{
          filter: 'isFile',
          expand: true,
          cwd: 'lib/',
          src: ['*.js'],
          dest: 'lib/'
        }]
      },
      demo: {
        options: {
          banner: getBanner(true)
        },
        files: {
          src: [
            'demo/sqlite-parser-demo.js',
            'demo/sqlite-parser-demo.css'
          ]
        }
      },
      bin: {
        options: {
          banner: getBanner(false, true)
        },
        files: {
          src: [
            'bin/sqlite-parser'
          ]
        }
      }
    },

    replace: {
      options: {
        patterns: [
          {
            match: 'VERSION',
            replacement: '<%= pkg.version %>'
          }
        ]
      },
      interactive: {
        files: [{
          expand: true,
          cwd: '.tmp/',
          src: 'index.js',
          dest: '.tmp/'
        }]
      },
      bin: {
        files: [{
          src: 'bin/sqlite-parser',
          dest: 'bin/sqlite-parser'
        }]
      }
    },

    concurrent: {
      interactive: [
        'copy:interactive',
        'browserify:interactive'
      ],
      live: [
        'interactive',
        [ 'clean:interactive', 'cssmin:interactive' ]
      ],
      demo1: [
        'cssmin:interactive',
        [ 'demobuild', 'replace:interactive', 'shell:test', 'concurrent:interactive' ]
      ],
      demo2: [
        'uglify:demo',
        'copy:demo'
      ],
      release: [
        [ 'demo', 'copy:release', 'usebanner:release' ],
        [ 'bin', 'replace:bin', 'usebanner:bin' ]
      ]
    }
  });

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

  grunt.registerTask('default', [
    'build'
  ]);
  grunt.registerTask('build', [
    'clean:build',
    'shell:build',
    'babel:build'
  ]);

  grunt.registerTask('bin', [
    'clean:bin',
    'babel:bin'
  ]);

  grunt.registerTask('test', [
    'build', 'shell:test'
  ]);
  grunt.registerTask('testall', [
    'build', 'shell:testAll'
  ]);
  grunt.registerTask('testprocess', [
    'clean:testProcess', 'shell:testProcess'
  ]);

  grunt.registerTask('testwatch', [
    'test', 'watch:test'
  ]);
  grunt.registerTask('debug', [
    'build', 'shell:debug', 'watch:debug'
  ]);
  grunt.registerTask('rewrite-json', [
    'build', 'shell:rewrite'
  ]);

  grunt.registerTask('interactive', [
    'build',
    'concurrent:interactive'
  ]);
  grunt.registerTask('live', [
    'concurrent:live',
    'connect:server',
    'watch:interactive'
  ]);

  grunt.registerTask('demo', [
    'clean:demo',
    'concurrent:demo1',
    'concurrent:demo2',
    'usebanner:demo'
  ]);
  grunt.registerTask('demobuild', [
    'clean:build',
    'shell:build',
    'babel:demo'
  ]);

  grunt.registerTask('release', [
    'concurrent:release'
  ]);
};
<commit_msg>Do not delete lib folder on grunt test. Refs #28<commit_after>var path = require('path');
var fs = require('fs');

module.exports = function(grunt) {
  function getBanner(isDemo, isBin) {
    return (isBin ? '#!/usr/bin/env node\n' : '') +
      '/*!\n' +
      ' * <%= pkg.name %>' + (isDemo ? '-demo' : '') + ' - v<%= pkg.version %>\n' +
      ' * @copyright 2015-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
      ' * @author Nick Wronski <nick@javascript.com>\n' +
      ' */';
  }
  function getCmdString(cmd, args) {
    if (!args) args = '';
    const binPath = path.normalize(`node_modules/.bin/${cmd}`);
    return `${binPath} ${customArgs[cmd]} ${args}`.trim();
  }
  const customArgs = {
    mocha: 'test/**/*-spec.js --colors --bail --compilers=js:babel-core/register',
    pegjs: `--trace --cache --optimize size --allowed-start-rules 'start,start_streaming' --output src/parser.js src/grammar.pegjs`
  };

  const tmpDir = './.tmp/';
  if (!fs.existsSync(tmpDir)){
    fs.mkdirSync(tmpDir);
  }
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    babel: {
      options: {
        compact: true,
        comments: false,
        presets: ['es2015'],
        plugins: ['add-module-exports']
      },
      build: {
        options: {
          sourceMaps: 'inline'
        },
        files: [{
          src: ['*.js'],
          expand: true,
          cwd: 'src/',
          dest: '.tmp/'
        }]
      },
      demo: {
        options: {
          sourceMaps: false
        },
        files: [{
          src: ['*.js'],
          expand: true,
          cwd: 'src/',
          dest: '.tmp/'
        }]
      },

      bin: {
        files: {
          'bin/sqlite-parser': 'src/bin/sqlite-parser.js'
        }
      }
    },

    browserify: {
      dist: {
        options: {
          browserifyOptions: {
            debug: true,
            standalone: 'sqliteParser'
          }
        },
        src: ['index.js'],
        dest: 'dist/sqlite-parser.js'
      },
      interactive: {
        options: {
          alias: {
            'codemirror': './node_modules/codemirror/lib/codemirror',
            'foldcode': './node_modules/codemirror/addon/fold/foldcode',
            'foldgutter': './node_modules/codemirror/addon/fold/foldgutter',
            'brace-fold': './node_modules/codemirror/addon/fold/brace-fold',
            'panel': './node_modules/codemirror/addon/display/panel',
            'mode-javascript': './node_modules/codemirror/mode/javascript/javascript',
            'mode-sql': './node_modules/codemirror/mode/sql/sql',
            'sqlite-parser': './.tmp/index.js',
            './streaming': './.tmp/streaming-shim.js'
          },
        },
        require: [
          'node_modules/codemirror/lib/codemirror',
          'node_modules/codemirror/addon/fold/foldcode',
          'node_modules/codemirror/addon/fold/foldgutter',
          'node_modules/codemirror/addon/fold/brace-fold',
          'node_modules/codemirror/addon/display/panel',
          'node_modules/codemirror/mode/javascript/javascript',
          'node_modules/codemirror/mode/sql/sql'
        ],
        src: ['src/demo/demo.js'],
        dest: '.tmp/sqlite-parser-demo.js'
      }
    },

    copy: {
      release: {
        files: [{
          filter: 'isFile',
          expand: true,
          cwd: '.tmp/',
          src: [
            'index.js', 'parser.js', 'streaming.js', 'streaming-shim.js', 'tracer.js'
          ],
          dest: 'lib/'
        }]
      },
      interactive: {
        files: [{
          src: ['index.html'],
          expand: true,
          cwd: 'src/demo/',
          dest: '.tmp/'
        }],
      },
      demo: {
        src: ['*.{html,css}'],
        expand: true,
        cwd: '.tmp/',
        dest: 'demo/'
      }
    },

    clean: {
      build: ['.tmp/*.js', 'src/parser.js'],
      interactive: ['.tmp/*.css'],
      demo: ['demo/**/*'],
      release: ['lib/**/*'],
      bin: ['bin/**/*'],
      testProcess: ['test/sql/official-suite/**/*.sql']
    },

    shell: {
      build: {
        options: {
          failOnError: true
        },
        command: getCmdString('pegjs')
      },
      test: {
        options: {
          failOnError: true
        },
        command: getCmdString('mocha', '--reporter=list')
      },
      testAll: {
        options: {
          failOnError: true
        },
        command: `ALL_TESTS=true ${getCmdString('mocha', '--reporter=list --timeout=90000')}`
      },
      debug: {
        options: {
          failOnError: false,
          debounceDelay: 500,
          forever: true
        },
        command: `DEBUG=true ${getCmdString('mocha', '--reporter=list')}`
      },
      rewrite: {
        options: {
          failOnError: true
        },
        command: `REWRITE=true ${getCmdString('mocha', '--reporter=list')}`
      },
      testProcess: {
        options: {
          failOnError: true,
          execOptions: {
            cwd: path.normalize(`${process.cwd()}/test/misc/`)
          }
        },
        command: `sh process-tests.sh`
      }
    },

    connect: {
      server: {
        options: {
          port: 8080,
          base: '.tmp',
          livereload: true
        }
      }
    },

    watch: {
      test: {
        options: {
          debounceDelay: 250,
          livereload: false
        },
        files: [
          'test/**/*.js', 'src/*.js', 'src/*.pegjs',
          'test/sql/**/*.sql', 'test/json/**/*.json', 'Gruntfile.js'
        ],
        tasks: [ 'test' ]
      },
      debug: {
        options: {
          debounceDelay: 250,
          livereload: false
        },
        files: [
          'test/**/*.js', 'src/*.js', 'src/*.pegjs',
          'test/sql/**/*.sql', 'test/json/**/*.json', 'Gruntfile.js'
        ],
        tasks: ['build', 'shell:debug']
      },
      interactive: {
        options: {
          debounceDelay: 1000,
          livereload: {
            directory: '.tmp/',
            port: 35729
          },
        },
        files: [
          'src/**/*.{js,css,html,pegjs}', 'Gruntfile.js'
        ],
        tasks: ['interactive']
      }
    },

    uglify: {
      options: {
        screwIE8: true,
        mangle: {
          except: ['sqliteParser']
        },
      },
      demo: {
        files: {
          'demo/sqlite-parser-demo.js': ['.tmp/sqlite-parser-demo.js']
        }
      },
      bin: {
        files: {
          'bin/sqlite-parser': ['bin/sqlite-parser']
        }
      }
    },

    cssmin: {
      interactive: {
        options: {
          processImport: true
        },
        files: {
          '.tmp/sqlite-parser-demo.css': [
            'node_modules/codemirror/lib/codemirror.css',
            'node_modules/codemirror/addon/fold/foldgutter.css',
            'node_modules/codemirror/theme/monokai.css',
            'src/demo/demo.css'
          ]
        }
      }
    },

    usebanner: {
      options: {
        position: 'top',
        linebreak: true
      },
      release: {
        options: {
          banner: getBanner(false)
        },
        files: [{
          filter: 'isFile',
          expand: true,
          cwd: 'lib/',
          src: ['*.js'],
          dest: 'lib/'
        }]
      },
      demo: {
        options: {
          banner: getBanner(true)
        },
        files: {
          src: [
            'demo/sqlite-parser-demo.js',
            'demo/sqlite-parser-demo.css'
          ]
        }
      },
      bin: {
        options: {
          banner: getBanner(false, true)
        },
        files: {
          src: [
            'bin/sqlite-parser'
          ]
        }
      }
    },

    replace: {
      options: {
        patterns: [
          {
            match: 'VERSION',
            replacement: '<%= pkg.version %>'
          }
        ]
      },
      interactive: {
        files: [{
          expand: true,
          cwd: '.tmp/',
          src: 'index.js',
          dest: '.tmp/'
        }]
      },
      bin: {
        files: [{
          src: 'bin/sqlite-parser',
          dest: 'bin/sqlite-parser'
        }]
      }
    },

    concurrent: {
      interactive: [
        'copy:interactive',
        'browserify:interactive'
      ],
      live: [
        'interactive',
        [ 'clean:interactive', 'cssmin:interactive' ]
      ],
      demo1: [
        'cssmin:interactive',
        [ 'demobuild', 'replace:interactive', 'shell:test', 'concurrent:interactive' ]
      ],
      demo2: [
        'uglify:demo',
        'copy:demo'
      ],
      release: [
        [ 'demo', 'clean:release', 'copy:release', 'usebanner:release' ],
        [ 'bin', 'replace:bin', 'usebanner:bin' ]
      ]
    }
  });

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

  grunt.registerTask('default', [
    'build'
  ]);
  grunt.registerTask('build', [
    'clean:build',
    'shell:build',
    'babel:build'
  ]);

  grunt.registerTask('bin', [
    'clean:bin',
    'babel:bin'
  ]);

  grunt.registerTask('test', [
    'build', 'shell:test'
  ]);
  grunt.registerTask('testall', [
    'build', 'shell:testAll'
  ]);
  grunt.registerTask('testprocess', [
    'clean:testProcess', 'shell:testProcess'
  ]);

  grunt.registerTask('testwatch', [
    'test', 'watch:test'
  ]);
  grunt.registerTask('debug', [
    'build', 'shell:debug', 'watch:debug'
  ]);
  grunt.registerTask('rewrite-json', [
    'build', 'shell:rewrite'
  ]);

  grunt.registerTask('interactive', [
    'build',
    'concurrent:interactive'
  ]);
  grunt.registerTask('live', [
    'concurrent:live',
    'connect:server',
    'watch:interactive'
  ]);

  grunt.registerTask('demo', [
    'clean:demo',
    'concurrent:demo1',
    'concurrent:demo2',
    'usebanner:demo'
  ]);
  grunt.registerTask('demobuild', [
    'clean:build',
    'shell:build',
    'babel:demo'
  ]);

  grunt.registerTask('release', [
    'concurrent:release'
  ]);
};
<|endoftext|>


<commit_before>var root = '';
if (undefined === process.env.NODE_PATH) {
    console.error('NODE_PATH is not configured, trying to resolve.');
    root = (function () {
        try {
            require('shelljs/global');
            return exec('npm root -g', {silent: true}).output.trim() + '/';
        } catch(exc) {
            console.error('Assuming default NODE_PATH, did you initialize the module?');
        }
    })();

    root || (root = '/usr/lib/node_modules/');
    process.env.NODE_PATH = root;
}
module.exports = function(grunt) {
    grunt.initConfig((function () {
        return require(root + 'webino-devkit');
    })().config(grunt, ['zend', 'module', 'auth']));
};
<commit_msg>Updated Gruntfile, fixed webino-devkit modules order by priority<commit_after>var root = '';
if (undefined === process.env.NODE_PATH) {
    console.error('NODE_PATH is not configured, trying to resolve.');
    root = (function () {
        try {
            require('shelljs/global');
            return exec('npm root -g', {silent: true}).output.trim() + '/';
        } catch(exc) {
            console.error('Assuming default NODE_PATH, did you initialize the module?');
        }
    })();

    root || (root = '/usr/lib/node_modules/');
    process.env.NODE_PATH = root;
}
module.exports = function(grunt) {
    grunt.initConfig((function () {
        return require(root + 'webino-devkit');
    })().config(grunt, ['module', 'auth', 'zend']));
};
<|endoftext|>


<commit_before>/*global module:false*/
module.exports = function ( grunt ) {

  // Project configuration.
  grunt.initConfig( {
                      pkg: '<json:package.json>',

                      lint: {
                        files: [
//                                  'grunt.js',
//                                  'app-easel/*.js'
                        ]
                      },

                      concat: {
                        "dist/debug/require.js": [
                          "js/vendor/almond.js",
                          "dist/debug/require.js"
                        ]
                      },

                      uglify: {
                        "dist/release/require.js": [
                          "dist/debug/require.js"
                        ]
                      },

                      requirejs: {
                        compile: {
                          options: {
                            mainConfigFile: "js/config.js",
                            out: "dist/debug/require.js",
                            name: "config",
                            wrap: false
                          }
                        }
                      },

                      jshint: {
                        options: {
                          curly: true,
                          eqeqeq: true,
                          immed: false,
                          latedef: false,
                          newcap: true,
                          noarg: true,
                          sub: true,
                          undef: true,
                          boss: true,
                          eqnull: true,
                          browser: true,
                          node: true,
                          jQuery: true,
                          expr: true
                        },
                        globals: {
                          Modernizr: true,
                          define: true,
                          $: true
                        }
                      }

                    } );

  // Default task.
  grunt.registerTask( 'default', ['requirejs', 'concat', 'uglify'] );
  grunt.loadNpmTasks( 'grunt-contrib-requirejs' );
  grunt.loadNpmTasks( 'grunt-contrib-concat' );
  grunt.loadNpmTasks( 'grunt-contrib-uglify' );
};<commit_msg>Formatting of gruntfile<commit_after>/*global module:false*/
module.exports = function( grunt ) {

  // Project configuration.
  grunt.initConfig( {
    pkg: '<json:package.json>',

    lint: {
      files: [
       // 'grunt.js',
       // 'app-easel/*.js'
      ]
    },

    concat: {
      "dist/debug/require.js": [
        "js/vendor/almond.js",
        "dist/debug/require.js"
      ]
    },

    uglify: {
      "dist/release/require.js": [
        "dist/debug/require.js"
      ]
    },

    requirejs: {
      compile: {
        options: {
          mainConfigFile: "js/config.js",
          out: "dist/debug/require.js",
          name: "config",
          wrap: false
        }
      }
    },

    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: false,
        latedef: false,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        boss: true,
        eqnull: true,
        browser: true,
        node: true,
        jQuery: true,
        expr: true
      },
      globals: {
        Modernizr: true,
        define: true,
        $: true
      }
    }
  } );

  // Default task.
  grunt.registerTask( 'default', [ 'requirejs', 'concat', 'uglify' ] );
  grunt.loadNpmTasks( 'grunt-contrib-requirejs' );
  grunt.loadNpmTasks( 'grunt-contrib-concat' );
  grunt.loadNpmTasks( 'grunt-contrib-uglify' );
};
<|endoftext|>


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

	var _ = require('underscore');

	// Load required NPM tasks.
	// You must first run `npm install` in the project's root directory to get these dependencies.
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-compress');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-jscs-checker');
	grunt.loadNpmTasks('grunt-shell');
	grunt.loadNpmTasks('grunt-karma');
	grunt.loadNpmTasks('grunt-bump');
	grunt.loadNpmTasks('lumbar');

	// This will eventually get passed to grunt.initConfig()
	// Initialize multitasks...
	var config = {
		concat: {},
		uglify: {},
		cssmin: {},
		copy: {},
		compress: {},
		shell: {},
		clean: {
			temp: 'build/temp'
		}
	};

	// for the "meta" template variable (<%= meta.whatever %>)
	config.meta = grunt.file.readJSON('package.json');

	// The "grunt" command with no arguments
	grunt.registerTask('default', 'dist');

	// Builds all distributable files, for a new release possibly
	grunt.registerTask('dist', [
		'clean',
		'modules',
		'languages',
		'karma:single',
		'archiveDist'
	]);

	// Bare minimum for debugging
	grunt.registerTask('dev', [
		'shell:assume-unchanged',
		'lumbar:build',
		'languages'
	]);

	/* FullCalendar Modules
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('modules', 'Build the FullCalendar modules', [
		'jscs:srcModules',
		'clean:modules',
		'lumbar:build',
		'concat:moduleVariables',
		'jshint:builtModules',
		'uglify:modules',
		'cssmin:modules'
	]);

	// assemble modules
	config.lumbar = {
		build: {
			build: 'lumbar.json',
			output: 'dist', // a directory. lumbar doesn't like trailing slash
			background: false // lumbar complains otherwise
		},
		watch: {
			watch: 'lumbar.json',
			output: 'dist', // a directory. lumbar doesn't like trailing slash
			background: false, // lumbar complains otherwise
			sourceMap: true
		}
	};

	// replace template variables (<%= %>), IN PLACE
	config.concat.moduleVariables = {
		options: {
			process: true // replace
		},
		expand: true,
		cwd: 'dist/',
		src: [ '*.js', '*.css' ],
		dest: 'dist/'
	};

	// create minified versions of JS
	config.uglify.modules = {
		options: {
			preserveComments: 'some' // keep comments starting with /*!
		},
		expand: true,
		src: 'dist/fullcalendar.js', // only do it for fullcalendar.js
		ext: '.min.js'
	};

	// create minified versions of CSS
	config.cssmin.modules = {
		expand: true,
		src: 'dist/fullcalendar.css', // only do it for fullcalendar.css
		ext: '.min.css'
	};

	config.clean.modules = [
		'dist/*.{js,css,map}', // maps created by lumbar sourceMap
		'dist/src' // created by lumbar sourceMap
	];

	/* Languages
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('languages', [
		'jscs:srcLanguages',
		'jshint:srcLanguages',
		'clean:languages',
		'generateLanguages',
		'uglify:languages',
		'uglify:languagesAll'
	]);

	config.generateLanguages = {
		moment: grunt.file.expand('lib/moment/{locale,lang}/')[0], // lang directory is pre-moment-2.8
		datepicker: 'lib/jquery-ui/ui/i18n/',
		fullCalendar: 'lang/',
		dest: 'build/temp/lang/',
		allDest: 'build/temp/lang-all.js'
	};

	config.uglify.languages = {
		expand: true,
		cwd: 'build/temp/lang/',
		src: '*.js',
		dest: 'dist/lang/'
	};

	config.uglify.languagesAll = {
		src: 'build/temp/lang-all.js',
		dest: 'dist/lang-all.js'
	};

	config.clean.languages = [
		'build/temp/lang',
		'build/temp/lang-all.js',
		'dist/lang',
		'dist/lang-all.js'
	];

	/* Automated Tests
	----------------------------------------------------------------------------------------------------*/

	config.karma = {
		options: {
			configFile: 'build/karma.conf.js'
		},
		url: {}, // visit a URL in a browser
		headless: { browsers: [ 'PhantomJS' ] },
		single: { browsers: [ 'PhantomJS' ], singleRun: true, autoWatch: false }
	};

	/* Archive
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('archive', 'Create a distributable ZIP archive', [
		'modules',
		'languages',
		'karma:single',
		'archiveDist'
	]);

	grunt.registerTask('archiveDist', [
		'clean:archive',
		'copy:archiveModules',
		'copy:archiveLanguages',
		'copy:archiveLanguagesAll',
		'copy:archiveMoment',
		'copy:archiveJQuery',
		'concat:archiveJQueryUI',
		'copy:archiveDemos',
		'copy:archiveDemoTheme',
		'copy:archiveMisc',
		'compress:archive'
	]);

	// copy FullCalendar modules into ./fullcalendar/ directory
	config.copy.archiveModules = {
		expand: true,
		cwd: 'dist/',
		src: [ '*.js', '*.css' ],
		dest: 'build/temp/archive/'
	};

	config.copy.archiveLanguages = {
		expand: true,
		cwd: 'dist/lang/',
		src: '*.js',
		dest: 'build/temp/archive/lang/'
	};

	config.copy.archiveLanguagesAll = {
		src: 'dist/lang-all.js',
		dest: 'build/temp/archive/lang-all.js'
	};

	config.copy.archiveMoment = {
		src: 'lib/moment/min/moment.min.js',
		dest: 'build/temp/archive/lib/moment.min.js'
	};

	config.copy.archiveJQuery = {
		src: 'lib/jquery/dist/jquery.min.js',
		dest: 'build/temp/archive/lib/jquery.min.js'
	};

	config.concat.archiveJQueryUI = {
		src: [
			'lib/jquery-ui/ui/minified/core.min.js',
			'lib/jquery-ui/ui/minified/widget.min.js',
			'lib/jquery-ui/ui/minified/mouse.min.js',
			'lib/jquery-ui/ui/minified/draggable.min.js'
		],
		dest: 'build/temp/archive/lib/jquery-ui.custom.min.js'
	};

	// copy demo files into ./demos/ directory
	config.copy.archiveDemos = {
		options: {
			processContent: function(content) {
				content = content.replace(/((?:src|href)=['"])([^'"]*)(['"])/g, function(m0, m1, m2, m3) {
					return m1 + transformDemoPath(m2) + m3;
				});
				return content;
			}
		},
		src: 'demos/**',
		dest: 'build/temp/archive/'
	};

	// copy the "cupertino" jquery-ui theme into the demo directory (for demos/theme.html)
	config.copy.archiveDemoTheme = {
		expand: true,
		cwd: 'lib/jquery-ui/themes/cupertino/',
		src: [ 'jquery-ui.min.css', 'images/*' ],
		dest: 'build/temp/archive/lib/cupertino/'
	};

	// in demo HTML, rewrites paths to work in the archive
	function transformDemoPath(path) {
		path = path.replace('../lib/moment/moment.js', '../lib/moment.min.js');
		path = path.replace('../lib/jquery/dist/jquery.js', '../lib/jquery.min.js');
		path = path.replace('../lib/jquery-ui/jquery-ui.js', '../lib/jquery-ui.custom.min.js');
		path = path.replace('../lib/jquery-ui/themes/cupertino/', '../lib/cupertino/');
		path = path.replace('../dist/', '../');
		path = path.replace('/fullcalendar.js', '/fullcalendar.min.js');
		return path;
	}

	// copy license and changelog
	config.copy.archiveMisc = {
		files: {
			'build/temp/archive/license.txt': 'license.txt',
			'build/temp/archive/changelog.txt': 'changelog.md'
		}
	};

	// create the ZIP
	config.compress.archive = {
		options: {
			archive: 'dist/<%= meta.name %>-<%= meta.version %>.zip'
		},
		expand: true,
		cwd: 'build/temp/archive/',
		src: '**',
		dest: '<%= meta.name %>-<%= meta.version %>/' // have a top-level directory in the ZIP file
	};

	config.clean.archive = [
		'build/temp/archive',
		'dist/*.zip'
	];

	/* Release Utilities
	----------------------------------------------------------------------------------------------------*/

	config.bump = { // changes the version number in the configs
		options: {
			files: [
				'package.json',
				'bower.json'
			],
			commit: false,
			createTag: false,
			push: false
		}
	};

	/* CDNJS (http://cdnjs.com/)
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('cdnjs', 'Build files for CDNJS\'s hosted version of FullCalendar', [
		'clean:cdnjs',
		'modules',
		'languages',
		'karma:single',
		'cdnjsDist'
	]);

	grunt.registerTask('cdnjsDist', [
		'copy:cdnjsModules',
		'copy:cdnjsLanguages',
		'copy:cdnjsLanguagesAll',
		'cdnjsConfig'
	]);

	config.copy.cdnjsModules = {
		expand: true,
		cwd: 'dist/',
		src: [ '*.js', '*.css' ],
		dest: 'dist/cdnjs/<%= meta.version %>/'
	};

	config.copy.cdnjsLanguages = {
		expand: true,
		cwd: 'dist/lang/',
		src: '*.js',
		dest: 'dist/cdnjs/<%= meta.version %>/lang/'
	};

	config.copy.cdnjsLanguagesAll = {
		src: 'dist/lang-all.js',
		dest: 'dist/cdnjs/<%= meta.version %>/lang-all.js'
	};

	grunt.registerTask('cdnjsConfig', function() {
		var packageConfig = grunt.file.readJSON('package.json');
		var cdnjsConfig = grunt.file.readJSON('build/cdnjs.json');
		grunt.file.write(
			'dist/cdnjs/package.json',
			JSON.stringify(
				_.extend({}, packageConfig, cdnjsConfig), // combine 2 configs
				null, // replace
				2 // indent
			)
		);
	});

	config.clean.cdnjs = 'dist/cdnjs';

	/* Linting and Code Style Checking
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('check', 'Lint and check code style', [
		'jscs',
		'jshint:srcModules', // so we can fix most quality errors in their original files
		'lumbar:build',
		'jshint' // will run srcModules again but oh well
	]);

	// configs located elsewhere
	config.jshint = require('./build/jshint.conf');
	config.jscs = require('./build/jscs.conf');

	/* dist & git hacks
	----------------------------------------------------------------------------------------------------
	// These shell commands are used to force/unforce git from thinking that files have changed.
	// Used to ignore changes when dist files are overwritten, but not committed, during development.
	*/

	config.shell['assume-unchanged'] = {
		command: 'git update-index --assume-unchanged `git ls-files dist`'
	};
	config.shell['no-assume-unchanged'] = {
		command: 'git update-index --no-assume-unchanged `git ls-files dist`'
	};
	config.shell['list-assume-unchanged'] = {
		command: 'git ls-files -v | grep \'^h\''
	};

	// finally, give grunt the config object...
	grunt.initConfig(config);

	grunt.loadTasks('./build/tasks/');
};
<commit_msg>better config generation for CDNJS<commit_after>
module.exports = function(grunt) {

	var _ = require('underscore');

	// Load required NPM tasks.
	// You must first run `npm install` in the project's root directory to get these dependencies.
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-compress');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-jscs-checker');
	grunt.loadNpmTasks('grunt-shell');
	grunt.loadNpmTasks('grunt-karma');
	grunt.loadNpmTasks('grunt-bump');
	grunt.loadNpmTasks('lumbar');

	// This will eventually get passed to grunt.initConfig()
	// Initialize multitasks...
	var config = {
		concat: {},
		uglify: {},
		cssmin: {},
		copy: {},
		compress: {},
		shell: {},
		clean: {
			temp: 'build/temp'
		}
	};

	// for the "meta" template variable (<%= meta.whatever %>)
	config.meta = grunt.file.readJSON('package.json');

	// The "grunt" command with no arguments
	grunt.registerTask('default', 'dist');

	// Builds all distributable files, for a new release possibly
	grunt.registerTask('dist', [
		'clean',
		'modules',
		'languages',
		'karma:single',
		'archiveDist'
	]);

	// Bare minimum for debugging
	grunt.registerTask('dev', [
		'shell:assume-unchanged',
		'lumbar:build',
		'languages'
	]);

	/* FullCalendar Modules
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('modules', 'Build the FullCalendar modules', [
		'jscs:srcModules',
		'clean:modules',
		'lumbar:build',
		'concat:moduleVariables',
		'jshint:builtModules',
		'uglify:modules',
		'cssmin:modules'
	]);

	// assemble modules
	config.lumbar = {
		build: {
			build: 'lumbar.json',
			output: 'dist', // a directory. lumbar doesn't like trailing slash
			background: false // lumbar complains otherwise
		},
		watch: {
			watch: 'lumbar.json',
			output: 'dist', // a directory. lumbar doesn't like trailing slash
			background: false, // lumbar complains otherwise
			sourceMap: true
		}
	};

	// replace template variables (<%= %>), IN PLACE
	config.concat.moduleVariables = {
		options: {
			process: true // replace
		},
		expand: true,
		cwd: 'dist/',
		src: [ '*.js', '*.css' ],
		dest: 'dist/'
	};

	// create minified versions of JS
	config.uglify.modules = {
		options: {
			preserveComments: 'some' // keep comments starting with /*!
		},
		expand: true,
		src: 'dist/fullcalendar.js', // only do it for fullcalendar.js
		ext: '.min.js'
	};

	// create minified versions of CSS
	config.cssmin.modules = {
		expand: true,
		src: 'dist/fullcalendar.css', // only do it for fullcalendar.css
		ext: '.min.css'
	};

	config.clean.modules = [
		'dist/*.{js,css,map}', // maps created by lumbar sourceMap
		'dist/src' // created by lumbar sourceMap
	];

	/* Languages
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('languages', [
		'jscs:srcLanguages',
		'jshint:srcLanguages',
		'clean:languages',
		'generateLanguages',
		'uglify:languages',
		'uglify:languagesAll'
	]);

	config.generateLanguages = {
		moment: grunt.file.expand('lib/moment/{locale,lang}/')[0], // lang directory is pre-moment-2.8
		datepicker: 'lib/jquery-ui/ui/i18n/',
		fullCalendar: 'lang/',
		dest: 'build/temp/lang/',
		allDest: 'build/temp/lang-all.js'
	};

	config.uglify.languages = {
		expand: true,
		cwd: 'build/temp/lang/',
		src: '*.js',
		dest: 'dist/lang/'
	};

	config.uglify.languagesAll = {
		src: 'build/temp/lang-all.js',
		dest: 'dist/lang-all.js'
	};

	config.clean.languages = [
		'build/temp/lang',
		'build/temp/lang-all.js',
		'dist/lang',
		'dist/lang-all.js'
	];

	/* Automated Tests
	----------------------------------------------------------------------------------------------------*/

	config.karma = {
		options: {
			configFile: 'build/karma.conf.js'
		},
		url: {}, // visit a URL in a browser
		headless: { browsers: [ 'PhantomJS' ] },
		single: { browsers: [ 'PhantomJS' ], singleRun: true, autoWatch: false }
	};

	/* Archive
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('archive', 'Create a distributable ZIP archive', [
		'modules',
		'languages',
		'karma:single',
		'archiveDist'
	]);

	grunt.registerTask('archiveDist', [
		'clean:archive',
		'copy:archiveModules',
		'copy:archiveLanguages',
		'copy:archiveLanguagesAll',
		'copy:archiveMoment',
		'copy:archiveJQuery',
		'concat:archiveJQueryUI',
		'copy:archiveDemos',
		'copy:archiveDemoTheme',
		'copy:archiveMisc',
		'compress:archive'
	]);

	// copy FullCalendar modules into ./fullcalendar/ directory
	config.copy.archiveModules = {
		expand: true,
		cwd: 'dist/',
		src: [ '*.js', '*.css' ],
		dest: 'build/temp/archive/'
	};

	config.copy.archiveLanguages = {
		expand: true,
		cwd: 'dist/lang/',
		src: '*.js',
		dest: 'build/temp/archive/lang/'
	};

	config.copy.archiveLanguagesAll = {
		src: 'dist/lang-all.js',
		dest: 'build/temp/archive/lang-all.js'
	};

	config.copy.archiveMoment = {
		src: 'lib/moment/min/moment.min.js',
		dest: 'build/temp/archive/lib/moment.min.js'
	};

	config.copy.archiveJQuery = {
		src: 'lib/jquery/dist/jquery.min.js',
		dest: 'build/temp/archive/lib/jquery.min.js'
	};

	config.concat.archiveJQueryUI = {
		src: [
			'lib/jquery-ui/ui/minified/core.min.js',
			'lib/jquery-ui/ui/minified/widget.min.js',
			'lib/jquery-ui/ui/minified/mouse.min.js',
			'lib/jquery-ui/ui/minified/draggable.min.js'
		],
		dest: 'build/temp/archive/lib/jquery-ui.custom.min.js'
	};

	// copy demo files into ./demos/ directory
	config.copy.archiveDemos = {
		options: {
			processContent: function(content) {
				content = content.replace(/((?:src|href)=['"])([^'"]*)(['"])/g, function(m0, m1, m2, m3) {
					return m1 + transformDemoPath(m2) + m3;
				});
				return content;
			}
		},
		src: 'demos/**',
		dest: 'build/temp/archive/'
	};

	// copy the "cupertino" jquery-ui theme into the demo directory (for demos/theme.html)
	config.copy.archiveDemoTheme = {
		expand: true,
		cwd: 'lib/jquery-ui/themes/cupertino/',
		src: [ 'jquery-ui.min.css', 'images/*' ],
		dest: 'build/temp/archive/lib/cupertino/'
	};

	// in demo HTML, rewrites paths to work in the archive
	function transformDemoPath(path) {
		path = path.replace('../lib/moment/moment.js', '../lib/moment.min.js');
		path = path.replace('../lib/jquery/dist/jquery.js', '../lib/jquery.min.js');
		path = path.replace('../lib/jquery-ui/jquery-ui.js', '../lib/jquery-ui.custom.min.js');
		path = path.replace('../lib/jquery-ui/themes/cupertino/', '../lib/cupertino/');
		path = path.replace('../dist/', '../');
		path = path.replace('/fullcalendar.js', '/fullcalendar.min.js');
		return path;
	}

	// copy license and changelog
	config.copy.archiveMisc = {
		files: {
			'build/temp/archive/license.txt': 'license.txt',
			'build/temp/archive/changelog.txt': 'changelog.md'
		}
	};

	// create the ZIP
	config.compress.archive = {
		options: {
			archive: 'dist/<%= meta.name %>-<%= meta.version %>.zip'
		},
		expand: true,
		cwd: 'build/temp/archive/',
		src: '**',
		dest: '<%= meta.name %>-<%= meta.version %>/' // have a top-level directory in the ZIP file
	};

	config.clean.archive = [
		'build/temp/archive',
		'dist/*.zip'
	];

	/* Release Utilities
	----------------------------------------------------------------------------------------------------*/

	config.bump = { // changes the version number in the configs
		options: {
			files: [
				'package.json',
				'bower.json'
			],
			commit: false,
			createTag: false,
			push: false
		}
	};

	/* CDNJS (http://cdnjs.com/)
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('cdnjs', 'Build files for CDNJS\'s hosted version of FullCalendar', [
		'clean:cdnjs',
		'modules',
		'languages',
		'karma:single',
		'cdnjsDist'
	]);

	grunt.registerTask('cdnjsDist', [
		'copy:cdnjsModules',
		'copy:cdnjsLanguages',
		'copy:cdnjsLanguagesAll',
		'cdnjsConfig'
	]);

	config.copy.cdnjsModules = {
		expand: true,
		cwd: 'dist/',
		src: [ '*.js', '*.css' ],
		dest: 'dist/cdnjs/<%= meta.version %>/'
	};

	config.copy.cdnjsLanguages = {
		expand: true,
		cwd: 'dist/lang/',
		src: '*.js',
		dest: 'dist/cdnjs/<%= meta.version %>/lang/'
	};

	config.copy.cdnjsLanguagesAll = {
		src: 'dist/lang-all.js',
		dest: 'dist/cdnjs/<%= meta.version %>/lang-all.js'
	};

	grunt.registerTask('cdnjsConfig', function() {
		var config = grunt.file.readJSON('package.json');

		// things that CDNJS doesn't need
		delete config.devDependencies;
		delete config.main;
		delete config.files;
		delete config.ignore;

		_.extend(config, grunt.file.readJSON('build/cdnjs.json')); // CDNJS-specific settings

		grunt.file.write(
			'dist/cdnjs/package.json',
			JSON.stringify(
				config,
				null, // replace
				2 // indent
			)
		);
	});

	config.clean.cdnjs = 'dist/cdnjs';

	/* Linting and Code Style Checking
	----------------------------------------------------------------------------------------------------*/

	grunt.registerTask('check', 'Lint and check code style', [
		'jscs',
		'jshint:srcModules', // so we can fix most quality errors in their original files
		'lumbar:build',
		'jshint' // will run srcModules again but oh well
	]);

	// configs located elsewhere
	config.jshint = require('./build/jshint.conf');
	config.jscs = require('./build/jscs.conf');

	/* dist & git hacks
	----------------------------------------------------------------------------------------------------
	// These shell commands are used to force/unforce git from thinking that files have changed.
	// Used to ignore changes when dist files are overwritten, but not committed, during development.
	*/

	config.shell['assume-unchanged'] = {
		command: 'git update-index --assume-unchanged `git ls-files dist`'
	};
	config.shell['no-assume-unchanged'] = {
		command: 'git update-index --no-assume-unchanged `git ls-files dist`'
	};
	config.shell['list-assume-unchanged'] = {
		command: 'git ls-files -v | grep \'^h\''
	};

	// finally, give grunt the config object...
	grunt.initConfig(config);

	grunt.loadTasks('./build/tasks/');
};
<|endoftext|>


<commit_before>/*
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

/*global module, require*/
module.exports = function (grunt) {
    'use strict';

    // Load dependencies
    require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*']});

    // Load optional requirejs config, see http://requirejs.org/docs/api.html#config
    var rjsconfig = grunt.file.readJSON("requirejs-config.json");

    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        jshint: {
            all: ['**/*.js', '!**/node_modules/**', '!dist/**']
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: ['dist']
                }]
            }
        },
        /* Non-JavaScript files to include in the build */
        copy: {
            dist: {
                files: [
                    {
                        expand: true,
                        dest: 'dist/',
                        src: [
                            'package.json',
                            /* Remove this line when not using Node */
                            'node/**',
                            /* Remove this line when not using CSS */
                            'styles/**'
                        ]
                    }
                ]
            }
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    name: 'main',
                    paths: rjsconfig.paths,
                    shim: rjsconfig.shim,
                    optimize: 'uglify2',
                    out: 'dist/main.js',
                    generateSourceMaps: true,
                    useSourceUrl: true,
                    preserveLicenseComments: false,
                    useStrict: true,
                    wrap: false,
                    uglify2: {}
                }
            }
        },
        compress: {
            dist: {
                options: {
                    archive: "<%= pkg.name %>.zip"
                },
                cwd: 'dist/',
                src: ['**/*'],
                dest: '<%= pkg.name %>'
            }
        }
    });

    grunt.registerTask('build', [
        'jshint',
        'requirejs',
        'copy',
        'compress'
    ]);

    // Default task
    grunt.registerTask('default', ['clean', 'build']);
};<commit_msg>add debug build to grunt tasks<commit_after>/*
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

/*global module, require*/
module.exports = function (grunt) {
    'use strict';

    // Load dependencies
    require('load-grunt-tasks')(grunt, {pattern: ['grunt-contrib-*']});

    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        jshint: {
            all: ['**/*.js', '!**/node_modules/**', '!dist/**', '!thirdparty/**']
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: ['dist']
                }]
            }
        },
        /* Non-JavaScript files to include in the build */
        copy: {
            debug: {
                files: [
                    {
                        expand: true,
                        dest: 'dist/',
                        src: [
                            'package.json',
                            '**/*.js',
                            '!node_modules/**',
                            'node/**',
                            '!node/node_modules/node-sass/build/**',
                            '!node/node_modules/node-sass/test/**'
                        ]
                    }
                ]
            },
            dist: {
                files: [
                    {
                        expand: true,
                        dest: 'dist/',
                        src: [
                            'package.json',
                            'node/**',
                            '!node/node_modules/node-sass/build/**',
                            '!node/node_modules/node-sass/test/**'
                        ]
                    }
                ]
            }
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    name: 'main',
                    optimize: 'uglify2',
                    out: 'dist/main.js',
                    generateSourceMaps: true,
                    useSourceUrl: true,
                    preserveLicenseComments: false,
                    useStrict: true,
                    wrap: false,
                    uglify2: {}
                }
            }
        },
        compress: {
            dist: {
                options: {
                    archive: "<%= pkg.name %>.zip"
                },
                cwd: 'dist/',
                src: ['**/*'],
                dest: '<%= pkg.name %>'
            }
        }
    });

    grunt.registerTask('build', [
        'jshint',
        'requirejs',
        'copy',
        'compress'
    ]);

    grunt.registerTask('debug', [
        'clean',
        'copy:debug',
        'compress'
    ]);

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


<commit_before>module.exports = function(grunt) {
    //grunt plugins
    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        ngAnnotate: {
            options: {
                ngAnnotateOptions: {}
            },
            default: {
                files: {
                    'dist/<%= pkg.name %>.js': ['src/module.js', 'src/*.js']
                }
            }
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
            },
            dist: {
                files: {
                    'dist/<%= pkg.name %>.min.js': ['dist/<%= pkg.name %>.js']
                }
            }
        },
        karma: {
            options: {
                singleRun: true,
                reporters: ['dots', 'coverage'],
                preprocessors: {
                    'src/**/*.js': ['coverage']
                }
            },
            angular_1_0: {
                configFile: 'karma-angular-1.0.conf.js',
                coverageReporter: {
                    type: 'lcov',
                    dir: 'coverage/angular-1.0'
                }
            },
            angular_1_2: {
                configFile: 'karma-angular-1.2.conf.js',
                coverageReporter: {
                    type: 'lcov',
                    dir: 'coverage/angular-1.2'
                }
            },
            angular_1_3_nightly: {
                configFile: 'karma-angular-1.3.conf.js',
                coverageReporter: {
                    type: 'lcov',
                    dir: 'coverage/angular-1.3-nightly'
                }
            }
        },
        jshint: {
            files: ['*.js', 'src/**/*.js', 'test/**/*.js'],
            options: {
                jshintrc: true
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'karma']
        },
        build: {

        },
        coveralls: {
            'combined-lcov-info': {
                src: 'coverage/combined-lcov.info'
            }
        }
    });

    grunt.registerTask('upload-combined-coverage', ['coveralls:combined-lcov-info']);

    grunt.registerTask('test', ['jshint', 'karma']);

    grunt.registerTask('default', ['jshint', 'karma', 'ngAnnotate', 'uglify']);
};<commit_msg>AngularJS 1.3 bower components no longer use the '-nightly' postfix in its directory (since AngularJS 1.3 has been released making bower automatically download the latest 1.3 for ~1.3).<commit_after>module.exports = function(grunt) {
    //grunt plugins
    require('load-grunt-tasks')(grunt);

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        ngAnnotate: {
            options: {
                ngAnnotateOptions: {}
            },
            default: {
                files: {
                    'dist/<%= pkg.name %>.js': ['src/module.js', 'src/*.js']
                }
            }
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
            },
            dist: {
                files: {
                    'dist/<%= pkg.name %>.min.js': ['dist/<%= pkg.name %>.js']
                }
            }
        },
        karma: {
            options: {
                singleRun: true,
                reporters: ['dots', 'coverage'],
                preprocessors: {
                    'src/**/*.js': ['coverage']
                }
            },
            angular_1_0: {
                configFile: 'karma-angular-1.0.conf.js',
                coverageReporter: {
                    type: 'lcov',
                    dir: 'coverage/angular-1.0'
                }
            },
            angular_1_2: {
                configFile: 'karma-angular-1.2.conf.js',
                coverageReporter: {
                    type: 'lcov',
                    dir: 'coverage/angular-1.2'
                }
            },
            angular_1_3: {
                configFile: 'karma-angular-1.3.conf.js',
                coverageReporter: {
                    type: 'lcov',
                    dir: 'coverage/angular-1.3'
                }
            }
        },
        jshint: {
            files: ['*.js', 'src/**/*.js', 'test/**/*.js'],
            options: {
                jshintrc: true
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'karma']
        },
        build: {

        },
        coveralls: {
            'combined-lcov-info': {
                src: 'coverage/combined-lcov.info'
            }
        }
    });

    grunt.registerTask('upload-combined-coverage', ['coveralls:combined-lcov-info']);

    grunt.registerTask('test', ['jshint', 'karma']);

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


<commit_before>import Vue from 'vue'
import Router from 'vue-router'

const About = () => import('~/components/pages/about.vue').then(m => m.default || m)
const Confirmation = () => import('~/components/pages/confirmation.vue').then(m => m.default || m)
const Index = () => import('~/components/pages/index.vue').then(m => m.default || m)
const IndexIndex = () => import('~/components/pages/index/index.vue').then(m => m.default || m)
const IndexDapp = () => import('~/components/pages/index/dapps/_slug.vue').then(m => m.default || m)
const Submit = () => import('~/components/pages/submit.vue').then(m => m.default || m)
const Terms = () => import('~/components/pages/terms.vue').then(m => m.default || m)
const WhatsADapp = () => import('~/components/pages/whats-a-dapp.vue').then(m => m.default || m)
const Dapp = () => import('~/components/pages/dapps/_slug.vue').then(m => m.default || m)

Vue.use(Router)

const scrollBehavior = (to, from, savedPosition) => {
  // SavedPosition is only available for popstate navigations.
  if (savedPosition) {
    return savedPosition
  } else {
    let position = {}
    // If no children detected
    if (to.matched.length < 2) {
      // Scroll to the top of the page
      position = { x: 0, y: 0 }
    } else if (to.matched.some((r) => r.components.default.options.scrollToTop)) {
      // If one of the children has scrollToTop option set to true
      position = { x: 0, y: 0 }
    }
    // If link has anchor, scroll to anchor by returning the selector
    if (to.hash) {
      position = { selector: to.hash }
    }
    return position
  }
}

export function createRouter () {
  return new Router({
    mode: 'history',
    base: '/',
    linkActiveClass: 'nuxt-link-active',
    linkExactActiveClass: 'nuxt-link-exact-active',
    scrollBehavior,
    routes: [
      {
        path: '/dapps/:slug?',
        component: Dapp,
        name: 'dapps-slug'
      },
      {
        path: '/',
        component: Index,
        children: [
          {
            path: '',
            component: IndexIndex,
            name: 'index'
          },
          {
            path: 'dapps/:slug?',
            component: IndexDapp,
            name: 'index-dapps-slug'
          }
        ]
      },
      {
        path: '/whats-a-dapp',
        component: WhatsADapp,
        name: 'whats-a-dapp'
      },
      {
        path: '/confirmation',
        component: Confirmation,
        name: 'confirmation'
      },
      {
        path: '/about',
        component: About,
        name: 'about'
      },
      {
        path: '/terms',
        component: Terms,
        name: 'terms'
      },
      {
        path: '/submit',
        component: Submit,
        name: 'submit'
      }
    ],
    fallback: false
  })
}
<commit_msg>Refactor router to handle new params<commit_after>import Vue from 'vue'
import Router from 'vue-router'

const About = () => import('~/components/pages/about.vue').then(m => m.default || m)
const Confirmation = () => import('~/components/pages/confirmation.vue').then(m => m.default || m)
const Index = () => import('~/components/pages/index.vue').then(m => m.default || m)
const IndexIndex = () => import('~/components/pages/index/index.vue').then(m => m.default || m)
const IndexDapp = () => import('~/components/pages/index/dapps/_slug.vue').then(m => m.default || m)
const Submit = () => import('~/components/pages/submit.vue').then(m => m.default || m)
const Terms = () => import('~/components/pages/terms.vue').then(m => m.default || m)
const WhatsADapp = () => import('~/components/pages/whats-a-dapp.vue').then(m => m.default || m)
const Dapp = () => import('~/components/pages/dapps/_slug.vue').then(m => m.default || m)

Vue.use(Router)

const scrollBehavior = (to, from, savedPosition) => {
  // SavedPosition is only available for popstate navigations.
  if (savedPosition) {
    return savedPosition
  } else {
    let position = {}
    // If no children detected
    if (to.matched.length < 2) {
      // Scroll to the top of the page
      position = { x: 0, y: 0 }
    } else if (to.matched.some((r) => r.components.default.options.scrollToTop)) {
      // If one of the children has scrollToTop option set to true
      position = { x: 0, y: 0 }
    }
    // If link has anchor, scroll to anchor by returning the selector
    if (to.hash) {
      position = { selector: to.hash }
    }
    return position
  }
}

export function createRouter () {
  return new Router({
    mode: 'history',
    base: '/',
    linkActiveClass: 'nuxt-link-active',
    linkExactActiveClass: 'nuxt-link-exact-active',
    scrollBehavior,
    routes: [
      {
        path: '/whats-a-dapp',
        component: WhatsADapp,
        name: 'whats-a-dapp'
      },
      {
        path: '/confirmation',
        component: Confirmation,
        name: 'confirmation'
      },
      {
        path: '/about',
        component: About,
        name: 'about'
      },
      {
        path: '/terms',
        component: Terms,
        name: 'terms'
      },
      {
        path: '/submit',
        component: Submit,
        name: 'submit'
      },
      {
        path: '/dapps/:slug?',
        component: Dapp,
        name: 'dapps-slug'
      },
      {
        path: '/',
        component: Index,
        children: [
          {
            path: '',
            component: IndexIndex,
            name: 'index'
          },
          {
            path: 'tagged/:tags',
            component: IndexIndex,
            name: 'index-tagged-tags',
            children: [
              {
                path: ':category',
                component: IndexIndex,
                name: 'index-tagged-tags-category'
              }
            ]
          },
          {
            path: ':category',
            component: IndexIndex,
            name: 'index-category'
          },
          {
            path: 'dapps/:slug?',
            component: IndexDapp,
            name: 'index-dapps-slug'
          }
        ]
      }
    ],
    fallback: false
  })
}
<|endoftext|>


<commit_before>/*
 Copyright (c) 2014, Intel Corporation

 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice,
 this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.
 * Neither the name of Intel Corporation nor the names of its contributors
 may be used to endorse or promote products derived from this software
 without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

module.exports = function(grunt) {
    // Project configuration.
    var buildID = grunt.option('buildID') || 'local';
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        dirs: {
            jshint: 'buildscripts/jshint',
            jsfiles: ['Gruntfile.js',
                      'lib/**/*.js',
                      'api/**/*.js',
                      'admin/**/*.js',
                      'listeners/**/*.js']
        },
        license_finder: {
            default_options: {
                options: {
                    production: false,
                    directory: process.cwd(),
                    csv: true,
                    out: 'licenses.csv'
                }
            },
            production : {
                options: {
                    production: true,
                    directory: process.cwd(),
                    csv: true,
                    out: 'licenses_production.csv'
                }
            }
        },
        jshint: {
			options: {
				jshintrc: '<%= dirs.jshint %>/config.json',
				ignores: ['lib/deprected/*.js']
			},
			local: {
				src: ['<%= dirs.jsfiles %>'],
				options: {
					force: true
				}
			},
			teamcity: {
				src: ['<%= dirs.jsfiles %>'],
				options: {
					force: true,
					reporter: require('jshint-teamcity')
				}
			}
		},
        compress: {
            teamcity: {
                options: {
                    archive: 'dist/'+'<%= pkg.name %>_' + buildID + ".tgz",
                    mode: 'tgz'
                },
                files: [{cwd: '.',
                        expand: true,
                         src: ['**/*.js', '**/*.sh', 'config.json', '!node_modules/**', '!dist/**', '!test/**', '!Gruntfile.js'],
                        /* this is the root folder of untar file */
                         dest: '<%= pkg.name %>/'
                        }
                    ]
                }
            },
        mocha_istanbul: {
           local: {
               src: 'test/', // the folder, not the files
               options: {
                   ui: 'bdd',
                   coverage: true,
                   recursive: true,
                   reporter: 'list',
                   timeout: 20000,
                   mask: '*Tests.js',
                   check: {
                    lines: 66,
                    statements: 66,
                    function: 70
                    },
                   root: '.', // define where the cover task should consider the root of libraries that are covered by tests
                   coverageFolder: 'dist/coverage',
                   reportFormats: ['lcov']
               }
           },
           teamcity: {
                src: 'test/', // the folder, not the files
                options: {
                    ui: 'bdd',
                    coverage: true,
                    recursive: true,
                    reporter: 'mocha-teamcity-reporter',
                    timeout: 20000,
                    mask: '*Tests.js',
                    /*check: {
                        lines: 70,
                        statements: 70,
                        function: 70
                    },*/
                    root: '.', // define where the cover task should consider the root of libraries that are covered by tests
                    coverageFolder: 'dist/coverage',
                    reportFormats: ['lcov', 'teamcity']
                }
            }
        }
    });

    grunt.event.on('coverage', function(lcovFileContents, done){
        // Check below
        done();
    });

    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-license-finder');

    // Load the plugin that provides the "uglify" task.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-compress');

    // Default task(s).
    grunt.registerTask('default', ['jshint:local', 'mocha_istanbul:local']);

    grunt.registerTask('teamcity_codevalidation', ['jshint:teamcity',
                                                   'mocha_istanbul:teamcity']);
    grunt.registerTask('packaging', ['compress:teamcity']);
};

<commit_msg>Changed required coverage levels<commit_after>/*
 Copyright (c) 2014, Intel Corporation

 Redistribution and use in source and binary forms, with or without modification,
 are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice,
 this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.
 * Neither the name of Intel Corporation nor the names of its contributors
 may be used to endorse or promote products derived from this software
 without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

module.exports = function(grunt) {
    // Project configuration.
    var buildID = grunt.option('buildID') || 'local';
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        dirs: {
            jshint: 'buildscripts/jshint',
            jsfiles: ['Gruntfile.js',
                      'lib/**/*.js',
                      'api/**/*.js',
                      'admin/**/*.js',
                      'listeners/**/*.js']
        },
        license_finder: {
            default_options: {
                options: {
                    production: false,
                    directory: process.cwd(),
                    csv: true,
                    out: 'licenses.csv'
                }
            },
            production : {
                options: {
                    production: true,
                    directory: process.cwd(),
                    csv: true,
                    out: 'licenses_production.csv'
                }
            }
        },
        jshint: {
			options: {
				jshintrc: '<%= dirs.jshint %>/config.json',
				ignores: ['lib/deprected/*.js']
			},
			local: {
				src: ['<%= dirs.jsfiles %>'],
				options: {
					force: true
				}
			},
			teamcity: {
				src: ['<%= dirs.jsfiles %>'],
				options: {
					force: true,
					reporter: require('jshint-teamcity')
				}
			}
		},
        compress: {
            teamcity: {
                options: {
                    archive: 'dist/'+'<%= pkg.name %>_' + buildID + ".tgz",
                    mode: 'tgz'
                },
                files: [{cwd: '.',
                        expand: true,
                         src: ['**/*.js', '**/*.sh', 'config.json', '!node_modules/**', '!dist/**', '!test/**', '!Gruntfile.js'],
                        /* this is the root folder of untar file */
                         dest: '<%= pkg.name %>/'
                        }
                    ]
                }
            },
        mocha_istanbul: {
           local: {
               src: 'test/', // the folder, not the files
               options: {
                   ui: 'bdd',
                   coverage: true,
                   recursive: true,
                   reporter: 'list',
                   timeout: 20000,
                   mask: '*Tests.js',
                   check: {
                    lines: 60,
                    statements: 60,
                    function: 60
                    },
                   root: '.', // define where the cover task should consider the root of libraries that are covered by tests
                   coverageFolder: 'dist/coverage',
                   reportFormats: ['lcov']
               }
           },
           teamcity: {
                src: 'test/', // the folder, not the files
                options: {
                    ui: 'bdd',
                    coverage: true,
                    recursive: true,
                    reporter: 'mocha-teamcity-reporter',
                    timeout: 20000,
                    mask: '*Tests.js',
                    /*check: {
                        lines: 70,
                        statements: 70,
                        function: 70
                    },*/
                    root: '.', // define where the cover task should consider the root of libraries that are covered by tests
                    coverageFolder: 'dist/coverage',
                    reportFormats: ['lcov', 'teamcity']
                }
            }
        }
    });

    grunt.event.on('coverage', function(lcovFileContents, done){
        // Check below
        done();
    });

    grunt.loadNpmTasks('grunt-mocha-istanbul');
    grunt.loadNpmTasks('grunt-license-finder');

    // Load the plugin that provides the "uglify" task.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-compress');

    // Default task(s).
    grunt.registerTask('default', ['jshint:local', 'mocha_istanbul:local']);

    grunt.registerTask('teamcity_codevalidation', ['jshint:teamcity',
                                                   'mocha_istanbul:teamcity']);
    grunt.registerTask('packaging', ['compress:teamcity']);
};

<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    less: {
      production: {
        options: {
          compress: true,
          yuicompress: true,
          optimization: 2
        },
        files: {
          "dist/chuckcss.min.css": "chuckcss/front.less"
        }
      },
      development: {
        files: {
          "dist/chuckcss.css": "chuckcss/front.less"
        }
      }
    },

    watch: {
      styles: {
        files: ['chuckcss/*.less','chuckcss/**/*.less'],
        tasks: ['less'],
        options: {
          nospawn: true
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['watch']);

};
<commit_msg>add print.css into dist folder<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    less: {
      production: {
        options: {
          compress: true,
          yuicompress: true,
          optimization: 2
        },
        files: {
          "dist/chuckcss.min.css": "chuckcss/front.less",
          "dist/print.css": "chuckcss/media/print.less"
        }
      },
      development: {
        files: {
          "dist/chuckcss.css": "chuckcss/front.less",
          "dist/print.css": "chuckcss/media/print.less"
        }
      }
    },

    watch: {
      styles: {
        files: ['chuckcss/*.less','chuckcss/**/*.less'],
        tasks: ['less'],
        options: {
          nospawn: true
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['watch']);

};
<|endoftext|>


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

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        htmlmin: {
            dist: {
                options: {                                 // Target options
                    removeComments: true,
                    collapseWhitespace: true
                },
                files: {                                   // Dictionary of files
                    '_site/index.html': '_site/index.html',    // 'destination': 'source'
                    '_site/404.html': '_site/404.html'
                }
            }
        },
        cssmin: {
            options: {
                keepSpecialComments: 0
            },
            target: {
                files: [{
                    expand: true,
                    cwd: '_site/css',
                    src: ['*.css', '!*.min.css'],
                    dest: '_site/css',
                    ext: '.css'
                }]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.loadNpmTasks('grunt-contrib-cssmin');

    grunt.registerTask('default', ['htmlmin', 'cssmin']);

};<commit_msg>Minify all HTML<commit_after>module.exports = function (grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        htmlmin: {
            dist: {
                options: {                                 // Target options
                    removeComments: true,
                    collapseWhitespace: true
                },
                files: [{
                    expand: true,
                    src: './_site/**/*.html',
                    ext: '.html'
                }]
            }
        },
        cssmin: {
            options: {
                keepSpecialComments: 0
            },
            target: {
                files: [{
                    expand: true,
                    cwd: '_site/css',
                    src: ['*.css', '!*.min.css'],
                    dest: '_site/css',
                    ext: '.css'
                }]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-htmlmin');
    grunt.loadNpmTasks('grunt-contrib-cssmin');

    grunt.registerTask('default', ['htmlmin', 'cssmin']);

};<|endoftext|>