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

  var path = require("path");
  var cwd = process.cwd();

  var tsJSON = {
    dev: {
      src: ["src/**/*.ts", "typings/**/*.d.ts"],
      outDir: "build/src/",
      options: {
        target: 'es5',
        noImplicitAny: true,
        sourceMap: false,
        declaration: true,
        removeComments: false
      }
    },
    test: {
      src: ["test/*.ts", "typings/**/*.d.ts", "build/plottable.d.ts"],
      outDir: "build/test/",
      // watch: "test",
      options: {
        target: 'es5',
        sourceMap: false,
        noImplicitAny: true,
        declaration: false,
        removeComments: false
      }
    },
    verify_d_ts: {
      src: ["typings/d3/d3.d.ts", "plottable.d.ts"]
    }
  };

  var bumpJSON = {
    options: {
      files: ['package.json', 'bower.json'],
      updateConfigs: ['pkg'],
      commit: false,
      createTag: false,
      push: false
    }
  }

  var FILES_TO_COMMIT = ['plottable.js',
                         'plottable.min.js',
                         'plottable.d.ts',
                         'examples/exampleUtil.js',
                         'test/tests.js',
                         "plottable.css",
                         "plottable.zip",
                         "bower.json",
                         "package.json"];

  var prefixMatch = "\\n *";
  var varNameMatch = "[^(:;]*(\\([^)]*\\))?"; // catch function args too
  var nestedBraceMatch = ": \\{[^{}]*\\}";
  var typeNameMatch = ": [^;]*";
  var finalMatch = "((" + nestedBraceMatch + ")|(" + typeNameMatch + "))?\\n?;"
  var jsdoc_init = "\\n *\\/\\*\\* *\\n";
  var jsdoc_mid = "( *\\*[^\\n]*\\n)+";
  var jsdoc_end = " *\\*\\/ *";
  var jsdoc = "(" + jsdoc_init + jsdoc_mid + jsdoc_end + ")?";

  var sedJSON = {
    private_definitions: {
      pattern: jsdoc + prefixMatch + "private " + varNameMatch + finalMatch,
      replacement: "",
      path: "build/plottable.d.ts",
    },
    protected_definitions: {
      pattern: jsdoc + prefixMatch + "public _" + varNameMatch + finalMatch,
      replacement: "",
      path: "plottable.d.ts",
    },
    plottable_multifile: {
      pattern: '/// *<reference path="([^."]*).ts" */>',
      replacement: 'synchronousRequire("/build/src/$1.js");',
      path: "plottable_multifile.js",
    },
    definitions: {
      pattern: '/// *<reference path=".*" */>',
      replacement: "",
      path: "build/plottable.d.ts",
    },
    tests_multifile: {
      pattern: '/// *<reference path="([^."]*).ts" */>',
      replacement: 'synchronousRequire("/build/test/$1.js");',
      path: "test/tests_multifile.js",
    },
    sublime: {
      pattern: "(.*\\.ts)",
      replacement: '/// <reference path="../$1" />',
      path: "build/sublime.d.ts",
    },
    version_number: {
      pattern: "@VERSION",
      replacement: "<%= pkg.version %>",
      path: "plottable.js"
    }
  };

  // e.g. ["components/foo.ts", ...]
  // the important thing is that they are sorted by hierarchy,
  // leaves first, roots last
  var tsFiles;
  // since src/reference.ts might have changed, I need to update this
  // on each recompile
  var updateTsFiles = function() {
    tsFiles = grunt.file.read("src/reference.ts")
                  .split("\n")
                  .filter(function(s) {
                    return s !== "";
                  })
                  .map(function(s) {
                    return s.match(/"(.*\.ts)"/)[1];
                  });
  };
  updateTsFiles();

  var testTsFiles;
  var updateTestTsFiles = function() {
    testTsFiles = grunt.file.read("test/testReference.ts")
                  .split("\n")
                  .filter(function(s) {
                    return s !== "";
                  })
                  .map(function(s) {
                    return s.match(/"(.*\.ts)"/)[1];
                  });
  };
  updateTestTsFiles();

  var browsers = [{
    browserName: "firefox",
    version: "30",
    platform: "WIN7"
  }, {
    browserName: "firefox",
    version: "30",
    platform: "linux"
  }, {
    browserName: "firefox",
    version: "30",
    platform: "OS X 10.9"
  }, {
    browserName: "chrome",
    version: "35",
    platform: "XP"
  }, {
    browserName: "chrome",
    version: "35",
    platform: "linux"
  }, {
    browserName: "chrome",
    version: "35",
    platform: "OS X 10.9",
  }, {
    browserName: "internet explorer",
    version: "10",
    platform: "WIN8"
  }, {
    browserName: "internet explorer",
    version: "9",
    platform: "WIN7"
  }];

  var configJSON = {
    pkg: grunt.file.readJSON("package.json"),
    bump: bumpJSON,
    concat: {
      header: {
        src: ["license_header.txt", "plottable.js"],
        dest: "plottable.js",
      },
      plottable_multifile: {
        src: ["synchronousRequire.js", "src/reference.ts"],
        dest: "plottable_multifile.js",
      },
      tests_multifile: {
        src: ["synchronousRequire.js", "test/testReference.ts"],
        dest: "test/tests_multifile.js",
      },
      plottable: {
        src: tsFiles.map(function(s) {
              return "build/src/" + s.replace(".ts", ".js");
          }),
        dest: "plottable.js",
      },
      tests: {
        src: testTsFiles.map(function(s) {
              return "build/test/" + s.replace(".ts", ".js");
          }),
        dest: "test/tests.js",
      },
      definitions: {
        src: tsFiles.map(function(s) {
              return "build/src/" + s.replace(".ts", ".d.ts");
          }),
        dest: "build/plottable.d.ts",
      },
    },
    ts: tsJSON,
    tslint: {
      options: {
        configuration: grunt.file.readJSON("tslint.json")
      },
      files: ["src/**/*.ts", "test/**.ts"]
    },
    watch: {
      "options": {
        livereload: true
      },
      "rebuild": {
        "tasks": ["dev-compile"],
        "files": ["src/**/*.ts", "examples/**/*.ts"]
      },
      "tests": {
        "tasks": ["test-compile"],
        "files": ["test/**.ts"]
      }
    },
    blanket_mocha: {
      all: ['test/coverage.html'],
      options: {
        threshold: 70
      }
    },
    connect: {
      server: {
        options: {
          port: 9999,
          base: ""
        }
      }
    },
    clean: {
      tscommand: ["tscommand*.tmp.txt"]
    },
    sed: sedJSON,
    gitcommit: {
      version: {
        options: {
          message: "Release version <%= pkg.version %>"
        },
        files: {
          src: FILES_TO_COMMIT
        }
      },
      built: {
        options: {
          message: "Update built files"
        },
        files: {
          src: FILES_TO_COMMIT
        }
      }
    },
    compress: {
      main: {
        options: {
          archive: 'plottable.zip'
        },
        files: [
        {src: 'plottable.js'  , dest: '.'},
        {src: 'plottable.min.js', dest: '.'},
        {src: 'plottable.d.ts', dest: '.'},
        {src: 'plottable.css' , dest: '.'},
        {src: 'README.md'     , dest: '.'},
        {src: 'LICENSE'       , dest: '.'}]
      }
    },
    uglify: {
      main: {
        files: {'plottable.min.js': ['plottable.js']}
      }
    },
    shell: {
      sublime: {
        command: "(echo 'src/reference.ts'; find typings -name '*.d.ts') > build/sublime.d.ts",
      },
    },
    'saucelabs-mocha': {
      all: {
        options: {
          urls: ['http://127.0.0.1:9999/test/tests.html'],
          testname: 'Plottable Sauce Unit Tests',
          browsers: browsers,
        }
      }
    }
  };

  // project configuration
  grunt.initConfig(configJSON);

  grunt.loadNpmTasks('grunt-saucelabs');

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

  // default task (this is what runs when a task isn't specified)
  grunt.registerTask("update_ts_files", updateTsFiles);
  grunt.registerTask("update_test_ts_files", updateTestTsFiles);
  grunt.registerTask("definitions_prod", function() {
    grunt.file.copy("build/plottable.d.ts", "plottable.d.ts");
  });
  grunt.registerTask("test-compile", [
                                  "ts:test",
                                  "concat:tests_multifile",
                                  "sed:tests_multifile",
                                  "concat:tests",
                                  ]);
  grunt.registerTask("default", "launch");
  grunt.registerTask("dev-compile", [
                                  "update_ts_files",
                                  "update_test_ts_files",
                                  "ts:dev",
                                  "concat:plottable",
                                  "concat:definitions",
                                  "sed:definitions",
                                  "sed:private_definitions",
                                  "concat:header",
                                  "sed:version_number",
                                  "definitions_prod",
                                  "test-compile",
                                  "sed:protected_definitions",
                                  "concat:plottable_multifile",
                                  "sed:plottable_multifile",
                                  "clean:tscommand"]);

  grunt.registerTask("release:patch", ["bump:patch", "dist-compile", "gitcommit:version"]);
  grunt.registerTask("release:minor", ["bump:minor", "dist-compile", "gitcommit:version"]);
  grunt.registerTask("release:major", ["bump:major", "dist-compile", "gitcommit:version"]);

  grunt.registerTask("dist-compile", [
                                  "dev-compile",
                                  "blanket_mocha",
                                  "tslint",
                                  "ts:verify_d_ts",
                                  "uglify",
                                  "compress"
                                  ]);

  grunt.registerTask("commitjs", ["dist-compile", "gitcommit:built"]);

  grunt.registerTask("launch", ["connect", "dev-compile", "watch"]);
  grunt.registerTask("test", ["dev-compile", "blanket_mocha", "saucelabs-mocha", "tslint", "ts:verify_d_ts"]);
  grunt.registerTask("bm", ["blanket_mocha"]);

  grunt.registerTask("sublime", [
                                  "shell:sublime",
                                  "sed:sublime",
                                  ]);

  grunt.registerTask("test-sauce", ["connect", "saucelabs-mocha"]);
};
<commit_msg>testing push again<commit_after>module.exports = function(grunt) {
  "use strict";

  var path = require("path");
  var cwd = process.cwd();

  var tsJSON = {
    dev: {
      src: ["src/**/*.ts", "typings/**/*.d.ts"],
      outDir: "build/src/",
      options: {
        target: 'es5',
        noImplicitAny: true,
        sourceMap: false,
        declaration: true,
        removeComments: false
      }
    },
    test: {
      src: ["test/*.ts", "typings/**/*.d.ts", "build/plottable.d.ts"],
      outDir: "build/test/",
      // watch: "test",
      options: {
        target: 'es5',
        sourceMap: false,
        noImplicitAny: true,
        declaration: false,
        removeComments: false
      }
    },
    verify_d_ts: {
      src: ["typings/d3/d3.d.ts", "plottable.d.ts"]
    }
  };

  var bumpJSON = {
    options: {
      files: ['package.json', 'bower.json'],
      updateConfigs: ['pkg'],
      commit: false,
      createTag: false,
      push: false
    }
  }

  var FILES_TO_COMMIT = ['plottable.js',
                         'plottable.min.js',
                         'plottable.d.ts',
                         'examples/exampleUtil.js',
                         'test/tests.js',
                         "plottable.css",
                         "plottable.zip",
                         "bower.json",
                         "package.json"];

  var prefixMatch = "\\n *";
  var varNameMatch = "[^(:;]*(\\([^)]*\\))?"; // catch function args too
  var nestedBraceMatch = ": \\{[^{}]*\\}";
  var typeNameMatch = ": [^;]*";
  var finalMatch = "((" + nestedBraceMatch + ")|(" + typeNameMatch + "))?\\n?;"
  var jsdoc_init = "\\n *\\/\\*\\* *\\n";
  var jsdoc_mid = "( *\\*[^\\n]*\\n)+";
  var jsdoc_end = " *\\*\\/ *";
  var jsdoc = "(" + jsdoc_init + jsdoc_mid + jsdoc_end + ")?";

  var sedJSON = {
    private_definitions: {
      pattern: jsdoc + prefixMatch + "private " + varNameMatch + finalMatch,
      replacement: "",
      path: "build/plottable.d.ts",
    },
    protected_definitions: {
      pattern: jsdoc + prefixMatch + "public _" + varNameMatch + finalMatch,
      replacement: "",
      path: "plottable.d.ts",
    },
    plottable_multifile: {
      pattern: '/// *<reference path="([^."]*).ts" */>',
      replacement: 'synchronousRequire("/build/src/$1.js");',
      path: "plottable_multifile.js",
    },
    definitions: {
      pattern: '/// *<reference path=".*" */>',
      replacement: "",
      path: "build/plottable.d.ts",
    },
    tests_multifile: {
      pattern: '/// *<reference path="([^."]*).ts" */>',
      replacement: 'synchronousRequire("/build/test/$1.js");',
      path: "test/tests_multifile.js",
    },
    sublime: {
      pattern: "(.*\\.ts)",
      replacement: '/// <reference path="../$1" />',
      path: "build/sublime.d.ts",
    },
    version_number: {
      pattern: "@VERSION",
      replacement: "<%= pkg.version %>",
      path: "plottable.js"
    }
  };

  // e.g. ["components/foo.ts", ...]
  // the important thing is that they are sorted by hierarchy,
  // leaves first, roots last
  var tsFiles;
  // since src/reference.ts might have changed, I need to update this
  // on each recompile
  var updateTsFiles = function() {
    tsFiles = grunt.file.read("src/reference.ts")
                  .split("\n")
                  .filter(function(s) {
                    return s !== "";
                  })
                  .map(function(s) {
                    return s.match(/"(.*\.ts)"/)[1];
                  });
  };
  updateTsFiles();

  var testTsFiles;
  var updateTestTsFiles = function() {
    testTsFiles = grunt.file.read("test/testReference.ts")
                  .split("\n")
                  .filter(function(s) {
                    return s !== "";
                  })
                  .map(function(s) {
                    return s.match(/"(.*\.ts)"/)[1];
                  });
  };
  updateTestTsFiles();

  var browsers = [{
    browserName: "firefox",
    version: "30",
    platform: "WIN7"
  }, {
    browserName: "firefox",
    version: "30",
    platform: "linux"
  }, {
    browserName: "firefox",
    version: "30",
    platform: "OS X 10.9"
  }, {
    browserName: "chrome",
    version: "35",
    platform: "XP"
  }, {
    browserName: "chrome",
    version: "35",
    platform: "linux"
  }, {
    browserName: "chrome",
    version: "35",
    platform: "OS X 10.9",
  }, {
    browserName: "internet explorer",
    version: "10",
    platform: "WIN8"
  // }, {
  //   browserName: "internet explorer",
  //   version: "9",
  //   platform: "WIN7"
  }];

  var configJSON = {
    pkg: grunt.file.readJSON("package.json"),
    bump: bumpJSON,
    concat: {
      header: {
        src: ["license_header.txt", "plottable.js"],
        dest: "plottable.js",
      },
      plottable_multifile: {
        src: ["synchronousRequire.js", "src/reference.ts"],
        dest: "plottable_multifile.js",
      },
      tests_multifile: {
        src: ["synchronousRequire.js", "test/testReference.ts"],
        dest: "test/tests_multifile.js",
      },
      plottable: {
        src: tsFiles.map(function(s) {
              return "build/src/" + s.replace(".ts", ".js");
          }),
        dest: "plottable.js",
      },
      tests: {
        src: testTsFiles.map(function(s) {
              return "build/test/" + s.replace(".ts", ".js");
          }),
        dest: "test/tests.js",
      },
      definitions: {
        src: tsFiles.map(function(s) {
              return "build/src/" + s.replace(".ts", ".d.ts");
          }),
        dest: "build/plottable.d.ts",
      },
    },
    ts: tsJSON,
    tslint: {
      options: {
        configuration: grunt.file.readJSON("tslint.json")
      },
      files: ["src/**/*.ts", "test/**.ts"]
    },
    watch: {
      "options": {
        livereload: true
      },
      "rebuild": {
        "tasks": ["dev-compile"],
        "files": ["src/**/*.ts", "examples/**/*.ts"]
      },
      "tests": {
        "tasks": ["test-compile"],
        "files": ["test/**.ts"]
      }
    },
    blanket_mocha: {
      all: ['test/coverage.html'],
      options: {
        threshold: 70
      }
    },
    connect: {
      server: {
        options: {
          port: 9999,
          base: ""
        }
      }
    },
    clean: {
      tscommand: ["tscommand*.tmp.txt"]
    },
    sed: sedJSON,
    gitcommit: {
      version: {
        options: {
          message: "Release version <%= pkg.version %>"
        },
        files: {
          src: FILES_TO_COMMIT
        }
      },
      built: {
        options: {
          message: "Update built files"
        },
        files: {
          src: FILES_TO_COMMIT
        }
      }
    },
    compress: {
      main: {
        options: {
          archive: 'plottable.zip'
        },
        files: [
        {src: 'plottable.js'  , dest: '.'},
        {src: 'plottable.min.js', dest: '.'},
        {src: 'plottable.d.ts', dest: '.'},
        {src: 'plottable.css' , dest: '.'},
        {src: 'README.md'     , dest: '.'},
        {src: 'LICENSE'       , dest: '.'}]
      }
    },
    uglify: {
      main: {
        files: {'plottable.min.js': ['plottable.js']}
      }
    },
    shell: {
      sublime: {
        command: "(echo 'src/reference.ts'; find typings -name '*.d.ts') > build/sublime.d.ts",
      },
    },
    'saucelabs-mocha': {
      all: {
        options: {
          urls: ['http://127.0.0.1:9999/test/tests.html'],
          testname: 'Plottable Sauce Unit Tests',
          browsers: browsers,
        }
      }
    }
  };

  // project configuration
  grunt.initConfig(configJSON);

  grunt.loadNpmTasks('grunt-saucelabs');

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

  // default task (this is what runs when a task isn't specified)
  grunt.registerTask("update_ts_files", updateTsFiles);
  grunt.registerTask("update_test_ts_files", updateTestTsFiles);
  grunt.registerTask("definitions_prod", function() {
    grunt.file.copy("build/plottable.d.ts", "plottable.d.ts");
  });
  grunt.registerTask("test-compile", [
                                  "ts:test",
                                  "concat:tests_multifile",
                                  "sed:tests_multifile",
                                  "concat:tests",
                                  ]);
  grunt.registerTask("default", "launch");
  grunt.registerTask("dev-compile", [
                                  "update_ts_files",
                                  "update_test_ts_files",
                                  "ts:dev",
                                  "concat:plottable",
                                  "concat:definitions",
                                  "sed:definitions",
                                  "sed:private_definitions",
                                  "concat:header",
                                  "sed:version_number",
                                  "definitions_prod",
                                  "test-compile",
                                  "sed:protected_definitions",
                                  "concat:plottable_multifile",
                                  "sed:plottable_multifile",
                                  "clean:tscommand"]);

  grunt.registerTask("release:patch", ["bump:patch", "dist-compile", "gitcommit:version"]);
  grunt.registerTask("release:minor", ["bump:minor", "dist-compile", "gitcommit:version"]);
  grunt.registerTask("release:major", ["bump:major", "dist-compile", "gitcommit:version"]);

  grunt.registerTask("dist-compile", [
                                  "dev-compile",
                                  "blanket_mocha",
                                  "tslint",
                                  "ts:verify_d_ts",
                                  "uglify",
                                  "compress"
                                  ]);

  grunt.registerTask("commitjs", ["dist-compile", "gitcommit:built"]);

  grunt.registerTask("launch", ["connect", "dev-compile", "watch"]);
  grunt.registerTask("test", ["dev-compile", "blanket_mocha", "saucelabs-mocha", "tslint", "ts:verify_d_ts"]);
  grunt.registerTask("bm", ["blanket_mocha"]);

  grunt.registerTask("sublime", [
                                  "shell:sublime",
                                  "sed:sublime",
                                  ]);

  grunt.registerTask("test-sauce", ["connect", "saucelabs-mocha"]);
};
<|endoftext|>


