<commit_before>var semver = require('semver'),
    fs = require('fs'),
    currentVersion = JSON.parse(fs.readFileSync('./package.json', 'utf8')).version,
    env = require('./config/environment');

// Globals
var PROMPT_CONFIRM_CONFIG = 'confirmation',
    GIT_BRANCH = env.get('FILER_UPSTREAM_BRANCH'),
    GIT_REMOTE = env.get('FILER_UPSTREAM_REMOTE_NAME'),
    GIT_FULL_REMOTE = env.get('FILER_UPSTREAM_URI') + ' ' + GIT_BRANCH;

module.exports = function(grunt) {

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

    clean: ['dist/filer-test.js', 'dist/filer-issue225.js', 'dist/filer-perf.js'],

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      develop: {
        src: 'dist/filer.js',
        dest: 'dist/filer.min.js'
      }
    },

    jshint: {
      // Don't bother with src/path.js
      all: [
        'gruntfile.js',
        'config/environment.js',
        'src/constants.js',
        'src/errors.js',
        'src/fs.js',
        'src/index.js',
        'src/shared.js',
        'src/shell.js',
        'src/fswatcher.js',
        'src/environment.js',
        'src/providers/**/*.js',
        'src/adapters/**/*.js',
        'src/directory-entry.js',
        'src/open-file-description.js',
        'src/super-node.js',
        'src/node.js',
        'src/stats.js',
        'src/filesystem/**/*.js'
      ]
    },

    browserify: {
      filerDist: {
        src: "./src/index.js",
        dest: "./dist/filer.js",
        options: {
          browserifyOptions: {
            commondir: false
          },
          bundleOptions: {
            standalone: 'Filer'
          },
          exclude: ["./node_modules/request/index.js"]
        }
      },
      filerPerf: {
        src: "./perf/index.js",
        dest: "./dist/filer-perf.js",
        options: {
          browserifyOptions: {
            commondir: false
          },
          bundleOptions: {
            standalone: 'Filer'
          }
        }
      },
      filerTest: {
        src: "./tests/index.js",
        dest: "./dist/filer-test.js"
      },
      // See tests/bugs/issue225.js
      filerIssue225: {
        src: "./src/index.js",
        dest: "./dist/filer-issue225.js",
        options: {
          browserifyOptions: {
            commondir: false
          },
          bundleOptions: {
            standalone: 'Filer'
          }
        }
      }
    },

    shell: {
      mocha: {
        // Run all tests (e.g., tests require()'ed in tests/index.js) and also tests/bugs/issue225.js
        // separately, since it can't be included in a browserify build.
        command: '"./node_modules/.bin/mocha" --reporter list tests/index.js && "./node_modules/.bin/mocha" --reporter list tests/bugs/issue225.js'
      }
    },

    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        commit: true,
        commitMessage: 'v%VERSION%',
        commitFiles: ['package.json', 'bower.json', './dist/filer.js', './dist/filer.min.js'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'v%VERSION%',
        push: true,
        pushTo: GIT_FULL_REMOTE
      }
    },

    'npm-checkBranch': {
      options: {
        branch: GIT_BRANCH
      }
    },

    'npm-publish': {
      options: {
        abortIfDirty: false
      }
    },

    prompt: {
      confirm: {
        options: {
          questions: [
            {
              config: PROMPT_CONFIRM_CONFIG,
              type: 'confirm',
              message: 'Bump version from ' + (currentVersion).cyan +
                          ' to ' + semver.inc(currentVersion, "patch").yellow + '?',
              default: false
            }
          ],
          then: function(results) {
            if (!results[PROMPT_CONFIRM_CONFIG]) {
              return grunt.fatal('User aborted...');
            }
          }
        }
      }
    },

    gitcheckout: {
      publish: {
        options: {
          branch: 'gh-pages',
          force: true
        }
      },
      revert: {
        options: {
          branch: GIT_BRANCH
        }
      }
    },

    gitpush: {
      publish: {
        options: {
          remote: GIT_REMOTE,
          branch: 'gh-pages',
          force: true
        },
      }
    },

    gitcommit: {
      publish: {
        options: {
          noStatus: true
        }
      }
    },

    gitadd: {
      publish: {
        files: {
          src: ['./dist/filer-test.js', './dist/filer-perf.js']
        }
      }
    },

    gitstash: {
      publish: {
      },
      pop: {
        options: {
          command: "pop"
        }
      }
    },

    gitrm: {
      publish: {
        files: {
          src: ['./dist/filer-test.js', './dist/filer-perf.js']
        }
      }
    },

    connect: {
      serverForNode: {
        options: {
          port: 1234,
          base: '.'
        }
      },
      serverForBrowser: {
        options: {
          port: 1234,
          base: '.',
          keepalive: true
        }
      }
    },

    usebanner: {
      publish: {
        options: {
          position: "top"
        },
        files: {
          src: ['./dist/filer-test.js', './dist/filer-perf.js']
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-git');
  grunt.loadNpmTasks('grunt-prompt');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-banner');

  grunt.registerTask('develop', ['clean', 'browserify:filerDist', 'browserify:filerIssue225']);
  grunt.registerTask('build-tests', ['clean', 'browserify:filerTest', 'browserify:filerPerf']);
  grunt.registerTask('release', ['test', 'develop', 'uglify']);

  grunt.registerTask('publish', 'Publish filer as a new version to NPM, bower and github.', function(patchLevel) {
    var allLevels = ['patch', 'minor', 'major'];

    // No level specified defaults to 'patch'
    patchLevel = (patchLevel || 'patch').toLowerCase();

    // Fail out if the patch level isn't recognized
    if (allLevels.filter(function(el) { return el == patchLevel; }).length === 0) {
      return grunt.fatal('Patch level not recognized! "Patch", "minor" or "major" only.');
    }

    // Set prompt message
    var promptOpts = grunt.config('prompt.confirm.options');
    promptOpts.questions[0].message =  'Bump version from ' + (currentVersion).cyan +
      ' to ' + semver.inc(currentVersion, patchLevel).yellow + '?';
    grunt.config('prompt.confirm.options', promptOpts);

    // Store the new version in the gh-pages commit message
    var ghPagesMessage = 'Tests for Filer v' + semver.inc(currentVersion, patchLevel);
    grunt.config('gitcommit.publish.options.message', ghPagesMessage);

    // Store the new version as a banner in the test file
    // NOTE: This is a hack intended to ensure that this build process
    //       succeeds even if no changes were made to the tests
    //       before publishing a new version. Otherwise, the automatic
    //       commit + push to github pages would break a normal build
    var bannerMsg = "/* Test file for filerjs v" + semver.inc(currentVersion, patchLevel) + "*/";
    grunt.config('usebanner.publish.options.banner', bannerMsg);

    grunt.task.run([
      'prompt:confirm',
      'checkBranch',
      'release',
      'bump:' + patchLevel,
      'build-tests',
      'usebanner:publish',
      'gitadd:publish',
      'gitstash:publish',
      'gitcheckout:publish',
      'gitrm:publish',
      'gitstash:pop',
      'gitcommit:publish',
      'gitpush:publish',
      'gitcheckout:revert',
      'npm-publish'
    ]);
  });
  grunt.registerTask('test-node', ['jshint', 'browserify:filerIssue225', 'connect:serverForNode', 'shell:mocha']);
  grunt.registerTask('test-browser', ['jshint', 'build-tests', 'connect:serverForBrowser']);
  grunt.registerTask('test', ['clean', 'test-node']);

  grunt.registerTask('default', ['test']);
};
<commit_msg>add tests/ and perf/ to gh-pages update<commit_after>var semver = require('semver'),
    fs = require('fs'),
    currentVersion = JSON.parse(fs.readFileSync('./package.json', 'utf8')).version,
    env = require('./config/environment');

// Globals
var PROMPT_CONFIRM_CONFIG = 'confirmation',
    GIT_BRANCH = env.get('FILER_UPSTREAM_BRANCH'),
    GIT_REMOTE = env.get('FILER_UPSTREAM_REMOTE_NAME'),
    GIT_FULL_REMOTE = env.get('FILER_UPSTREAM_URI') + ' ' + GIT_BRANCH;

module.exports = function(grunt) {

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

    clean: ['dist/filer-test.js', 'dist/filer-issue225.js', 'dist/filer-perf.js'],

    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      develop: {
        src: 'dist/filer.js',
        dest: 'dist/filer.min.js'
      }
    },

    jshint: {
      // Don't bother with src/path.js
      all: [
        'gruntfile.js',
        'config/environment.js',
        'src/constants.js',
        'src/errors.js',
        'src/fs.js',
        'src/index.js',
        'src/shared.js',
        'src/shell.js',
        'src/fswatcher.js',
        'src/environment.js',
        'src/providers/**/*.js',
        'src/adapters/**/*.js',
        'src/directory-entry.js',
        'src/open-file-description.js',
        'src/super-node.js',
        'src/node.js',
        'src/stats.js',
        'src/filesystem/**/*.js'
      ]
    },

    browserify: {
      filerDist: {
        src: "./src/index.js",
        dest: "./dist/filer.js",
        options: {
          browserifyOptions: {
            commondir: false
          },
          bundleOptions: {
            standalone: 'Filer'
          },
          exclude: ["./node_modules/request/index.js"]
        }
      },
      filerPerf: {
        src: "./perf/index.js",
        dest: "./dist/filer-perf.js",
        options: {
          browserifyOptions: {
            commondir: false
          },
          bundleOptions: {
            standalone: 'Filer'
          }
        }
      },
      filerTest: {
        src: "./tests/index.js",
        dest: "./dist/filer-test.js"
      },
      // See tests/bugs/issue225.js
      filerIssue225: {
        src: "./src/index.js",
        dest: "./dist/filer-issue225.js",
        options: {
          browserifyOptions: {
            commondir: false
          },
          bundleOptions: {
            standalone: 'Filer'
          }
        }
      }
    },

    shell: {
      mocha: {
        // Run all tests (e.g., tests require()'ed in tests/index.js) and also tests/bugs/issue225.js
        // separately, since it can't be included in a browserify build.
        command: '"./node_modules/.bin/mocha" --reporter list tests/index.js && "./node_modules/.bin/mocha" --reporter list tests/bugs/issue225.js'
      }
    },

    bump: {
      options: {
        files: ['package.json', 'bower.json'],
        commit: true,
        commitMessage: 'v%VERSION%',
        commitFiles: ['package.json', 'bower.json', './dist/filer.js', './dist/filer.min.js'],
        createTag: true,
        tagName: 'v%VERSION%',
        tagMessage: 'v%VERSION%',
        push: true,
        pushTo: GIT_FULL_REMOTE
      }
    },

    'npm-checkBranch': {
      options: {
        branch: GIT_BRANCH
      }
    },

    'npm-publish': {
      options: {
        abortIfDirty: false
      }
    },

    prompt: {
      confirm: {
        options: {
          questions: [
            {
              config: PROMPT_CONFIRM_CONFIG,
              type: 'confirm',
              message: 'Bump version from ' + (currentVersion).cyan +
                          ' to ' + semver.inc(currentVersion, "patch").yellow + '?',
              default: false
            }
          ],
          then: function(results) {
            if (!results[PROMPT_CONFIRM_CONFIG]) {
              return grunt.fatal('User aborted...');
            }
          }
        }
      }
    },

    gitcheckout: {
      publish: {
        options: {
          branch: 'gh-pages',
          force: true
        }
      },
      revert: {
        options: {
          branch: GIT_BRANCH
        }
      }
    },

    gitpush: {
      publish: {
        options: {
          remote: GIT_REMOTE,
          branch: 'gh-pages',
          force: true
        },
      }
    },

    gitcommit: {
      publish: {
        options: {
          noStatus: true
        }
      }
    },

    gitadd: {
      publish: {
        files: {
          src: ['./dist/filer-test.js', './dist/filer-perf.js', 'tests/', 'perf/']
        }
      }
    },

    gitstash: {
      publish: {
      },
      pop: {
        options: {
          command: "pop"
        }
      }
    },

    gitrm: {
      publish: {
        files: {
          src: ['./dist/filer-test.js', './dist/filer-perf.js', 'tests/', 'perf/']
        }
      }
    },

    connect: {
      serverForNode: {
        options: {
          port: 1234,
          base: '.'
        }
      },
      serverForBrowser: {
        options: {
          port: 1234,
          base: '.',
          keepalive: true
        }
      }
    },

    usebanner: {
      publish: {
        options: {
          position: "top"
        },
        files: {
          src: ['./dist/filer-test.js', './dist/filer-perf.js']
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-bump');
  grunt.loadNpmTasks('grunt-npm');
  grunt.loadNpmTasks('grunt-git');
  grunt.loadNpmTasks('grunt-prompt');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-banner');

  grunt.registerTask('develop', ['clean', 'browserify:filerDist', 'browserify:filerIssue225']);
  grunt.registerTask('build-tests', ['clean', 'browserify:filerTest', 'browserify:filerPerf']);
  grunt.registerTask('release', ['test', 'develop', 'uglify']);

  grunt.registerTask('publish', 'Publish filer as a new version to NPM, bower and github.', function(patchLevel) {
    var allLevels = ['patch', 'minor', 'major'];

    // No level specified defaults to 'patch'
    patchLevel = (patchLevel || 'patch').toLowerCase();

    // Fail out if the patch level isn't recognized
    if (allLevels.filter(function(el) { return el == patchLevel; }).length === 0) {
      return grunt.fatal('Patch level not recognized! "Patch", "minor" or "major" only.');
    }

    // Set prompt message
    var promptOpts = grunt.config('prompt.confirm.options');
    promptOpts.questions[0].message =  'Bump version from ' + (currentVersion).cyan +
      ' to ' + semver.inc(currentVersion, patchLevel).yellow + '?';
    grunt.config('prompt.confirm.options', promptOpts);

    // Store the new version in the gh-pages commit message
    var ghPagesMessage = 'Tests for Filer v' + semver.inc(currentVersion, patchLevel);
    grunt.config('gitcommit.publish.options.message', ghPagesMessage);

    // Store the new version as a banner in the test file
    // NOTE: This is a hack intended to ensure that this build process
    //       succeeds even if no changes were made to the tests
    //       before publishing a new version. Otherwise, the automatic
    //       commit + push to github pages would break a normal build
    var bannerMsg = "/* Test file for filerjs v" + semver.inc(currentVersion, patchLevel) + "*/";
    grunt.config('usebanner.publish.options.banner', bannerMsg);

    grunt.task.run([
      'prompt:confirm',
      'checkBranch',
      'release',
      'bump:' + patchLevel,
      'build-tests',
      'usebanner:publish',
      'gitadd:publish',
      'gitstash:publish',
      'gitcheckout:publish',
      'gitrm:publish',
      'gitstash:pop',
      'gitcommit:publish',
      'gitpush:publish',
      'gitcheckout:revert',
      'npm-publish'
    ]);
  });
  grunt.registerTask('test-node', ['jshint', 'browserify:filerIssue225', 'connect:serverForNode', 'shell:mocha']);
  grunt.registerTask('test-browser', ['jshint', 'build-tests', 'connect:serverForBrowser']);
  grunt.registerTask('test', ['clean', 'test-node']);

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


<commit_before>var properties = require('./src/js/game/properties.js');

module.exports = function (grunt) {

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-cache-bust');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-open');
  grunt.loadNpmTasks('grunt-pngmin');

  var productionBuild = !!(grunt.cli.tasks.length && grunt.cli.tasks[0] === 'build');

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

    , properties: properties

    , project:
      { src: 'src/js'
      , js: '<%= project.src %>/game/{,*/}*.js'
      , dest: 'build/js'
      , bundle: 'build/js/app.min.js'
      , port: properties.port
      , banner:
        '/*\n' +
        ' * <%= properties.title %>\n' +
        ' * <%= pkg.description %>\n' +
        ' *\n' +
        ' * @author <%= pkg.author %>\n' +
        ' * @version <%= pkg.version %>\n' +
        ' * @copyright <%= pkg.author %>\n' +
        ' * @license <%= pkg.license %> licensed\n' +
        ' *\n' +
        ' * Made using Phaser JS Boilerplate <https://github.com/lukewilde/phaser-js-boilerplate>\n' +
        ' */\n'
      }

    , connect:
      { dev:
        { options:
          { port: '<%= project.port %>'
          , base: './build'
          }
        }
      }

    , jshint:
      { files:
        [ 'gruntfile.js'
        , '<%= project.js %>'
        ]
      , options:
        { jshintrc: '.jshintrc'
        }
      }

    , watch:
      { options:
        { livereload: productionBuild ? false : properties.liveReloadPort
        }
      , js:
        { files: '<%= project.dest %>/**/*.js'
        , tasks: ['jade']
        }
      , jade:
        { files: 'src/templates/*.jade'
        , tasks: ['jade']
        }
      , stylus:
        { files: 'src/style/*.styl'
        , tasks: ['stylus']
        }
      , images:
        { files: 'src/images/**/*'
        , tasks: ['copy:images']
        }
      , audio:
        { files: 'src/audio/**/*'
        , tasks: ['copy:audio']
        }
      }

    , browserify:
      { app:
        { src: ['<%= project.src %>/game/app.js']
        , dest: '<%= project.bundle %>'
        , options:
          { transform: ['browserify-shim']
          , watch: true
          , bundleOptions:
            { debug: !productionBuild
            }
          }
        }
      }

    , open:
      { server:
        { path: 'http://localhost:<%= project.port %>'
        }
      }

    , cacheBust:
      { options:
        { encoding: 'utf8'
        , algorithm: 'md5'
        , length: 8
        }
      , assets:
        { files:
          [ { src:
              [ 'build/index.html'
              , '<%= project.bundle %>'
              ]
            }
          ]
        }
      }

    , jade:
      { compile:
        { options:
          { data:
            { properties: properties
            , productionBuild: productionBuild
            }
          }
        , files:
          { 'build/index.html': ['src/templates/index.jade']
          }
        }
      }

    , stylus:
      { compile:
        { files:
          { 'build/style/index.css': ['src/style/index.styl'] }
        , options:
          { sourcemaps: !productionBuild
          }
        }
      }

    , clean: ['./build/']

    , pngmin:
      { options:
        { ext: '.png'
        , force: true
        }
      , compile:
        { files:
            [ { src: 'src/images/*.png'
              , dest: 'src/images/'
              }
            ]
          }
        }

    , copy:
      { images:
        { files:
          [ { expand: true, cwd: 'src/images/', src: ['**'], dest: 'build/images/' }
          ]
        }
      , audio:
        { files:
          [ { expand: true, cwd: 'src/audio/', src: ['**'], dest: 'build/audio/' }
          ]
        }
      }

    , uglify:
      { options:
        { banner: '<%= project.banner %>'
        }
      , dist:
        { files:
          { '<%= project.bundle %>': '<%= project.bundle %>'
          }
        }
      }

    , compress:
      { options:
        { archive: '<%= pkg.name %>.zip'
        }
      , zip:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'], dest: '<%= pkg.name %>/' } ]
        }
      , cocoon:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'] } ]
        }
      }
    }
  );

  grunt.registerTask('default',
    [ 'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'copy'
    , 'connect'
    , 'open'
    , 'watch'
    ]
  );

  grunt.registerTask('build',
    [ /*'jshint'
    , */'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'uglify'
    , 'copy'
    , 'cacheBust'
    , 'connect'
    , 'open'
    , 'watch'
    ]
  );

  grunt.registerTask('optimise', ['pngmin', 'copy:images']);
  grunt.registerTask('cocoon', ['compress:cocoon']);
  grunt.registerTask('zip', ['compress:zip']);
};
<commit_msg>do not start web server on build target<commit_after>var properties = require('./src/js/game/properties.js');

module.exports = function (grunt) {

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-cache-bust');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-open');
  grunt.loadNpmTasks('grunt-pngmin');

  var productionBuild = !!(grunt.cli.tasks.length && grunt.cli.tasks[0] === 'build');

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

    , properties: properties

    , project:
      { src: 'src/js'
      , js: '<%= project.src %>/game/{,*/}*.js'
      , dest: 'build/js'
      , bundle: 'build/js/app.min.js'
      , port: properties.port
      , banner:
        '/*\n' +
        ' * <%= properties.title %>\n' +
        ' * <%= pkg.description %>\n' +
        ' *\n' +
        ' * @author <%= pkg.author %>\n' +
        ' * @version <%= pkg.version %>\n' +
        ' * @copyright <%= pkg.author %>\n' +
        ' * @license <%= pkg.license %> licensed\n' +
        ' *\n' +
        ' * Made using Phaser JS Boilerplate <https://github.com/lukewilde/phaser-js-boilerplate>\n' +
        ' */\n'
      }

    , connect:
      { dev:
        { options:
          { port: '<%= project.port %>'
          , base: './build'
          }
        }
      }

    , jshint:
      { files:
        [ 'gruntfile.js'
        , '<%= project.js %>'
        ]
      , options:
        { jshintrc: '.jshintrc'
        }
      }

    , watch:
      { options:
        { livereload: productionBuild ? false : properties.liveReloadPort
        }
      , js:
        { files: '<%= project.dest %>/**/*.js'
        , tasks: ['jade']
        }
      , jade:
        { files: 'src/templates/*.jade'
        , tasks: ['jade']
        }
      , stylus:
        { files: 'src/style/*.styl'
        , tasks: ['stylus']
        }
      , images:
        { files: 'src/images/**/*'
        , tasks: ['copy:images']
        }
      , audio:
        { files: 'src/audio/**/*'
        , tasks: ['copy:audio']
        }
      }

    , browserify:
      { app:
        { src: ['<%= project.src %>/game/app.js']
        , dest: '<%= project.bundle %>'
        , options:
          { transform: ['browserify-shim']
          , watch: true
          , bundleOptions:
            { debug: !productionBuild
            }
          }
        }
      }

    , open:
      { server:
        { path: 'http://localhost:<%= project.port %>'
        }
      }

    , cacheBust:
      { options:
        { encoding: 'utf8'
        , algorithm: 'md5'
        , length: 8
        }
      , assets:
        { files:
          [ { src:
              [ 'build/index.html'
              , '<%= project.bundle %>'
              ]
            }
          ]
        }
      }

    , jade:
      { compile:
        { options:
          { data:
            { properties: properties
            , productionBuild: productionBuild
            }
          }
        , files:
          { 'build/index.html': ['src/templates/index.jade']
          }
        }
      }

    , stylus:
      { compile:
        { files:
          { 'build/style/index.css': ['src/style/index.styl'] }
        , options:
          { sourcemaps: !productionBuild
          }
        }
      }

    , clean: ['./build/']

    , pngmin:
      { options:
        { ext: '.png'
        , force: true
        }
      , compile:
        { files:
            [ { src: 'src/images/*.png'
              , dest: 'src/images/'
              }
            ]
          }
        }

    , copy:
      { images:
        { files:
          [ { expand: true, cwd: 'src/images/', src: ['**'], dest: 'build/images/' }
          ]
        }
      , audio:
        { files:
          [ { expand: true, cwd: 'src/audio/', src: ['**'], dest: 'build/audio/' }
          ]
        }
      }

    , uglify:
      { options:
        { banner: '<%= project.banner %>'
        }
      , dist:
        { files:
          { '<%= project.bundle %>': '<%= project.bundle %>'
          }
        }
      }

    , compress:
      { options:
        { archive: '<%= pkg.name %>.zip'
        }
      , zip:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'], dest: '<%= pkg.name %>/' } ]
        }
      , cocoon:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'] } ]
        }
      }
    }
  );

  grunt.registerTask('default',
    [ 'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'copy'
    , 'connect'
    , 'open'
    , 'watch'
    ]
  );

  grunt.registerTask('build',
    [ /*'jshint'
    , */'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'uglify'
    , 'copy'
//    , 'cacheBust'
//    , 'connect'
//    , 'open'
//    , 'watch'
    ]
  );

  grunt.registerTask('optimise', ['pngmin', 'copy:images']);
  grunt.registerTask('cocoon', ['compress:cocoon']);
  grunt.registerTask('zip', ['compress:zip']);
};
<|endoftext|>