<commit_before>#!/usr/bin/env node
/*!
 * -----------
 * ASPDB®-Data
 * -----------
 * Data of ASPDB — A manually curated dedicated acid shock proteins database.
 * ___________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * ___________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ___________________________________________________________________________
 *
 * @date      : 10-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * ___________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "ASPDB®-Data".
 * ___________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";
<commit_msg>Initial commit<commit_after>#!/usr/bin/env node
/*!
 * -----------
 * ASPDB®-Data
 * -----------
 * Data of ASPDB — A manually curated dedicated acid shock proteins database.
 * ___________________________________________________________________________
 *
 * Grunt, http://gruntjs.com/ — The JavaScript Task Runner.
 * ___________________________________________________________________________
 *
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Prabhat Kumar [http://prabhatkumar.org/].
 * @copyright : Sequømics Research [http://research.sequomics.com/].
 * @copyright : Sequømics Corporation [http://sequomics.com/].
 * ___________________________________________________________________________
 *
 * @date      : 10-Dec-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * @require   : grunt-cli
 * @build     : SEED™ — Skövde
 *              └────── A Sequømics Product — http://seed.sequomics.com/.
 * ___________________________________________________________________________
 *
 * --/The Heart of Build System/-- of "ASPDB®-Data".
 * ___________________________________________________________________________
 */

// global __dirname: true
// global require: true

// # Usage: $ node -v
// # Usage: $ npm -v
// # Usage: $ grunt -version

// Invoking strict mode.
"use strict";

// To load required Node module.
// -----------------------------
var os         = require('os');
<|endoftext|>


<commit_before>// Generated on 2014-03-28 using generator-phaser-official 0.0.8-rc-2
'use strict';
var config = require('./config.json');
var _ = require('underscore');
_.str = require('underscore.string');

// Mix in non-conflict functions to Underscore namespace if you want
_.mixin(_.str.exports());

var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

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

  grunt.initConfig({
    manifest: grunt.file.readJSON('manifest.json'),
    watch: {
      scripts: {
        files: [
          'game/**/*.js',
          '!game/main.js',
          'templates/*.js.tpl',
          'config.json',
          'css/**/*.css'
        ],
        options: {
          spawn: false,
          livereload: LIVERELOAD_PORT
        },
        tasks: ['build']
      }
    },
    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, 'dist')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://localhost:9000'
      }
    },
    copy: {
      dist: {
        files: [
          // includes files within path and its sub-directories
          { expand: true, src: ['assets/**'], dest: 'dist/' },
          { expand: true, src: ['fonts/**'], dest: 'dist/' },
          { expand: true, src: ['css/**'], dest: 'dist/' },
          { expand: true, flatten: true, src: ['game/plugins/*.js'], dest: 'dist/' },
          { expand: true, flatten: true, src: ['bower_components/**/build/*.js'], dest: 'dist/' },
          { expand: true, src: ['icon.png'], dest: 'dist/' },
          { expand: true, src: ['manifest.json'], dest: 'dist/' },
          { expand: true, src: ['index.html'], dest: 'dist/' }
        ]
      },
      dev: {
        files: [
          { src: 'game/config/config.dev.json', dest: 'game/config.json' }
        ]
      },
      prod: {
        files: [
          { src: 'game/config/config.prod.json', dest: 'game/config.json' }
        ]
      }
    },
    browserify: {
      build: {
        src: ['game/main.js'],
        dest: 'dist/game.js'
      }
    },
    shell: {
      options: {
        stderr: false
      },
      buildAndroid: {
        command: "./build_android.sh <%= manifest.package %> <%= manifest.name %> <%= manifest.version %>"
      },
      installAndroidx86: {
        command: "adb install -r build/<%= manifest.name %>_<%= manifest.version %>_x86.apk"
      },
      installAndroidarm: {
        command: "adb install -r build/<%= manifest.name %>_<%= manifest.version %>_arm.apk"
      },
      restartAdb: {
        command: [
          'sudo $(which adb) kill-server',
          'sudo $(which adb) start-server',
          'adb devices'
        ].join('&&')
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json', 'manifest.json'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release %VERSION%',
        commitFiles: ['package.json', 'bower.json', 'manifest.json'],
        createTag: true,
        tagName: '%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: false,
        pushTo: 'upstream',
        gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
      }
    },
    jshint: {
      all: ['game/**/*.js', 'Gruntfile.js'],
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      }
    },
    jscs: {
      src: [
        'game/**/*.js',
        '!game/main.js'
      ],
      options: {
        config: '.jscsrc'
      }
    },
    githooks: {
      all: {
        // Will run the jshint and test:unit tasks at every commit
        'pre-commit': 'jshint jscs',
      }
    },
    clean: {
      serve: ['dist'],
      build: ['dist', 'build'],
    },
  });

  grunt.registerTask('default', 'serve');
  grunt.registerTask('build', function(env) {
    grunt.task.run(['buildBootstrapper', 'copy:' + env || 'dev', 'browserify', 'copy:dist']);
  });
  grunt.registerTask('serve', function(env) {
    grunt.task.run(['githooks', 'clean:serve', 'build:' + env || 'dev', 'connect:livereload', 'open', 'watch']);
  });
  grunt.registerTask('buildAndroid', function(env) {
    grunt.task.run(['clean:build', 'build:' + env || 'prod', 'shell:buildAndroid']);
  });
  grunt.registerTask('restartAdb', ['shell:restartAdb']);
  grunt.registerTask('installAndroid', function(arch) {
    // arch is x86 (Intel based tablets) or arm (non-Intel)
    grunt.task.run(['shell:installAndroid' + arch || 'arm']);
  });
  grunt.registerTask('buildBootstrapper', 'builds the bootstrapper file correctly', function() {
    var stateFiles = grunt.file.expand('game/states/*.js');
    var gameStates = [];
    var statePattern = new RegExp(/(\w+).js$/);
    stateFiles.forEach(function(file) {
      var state = file.match(statePattern)[1];
      if (!!state) {
        gameStates.push({shortName: state, stateName: _.capitalize(state) + 'State'});
      }
    });
    config.gameStates = gameStates;
    console.log(config);
    var bootstrapper = grunt.file.read('templates/_main.js.tpl');
    bootstrapper = grunt.template.process(bootstrapper,{data: config});
    grunt.file.write('game/main.js', bootstrapper);
  });
};
<commit_msg>fix(config): fixes grunt tasks default parameters<commit_after>// Generated on 2014-03-28 using generator-phaser-official 0.0.8-rc-2
'use strict';
var config = require('./config.json');
var _ = require('underscore');
_.str = require('underscore.string');

// Mix in non-conflict functions to Underscore namespace if you want
_.mixin(_.str.exports());