<commit_before>import { expandEmojiData, emojiDataStable } from 'unicode-emoji-data';
import countries from 'i18n-iso-countries';
import fs from 'fs';
import combineAnnotations from './combine-annotations';
import { groupArrayOfObjectsByKey } from './utils';

const languages = ['en', 'de'];

languages.forEach((language) => {
	const cldrAnnotations = require(`../res/cldr/${language}.json`); // eslint-disable-line
	const communityAnnotations = require(`../res/community/${language}.json`); // eslint-disable-line
	const globalCommunityAnnotations = require('../res/community/global.json'); // eslint-disable-line

	const annotations = combineAnnotations(cldrAnnotations, communityAnnotations, globalCommunityAnnotations);
	const annotationForSequence = groupArrayOfObjectsByKey(annotations, 'sequence');
	const matchAnyVariationSelectorOrModifier = /\s(FE0E|FE0F|1F3FB|1F3FC|1F3FD|1F3FE|1F3FF)/g;

	const emojiDataMissingAnnotations = expandEmojiData(emojiDataStable)
	.map(datum => ({
		sequence: datum.sequence.replace(matchAnyVariationSelectorOrModifier, ''), // normalize sequence
		name: datum.name,
		output: datum.output,
	}))
	.filter(datum => annotationForSequence[datum.sequence] == null);

	const regionalIndicatorBaseName = 'REGIONAL INDICATOR SYMBOL LETTER';

	const emojiAnnotationSuggestions = emojiDataMissingAnnotations.map((datum) => {
		if (datum.name.includes(regionalIndicatorBaseName)) {
			const isoCode = datum.name
			.split(',')
			.map(part => part.replace(regionalIndicatorBaseName, '').trim())
			.join('');
			const tts = countries.getName(isoCode, language);
			return {
				sequence: datum.sequence,
				name: datum.name,
				output: datum.output,
				tts: tts || `TODO: translate iso code '${isoCode}'`,
				keywords: ['flag'],
			};
		}
		return {
			sequence: datum.sequence,
			name: datum.name,
			output: datum.output,
			tts: 'TODO',
			keywords: ['TODO'],
		};
	});

	fs.writeFileSync(`res/community/_TODO/${language}.TODO.json`, JSON.stringify(emojiAnnotationSuggestions, null, 2));
});
<commit_msg>Using community supported languages from stable preset<commit_after>import { expandEmojiData, emojiDataStable } from 'unicode-emoji-data';
import countries from 'i18n-iso-countries';
import fs from 'fs';
import presetStable from './preset-stable';
import combineAnnotations from './combine-annotations';
import { groupArrayOfObjectsByKey } from './utils';

presetStable.cldrAnnotationsLanguages.forEach((language) => {
	const cldrAnnotations = require(`../res/cldr/${language}.json`); // eslint-disable-line
	const communityAnnotations = require(`../res/community/${language}.json`); // eslint-disable-line
	const globalCommunityAnnotations = require('../res/community/global.json'); // eslint-disable-line

	const annotations = combineAnnotations(cldrAnnotations, communityAnnotations, globalCommunityAnnotations);
	const annotationForSequence = groupArrayOfObjectsByKey(annotations, 'sequence');
	const matchAnyVariationSelectorOrModifier = /\s(FE0E|FE0F|1F3FB|1F3FC|1F3FD|1F3FE|1F3FF)/g;

	const emojiDataMissingAnnotations = expandEmojiData(emojiDataStable)
	.map(datum => ({
		sequence: datum.sequence.replace(matchAnyVariationSelectorOrModifier, ''), // normalize sequence
		name: datum.name,
		output: datum.output,
	}))
	.filter(datum => annotationForSequence[datum.sequence] == null);

	const regionalIndicatorBaseName = 'REGIONAL INDICATOR SYMBOL LETTER';

	const emojiAnnotationSuggestions = emojiDataMissingAnnotations.map((datum) => {
		if (datum.name.includes(regionalIndicatorBaseName)) {
			const isoCode = datum.name
			.split(',')
			.map(part => part.replace(regionalIndicatorBaseName, '').trim())
			.join('');
			const tts = countries.getName(isoCode, language);
			return {
				sequence: datum.sequence,
				name: datum.name,
				output: datum.output,
				tts: tts || `TODO: translate iso code '${isoCode}'`,
				keywords: ['flag'],
			};
		}
		return {
			sequence: datum.sequence,
			name: datum.name,
			output: datum.output,
			tts: 'TODO',
			keywords: ['TODO'],
		};
	});

	fs.writeFileSync(`res/community/_TODO/${language}.TODO.json`, JSON.stringify(emojiAnnotationSuggestions, null, 2));
});
<|endoftext|>


<commit_before>module.exports = (grunt) => {
  const
    path = require('path'),
    appPath = './app',
    outPath = './dist',
    electronPath = './node_modules/.bin/electron',
    electronPackagerPath = './node_modules/.bin/electron-packager',
    node_modules = ['serialport', 'lwip'],
    iconPath = appPath + '/recursos/icon'
    ;
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    pckg: grunt.file.readJSON('./package.json'),
    shell: {
      ebuild: {
        // platform ["mac", "osx", "win", "linux", "darwin", "win32", "all"]
        // arch ["ia32", "x64", "all"]
        command: (platform, arch) => {
          return [path.resolve("./node_modules/.bin/build"), path.resolve("./dist/CNC-ino-win32-x64"), "--platform=" + platform, "--arch=" + arch, "--dir=" + path.resolve("./dist")].join(' ')
        }
      },
      rebuidserialport: {
        command: ["cd", path.resolve(appPath + "/node_modules/" + node_modules[0]), ";", "node-gyp rebuild --target=<%=pckg.devDependencies['electron-prebuilt']%> --dist-url=https://atom.io/download/atom-shell"].join(' ')
      },
      rebuidimg2gcode: {
        command: ["cd", path.resolve(appPath + "/node_modules/" + node_modules[1]), ";", "node-gyp rebuild --target=<%=pckg.devDependencies['electron-prebuilt']%> --dist-url=https://atom.io/download/atom-shell"].join(' ')
      },
      erun: {
        command: [path.resolve(electronPath), path.resolve(appPath)].join(' ')
      },
      epack: {
        command: (platform, arch) => {
          return [path.resolve(electronPackagerPath), path.resolve(appPath), grunt.file.readJSON(path.resolve(appPath + '/package.json')).productName, "--platform=" + platform, "--arch=" + arch, "--out=" + path.resolve(outPath), "--overwrite", "--icon=" + path.resolve(iconPath)].join(' ');
        }
      }
    },
    jshint: {
      all: ['Gruntfile.js', './app/app.js', './app/lib/**/*.js', './app/js/**/*.js', 'tests/**/*.js'],
      options: {
        globals: {
          console: true,
          module: true,
          jQuery: true,
          window: true,
          angular: true
        },
        reporter: require('jshint-stylish'),
        jshintrc: './.jshintrc'
      }
    },
    pug: {
      compile: {
        files: {
          './app/html/index.html': ['./views/main.pug']
        }
      }
    },
    mochaTest: {
      test: {
        options: {
          reporter: 'spec'
        },
        src: ['./tests/**/*.js']
      }
    },
    'docco-plus': {
      debug: {
        src: ['./tests/**/*.js', './app/app.js', './app/lib/**/*.js', './app/js/**/*.js', '!node_modules/**/*.js', '!app/node_modules/**/*.js', '!app/components/**/*.js'],
        options: {
          output: 'docs/'
        }
      }
    },
    watch: {
      files: ['<%= pug.files %>', './views/**/*'],
      tasks: ['pug']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-pug');

  //  grunt.registerTask('default', ['jshint','pug','docco-plus','shell:erun']);
  grunt.registerTask('default', ['jshint', 'pug', 'shell:erun']);

  grunt.registerTask('test', ['jshint', 'mochaTest']);
  grunt.registerTask('run', ['pug', 'shell:erun']);
  grunt.registerTask('buildmodule', ['shell:rebuidserialport', 'shell:rebuidimg2gcode']);
  grunt.registerTask('pack', ['pug', 'shell:epack:win32:x64']);
  //  grunt.registerTask('build'    , ['pug','shell:ebuild:win32:x64']);
};<commit_msg>fix grunt task in windows<commit_after>module.exports = (grunt) => {
  const
    path = require('path'),
    appPath = './app',
    outPath = './dist',
    electronPath = './node_modules/.bin/electron',
    electronPackagerPath = './node_modules/.bin/electron-packager',
    node_modules = ['serialport', 'lwip'],
    iconPath = appPath + '/recursos/icon'
    ;
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    pckg: grunt.file.readJSON('./package.json'),
    shell: {
      ebuild: {
        // platform ["mac", "osx", "win", "linux", "darwin", "win32", "all"]
        // arch ["ia32", "x64", "all"]
        command: (platform, arch) => {
          return [path.resolve("./node_modules/.bin/build"), path.resolve("./dist/CNC-ino-win32-x64"), "--platform=" + platform, "--arch=" + arch, "--dir=" + path.resolve("./dist")].join(' ')
        }
      },
      rebuidserialport: {
        command: ["cd", path.resolve(appPath + "/node_modules/" + node_modules[0]), "&&", "node-gyp rebuild --target=<%=pckg.devDependencies['electron-prebuilt']%> --dist-url=https://atom.io/download/atom-shell"].join(' ')
      },
      rebuidimg2gcode: {
        command: ["cd", path.resolve(appPath + "/node_modules/" + node_modules[1]), "&&", "node-gyp rebuild --target=<%=pckg.devDependencies['electron-prebuilt']%> --dist-url=https://atom.io/download/atom-shell"].join(' ')
      },
      erun: {
        command: [path.resolve(electronPath), path.resolve(appPath)].join(' ')
      },
      epack: {
        command: (platform, arch) => {
          return [path.resolve(electronPackagerPath), path.resolve(appPath), grunt.file.readJSON(path.resolve(appPath + '/package.json')).productName, "--platform=" + platform, "--arch=" + arch, "--out=" + path.resolve(outPath), "--overwrite", "--icon=" + path.resolve(iconPath)].join(' ');
        }
      }
    },
    jshint: {
      all: ['Gruntfile.js', './app/app.js', './app/lib/**/*.js', './app/js/**/*.js', 'tests/**/*.js'],
      options: {
        globals: {
          console: true,
          module: true,
          jQuery: true,
          window: true,
          angular: true
        },
        reporter: require('jshint-stylish'),
        jshintrc: './.jshintrc'
      }
    },
    pug: {
      compile: {
        files: {
          './app/html/index.html': ['./views/main.pug']
        }
      }
    },
    mochaTest: {
      test: {
        options: {
          reporter: 'spec'
        },
        src: ['./tests/**/*.js']
      }
    },
    'docco-plus': {
      debug: {
        src: ['./tests/**/*.js', './app/app.js', './app/lib/**/*.js', './app/js/**/*.js', '!node_modules/**/*.js', '!app/node_modules/**/*.js', '!app/components/**/*.js'],
        options: {
          output: 'docs/'
        }
      }
    },
    watch: {
      files: ['<%= pug.files %>', './views/**/*'],
      tasks: ['pug']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-pug');

  //  grunt.registerTask('default', ['jshint','pug','docco-plus','shell:erun']);
  grunt.registerTask('default', ['jshint', 'pug', 'shell:erun']);

  grunt.registerTask('test', ['jshint', 'mochaTest']);
  grunt.registerTask('run', ['pug', 'shell:erun']);
  grunt.registerTask('buildmodule', ['shell:rebuidserialport', 'shell:rebuidimg2gcode']);
  grunt.registerTask('pack', ['pug', 'shell:epack:win32:x64']);
  //  grunt.registerTask('build'    , ['pug','shell:ebuild:win32:x64']);
};<|endoftext|>


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

	'use strict';

	// ================================================================
	// CONFIG TASKS
	// ================================================================

	// Define the configuration
	grunt.initConfig({

		// Specifics of npm's package.json handling
		pkg: grunt.file.readJSON( 'package.json' ),

		// Banner
		banner:
			'/*!\n'+
			' * Milligram v<%= pkg.version %>\n'+
			' * <%= pkg.homepage %>\n'+
			' *\n'+
			' * Copyright (c) 2015, CJ Patoilo\n'+
			' * Licensed under the <%= pkg.license %> license\n'+
			'*/\n\n',

		// DEFAULT TASK
		// ================================================================

		// Watch files and process the above tasks
		watch: {
			options: {
				livereload: false
			},
			grunt: {
				files: [
					'gruntfile.js'
				],
				options: {
					reload: true
				}
			},
			sass: {
				files: [
					'src/**/*.sass'
				],
				tasks: [
					'sass',
					'autoprefixer'
				]
			}
		},

		// BUILD TASKS
		// ================================================================

		// Clear files and folders
		clean: {
			all: [ 'dist' ]
		},

		// Compile Sass files to CSS
		sass: {
			minify: {
				options: {
					banner: '<%= banner %>',
					noCache: true,
					sourcemap: 'none',
					style: 'compressed'
				},
				files: {
					'dist/milligram.min.css': [ 'src/**/*.sass', '!src/**/_*.sass' ]
				}
			},
			default: {
				options: {
					banner: '<%= banner %>',
					noCache: true,
					sourcemap: 'none',
					style: 'expanded'
				},
				files: {
					'dist/milligram.css': [ 'src/**/*.sass', '!src/**/_*.sass' ]
				}
			}
		},

		// Parse CSS and add vendor-prefixed CSS properties using the Can I Use database.
		autoprefixer: {
			minify: {
				options: {
					browsers: [
						'last 1 versions'
					],
					map: {
						inline: false
					}
				},
				files: {
					'dist/milligram.min.css': 'dist/milligram.min.css'
				}
			},
			default: {
				options: {
					browsers: [
						'last 1 versions'
					],
					map: false
				},
				files: {
					'dist/milligram.css': 'dist/milligram.css'
				}
			}
		}

	});

	// ================================================================
	// REGISTER TASKS
	// ================================================================

	// Default task
	grunt.registerTask( 'default', [
		'build',
		'watch'
	]);

	// Build task
	grunt.registerTask( 'build', [
		'clean',
		'sass',
		'autoprefixer'
	]);

	// ================================================================
	// LOAD TASKS
	// ================================================================

	// Automatically loading Grunt tasks
	require( 'load-grunt-tasks' )( grunt );

	// Display the elapsed execution time of Grunt tasks
	require( 'time-grunt' )( grunt );

};

// Code is Poetry
<commit_msg>updated project year<commit_after>module.exports = function ( grunt ) {

	'use strict';

	// ================================================================
	// CONFIG TASKS
	// ================================================================

	// Define the configuration
	grunt.initConfig({

		// Specifics of npm's package.json handling
		pkg: grunt.file.readJSON( 'package.json' ),

		// Banner
		banner:
			'/*!\n'+
			' * Milligram v<%= pkg.version %>\n'+
			' * <%= pkg.homepage %>\n'+
			' *\n'+
			' * Copyright (c) '+new Date().getFullYear()+' CJ Patoilo\n'+
			' * Licensed under the <%= pkg.license %> license\n'+
			'*/\n\n',

		// DEFAULT TASK
		// ================================================================

		// Watch files and process the above tasks
		watch: {
			options: {
				livereload: false
			},
			grunt: {
				files: [
					'gruntfile.js'
				],
				options: {
					reload: true
				}
			},
			sass: {
				files: [
					'src/**/*.sass'
				],
				tasks: [
					'sass',
					'autoprefixer'
				]
			}
		},

		// BUILD TASKS
		// ================================================================

		// Clear files and folders
		clean: {
			all: [ 'dist' ]
		},

		// Compile Sass files to CSS
		sass: {
			minify: {
				options: {
					banner: '<%= banner %>',
					noCache: true,
					sourcemap: 'none',
					style: 'compressed'
				},
				files: {
					'dist/milligram.min.css': [ 'src/**/*.sass', '!src/**/_*.sass' ]
				}
			},
			default: {
				options: {
					banner: '<%= banner %>',
					noCache: true,
					sourcemap: 'none',
					style: 'expanded'
				},
				files: {
					'dist/milligram.css': [ 'src/**/*.sass', '!src/**/_*.sass' ]
				}
			}
		},

		// Parse CSS and add vendor-prefixed CSS properties using the Can I Use database.
		autoprefixer: {
			minify: {
				options: {
					browsers: [
						'last 1 versions'
					],
					map: {
						inline: false
					}
				},
				files: {
					'dist/milligram.min.css': 'dist/milligram.min.css'
				}
			},
			default: {
				options: {
					browsers: [
						'last 1 versions'
					],
					map: false
				},
				files: {
					'dist/milligram.css': 'dist/milligram.css'
				}
			}
		}

	});

	// ================================================================
	// REGISTER TASKS
	// ================================================================

	// Default task
	grunt.registerTask( 'default', [
		'build',
		'watch'
	]);

	// Build task
	grunt.registerTask( 'build', [
		'clean',
		'sass',
		'autoprefixer'
	]);

	// ================================================================
	// LOAD TASKS
	// ================================================================

	// Automatically loading Grunt tasks
	require( 'load-grunt-tasks' )( grunt );

	// Display the elapsed execution time of Grunt tasks
	require( 'time-grunt' )( grunt );

};

// Code is Poetry
<|endoftext|>


<commit_before>var properties = require('./src/js/game/properties.js');

module.exports = function (grunt) {

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-cache-bust');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-open');
  grunt.loadNpmTasks('grunt-pngmin');

  var productionBuild = !!(grunt.cli.tasks.length && grunt.cli.tasks[0] === 'build');

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

    , properties: properties

    , project:
      { src: 'src/js'
      , js: '<%= project.src %>/game/{,*/}*.js'
      , dest: 'build/js'
      , bundle: 'build/js/app.min.js'
      , port: properties.port
      , banner:
        '/*\n' +
        ' * <%= properties.title %>\n' +
        ' * <%= pkg.description %>\n' +
        ' *\n' +
        ' * @author <%= pkg.author %>\n' +
        ' * @version <%= pkg.version %>\n' +
        ' * @copyright <%= pkg.author %>\n' +
        ' * @license <%= pkg.license %> licensed\n' +
        ' *\n' +
        ' * Made using Phaser JS Boilerplate <https://github.com/lukewilde/phaser-js-boilerplate>\n' +
        ' */\n'
      }

    , connect:
      { dev:
        { options:
          { port: '<%= project.port %>'
          , base: './build'
          }
        }
      }

    , jshint:
      { files:
        [ 'gruntfile.js'
        , '<%= project.js %>'
        ]
      , options:
        { jshintrc: '.jshintrc'
        }
      }

    , watch:
      { options:
        { livereload: productionBuild ? false : properties.liveReloadPort
        }
      , js:
        { files: '<%= project.dest %>/**/*.js'
        , tasks: ['jade']
        }
      , jade:
        { files: 'src/templates/*.jade'
        , tasks: ['jade']
        }
      , stylus:
        { files: 'src/style/*.styl'
        , tasks: ['stylus']
        }
      , images:
        { files: 'src/images/**/*'
        , tasks: ['copy:images']
        }
      , audio:
        { files: 'src/audio/**/*'
        , tasks: ['copy:audio']
        }
      }

    , browserify:
      { app:
        { src: ['<%= project.src %>/game/app.js']
        , dest: '<%= project.bundle %>'
        , options:
          { transform: ['browserify-shim']
          , watch: true
          , bundleOptions:
            { debug: !productionBuild
            }
          }
        }
      }

    , open:
      { server:
        { path: 'http://localhost:<%= project.port %>'
        }
      }

    , cacheBust:
      { options:
        { encoding: 'utf8'
        , algorithm: 'md5'
        , length: 8
        }
      , assets:
        { files:
          [ { src:
              [ 'build/index.html'
              , '<%= project.bundle %>'
              ]
            }
          ]
        }
      }

    , jade:
      { compile:
        { options:
          { data:
            { properties: properties
            , productionBuild: productionBuild
            }
          }
        , files:
          { 'build/index.html': ['src/templates/index.jade']
          }
        }
      }

    , stylus:
      { compile:
        { files:
          { 'build/style/index.css': ['src/style/index.styl'] }
        , options:
          { sourcemaps: !productionBuild
          }
        }
      }

    , clean: ['./build/']

    , pngmin:
      { options:
        { ext: '.png'
        , force: true
        }
      , compile:
        { files:
            [ { src: 'src/images/*.png'
              , dest: 'src/images/'
              }
            ]
          }
        }

    , copy:
      { images:
        { files:
          [ { expand: true, cwd: 'src/images/', src: ['**'], dest: 'build/images/' }
          ]
        }
      , audio:
        { files:
          [ { expand: true, cwd: 'src/audio/', src: ['**'], dest: 'build/audio/' }
          ]
        }
      }

    , uglify:
      { options:
        { banner: '<%= project.banner %>'
        }
      , dist:
        { files:
          { '<%= project.bundle %>': '<%= project.bundle %>'
          }
        }
      }

    , compress:
      { options:
        { archive: '<%= pkg.name %>.zip'
        }
      , zip:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'], dest: '<%= pkg.name %>/' } ]
        }
      , cocoon:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'] } ]
        }
      }
    }
  );

  grunt.registerTask('default',
    [ 'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'copy'
    , 'connect'
    , 'open'
    , 'watch'
    ]
  );

  grunt.registerTask('build',
    [ /*'jshint'
    , */'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'uglify'
    , 'copy'
    , 'cacheBust'
    , 'connect'
    , 'open'
    , 'watch'
    ]
  );

  grunt.registerTask('optimise', ['pngmin', 'copy:images']);
  grunt.registerTask('cocoon', ['compress:cocoon']);
  grunt.registerTask('zip', ['compress:zip']);
};
<commit_msg>Agrego directorio de maps<commit_after>var properties = require('./src/js/game/properties.js');