var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

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

  grunt.initConfig({
    manifest: grunt.file.readJSON('manifest.json'),
    watch: {
      scripts: {
        files: [
          'game/**/*.js',
          '!game/main.js',
          'templates/*.js.tpl',
          'config.json',
          'css/**/*.css'
        ],
        options: {
          spawn: false,
          livereload: LIVERELOAD_PORT
        },
        tasks: ['build']
      }
    },
    connect: {
      options: {
        port: 9000,
        // change this to '0.0.0.0' to access the server from outside
        hostname: 'localhost'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, 'dist')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://localhost:9000'
      }
    },
    copy: {
      dist: {
        files: [
          // includes files within path and its sub-directories
          { expand: true, src: ['assets/**'], dest: 'dist/' },
          { expand: true, src: ['fonts/**'], dest: 'dist/' },
          { expand: true, src: ['css/**'], dest: 'dist/' },
          { expand: true, flatten: true, src: ['game/plugins/*.js'], dest: 'dist/' },
          { expand: true, flatten: true, src: ['bower_components/**/build/*.js'], dest: 'dist/' },
          { expand: true, src: ['icon.png'], dest: 'dist/' },
          { expand: true, src: ['manifest.json'], dest: 'dist/' },
          { expand: true, src: ['index.html'], dest: 'dist/' }
        ]
      },
      dev: {
        files: [
          { src: 'game/config/config.dev.json', dest: 'game/config.json' }
        ]
      },
      prod: {
        files: [
          { src: 'game/config/config.prod.json', dest: 'game/config.json' }
        ]
      }
    },
    browserify: {
      build: {
        src: ['game/main.js'],
        dest: 'dist/game.js'
      }
    },
    shell: {
      options: {
        stderr: false
      },
      buildAndroid: {
        command: "./build_android.sh <%= manifest.package %> <%= manifest.name %> <%= manifest.version %>"
      },
      installAndroidx86: {
        command: "adb install -r build/<%= manifest.name %>_<%= manifest.version %>_x86.apk"
      },
      installAndroidarm: {
        command: "adb install -r build/<%= manifest.name %>_<%= manifest.version %>_arm.apk"
      },
      restartAdb: {
        command: [
          'sudo $(which adb) kill-server',
          'sudo $(which adb) start-server',
          'adb devices'
        ].join('&&')
      }
    },
    bump: {
      options: {
        files: ['package.json', 'bower.json', 'manifest.json'],
        updateConfigs: [],
        commit: true,
        commitMessage: 'Release %VERSION%',
        commitFiles: ['package.json', 'bower.json', 'manifest.json'],
        createTag: true,
        tagName: '%VERSION%',
        tagMessage: 'Version %VERSION%',
        push: false,
        pushTo: 'upstream',
        gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d'
      }
    },
    jshint: {
      all: ['game/**/*.js', 'Gruntfile.js'],
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      }
    },
    jscs: {
      src: [
        'game/**/*.js',
        '!game/main.js'
      ],
      options: {
        config: '.jscsrc'
      }
    },
    githooks: {
      all: {
        // Will run the jshint and test:unit tasks at every commit
        'pre-commit': 'jshint jscs',
      }
    },
    clean: {
      serve: ['dist'],
      build: ['dist', 'build'],
    },
  });

  grunt.registerTask('default', 'serve');
  grunt.registerTask('build', ['buildBootstrapper', 'browserify', 'copy:dist']);
  grunt.registerTask('serve', function(env) {
    grunt.task.run(['githooks', 'clean:serve', 'copy:' + (env || 'dev'), 'build', 'connect:livereload', 'open', 'watch']);
  });
  grunt.registerTask('buildAndroid', function(env) {
    grunt.task.run(['clean:build', 'copy:' + (env || 'prod'), 'build', 'shell:buildAndroid']);
  });
  grunt.registerTask('restartAdb', ['shell:restartAdb']);
  grunt.registerTask('installAndroid', function(arch) {
    // arch is x86 (Intel based tablets) or arm (non-Intel)
    grunt.task.run(['shell:installAndroid' + (arch || 'arm')]);
  });
  grunt.registerTask('buildBootstrapper', 'builds the bootstrapper file correctly', function() {
    var stateFiles = grunt.file.expand('game/states/*.js');
    var gameStates = [];
    var statePattern = new RegExp(/(\w+).js$/);
    stateFiles.forEach(function(file) {
      var state = file.match(statePattern)[1];
      if (!!state) {
        gameStates.push({shortName: state, stateName: _.capitalize(state) + 'State'});
      }
    });
    config.gameStates = gameStates;
    console.log(config);
    var bootstrapper = grunt.file.read('templates/_main.js.tpl');
    bootstrapper = grunt.template.process(bootstrapper,{data: config});
    grunt.file.write('game/main.js', bootstrapper);
  });
};
<|endoftext|>


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

	// set Underscore as a shortcut
	var _ = grunt.util._;

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

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

		, jshint: {
			all: ['Gruntfile.js', 'src/js/*.js']
			, options: {
				laxbreak: true
				, laxcomma: true
				, smarttabs: true
			}
		}

		, clean: {
			dist: ['dist']
		}

		, copy: {
			data: {
				files: [
					{ expand: true, flatten: true, src: ['src/data/*'], dest: 'dist/data' }
				]
			}
			, tpl: {
				files: [
					{ expand: true, flatten: true, src: ['src/tpl/*'], dest: 'dist/tpl' }
				]
			}
			, js: {
				files: [
					{ expand: true, flatten: true, src: ['src/js/*.js'], dest: 'dist/js' }
					, { expand: true, flatten: true, src: ['bower_components/requirejs/require.js'], dest: 'dist/js' }
				]
			}
		}

		, less: {
			styles: {
				options: {
					paths: ["src/less"]
					, yuicompress: true
				}
				, files: {
					"dist/css/styles.css": [
						"bower_components/bootstrap/dist/css/bootstrap.min.css"
						, "src/less/main.less"
					]
				}
			}
		}

		, requirejs: {
			app: {
				options: {
					baseUrl : "src/js"
					, mainConfigFile: "src/js/app.js"
					, out: "dist/js/app.js"
					, name: "app"
					, optimizeCss: "none"
					, fileExclusionRegExp: /^\./
					, optimize: 'uglify'
					, preserveLicenseComments: true
				}
			}
		}

		, html: {
			dist: {}
		}

		, watch: {
			js: {
				files: ['src/js/*.js']
				, tasks: ['jshint', 'copy:js']
				, options: {
					spawn: false
				}
			}
			, css: {
				files: ['src/less/*.less']
				, tasks: ['less']
				, options: {
					spawn: false
				}
			}
			, html: {
				files: ['src/data/**', 'src/*.html', 'src/partials/*.html']
				, tasks: ['html']
				, options: {
					spawn: false
				}
			}
			, data: {
				files: ['src/data/**', 'src/tpl/**']
				, tasks: ['copy:data', 'copy:tpl']
				, options: {
					spawn: false
				}
			}
		}
	});

	// Generating html pages
	grunt.registerMultiTask('html', 'Generating html pages', function () {
		var
			data = grunt.file.readJSON('src/data/data.json')
			, includes = {
				header: grunt.file.read('src/partials/header.html')
				, footer: grunt.file.read('src/partials/footer.html')
				, works: grunt.file.read('src/partials/works.html')
			}
			, options = { encoding : 'utf8' }
		;

		/**
		 * Process the HTML page for the work
		 * @param	{object} work Object including name, title and can include works
		 */
		function processWork(work) {
			var
				srcPath = 'src/' + work.name + '.html'
				, destPath = 'dist/' + work.name + '.html'
			;

			// if file does not exists, get the template
			if (!grunt.file.exists(srcPath)) {
				srcPath = 'src/partials/tpl-' + (work.works ? 'parent' : 'work') + '.html';
			}

			// copy the file
			grunt.file.copy(srcPath, destPath, options);

			// read the file
			grunt.log.writeln(('Reading "' + destPath + '".').green);
			var fileContent = grunt.file.read(destPath);

			// replace the includes
			_.each(includes, function (include, ind) {
				grunt.log.writeln('Replacing "' + ind + '" inclusion.');
				fileContent = fileContent.replace(new RegExp('@@include.' + ind, "g"), include);
			});

			// process the template
			var tpl = _.template(fileContent);
			fileContent = tpl({
				work: work
				, app: data.app
			});

			// write the file
			try {
				grunt.file.write(destPath, fileContent, options);
			}
			catch (e) {
				grunt.log.writeln(e.toString().red);
			}

			// process the sub works
			if (work.works) {
				_.each(work.works, function (subWork) {
					subWork.parent = _.omit(work, 'works');
					processWork(subWork);
				});
			}
		}

		// process the homepage
		processWork(data.app.index);

		// process the works
		_.each(data.app.works, function (work) {
			processWork(work);
		});
	});

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-requirejs');
	grunt.loadNpmTasks('grunt-gh-pages');

	grunt.registerTask('copy:assets', ['copy:data', 'copy:tpl', 'copy:js']);
	grunt.registerTask('build', ['jshint', 'clean', 'less', 'copy:assets', 'requirejs', 'html']);

	grunt.registerTask('default', ['build']);

	grunt.registerTask('deploy', ['build', 'gh-pages']);
};
<commit_msg>Fixed grunt config file syntax<commit_after>module.exports = function(grunt) {

	// set Underscore as a shortcut
	var _ = grunt.util._;

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

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

		, jshint: {
			all: ['Gruntfile.js', 'src/js/*.js']
			, options: {
				laxbreak: true
				, laxcomma: true
				, smarttabs: true
			}
		}

		, clean: {
			dist: ['dist']
		}

		, copy: {
			data: {
				files: [
					{ expand: true, flatten: true, src: ['src/data/*'], dest: 'dist/data' }
				]
			}
			, tpl: {
				files: [
					{ expand: true, flatten: true, src: ['src/tpl/*'], dest: 'dist/tpl' }
				]
			}
			, js: {
				files: [
					{ expand: true, flatten: true, src: ['src/js/*.js'], dest: 'dist/js' }
					, { expand: true, flatten: true, src: ['bower_components/requirejs/require.js'], dest: 'dist/js' }
				]
			}
		}

		, less: {
			styles: {
				options: {
					paths: ["src/less"]
					, yuicompress: true
				}
				, files: {
					"dist/css/styles.css": [
						"bower_components/bootstrap/dist/css/bootstrap.min.css"
						, "src/less/main.less"
					]
				}
			}
		}

		, requirejs: {
			app: {
				options: {
					baseUrl : "src/js"
					, mainConfigFile: "src/js/app.js"
					, out: "dist/js/app.js"
					, name: "app"
					, optimizeCss: "none"
					, fileExclusionRegExp: /^\./
					, optimize: 'uglify'
					, preserveLicenseComments: true
				}
			}
		}

		, html: {
			dist: {}
		}

		, watch: {
			js: {
				files: ['src/js/*.js']
				, tasks: ['jshint', 'copy:js']
				, options: {
					spawn: false
				}
			}
			, css: {
				files: ['src/less/*.less']
				, tasks: ['less']
				, options: {
					spawn: false
				}
			}
			, html: {
				files: ['src/data/**', 'src/*.html', 'src/partials/*.html']
				, tasks: ['html']
				, options: {
					spawn: false
				}
			}
			, data: {
				files: ['src/data/**', 'src/tpl/**']
				, tasks: ['copy:data', 'copy:tpl']
				, options: {
					spawn: false
				}
			}
		}
	});

	// Generating html pages
	grunt.registerMultiTask('html', 'Generating html pages', function () {
		var
			data = grunt.file.readJSON('src/data/data.json')
			, includes = {
				header: grunt.file.read('src/partials/header.html')
				, footer: grunt.file.read('src/partials/footer.html')
				, works: grunt.file.read('src/partials/works.html')
			}
			, options = { encoding : 'utf8' }
		;

		/**
		 * Process the HTML page for the work
		 * @param	{object} work Object including name, title and can include works
		 */
		function processWork(work) {
			var
				srcPath = 'src/' + work.name + '.html'
				, destPath = 'dist/' + work.name + '.html'
			;

			// if file does not exists, get the template
			if (!grunt.file.exists(srcPath)) {
				srcPath = 'src/partials/tpl-' + (work.works ? 'parent' : 'work') + '.html';
			}

			// copy the file
			grunt.file.copy(srcPath, destPath, options);

			// read the file
			grunt.log.writeln(('Reading "' + destPath + '".').green);
			var fileContent = grunt.file.read(destPath);

			// replace the includes
			_.each(includes, function (include, ind) {
				grunt.log.writeln('Replacing "' + ind + '" inclusion.');
				fileContent = fileContent.replace(new RegExp('@@include.' + ind, "g"), include);
			});

			// process the template
			var tpl = _.template(fileContent);
			fileContent = tpl({
				work: work
				, app: data.app
			});

			// write the file
			try {
				grunt.file.write(destPath, fileContent, options);
			}
			catch (e) {
				grunt.log.writeln(e.toString().red);
			}

			// process the sub works
			if (work.works) {
				_.each(work.works, function (subWork) {
					subWork.parent = _.omit(work, 'works');
					processWork(subWork);
				});
			}
		}

		// process the homepage
		processWork(data.app.index);

		// process the works
		_.each(data.app.works, function (work) {
			processWork(work);
		});
	});

	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-requirejs');
	grunt.loadNpmTasks('grunt-gh-pages');

	grunt.registerTask('copy:assets', ['copy:data', 'copy:tpl', 'copy:js']);
	grunt.registerTask('build', ['jshint', 'clean', 'less', 'copy:assets', 'requirejs', 'html']);

	grunt.registerTask('default', ['build']);

	grunt.registerTask('deploy', ['build', 'gh-pages']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    'mocha_istanbul': {
      coverage: {
        src: 'test',
        options: {
          quiet: true
        }
      },
      coveralls: {
        src: 'test',
        options: {
          coverage: true,
          quiet: true
        }
      }
    }
  });

  grunt.event.on('coverage', function(data){
    process.env.NODE_COVERALLS_DEBUG = 1;
    grunt.log.writeln('Travis JOB ID:', process.env.TRAVIS_JOB_ID);
    grunt.log.writeln('Travis ENV:', process.env.TRAVIS);

    var coveralls = require('coveralls');

    coveralls.handleInput(data, function(err){
      if (err) {
        throw err;
      }
    });
  });

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

  grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']);
  grunt.registerTask('coverage', ['mocha_istanbul:coverage']);

};<commit_msg>Gruntfile.js<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    'mocha_istanbul': {
      coverage: {
        src: 'test',
        options: {
          quiet: true
        }
      },
      coveralls: {
        src: 'test',
        options: {
          coverage: true,
          quiet: true
        }
      }
    }
  });

  grunt.event.on('coverage', function(data){
    process.env.NODE_COVERALLS_DEBUG = 1;
    process.env.TRAVIS_JOB_ID = 18185530;
    process.env.TRAVIS = true;
    grunt.log.writeln('Travis JOB ID:', process.env.TRAVIS_JOB_ID);
    grunt.log.writeln('Travis ENV:', process.env.TRAVIS);

    var coveralls = require('coveralls');

    coveralls.handleInput(data, function(err){
      if (err) {
        throw err;
      }
    });
  });

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

  grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']);
  grunt.registerTask('coverage', ['mocha_istanbul:coverage']);

};<|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: {
            angular_1_0: {
                configFile: 'karma-angular-1.0.conf.js',
                singleRun: true
            },
            angular_1_2: {
                configFile: 'karma-angular-1.2.conf.js',
                singleRun: true
            },
            angular_1_3_nightly: {
                configFile: 'karma-angular-1.3-nightly.conf.js',
                singleRun: true
            }
        },
        jshint: {
            files: ['*.js', 'src/**/*.js', 'test/**/*.js'],
            options: {
                jshintrc: true
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'karma']
        },
        build: {

        },
        coveralls: {
            options: {
                debug: true,
                coverage_dir: 'coverage',
                dryRun: false,
                force: true,
                recursive: true
            }
        }
    });

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

    grunt.registerTask('default', ['jshint', 'karma', 'ngAnnotate', 'uglify']);
};<commit_msg>Setting dryRun to true for coveralls; instead we will enable it through command-line args.<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: {
            angular_1_0: {
                configFile: 'karma-angular-1.0.conf.js',
                singleRun: true
            },
            angular_1_2: {
                configFile: 'karma-angular-1.2.conf.js',
                singleRun: true
            },
            angular_1_3_nightly: {
                configFile: 'karma-angular-1.3-nightly.conf.js',
                singleRun: true
            }
        },
        jshint: {
            files: ['*.js', 'src/**/*.js', 'test/**/*.js'],
            options: {
                jshintrc: true
            }
        },
        watch: {
            files: ['<%= jshint.files %>'],
            tasks: ['jshint', 'karma']
        },
        build: {

        },
        coveralls: {
            options: {
                debug: true,
                coverage_dir: 'coverage',
                dryRun: true,
                force: true,
                recursive: true
            }
        }
    });

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

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