module.exports = function (grunt) {

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-cache-bust');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-stylus');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-open');
  grunt.loadNpmTasks('grunt-pngmin');

  var productionBuild = !!(grunt.cli.tasks.length && grunt.cli.tasks[0] === 'build');

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

    , properties: properties

    , project:
      { src: 'src/js'
      , js: '<%= project.src %>/game/{,*/}*.js'
      , dest: 'build/js'
      , bundle: 'build/js/app.min.js'
      , port: properties.port
      , banner:
        '/*\n' +
        ' * <%= properties.title %>\n' +
        ' * <%= pkg.description %>\n' +
        ' *\n' +
        ' * @author <%= pkg.author %>\n' +
        ' * @version <%= pkg.version %>\n' +
        ' * @copyright <%= pkg.author %>\n' +
        ' * @license <%= pkg.license %> licensed\n' +
        ' *\n' +
        ' * Made using Phaser JS Boilerplate <https://github.com/lukewilde/phaser-js-boilerplate>\n' +
        ' */\n'
      }

    , connect:
      { dev:
        { options:
          { port: '<%= project.port %>'
          , base: './build'
          }
        }
      }

    , jshint:
      { files:
        [ 'gruntfile.js'
        , '<%= project.js %>'
        ]
      , options:
        { jshintrc: '.jshintrc'
        }
      }

    , watch:
      { options:
        { livereload: productionBuild ? false : properties.liveReloadPort
        }
      , js:
        { files: '<%= project.dest %>/**/*.js'
        , tasks: ['jade']
        }
      , jade:
        { files: 'src/templates/*.jade'
        , tasks: ['jade']
        }
      , stylus:
        { files: 'src/style/*.styl'
        , tasks: ['stylus']
        }
      , images:
        { files: 'src/images/**/*'
        , tasks: ['copy:images']
        }
      , audio:
        { files: 'src/audio/**/*'
        , tasks: ['copy:audio']
        }
      }

    , browserify:
      { app:
        { src: ['<%= project.src %>/game/app.js']
        , dest: '<%= project.bundle %>'
        , options:
          { transform: ['browserify-shim']
          , watch: true
          , bundleOptions:
            { debug: !productionBuild
            }
          }
        }
      }

    , open:
      { server:
        { path: 'http://localhost:<%= project.port %>'
        }
      }

    , cacheBust:
      { options:
        { encoding: 'utf8'
        , algorithm: 'md5'
        , length: 8
        }
      , assets:
        { files:
          [ { src:
              [ 'build/index.html'
              , '<%= project.bundle %>'
              ]
            }
          ]
        }
      }

    , jade:
      { compile:
        { options:
          { data:
            { properties: properties
            , productionBuild: productionBuild
            }
          }
        , files:
          { 'build/index.html': ['src/templates/index.jade']
          }
        }
      }

    , stylus:
      { compile:
        { files:
          { 'build/style/index.css': ['src/style/index.styl'] }
        , options:
          { sourcemaps: !productionBuild
          }
        }
      }

    , clean: ['./build/']

    , pngmin:
      { options:
        { ext: '.png'
        , force: true
        }
      , compile:
        { files:
            [ { src: 'src/images/*.png'
              , dest: 'src/images/'
              }
            ]
          }
        }

    , copy:
      { images:
        { files:
          [ { expand: true, cwd: 'src/images/', src: ['**'], dest: 'build/images/' }
          ]
        }
      , audio:
        { files:
          [ { expand: true, cwd: 'src/audio/', src: ['**'], dest: 'build/audio/' }
          ]
        }
      , maps:
        { files:
          [ { expand: true, cwd: 'src/maps/', src: ['**'], dest: 'build/maps/' }
          ]
        }
      }

    , uglify:
      { options:
        { banner: '<%= project.banner %>'
        }
      , dist:
        { files:
          { '<%= project.bundle %>': '<%= project.bundle %>'
          }
        }
      }

    , compress:
      { options:
        { archive: '<%= pkg.name %>.zip'
        }
      , zip:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'], dest: '<%= pkg.name %>/' } ]
        }
      , cocoon:
        { files: [ { expand: true, cwd: 'build/', src: ['**/*'] } ]
        }
      }
    }
  );

  grunt.registerTask('default',
    [ 'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'copy'
    , 'connect'
    , 'open'
    , 'watch'
    ]
  );

  grunt.registerTask('build',
    [ /*'jshint'
    , */'clean'
    , 'browserify'
    , 'jade'
    , 'stylus'
    , 'uglify'
    , 'copy'
    , 'cacheBust'
    , 'connect'
    , 'open'
    , 'watch'
    ]
  );

  grunt.registerTask('optimise', ['pngmin', 'copy:images']);
  grunt.registerTask('cocoon', ['compress:cocoon']);
  grunt.registerTask('zip', ['compress:zip']);
};
<|endoftext|>


<commit_before>// gruntfile.js
//
// Author: blinklv <blinklv@icloud.com>
// Create Time: 2017-03-22
// Maintainer: blinklv <blinklv@icloud.com>
// Last Change: 2017-05-18
// Purpose: The gruntfile.js for Web development.

module.exports = function(grunt) {

    // Get file list (include directory) recursively
    function get_files(cwd) {
        cwd = cwd || "" && cwd + "/";
        var tmp = grunt.file.expand({filter: "isFile", cwd: cwd}, ["*"]);
        var files = tmp.reduce(function(obj, item, i) {
            obj[i] = item;
            return obj;
        }, {});

        tmp = grunt.file.expand({filter: "isDirectory", cwd: cwd}, ["*"]);
        files = tmp.reduce(function(obj, item) {
            obj[item] = get_files(cwd + item + "/");
            return obj;
        }, files);
        return files;
    }

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

        // Watch all files.
        watch: {
            sass: {
                files: ["sass/*.sass", "sass/*.scss"],
                tasks: ["sass", "concat:css"]
            },
            css: {
                files: ["font/*.css", "css/*.css", "!css/*.min.css"],
                tasks: ["concat:css"]
            },
            js: {
                files: ["js/*.js", "!js/main.js","!js/*.min.js"],
                tasks: ["concat:js", "jshint"]
            },
            html: {
                files: ["index.html", "html/**/*.html"],
                tasks: ["copy:devel"]
            },
            img: {
                files: ["img/**/*.{gif,jpg,jpeg,png,svg}"],
                tasks: ["responsive_images", "copy:devel"]
            },
            font: {
                files: ["font/*.{woff,woff2}"],
                tasks: ["copy:devel"]
            },
            pug: {
                files: ["index.pug", "pug/**/*.pug"],
                tasks: ["pug"]
            }
        },

        // Copy files to build/devel directory.
        copy: {
            devel: {
                files: [{
                    expand: true,
                    flatten: true,
                    cwd: "vendor/",
                    src: ["**/*.css", "!**/*.min.css"],
                    dest: "build/devel/css/",
                },{
                    expand: true,
                    flatten: true,
                    cwd: "vendor/",
                    src: ["**/*.js", "!**/*.min.js"],
                    dest: "build/devel/js/",
                },{
                    expand: true,
                    src: ["index.html", "html/**/*.html"],
                    dest: "build/devel/"
                },{
                    expand: true,
                    cwd: "img/",
                    src: ["**/*.svg"],
                    dest: "build/devel/img/"
                },{
                    expand: true,
                    cwd: "font/",
                    src: ["**/*.{woff,woff2}"],
                    dest: "build/devel/css/font/"
                }]
            },
            release: {
                files: [{
                    expand: true,
                    cwd: "build/devel/img/",
                    src: ["**/*.{gif,jpg,jpeg,png,svg}"],
                    dest: "build/release/img/"
                },{
                    expand: true,
                    cwd: "build/devel/css/font/",
                    src: ["**/*.woff", "**/*.woff2"],
                    dest: "build/release/css/font/"
                }]
            }
        },

        // Generate multi-resolution images.
        responsive_images: {
            normal: {
                options: {
                    engine: "im",
                    sizes: [{
                        name: "s",
                        width: 320,
                        quality: 70
                    },{
                        name: "m",
                        width: 480,
                        quality: 70
                    },{
                        name: "l",
                        width: 720,
                        quality: 70
                    },{
                        name: "xl",
                        width: 1024,
                        quality: 70
                    },{
                        name: "xxl",
                        width: 1440,
                        quality: 70
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "img/",
                    src: ["**/*.{gif,jpg,jpeg,png}","!**/logo.{gif,jpg,jpeg,png}","!**/*{-,_}logo.{gif,jpg,jpeg,png}"],
                    dest: "build/devel/img/"
                }]
            },

            // The shape of orignal logo picture is preferably square.
            logo: {
                options: {
                    engine: "im",
                    sizes: [{
                        name: "s",
                        width: 64
                    },{
                        name: "m",
                        width: 128,
                        quality: 90
                    },{
                        name: "l",
                        width: 256,
                        quality: 70
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "img/",
                    src: ["**/logo.{gif,jpg,jpeg,png}", "**/*{-,_}logo.{gif,jpg,jpeg,png}"],
                    dest: "build/devel/img/"
                }]
            }
        },

        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                eqnull: true,
                browser: true,
                globals: {
                    jQuery: true
                },
            },
            target: ["gruntfile.js", "js/*.js", "build/devel/js/main.js"]
        },

        // Concatenate files, but exclude some files of 'min' suffix.
        concat: {
            css: {
                src: ["font/*.css", "css/*.css", "!css/main.css","!css/*.min.css"],
                dest: "build/devel/css/main.css"
            },
            js: {
                src: ["js/*.js", "!js/main.js", "!js/*.min.js"],
                dest: "build/devel/js/main.js"
            }
        },

        // Compiling SASS files to CSS files.
        sass: {
            target: {
                files: [{
                    expand: true,
                    cwd: "sass/",
                    src: ["*.sass", "*.scss"],
                    dest: "css/",
                    ext: ".css"
                }]
            }
        },

        // Remove unused CSS.
        uncss: {
            target: {
                files: {
                    "build/devel/css/tidy.css": "build/devel/**/*.html"
                }
            }
        },

        // Minifying CSS files.
        cssmin: {
            target: {
                src: "build/devel/css/tidy.css",
                dest: "build/release/css/main.min.css"
            }
        },

        // Minifying JS files.
        uglify: {
            options: {
                mangle: false,
                compress: {
                    drop_console: true
                }
            },
            target: {
                files: [{
                    expand: true,
                    flatten: true,
                    cwd: "build/devel/js/",
                    src: "**/*.js",
                    dest: "build/release/js/",
                    ext: ".min.js",
                    extDot: "last"
                }]
            }
        },

        // Compiling Pug files to HTML files.
        pug: {
            target: {
                options: {
                    pretty: true,
                    data: function(dest, src) {
                      var files = get_files();
                      files.img.description = Object.keys(files.img.description).reduce(function(obj, i){
                        var key = files.img.description[i];
                        obj[key] = grunt.file.read("img/description/" + key);
                        return obj;
                      }, {});
                      return {
                          files: files
                      };
                    }
                },
                files: [{
                    expand: true,
                    src: ["index.pug"],
                    dest: "build/devel/",
                    ext: ".html",
                    extDot: "last"
                },{
                    expand: true,
                    cwd: "pug/",
                    src: ["*.pug"],
                    dest: "build/devel/html/",
                    ext: ".html",
                    extDot: "last"
                }]
            }
        },

        // Minifying HTML files.
        htmlmin: {
            options: {
                removeComments: true,
                collapseWhitespace: true
            },
            target: {
                files: [{
                    expand: true,
                    cwd: "build/devel/",
                    src: ["index.html", "html/*.html"],
                    dest: "build/release/"
                }]
            }
        },

        replace: {
            release: {
                src: ["build/release/index.html", "build/release/html/*.html"],
                overwrite: true,
                // NOTICE: The asterisk(*) wildcard should be in non-greedy mode.
                replacements: [{
                    from: /href="(.*?)\.css"/g,
                    to: 'href="$1.min.css"'
                },{
                    from: /src="(.*?)\.js"/g,
                    to: 'src="$1.min.js"'
                }]
            }
        },

        // Adding a banner information to some files.
        usebanner: {
            options: {
                position: "top",
                banner: "<%= create_banner() %>"
            },
            css: {
                src: "build/devel/css/main.css"
            },
            js: {
                src: "build/devel/js/main.js"
            }
        },

        clean: {
            devel: ["build/devel"],
            release: ["build/release"]
        },

        // Auxiliary method.
        create_banner: function() {
            var str = "";
            var pkg = this.pkg;

            // If 'pkg.name' is empty, the 'banner' is empty too.
            if (pkg.name) {
                str = "/*! " + pkg.name;
                str = pkg.version ? str + " v" + pkg.version : str;
                str += " " + grunt.template.today("yyyy-mm-dd");
                str = pkg.license ? str + " | " + pkg.license : str;
                str = pkg.url ? str +  " | " + pkg.url : str;
                str += " */";
            }

            return str;
        }
    });

    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-responsive-images");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-copy");
    grunt.loadNpmTasks("grunt-uncss");
    grunt.loadNpmTasks("grunt-contrib-sass");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-cssmin");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-htmlmin");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-contrib-pug");
    grunt.loadNpmTasks("grunt-text-replace");
    grunt.loadNpmTasks("grunt-banner");

    grunt.registerTask("devel", ["sass", "concat", "jshint", "usebanner", "responsive_images", "pug", "copy:devel"]);
    grunt.registerTask("release", ["devel", "uncss", "cssmin", "uglify", "copy:release",  "htmlmin", "replace:release"]);
    grunt.registerTask("rebuild-devel", ["clean:devel", "devel"]);
    grunt.registerTask("rebuild", ["clean", "release"]);
    grunt.registerTask("default", ["release"]);
};