<commit_before>/**
 * Copyright Kitware Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* global module, require */

module.exports = function (grunt) {
  var path = require('path');

  var defaultTasks = [
    'build-default'
  ];

  // Pass a "--env=<value>" argument to grunt. Default value is "dev".
  var environment = grunt.option('env') || 'dev';

  // Returns a json string containing information from the current git repository.
  var versionInfoObject = function () {
    var gitVersion = grunt.config.get('gitinfo');
    var local = gitVersion.local || {};
    var branch = local.branch || {};
    var current = branch.current || {};
    return JSON.stringify(
      {
        git: !!current.SHA,
        SHA: current.SHA,
        shortSHA: current.shortSHA,
        date: grunt.template.date(new Date(), 'isoDateTime', true),
        apiVersion: grunt.config.get('pkg').version,
        describe: gitVersionObject
      },
      null,
      '  '
    );
  };

  /* Ideally, we would add version information for each library we use to
   * this object. */
  var libVersionInfoObject = function () {
    return JSON.stringify({
      date: grunt.template.date(new Date(), 'isoDateTime', true)
    }, null, '  ');
  };
  var gitVersionObject;

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

    clean: {
      libs: [
        'built/entity-version.js',
        'built/entitylib-version.js',
        'built/googlefonts.css',
        'built/templates.js'
      ]
    },

    copy: {
      static: {
        expand: true,
        cwd: 'client/static',
        src: ['**/*'],
        dest: 'built'
      },
      libs: {
        files: [{
          expand: true,
          cwd: 'node_modules/bootstrap/dist/fonts',
          src: ['**/*'],
          dest: 'built/fonts'
        }, {
          expand: true,
          cwd: 'node_modules/jquery-ui-bundle/images',
          src: ['**/*'],
          dest: 'built/libs/images'
        }, {
          expand: true,
          cwd: 'node_modules/font-awesome/fonts',
          src: ['**/*'],
          dest: 'built/fonts'
        }]
      }
    },

    cssmin: {
      options: {
        sourceMap: environment === 'dev'
      },
      libs: {
        files: {
          'built/libs/libs.min.css': [
            'node_modules/bootstrap/dist/css/bootstrap.css',
            'node_modules/jquery-ui-bundle/jquery-ui.css',
            'node_modules/jquery-contextmenu/dist/jquery.contextMenu.css',
            'node_modules/font-awesome/css/font-awesome.css',
            'node_modules/LineUpJS/dist/style.css',
            'node_modules/LineUpJS/demo/css/style-demo.css',
            'node_modules/bootstrap-table/dist/bootstrap-table.css',
            'built/googlefonts.css'
          ]
        }
      }
    },

    'curl-dir': {
      libs: {
        src: [
          'https://raw.githubusercontent.com/draperlaboratory/user-ale/master/userale.js',
          'https://raw.githubusercontent.com/draperlaboratory/user-ale/master/userale-worker.js'
        ],
        dest: 'built/userale'
      }
    },

    jade: {
      options: {
        client: true,
        compileDebug: false,
        namespace: 'entityApp.templates',
        processName: function (filename) {
          return path.basename(filename, '.jade');
        }
      },
      core: {
        files: {
          'built/templates.js': [
            'client/templates/**/*.jade'
          ]
        }
      }
    },

    shell: {
      getgitversion: {
        command: 'git describe --always --long --dirty --all',
        options: {
          callback: function (ignore_err, stdout, stderr, callback) {
            gitVersionObject = stdout.replace(/^\s+|\s+$/g, '');
            callback();
          }
        }
      },
      googlefonts: {
        command: 'node node_modules/google-fonts-offline/bin/goofoffline outDir=built/libs outCss=../googlefonts.css \'http://fonts.googleapis.com/css?family=Lato:400,700\''
      },
      npmlibs: {
        command: [
          'cd node_modules/Clique',
          'npm install',
          'npm run build' /*,
          'cd ../candela',
          'npm install',
          'npm run dist' */
        ].join(' && ')
      }
    },

    symlink: {
      options: {
        overwrite: true
      },
      app: {
        files: [{
          expand: true,
          overwrite: true,
          cwd: 'client',
          src: ['*.js', '*.css', '*.html'],
          dest: 'built'
        }, {
          src: 'service',
          dest: 'built/service'
        }, {
          src: 'defaults.json',
          dest: 'built/defaults.json'
        }, {
          src: 'profileimages',
          dest: 'built/profileimages'
        }]
      }
    },

    uglify: {
      options: {
        sourceMap: environment === 'dev',
        sourceMapIncludeSources: true,
        report: 'min',
        beautify: {
          ascii_only: true
        }
      },
      app: {
        files: {
          'built/app.min.js': [
            'built/entity-version.js',
            'built/templates.js'
          ]
        }
      },
      libs: {
        files: {
          'built/libs/libs.min.js': [
            'node_modules/jquery/dist/jquery.js',
            'node_modules/jquery-ui-bundle/jquery-ui.js',
            'node_modules/jquery-contextmenu/dist/jquery.contextMenu.js',
            /* We get d3 with Clique, so don't include it here. */
            // 'node_modules/d3/d3.js',
            'node_modules/underscore/underscore.js',
            'node_modules/backbone/backbone.js',
            'node_modules/bootstrap/dist/js/bootstrap.js',
            'node_modules/bootstrap-table/dist/bootstrap-table.js',
            'node_modules/LineUpJS/dist/LineUpJS.js',
            'node_modules/moment/moment.js',
            // 'node_modules/jade/runtime.js',
            'built/entitylib-version.js'
          ]
        }
      },
      npmlibs: {
        files: {
          'built/libs/libs-additional.min.js': [
            // 'node_modules/candela/dist/candela.js',
            'node_modules/Clique/dist/clique.js'
          ]
        }
      }
    },

    'file-creator': {
      app: {
        'built/entity-version.js': function (fs, fd, done) {
          var entityVersion = versionInfoObject();
          fs.writeSync(
            fd,
            [
              '/* global entity: true */',
              'window.versionInfo = ',
              entityVersion,
              ';',
              'window.versionInfo.libVersion = libVersionInfo;'
            ].join('\n')
          );
          done();
        }
      },
      libs: {
        'built/entitylib-version.js': function (fs, fd, done) {
          var entityLibVersion = libVersionInfoObject();
          fs.writeSync(
            fd,
            [
              '/* global entity: true */',
              'window.libVersionInfo = ',
              entityLibVersion,
              ';'
            ].join('\n')
          );
          done();
        }
      }
    }
  });

  if (['dev', 'prod'].indexOf(environment) === -1) {
    grunt.fatal('The "env" argument must be either "dev" or "prod".');
  }

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.loadNpmTasks('grunt-contrib-symlink');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-curl');
  grunt.loadNpmTasks('grunt-file-creator');
  grunt.loadNpmTasks('grunt-gitinfo');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-string-replace');

  grunt.registerTask('version-info', [
    'gitinfo',
    'shell:getgitversion',
    'file-creator:app'
  ]);

  grunt.registerTask('libversion-info', [
    'file-creator:libs'
  ]);

  grunt.registerTask('npmlibs', [
    'shell:npmlibs',
    'uglify:npmlibs'
  ]);

  grunt.registerTask('build-default', [
    'jade',
    'version-info',
    'uglify:app',
    'copy:static',
    'symlink:app'
  ]);
  grunt.registerTask('init', [
    'libversion-info',
    'shell:googlefonts',
    'uglify:libs',
    'cssmin:libs',
    'copy:libs',
    'curl-dir:libs',
    'clean:libs'
  ]);
  grunt.registerTask('default', defaultTasks);
};
<commit_msg>Don't require the profileimages directory.<commit_after>/**
 * Copyright Kitware Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* global module, require */