<commit_msg>Expand 'vendor' and 'font'.<commit_after>// gruntfile.js
//
// Author: blinklv <blinklv@icloud.com>
// Create Time: 2017-03-22
// Maintainer: blinklv <blinklv@icloud.com>
// Last Change: 2017-05-18
// Purpose: The gruntfile.js for Web development.

module.exports = function(grunt) {

    // Get file list (include directory) recursively
    function get_files(cwd) {
        cwd = cwd || "" && cwd + "/";
        var tmp = grunt.file.expand({filter: "isFile", cwd: cwd}, ["*"]);
        var files = tmp.reduce(function(obj, item, i) {
            obj[i] = item;
            return obj;
        }, {});

        tmp = grunt.file.expand({filter: "isDirectory", cwd: cwd}, ["*"]);
        files = tmp.reduce(function(obj, item) {
            obj[item] = get_files(cwd + item + "/");
            return obj;
        }, files);
        return files;
    }

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

        // Watch all files.
        watch: {
            sass: {
                files: ["sass/*.sass", "sass/*.scss"],
                tasks: ["sass", "concat:css"]
            },
            css: {
                files: ["font/*.css", "css/*.css", "!css/*.min.css"],
                tasks: ["concat:css"]
            },
            js: {
                files: ["js/*.js", "!js/main.js","!js/*.min.js"],
                tasks: ["concat:js", "jshint"]
            },
            html: {
                files: ["index.html", "html/**/*.html"],
                tasks: ["copy:devel"]
            },
            img: {
                files: ["img/**/*.{gif,jpg,jpeg,png,svg}"],
                tasks: ["responsive_images", "copy:devel"]
            },
            font: {
                files: ["font/*.{woff,woff2,eot,ttf,otf,svg}"],
                tasks: ["copy:devel"]
            },
            pug: {
                files: ["index.pug", "pug/**/*.pug"],
                tasks: ["pug"]
            },
            vendor: {
              cwd: "vendor/",
              files: ["**/*.js", "**/*.css", "!**/*.min.js", "!**/*.min.css"],
              tasks: ["copy:devel"]
            }
        },

        // Copy files to build/devel directory.
        copy: {
            devel: {
                files: [{
                    expand: true,
                    flatten: true,
                    cwd: "vendor/",
                    src: ["**/*.css", "!**/*.min.css"],
                    dest: "build/devel/css/",
                },{
                    expand: true,
                    flatten: true,
                    cwd: "vendor/",
                    src: ["**/*.js", "!**/*.min.js"],
                    dest: "build/devel/js/",
                },{
                    expand: true,
                    src: ["index.html", "html/**/*.html"],
                    dest: "build/devel/"
                },{
                    expand: true,
                    cwd: "img/",
                    src: ["**/*.svg"],
                    dest: "build/devel/img/"
                },{
                    expand: true,
                    cwd: "font/",
                    src: ["**/*.{woff,woff2,eot,ttf,otf,svg}"],
                    dest: "build/devel/css/font/"
                }]
            },
            release: {
                files: [{
                    expand: true,
                    cwd: "build/devel/img/",
                    src: ["**/*.{gif,jpg,jpeg,png,svg}"],
                    dest: "build/release/img/"
                },{
                    expand: true,
                    cwd: "build/devel/css/font/",
                    src: ["**/*.{woff,woff2,eot,ttf,otf,svg}"],
                    dest: "build/release/css/font/"
                }]
            }
        },

        // Generate multi-resolution images.
        responsive_images: {
            normal: {
                options: {
                    engine: "im",
                    sizes: [{
                        name: "s",
                        width: 320,
                        quality: 70
                    },{
                        name: "m",
                        width: 480,
                        quality: 70
                    },{
                        name: "l",
                        width: 720,
                        quality: 70
                    },{
                        name: "xl",
                        width: 1024,
                        quality: 70
                    },{
                        name: "xxl",
                        width: 1440,
                        quality: 70
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "img/",
                    src: ["**/*.{gif,jpg,jpeg,png}","!**/logo.{gif,jpg,jpeg,png}","!**/*{-,_}logo.{gif,jpg,jpeg,png}"],
                    dest: "build/devel/img/"
                }]
            },

            // The shape of orignal logo picture is preferably square.
            logo: {
                options: {
                    engine: "im",
                    sizes: [{
                        name: "s",
                        width: 64
                    },{
                        name: "m",
                        width: 128,
                        quality: 90
                    },{
                        name: "l",
                        width: 256,
                        quality: 70
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "img/",
                    src: ["**/logo.{gif,jpg,jpeg,png}", "**/*{-,_}logo.{gif,jpg,jpeg,png}"],
                    dest: "build/devel/img/"
                }]
            }
        },

        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                eqnull: true,
                browser: true,
                globals: {
                    jQuery: true
                },
            },
            target: ["gruntfile.js", "js/*.js", "build/devel/js/main.js"]
        },

        // Concatenate files, but exclude some files of 'min' suffix.
        concat: {
            css: {
                src: ["font/*.css", "css/*.css", "!css/main.css","!css/*.min.css"],
                dest: "build/devel/css/main.css"
            },
            js: {
                src: ["js/*.js", "!js/main.js", "!js/*.min.js"],
                dest: "build/devel/js/main.js"
            }
        },

        // Compiling SASS files to CSS files.
        sass: {
            target: {
                files: [{
                    expand: true,
                    cwd: "sass/",
                    src: ["*.sass", "*.scss"],
                    dest: "css/",
                    ext: ".css"
                }]
            }
        },

        // Remove unused CSS.
        uncss: {
            target: {
                files: {
                    "build/devel/css/tidy.css": "build/devel/**/*.html"
                }
            }
        },

        // Minifying CSS files.
        cssmin: {
            target: {
                src: "build/devel/css/tidy.css",
                dest: "build/release/css/main.min.css"
            }
        },

        // Minifying JS files.
        uglify: {
            options: {
                mangle: false,
                compress: {
                    drop_console: true
                }
            },
            target: {
                files: [{
                    expand: true,
                    flatten: true,
                    cwd: "build/devel/js/",
                    src: "**/*.js",
                    dest: "build/release/js/",
                    ext: ".min.js",
                    extDot: "last"
                }]
            }
        },

        // Compiling Pug files to HTML files.
        pug: {
            target: {
                options: {
                    pretty: true,
                    data: function(dest, src) {
                      var files = get_files();
                      files.img.description = Object.keys(files.img.description).reduce(function(obj, i){
                        var key = files.img.description[i];
                        obj[key] = grunt.file.read("img/description/" + key);
                        return obj;
                      }, {});
                      return {
                          files: files
                      };
                    }
                },
                files: [{
                    expand: true,
                    src: ["index.pug"],
                    dest: "build/devel/",
                    ext: ".html",
                    extDot: "last"
                },{
                    expand: true,
                    cwd: "pug/",
                    src: ["*.pug"],
                    dest: "build/devel/html/",
                    ext: ".html",
                    extDot: "last"
                }]
            }
        },

        // Minifying HTML files.
        htmlmin: {
            options: {
                removeComments: true,
                collapseWhitespace: true
            },
            target: {
                files: [{
                    expand: true,
                    cwd: "build/devel/",
                    src: ["index.html", "html/*.html"],
                    dest: "build/release/"
                }]
            }
        },

        replace: {
            release: {
                src: ["build/release/index.html", "build/release/html/*.html"],
                overwrite: true,
                // NOTICE: The asterisk(*) wildcard should be in non-greedy mode.
                replacements: [{
                    from: /href="(.*?)\.css"/g,
                    to: 'href="$1.min.css"'
                },{
                    from: /src="(.*?)\.js"/g,
                    to: 'src="$1.min.js"'
                }]
            }
        },

        // Adding a banner information to some files.
        usebanner: {
            options: {
                position: "top",
                banner: "<%= create_banner() %>"
            },
            css: {
                src: "build/devel/css/main.css"
            },
            js: {
                src: "build/devel/js/main.js"
            }
        },

        clean: {
            devel: ["build/devel"],
            release: ["build/release"]
        },

        // Auxiliary method.
        create_banner: function() {
            var str = "";
            var pkg = this.pkg;

            // If 'pkg.name' is empty, the 'banner' is empty too.
            if (pkg.name) {
                str = "/*! " + pkg.name;
                str = pkg.version ? str + " v" + pkg.version : str;
                str += " " + grunt.template.today("yyyy-mm-dd");
                str = pkg.license ? str + " | " + pkg.license : str;
                str = pkg.url ? str +  " | " + pkg.url : str;
                str += " */";
            }

            return str;
        }
    });

    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-responsive-images");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-copy");
    grunt.loadNpmTasks("grunt-uncss");
    grunt.loadNpmTasks("grunt-contrib-sass");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-cssmin");
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-htmlmin");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-contrib-pug");
    grunt.loadNpmTasks("grunt-text-replace");
    grunt.loadNpmTasks("grunt-banner");

    grunt.registerTask("devel", ["sass", "concat", "jshint", "usebanner", "responsive_images", "pug", "copy:devel"]);
    grunt.registerTask("release", ["devel", "uncss", "cssmin", "uglify", "copy:release",  "htmlmin", "replace:release"]);
    grunt.registerTask("rebuild-devel", ["clean:devel", "devel"]);
    grunt.registerTask("rebuild", ["clean", "release"]);
    grunt.registerTask("default", ["release"]);
};

<|endoftext|>


<commit_before>/**
 * 	@author       Sergueï LALLEMENT <serguei.l@orange.fr>
 * 	@copyright    2014 Sergueï LALLEMENT
 */

/**
 * 	Creates a new GraphicCurve object.
 * 	The GraphicCurve is defined with a curve and some colors.
 * 	@class GraphicCurve
 * 	@classdesc yom - GraphicCurve
 * 	@constructor
 * 	@param {yom.Curve} [curve] - The curve to copy
 * 	@param {number} [zIndex] - The zIndex of the curve
 * 	@param {String} [borderColor] - The border color for the curve
 * 	@param {number} [lineWidth] - The border width (optionnal 1 is by default)
 * 	@param {String} [insideColor] - The inside color for the curve
 * 									(optionnal if unspecified it won't be filled)
 * 	@return {yom.GrapphicCurve} The GraphicCurve object
 *
 */
yom.GraphicCurve = function (curve, zIndex, borderColor, lineWidth, insideColor) {

	/**
     * 	@property {yom.curve} curve - The curve we want to display
     */
	this.curve = curve || {};

	/**
     * 	@property {String} borderColor - The border color for the curve
     */
	this.borderColor = borderColor || '#000';

	/**
     * 	@property {String} insideColor - The inside color for the curve
     */
	this.insideColor = insideColor;

	/**
     * 	@property {number} zIndex - The z index of the curve
     */
	this.zIndex = zIndex || 0;

	/**
     * 	@property {number} lineWidth - The line width of the border of the curve
     */
	this.lineWidth = lineWidth || 1;

	this.centroid = curve.centroid;
};

// ----- Method(s) ----- \\
/**
 * 	Copies this into a new object of type 'yom.GraphicCurve'
 * 	@method yom.GraphicCurve#copy
 * 	@return {yom.GraphicCurve} The new GraphicCurve object
 */
yom.GraphicCurve.prototype.copy = function () {
	return new yom.GraphicCurve(this.curve);
};

/**
 * 	Moves the graphic curve by x for the x coordinate, and by y for the y coordinate
 * 	@method yom.GraphicCurve#move
 * 	@param {number} [x=0] - The x-coordinate offset
 * 	@param {number} [y=0] - The y-coordinate offset
 */
yom.GraphicCurve.prototype.move = function (x, y) {
	this.curve.move(x, y);
};

/**
 * 	Draw the graphic curve.
 * 	@method yom.GraphicCurve#draw
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
yom.GraphicCurve.prototype.draw = function(drawManager) {
	drawManager.drawCurve(this);
};

/**
 * 	Fill the graphic curve with color.
 * 	@method yom.GraphicCurve#fillWithColor
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
yom.GraphicCurve.prototype.fillWithColor = function(drawManager) {
	drawManager.fillCurveWithColor(this);
};

/**
 * 	Fill the graphic curve with image.
 * 	@method yom.GraphicCurve#fillWithImage
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
// TODO
yom.GraphicCurve.prototype.fillWithImage = function(drawManager) {
	drawManager.drawCurve(this);
};

/**
 * 	Render the curve
 * 	@method yom.GraphicCurve#render
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
yom.GraphicCurve.prototype.render = function(drawManager) {
	this.draw(drawManager);
};
<commit_msg>Fixed function copy for GraphicCurve<commit_after>/**
 * 	@author       Sergueï LALLEMENT <serguei.l@orange.fr>
 * 	@copyright    2014 Sergueï LALLEMENT
 */

/**
 * 	Creates a new GraphicCurve object.
 * 	The GraphicCurve is defined with a curve and some colors.
 * 	@class GraphicCurve
 * 	@classdesc yom - GraphicCurve
 * 	@constructor
 * 	@param {yom.Curve} [curve] - The curve to copy
 * 	@param {number} [zIndex] - The zIndex of the curve
 * 	@param {String} [borderColor] - The border color for the curve
 * 	@param {number} [lineWidth] - The border width (optionnal 1 is by default)
 * 	@param {String} [insideColor] - The inside color for the curve
 * 									(optionnal if unspecified it won't be filled)
 * 	@return {yom.GrapphicCurve} The GraphicCurve object
 *
 */
yom.GraphicCurve = function (curve, zIndex, borderColor, lineWidth, insideColor) {

	/**
     * 	@property {yom.curve} curve - The curve we want to display
     */
	this.curve = curve || {};

	/**
     * 	@property {String} borderColor - The border color for the curve
     */
	this.borderColor = borderColor || '#000';

	/**
     * 	@property {String} insideColor - The inside color for the curve
     */
	this.insideColor = insideColor;

	/**
     * 	@property {number} zIndex - The z index of the curve
     */
	this.zIndex = zIndex || 0;

	/**
     * 	@property {number} lineWidth - The line width of the border of the curve
     */
	this.lineWidth = lineWidth || 1;

	this.centroid = curve.centroid;
};

// ----- Method(s) ----- \\
/**
 * 	Copies this into a new object of type 'yom.GraphicCurve'
 * 	@method yom.GraphicCurve#copy
 * 	@return {yom.GraphicCurve} The new GraphicCurve object
 */
yom.GraphicCurve.prototype.copy = function () {
	return new yom.GraphicCurve(this.curve, this.zIndex, this.borderColor, this.lineWidth, this.insideColor);
};

/**
 * 	Moves the graphic curve by x for the x coordinate, and by y for the y coordinate
 * 	@method yom.GraphicCurve#move
 * 	@param {number} [x=0] - The x-coordinate offset
 * 	@param {number} [y=0] - The y-coordinate offset
 */
yom.GraphicCurve.prototype.move = function (x, y) {
	this.curve.move(x, y);
};

/**
 * 	Draw the graphic curve.
 * 	@method yom.GraphicCurve#draw
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
yom.GraphicCurve.prototype.draw = function(drawManager) {
	drawManager.drawCurve(this);
};

/**
 * 	Fill the graphic curve with color.
 * 	@method yom.GraphicCurve#fillWithColor
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
yom.GraphicCurve.prototype.fillWithColor = function(drawManager) {
	drawManager.fillCurveWithColor(this);
};

/**
 * 	Fill the graphic curve with image.
 * 	@method yom.GraphicCurve#fillWithImage
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
// TODO
yom.GraphicCurve.prototype.fillWithImage = function(drawManager) {
	drawManager.drawCurve(this);
};

/**
 * 	Render the curve
 * 	@method yom.GraphicCurve#render
 * 	@param {yom.DrawManager} [drawManager] - The drawManager object
 */
yom.GraphicCurve.prototype.render = function(drawManager) {
	this.draw(drawManager);
};
<|endoftext|>