module.exports = function (grunt) {
  var path = require('path');

  var defaultTasks = [
    'build-default'
  ];

  // Pass a "--env=<value>" argument to grunt. Default value is "dev".
  var environment = grunt.option('env') || 'dev';

  // Returns a json string containing information from the current git repository.
  var versionInfoObject = function () {
    var gitVersion = grunt.config.get('gitinfo');
    var local = gitVersion.local || {};
    var branch = local.branch || {};
    var current = branch.current || {};
    return JSON.stringify(
      {
        git: !!current.SHA,
        SHA: current.SHA,
        shortSHA: current.shortSHA,
        date: grunt.template.date(new Date(), 'isoDateTime', true),
        apiVersion: grunt.config.get('pkg').version,
        describe: gitVersionObject
      },
      null,
      '  '
    );
  };

  /* Ideally, we would add version information for each library we use to
   * this object. */
  var libVersionInfoObject = function () {
    return JSON.stringify({
      date: grunt.template.date(new Date(), 'isoDateTime', true)
    }, null, '  ');
  };
  var gitVersionObject;

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

    clean: {
      libs: [
        'built/entity-version.js',
        'built/entitylib-version.js',
        'built/googlefonts.css',
        'built/templates.js'
      ]
    },

    copy: {
      static: {
        expand: true,
        cwd: 'client/static',
        src: ['**/*'],
        dest: 'built'
      },
      libs: {
        files: [{
          expand: true,
          cwd: 'node_modules/bootstrap/dist/fonts',
          src: ['**/*'],
          dest: 'built/fonts'
        }, {
          expand: true,
          cwd: 'node_modules/jquery-ui-bundle/images',
          src: ['**/*'],
          dest: 'built/libs/images'
        }, {
          expand: true,
          cwd: 'node_modules/font-awesome/fonts',
          src: ['**/*'],
          dest: 'built/fonts'
        }]
      }
    },

    cssmin: {
      options: {
        sourceMap: environment === 'dev'
      },
      libs: {
        files: {
          'built/libs/libs.min.css': [
            'node_modules/bootstrap/dist/css/bootstrap.css',
            'node_modules/jquery-ui-bundle/jquery-ui.css',
            'node_modules/jquery-contextmenu/dist/jquery.contextMenu.css',
            'node_modules/font-awesome/css/font-awesome.css',
            'node_modules/LineUpJS/dist/style.css',
            'node_modules/LineUpJS/demo/css/style-demo.css',
            'node_modules/bootstrap-table/dist/bootstrap-table.css',
            'built/googlefonts.css'
          ]
        }
      }
    },

    'curl-dir': {
      libs: {
        src: [
          'https://raw.githubusercontent.com/draperlaboratory/user-ale/master/userale.js',
          'https://raw.githubusercontent.com/draperlaboratory/user-ale/master/userale-worker.js'
        ],
        dest: 'built/userale'
      }
    },

    jade: {
      options: {
        client: true,
        compileDebug: false,
        namespace: 'entityApp.templates',
        processName: function (filename) {
          return path.basename(filename, '.jade');
        }
      },
      core: {
        files: {
          'built/templates.js': [
            'client/templates/**/*.jade'
          ]
        }
      }
    },

    shell: {
      getgitversion: {
        command: 'git describe --always --long --dirty --all',
        options: {
          callback: function (ignore_err, stdout, stderr, callback) {
            gitVersionObject = stdout.replace(/^\s+|\s+$/g, '');
            callback();
          }
        }
      },
      googlefonts: {
        command: 'node node_modules/google-fonts-offline/bin/goofoffline outDir=built/libs outCss=../googlefonts.css \'http://fonts.googleapis.com/css?family=Lato:400,700\''
      },
      npmlibs: {
        command: [
          'cd node_modules/Clique',
          'npm install',
          'npm run build' /*,
          'cd ../candela',
          'npm install',
          'npm run dist' */
        ].join(' && ')
      }
    },

    symlink: {
      options: {
        overwrite: true
      },
      app: {
        files: [{
          expand: true,
          overwrite: true,
          cwd: 'client',
          src: ['*.js', '*.css', '*.html'],
          dest: 'built'
        }, {
          src: 'service',
          dest: 'built/service'
        }, {
          src: 'defaults.json',
          dest: 'built/defaults.json'
        }, {
          expand: true,
          overwrite: true,
          cwd: '.',
          src: ['profileimages*'],
          dest: 'built'
        }]
      }
    },

    uglify: {
      options: {
        sourceMap: environment === 'dev',
        sourceMapIncludeSources: true,
        report: 'min',
        beautify: {
          ascii_only: true
        }
      },
      app: {
        files: {
          'built/app.min.js': [
            'built/entity-version.js',
            'built/templates.js'
          ]
        }
      },
      libs: {
        files: {
          'built/libs/libs.min.js': [
            'node_modules/jquery/dist/jquery.js',
            'node_modules/jquery-ui-bundle/jquery-ui.js',
            'node_modules/jquery-contextmenu/dist/jquery.contextMenu.js',
            /* We get d3 with Clique, so don't include it here. */
            // 'node_modules/d3/d3.js',
            'node_modules/underscore/underscore.js',
            'node_modules/backbone/backbone.js',
            'node_modules/bootstrap/dist/js/bootstrap.js',
            'node_modules/bootstrap-table/dist/bootstrap-table.js',
            'node_modules/LineUpJS/dist/LineUpJS.js',
            'node_modules/moment/moment.js',
            // 'node_modules/jade/runtime.js',
            'built/entitylib-version.js'
          ]
        }
      },
      npmlibs: {
        files: {
          'built/libs/libs-additional.min.js': [
            // 'node_modules/candela/dist/candela.js',
            'node_modules/Clique/dist/clique.js'
          ]
        }
      }
    },

    'file-creator': {
      app: {
        'built/entity-version.js': function (fs, fd, done) {
          var entityVersion = versionInfoObject();
          fs.writeSync(
            fd,
            [
              '/* global entity: true */',
              'window.versionInfo = ',
              entityVersion,
              ';',
              'window.versionInfo.libVersion = libVersionInfo;'
            ].join('\n')
          );
          done();
        }
      },
      libs: {
        'built/entitylib-version.js': function (fs, fd, done) {
          var entityLibVersion = libVersionInfoObject();
          fs.writeSync(
            fd,
            [
              '/* global entity: true */',
              'window.libVersionInfo = ',
              entityLibVersion,
              ';'
            ].join('\n')
          );
          done();
        }
      }
    }
  });

  if (['dev', 'prod'].indexOf(environment) === -1) {
    grunt.fatal('The "env" argument must be either "dev" or "prod".');
  }

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.loadNpmTasks('grunt-contrib-symlink');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-curl');
  grunt.loadNpmTasks('grunt-file-creator');
  grunt.loadNpmTasks('grunt-gitinfo');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-string-replace');

  grunt.registerTask('version-info', [
    'gitinfo',
    'shell:getgitversion',
    'file-creator:app'
  ]);

  grunt.registerTask('libversion-info', [
    'file-creator:libs'
  ]);

  grunt.registerTask('npmlibs', [
    'shell:npmlibs',
    'uglify:npmlibs'
  ]);

  grunt.registerTask('build-default', [
    'jade',
    'version-info',
    'uglify:app',
    'copy:static',
    'symlink:app'
  ]);
  grunt.registerTask('init', [
    'libversion-info',
    'shell:googlefonts',
    'uglify:libs',
    'cssmin:libs',
    'copy:libs',
    'curl-dir:libs',
    'clean:libs'
  ]);
  grunt.registerTask('default', defaultTasks);
};
<|endoftext|>


<commit_before>'use strict';

var browsers = require('./grunt/browsers');
var fabricator = require('./grunt/fabricator');
var util = require('./grunt/util');
fabricator.basePath = '.';

module.exports = function(grunt) {

	// Force use of Unix newlines
	grunt.util.linefeed = '\n';
	RegExp.quote = function(string) {
		return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
	};

	var pkg = grunt.file.readJSON('package.json');
	grunt
			.initConfig({
				pkg : pkg,
				banner : '/*!\n'
						+ ' * <%= pkg.name %>.js v<%= pkg.version %> (<%= pkg.homepage %>)\n'
						+ ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n'
						+ ' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n'
						+ ' */\n',
				sourceFiles : 'js/*.js',

				// Task configuration

				clean : {
					dist : [ fabricator.distPath ]
				},

				uglify : {
					options : {
						report : 'min'
					},
					js : {
						options : {
							banner : '<%= banner %>'
						},
						src : fabricator.distScriptPath + pkg.name + '.js',
						dest : fabricator.distScriptPath + pkg.name + '.min.js'
					},
					docs : {
						options : {
							banner : '<%= banner %>',
							preserveComments : 'some'
						},
						src : [ fabricator.devDocsScriptPath + 'app.js',
								fabricator.devDocsScriptPath + 'loader.js' ],
						dest : fabricator.distDocsScriptPath + 'docs.min.js'
					}
				},

				copy : {
					dist : {
						expand : true,
						src : [ '**/**/*.{htm,html,css,js,md,png,jpg,gif,ico}',
								'!**/{node_modules,lib,grunt,dist}/**',
								'!Gruntfile.js' ],
						dest : fabricator.distPath,
						options : {
							mode : true,
							process : function(contents, path) {
								// use distribution packaged script
								if (typeof contents === 'string') {
									return fabricator.replaceSrciptTagSrcById(
											pkg.name, contents, function(from,
													to) {
												grunt.log.writeln('\nUpdated\n'
														+ from + '\nto:\n' + to
														+ '\nfor: ' + path);
											});
								}
								return contents;
							}
						}
					}
				},

				qunit : {
					// options : {
					// inject : 'js/test/unit/phantom.js'
					// },
					// files : 'js/test/*.html'
					all : {
						options : {
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ]
						}
					}
				},

				connect : {
					server : {
						options : {
							port : 3000,
							base : '.',
							hostname : pkg.name + '-test-host'
						}
					}
				},

				watch : {
					src : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					},
					test : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					}
				},

				'saucelabs-qunit' : {
					all : {
						options : {
							build : process.env.TRAVIS_JOB_ID,
							testname : process.env.TRAVIS_BUILD_NUMBER,
							concurrency : 10,
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ],
							tags : [ process.env.TRAVIS_BRANCH,
									process.env.TRAVIS_REPO_SLUG,
									process.env.TRAVIS_BUILD_DIR ],
							browsers : browsers
						}
					}
				}
			});

	// Retrieve commit details
	var commit = util.getCommit(grunt.log.error, grunt.log.writeln);

	// Load tasks from package
	for ( var key in grunt.file.readJSON('package.json').devDependencies) {
		if (key !== 'grunt' && key.indexOf('grunt') === 0) {
			grunt.loadNpmTasks(key);
		}
	}
	// load project tasks
	grunt.loadTasks('grunt/tasks');

	// suppress "key" options in verbose mode
	var writeflags = grunt.log.writeflags;
	grunt.log.writeflags = function(obj, prefix) {
		if (typeof obj === 'object' && obj && obj.key) {
			var obj2 = JSON.parse(JSON.stringify(obj));
			obj2.key = '[SECURE]';
			return writeflags(obj2, prefix);
		}
		return writeflags(obj, prefix);
	};

	// Custom tasks
	grunt.registerTask('includes', 'Process JS inclusions',
			function() {
				grunt.log.writeln('Processing script includes');
				var incCnt = 0;
				var script = fabricator.processScriptIncludes(null, null,
						function(parentPath, incPath) {
							incCnt++;
							return grunt.file.read(incPath);
						});
				var banner = grunt.template.process('<%= banner %>');
				var js = fabricator.distScriptPath + pkg.name + '.js';
				grunt.file.write(js, banner + script);
				grunt.log.writeln('Generated ' + js + ' from ' + incCnt
						+ ' inclusions');
			});

	// Build tasks
	var buildTasks = new util.Tasks(commit, grunt.log.writeln);
	buildTasks.add('clean');
	buildTasks.add('includes');
	buildTasks.add('copy:dist');
	buildTasks.add('uglify:js');
	buildTasks.add('uglify:docs');
	buildTasks.add('connect');
	buildTasks.add('qunit');
	buildTasks.add('saucelabs-qunit');
	buildTasks.add('release');
	grunt.registerTask('test', buildTasks.tasks);

	// Default tasks
	grunt.registerTask('default', [ 'test' ]);
};<commit_msg>Release v1.0.0-beta.4 [skip saucelabs-qunit]<commit_after>'use strict';

var browsers = require('./grunt/browsers');
var fabricator = require('./grunt/fabricator');
var util = require('./grunt/util');
fabricator.basePath = '.';

module.exports = function(grunt) {

	// Force use of Unix newlines
	grunt.util.linefeed = '\n';
	RegExp.quote = function(string) {
		return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
	};

	var pkg = grunt.file.readJSON('package.json');
	grunt
			.initConfig({
				pkg : pkg,
				banner : '/*!\n'
						+ ' * <%= pkg.name %>.js v<%= pkg.version %> (<%= pkg.homepage %>)\n'
						+ ' * Copyright 2013-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n'
						+ ' * Licensed under <%= _.pluck(pkg.licenses, "type") %> (<%= _.pluck(pkg.licenses, "url") %>)\n'
						+ ' */\n',
				sourceFiles : 'js/*.js',

				// Task configuration

				clean : {
					dist : [ fabricator.distPath ]
				},

				uglify : {
					options : {
						report : 'min'
					},
					js : {
						options : {
							banner : '<%= banner %>'
						},
						src : fabricator.distScriptPath + pkg.name + '.js',
						dest : fabricator.distScriptPath + pkg.name + '.min.js'
					},
					docs : {
						options : {
							banner : '<%= banner %>',
							preserveComments : 'some'
						},
						src : [ fabricator.devDocsScriptPath + 'app.js',
								fabricator.devDocsScriptPath + 'loader.js' ],
						dest : fabricator.distDocsScriptPath + 'docs.min.js'
					}
				},

				copy : {
					dist : {
						expand : true,
						src : [ '**/**/*.{htm,html,css,js,md,png,jpg,gif,ico}',
								'!**/{node_modules,lib,grunt,dist}/**',
								'!Gruntfile.js', 'README' ],
						dest : fabricator.distPath,
						options : {
							mode : true,
							process : function(contents, path) {
								// use distribution packaged script
								if (typeof contents === 'string') {
									return fabricator.replaceSrciptTagSrcById(
											pkg.name, contents, function(from,
													to) {
												grunt.log.writeln('\nUpdated\n'
														+ from + '\nto:\n' + to
														+ '\nfor: ' + path);
											});
								}
								return contents;
							}
						}
					}
				},

				qunit : {
					// options : {
					// inject : 'js/test/unit/phantom.js'
					// },
					// files : 'js/test/*.html'
					all : {
						options : {
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ]
						}
					}
				},

				connect : {
					server : {
						options : {
							port : 3000,
							base : '.',
							hostname : pkg.name + '-test-host'
						}
					}
				},

				watch : {
					src : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					},
					test : {
						files : fabricator.jsFiles,
						tasks : [ 'qunit' ]
					}
				},

				'saucelabs-qunit' : {
					all : {
						options : {
							build : process.env.TRAVIS_JOB_ID,
							testname : process.env.TRAVIS_BUILD_NUMBER,
							concurrency : 10,
							urls : [ 'http://<%= connect.server.options.hostname %>:<%= connect.server.options.port %>/'
									+ fabricator.testScriptPath
									+ fabricator.testMainFile ],
							tags : [ process.env.TRAVIS_BRANCH,
									process.env.TRAVIS_REPO_SLUG,
									process.env.TRAVIS_BUILD_DIR ],
							browsers : browsers
						}
					}
				}
			});

	// Retrieve commit details
	var commit = util.getCommit(grunt.log.error, grunt.log.writeln);

	// Load tasks from package
	for ( var key in grunt.file.readJSON('package.json').devDependencies) {
		if (key !== 'grunt' && key.indexOf('grunt') === 0) {
			grunt.loadNpmTasks(key);
		}
	}
	// load project tasks
	grunt.loadTasks('grunt/tasks');

	// suppress "key" options in verbose mode
	var writeflags = grunt.log.writeflags;
	grunt.log.writeflags = function(obj, prefix) {
		if (typeof obj === 'object' && obj && obj.key) {
			var obj2 = JSON.parse(JSON.stringify(obj));
			obj2.key = '[SECURE]';
			return writeflags(obj2, prefix);
		}
		return writeflags(obj, prefix);
	};

	// Custom tasks
	grunt.registerTask('includes', 'Process JS inclusions',
			function() {
				grunt.log.writeln('Processing script includes');
				var incCnt = 0;
				var script = fabricator.processScriptIncludes(null, null,
						function(parentPath, incPath) {
							incCnt++;
							return grunt.file.read(incPath);
						});
				var banner = grunt.template.process('<%= banner %>');
				var js = fabricator.distScriptPath + pkg.name + '.js';
				grunt.file.write(js, banner + script);
				grunt.log.writeln('Generated ' + js + ' from ' + incCnt
						+ ' inclusions');
			});

	// Build tasks
	var buildTasks = new util.Tasks(commit, grunt.log.writeln);
	buildTasks.add('clean');
	buildTasks.add('includes');
	buildTasks.add('copy:dist');
	buildTasks.add('uglify:js');
	buildTasks.add('uglify:docs');
	buildTasks.add('connect');
	buildTasks.add('qunit');
	buildTasks.add('saucelabs-qunit');
	buildTasks.add('release');
	grunt.registerTask('test', buildTasks.tasks);

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


<commit_before>module.exports = function(grunt) {
  var path = require('path');

  grunt.initConfig({

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

    handlebars: {
      all: {
        options: {
          namespace: function(filename) {
            return 'ds.' + path.dirname(filename).replace('/', '.');
          },
          processName: function(filename) {
            var pieces = filename.split('/');
            return pieces[pieces.length - 1].split('.')[0];
          }
        },
        files: {
          'cronenberg/static/templates.js' : [ 'templates/**/*.hbs']
        }
      }
    },
    concat: {
      bundle_css: {
        src: [
          'cronenberg/static/css/bootstrap.css',
          'cronenberg/static/css/bootstrap-callouts.css',
          'cronenberg/static/css/bootstrap-editable.css',
          'cronenberg/static/css/font-awesome.css',
          'cronenberg/static/css/nv.d3.css'
        ],
        dest: 'cronenberg/static/css/bundle.css'
      },
      bundle: {
        options: {
          separator: ';'
        },
        src: [
          'cronenberg/static/js/jquery-1.11.0.min.js',
          'cronenberg/static/js/moment.min.js',
          'cronenberg/static/js/markdown.min.js',
          'cronenberg/static/js/bean.min.js',
          'cronenberg/static/js/URI.min.js',
          'cronenberg/static/js/handlebars.min.js',
          'cronenberg/static/js/bootstrap.min.js',
          'cronenberg/static/js/bootbox.min.js',
          'cronenberg/static/js/d3.min.js',
          'cronenberg/static/js/nv.d3.min.js',
          'cronenberg/static/js/tagmanager.js',
          'cronenberg/static/js/bootstrap-editable.min.js'
        ],
        dest: 'cronenberg/static/bundle.js'
      },
      app: {
        options: {
          separator: ';'
        },
        src: [
          'js/core.js',
          'js/cronenberg.js',
          'js/app/*.js',
          'js/models/*.js',
          'js/models/presentations/*.js',
          'js/models/layouts/*.js',
          'js/models/data/*.js',
          'cronenberg/static/templates.js',
          'templates/**/*.js'
        ],
        dest: 'cronenberg/static/app.js'
      }
    },
    watch: {
      files: [
        'js/**/cron*.js',
        'templates/**/cron*.hbs',
        'cronenberg/static/js/**/*.js'
      ],
      tasks: ['handlebars', 'concat']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-handlebars');

  grunt.registerTask('default', ['handlebars', 'concat']);
}
<commit_msg>Fix watch file list<commit_after>module.exports = function(grunt) {
  var path = require('path');

  grunt.initConfig({

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

    handlebars: {
      all: {
        options: {
          namespace: function(filename) {
            return 'ds.' + path.dirname(filename).replace('/', '.');
          },
          processName: function(filename) {
            var pieces = filename.split('/');
            return pieces[pieces.length - 1].split('.')[0];
          }
        },
        files: {
          'cronenberg/static/templates.js' : [ 'templates/**/*.hbs']
        }
      }
    },
    concat: {
      bundle_css: {
        src: [
          'cronenberg/static/css/bootstrap.css',
          'cronenberg/static/css/bootstrap-callouts.css',
          'cronenberg/static/css/bootstrap-editable.css',
          'cronenberg/static/css/font-awesome.css',
          'cronenberg/static/css/nv.d3.css'
        ],
        dest: 'cronenberg/static/css/bundle.css'
      },
      bundle: {
        options: {
          separator: ';'
        },
        src: [
          'cronenberg/static/js/jquery-1.11.0.min.js',
          'cronenberg/static/js/moment.min.js',
          'cronenberg/static/js/markdown.min.js',
          'cronenberg/static/js/bean.min.js',
          'cronenberg/static/js/URI.min.js',
          'cronenberg/static/js/handlebars.min.js',
          'cronenberg/static/js/bootstrap.min.js',
          'cronenberg/static/js/bootbox.min.js',
          'cronenberg/static/js/d3.min.js',
          'cronenberg/static/js/nv.d3.min.js',
          'cronenberg/static/js/tagmanager.js',
          'cronenberg/static/js/bootstrap-editable.min.js'
        ],
        dest: 'cronenberg/static/bundle.js'
      },
      app: {
        options: {
          separator: ';'
        },
        src: [
          'js/core.js',
          'js/cronenberg.js',
          'js/app/*.js',
          'js/models/*.js',
          'js/models/presentations/*.js',
          'js/models/layouts/*.js',
          'js/models/data/*.js',
          'cronenberg/static/templates.js',
          'templates/**/*.js'
        ],
        dest: 'cronenberg/static/app.js'
      }
    },
    watch: {
      files: [
        'js/**/*.js',
        'templates/**/*.hbs',
        'cronenberg/static/js/**/*.js'
      ],
      tasks: ['handlebars', 'concat']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-handlebars');

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


<commit_before>'use strict';

module.exports = function(grunt) {
    // Configuration.
    grunt.initConfig({
        jscs: {
            options: {
                config: '.jscsrc'
            },
            grunt: 'Gruntfile.js',
            tasks: 'tasks/**/*.js'
        },
        jshint: {
            options: {
                jshintrc: true
            },
            grunt: 'Gruntfile.js',
            tasks: 'tasks/**/*.js'
        },
        jsonlint: {
            jshint: ['.jshintrc'],
            npm: ['package.json']
        },
        nodeunit: {
            all: 'test/**/*.js'
        }
    });

    // Load tasks.
    grunt.loadTasks('./tasks');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-jscs-checker');
    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-release');

    // Register tasks.
    grunt.renameTask('release', 'bump');
    grunt.registerTask('lint', ['jsonlint', 'jshint', 'jscs']);
    grunt.registerTask('release', function() {
        grunt.task.run('lint', Array.prototype.concat.apply('bump', arguments).join(':'));
    });
    grunt.registerTask('test', ['nodeunit']);
    grunt.registerTask('travis', ['lint', 'test', 'validate']);
    grunt.registerTask('validate', ['npm-validate']);
    grunt.registerTask('default', ['lint', 'test', 'validate']);
};
<commit_msg>Enable strict validation of `package.json`.<commit_after>'use strict';

module.exports = function(grunt) {
    // Configuration.
    grunt.initConfig({
        jscs: {
            options: {
                config: '.jscsrc'
            },
            grunt: 'Gruntfile.js',
            tasks: 'tasks/**/*.js'
        },
        jshint: {
            options: {
                jshintrc: true
            },
            grunt: 'Gruntfile.js',
            tasks: 'tasks/**/*.js'
        },
        jsonlint: {
            jshint: ['.jshintrc'],
            npm: ['package.json']
        },
        nodeunit: {
            all: 'test/**/*.js'
        },
        'npm-validate': {
            options: {
                strict: true
            }
        }
    });

    // Load tasks.
    grunt.loadTasks('./tasks');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-jscs-checker');
    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-release');

    // Register tasks.
    grunt.renameTask('release', 'bump');
    grunt.registerTask('lint', ['jsonlint', 'jshint', 'jscs']);
    grunt.registerTask('release', function() {
        grunt.task.run('lint', Array.prototype.concat.apply('bump', arguments).join(':'));
    });
    grunt.registerTask('test', ['nodeunit']);
    grunt.registerTask('travis', ['lint', 'test', 'validate']);
    grunt.registerTask('validate', ['npm-validate']);
    grunt.registerTask('default', ['lint', 'test', 'validate']);
};
<|endoftext|>


<commit_before>/**
    * @ngdoc directive
    * @name umbraco.directives.directive:valServerField
    * @restrict A
    * @description This directive is used to associate a content field (not user defined) with a server-side validation response
    *               so that the validators in angular are updated based on server-side feedback.
    **/
function valServerField(serverValidationManager) {
    return {
        require: 'ngModel',
        restrict: "A",
        link: function (scope, element, attr, ctrl) {

            var fieldName = null;

            attr.$observe("valServerField", function (newVal) {
                if (newVal && fieldName === null) {
                    fieldName = newVal;

                    //subscribe to the changed event of the view model. This is required because when we
                    // have a server error we actually invalidate the form which means it cannot be
                    // resubmitted. So once a field is changed that has a server error assigned to it
                    // we need to re-validate it for the server side validator so the user can resubmit
                    // the form. Of course normal client-side validators will continue to execute.
                    ctrl.$viewChangeListeners.push(function () {
                        if (ctrl.$invalid) {
                            ctrl.$setValidity('valServerField', true);
                        }
                    });

                    //subscribe to the server validation changes
                    serverValidationManager.subscribe(null, fieldName, function (isValid, fieldErrors, allErrors) {
                        if (!isValid) {
                            ctrl.$setValidity('valServerField', false);
                            //assign an error msg property to the current validator
                            ctrl.errorMsg = fieldErrors[0].errorMsg;
                        }
                        else {
                            ctrl.$setValidity('valServerField', true);
                            //reset the error message
                            ctrl.errorMsg = "";
                        }
                    });

                    //when the element is disposed we need to unsubscribe!
                    // NOTE: this is very important otherwise when this controller re-binds the previous subscriptsion will remain
                    // but they are a different callback instance than the above.
                    element.bind('$destroy', function () {
                        serverValidationManager.unsubscribe(null, fieldName);
                    });

                }
            });
        }
    };
}
angular.module('umbraco.directives.validation').directive("valServerField", valServerField);<commit_msg>Fixes: U4-7898 Validation for locked alias still not working<commit_after>/**
    * @ngdoc directive
    * @name umbraco.directives.directive:valServerField
    * @restrict A
    * @description This directive is used to associate a content field (not user defined) with a server-side validation response
    *               so that the validators in angular are updated based on server-side feedback.
    **/
function valServerField(serverValidationManager) {
    return {
        require: 'ngModel',
        restrict: "A",
        link: function (scope, element, attr, ctrl) {

            var fieldName = null;
            var eventBindings = [];

            attr.$observe("valServerField", function (newVal) {
                if (newVal && fieldName === null) {
                    fieldName = newVal;

                    //subscribe to the changed event of the view model. This is required because when we
                    // have a server error we actually invalidate the form which means it cannot be
                    // resubmitted. So once a field is changed that has a server error assigned to it
                    // we need to re-validate it for the server side validator so the user can resubmit
                    // the form. Of course normal client-side validators will continue to execute.
                    eventBindings.push(scope.$watch('ngModel', function(newValue){
                        if (ctrl.$invalid) {
                            ctrl.$setValidity('valServerField', true);
                        }
                    }));

                    //subscribe to the server validation changes
                    serverValidationManager.subscribe(null, fieldName, function (isValid, fieldErrors, allErrors) {
                        if (!isValid) {
                            ctrl.$setValidity('valServerField', false);
                            //assign an error msg property to the current validator
                            ctrl.errorMsg = fieldErrors[0].errorMsg;
                        }
                        else {
                            ctrl.$setValidity('valServerField', true);
                            //reset the error message
                            ctrl.errorMsg = "";
                        }
                    });

                    //when the element is disposed we need to unsubscribe!
                    // NOTE: this is very important otherwise when this controller re-binds the previous subscriptsion will remain
                    // but they are a different callback instance than the above.
                    element.bind('$destroy', function () {
                        serverValidationManager.unsubscribe(null, fieldName);
                    });
                }
            });

            scope.$on('$destroy', function(){
              // unbind watchers
              for(var e in eventBindings) {
                eventBindings[e]();
               }
            });

        }
    };
}
angular.module('umbraco.directives.validation').directive("valServerField", valServerField);
<|endoftext|>


<commit_before>/*

  Dependencies:

  + npm
  + grunt-cli
    > npm install -g grunt-cli

  Setup:

  > npm install

*/

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

    uncss: {
      dist: {
        src: ['app/index.html'],
        dest: 'app/css/tidy.css',
        options: {
          report: 'min'
        }
      }
    },

    jshint: {
      all: ['app/js/*.js'],
      options: {
        jshintrc: '.jshintrc'
      }
    },
    jsbeautifier: {
      modify: {
        src: ['app/js/*.js'],
        options: {
          config: '.jsbeautifyrc'
        }
      },
      verify: {
        src: ['app/js/**/*.js'],
        options: {
          mode: 'VERIFY_ONLY',
          config: '.jsbeautifyrc'
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-uncss');
  grunt.loadNpmTasks('grunt-jsbeautifier');
  grunt.loadNpmTasks('grunt-contrib-jshint');

  // Verify code before a commit
  grunt.registerTask('clean', [
    'jsbeautifier:modify',
    'jshint'
  ]);

  // Build test for Travis
  grunt.registerTask('verify', [
    'jsbeautifier:verify',
    'jshint'
  ]);

};
<commit_msg>fix travis build<commit_after>/*

  Dependencies:

  + npm
  + grunt-cli
    > npm install -g grunt-cli

  Setup:

  > npm install

*/

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

    uncss: {
      dist: {
        src: ['app/index.html'],
        dest: 'app/css/tidy.css',
        options: {
          report: 'min'
        }
      }
    },

    jshint: {
      all: ['app/js/*.js'],
      options: {
        jshintrc: '.jshintrc'
      }
    },
    jsbeautifier: {
      modify: {
        src: ['app/js/*.js'],
        options: {
          config: '.jsbeautifyrc'
        }
      },
      verify: {
        src: ['app/js/**/*.js'],
        options: {
          mode: 'VERIFY_ONLY',
          config: '.jsbeautifyrc'
        }
      }
    }
  });
  grunt.loadNpmTasks('grunt-uncss');
  grunt.loadNpmTasks('grunt-jsbeautifier');
  grunt.loadNpmTasks('grunt-contrib-jshint');

  // Verify code before a commit
  grunt.registerTask('clean', [
    'jsbeautifier:modify',
    'jshint'
  ]);

  // Build test for Travis
  grunt.registerTask('verify', [
    'jshint'
  ]);

};
<|endoftext|>