<commit_before>/*jslint node: true */
'use strict';

var pkg = require('./package.json');

//Using exclusion patterns slows down Grunt significantly
//instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**'
//this method is used to create a set of inclusive patterns for all subdirectories
//skipping node_modules, bower_components, dist, and any .dirs
//This enables users to create any directory structure they desire.
var createFolderGlobs = function(fileTypePatterns) {
  fileTypePatterns = Array.isArray(fileTypePatterns) ? fileTypePatterns : [fileTypePatterns];
  var ignore = ['node_modules','bower_components','dist','temp'];
  var fs = require('fs');
  return fs.readdirSync(process.cwd())
          .map(function(file){
            if (ignore.indexOf(file) !== -1 ||
                file.indexOf('.') === 0 ||
                !fs.lstatSync(file).isDirectory()) {
              return null;
            } else {
              return fileTypePatterns.map(function(pattern) {
                return file + '/**/' + pattern;
              });
            }
          })
          .filter(function(patterns){
            return patterns;
          })
          .concat(fileTypePatterns);
};

module.exports = function (grunt) {

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

  // Project configuration.
  grunt.initConfig({
    connect: {
      main: {
        options: {
          port: 9001
        }
      }
    },
    watch: {
      main: {
        options: {
            livereload: true,
            livereloadOnError: false,
            spawn: false
        },
        files: [createFolderGlobs(['*.js','*.less','*.html']),'!_SpecRunner.html','!.grunt'],
        tasks: [] //all the tasks are run dynamically during the watch event handler
      }
    },
    jshint: {
      main: {
        options: {
            jshintrc: '.jshintrc'
        },
        src: createFolderGlobs('*.js')
      }
    },
    clean: {
      before:{
        src:['dist','temp']
      },
      after: {
        src:['temp']
      }
    },
    less: {
      production: {
        options: {
        },
        files: [{
          expand: true,
          src: ['bower_components/avCommon/themes/**/app.less'],
          dest: 'temp/',
          ext: '.css',
        }]
      }
    },
    autoprefixer: {
      options: {
        browsers: ['ie >= 8', 'ff > 4', 'last 8 versions']
      },
      main: {
        src: 'temp/bower_components/avCommon/themes/**/app.css'
      }
    },
    ngtemplates: {
      main: {
        options: {
            module: pkg.name,
            htmlmin:'<%= htmlmin.main.options %>'
        },
        src: [createFolderGlobs('*.html'),'!index.html','!_SpecRunner.html'],
        dest: 'temp/templates.js'
      }
    },
    copy: {
      main: {
        files: [
          {src: ['img/**'], dest: 'dist/'},
          {src: ['img/**'], dest: 'dist/'},
          {src: ['temp_data/**'], dest: 'dist/'},
          {
            expand: true,
            cwd:'bower_components/avCommon/themes',
            src: ['**/*.png'],
            dest: 'dist/themes/',
            ext: '.png',
            extDot: 'first'
          },
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/themes/fonts/'
          },
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/themes/fonts/'
          },
          {
            expand: true,
            cwd: 'bower_components/font-awesome/fonts/',
            src: ['**'],
            dest: 'dist/fonts/'
          }
          //{src: ['bower_components/angular-ui-utils/ui-utils-ieshiv.min.js'], dest: 'dist/'},
          //{src: ['bower_components/select2/*.png','bower_components/select2/*.gif'], dest:'dist/css/',flatten:true,expand:true},
          //{src: ['bower_components/angular-mocks/angular-mocks.js'], dest: 'dist/'}
        ]
      }
    },
    dom_munger:{
      read: {
        options: {
          read:[
            {selector:'script[class="libnocompat"]',attribute:'src',writeto:'libnocompatjs'},
            {selector:'script[class="lib"]',attribute:'src',writeto:'libjs'},
            {selector:'script[class="app"]',attribute:'src',writeto:'appjs'},
            {selector:'link[rel="stylesheet"][data-concat!="false"]',attribute:'href',writeto:'appcss'}
          ]
        },
        src: 'index.html'
      },
      update: {
        options: {
          remove: ['script[data-remove!="false"]','link[data-remove!="false"]'],
          append: [
            {selector:'body',html:'<!--[if lte IE 8]><script src="/libcompat-v3.0.1.min.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v3.0.1.min.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v3.0.1.min.js"></script><!--<![endif]-->'},
            {selector:'body',html:'<!--All the source code of this program under copyright. Take a look at the license details at https://github.com/agoravoting/agora-core-view/blob/master/README.md -->'},
            {selector:'body',html:'<script src="/lib-v3.0.1.min.js"></script>'},
            {selector:'body',html:'<script src="/avConfig-v3.0.1.js"></script>'},
            {selector:'body',html:'<script src="/avThemes-v3.0.1.js"></script>'},
            {selector:'body',html:'<script src="/app-v3.0.1.min.js"></script>'},
            {selector:'body',html:'<script src="/avPlugins-v3.0.1.js"></script>'},
            {selector:'head',html:'<link rel="stylesheet" id="theme" href="/themes/default/app.min.css">'}
          ]
        },
        src:'index.html',
        dest: 'dist/index.html'
      }
    },
    cssmin: {
      main: {
        files: [{
            expand: true,
            cwd:'temp/bower_components/avCommon/themes',
            src: ['**/app.css'],
            dest: 'dist/themes/',
            ext: '.min.css',
            extDot: 'first'
        }]
      },
    },
    concat: {
      main: {
        files: {
          'temp/libcompat.js': [
            'vendor/jquery.compat/jquery-1.11.1.js',
            'vendor/json3/json-v3.3.2.js',
            'vendor/crypto/unsupportedBrowser.js'
          ],
          'temp/libnocompat.js': ['<%= dom_munger.data.libnocompatjs %>'],
          'temp/lib.js': ['<%= dom_munger.data.libjs %>'],
          'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'],
          'dist/avConfig-v3.0.1.js': ['bower_components/avCommon/dist/avConfig-v3.0.1.js'],
          'dist/avThemes-v3.0.1.js': ['bower_components/avCommon/dist/avThemes-v3.0.1.js'],
          'dist/avPlugins-v3.0.1.js': ['plugins/**/*.js']
        }
      }
    },
    "merge-json": {
      main: {
        files: {
            "dist/locales/en.json": ["locales/en.json", "plugins/**/locales/en.json"],
            "dist/locales/es.json": ["locales/es.json", "plugins/**/locales/es.json"],
            "dist/locales/gl.json": ["locales/gl.json", "plugins/**/locales/gl.json"],
            "dist/locales/ca.json": ["locales/ca.json", "plugins/**/locales/ca.json"]
        }
      }
    },
    ngAnnotate: {
      main: {
        files: {
        'temp/app.js':['temp/app.js'],
        'temp/lib.js': ['temp/lib.js'],
        'temp/libnocompat.js': ['temp/libnocompat.js'],
        'temp/libcompat.js': ['temp/libcompat.js']
        }
      }
    },
    uglify: {
      main: {
        options:{
          mangle: false,
          compress: {},
          beautify: true
        },
        files: {
          'dist/app-v3.0.1.min.js': 'temp/app.js',
          'dist/lib-v3.0.1.min.js': 'temp/lib.js',
          'dist/libnocompat-v3.0.1.min.js': 'temp/libnocompat.js',
          'dist/libcompat-v3.0.1.min.js': 'temp/libcompat.js',
          'dist/avWidgets.min.js': 'bower_components/avCommon/dist/avWidgets.js',

          "dist/locales/moment/es.js": "bower_components/moment/lang/es.js",
          "dist/locales/moment/gl.js": "bower_components/moment/lang/gl.js",
          "dist/locales/moment/ca.js": "bower_components/moment/lang/ca.js"
        }
      }
    },
    htmlmin: {
      main: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: false,
          removeComments: false,
          removeEmptyAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        },
        files: {
          'dist/index.html': 'dist/index.html'
        }
      }
    },
    imagemin: {
      main:{
        files: [{
          expand: true, cwd:'dist/',
          src:['**/{*.png,*.jpg}'],
          dest: 'dist/'
        }]
      }
    },
    karma: {
      options: {
        frameworks: ['jasmine'],
        files: [  //this files data is also updated in the watch handler, if updated change there too
          '<%= dom_munger.data.libnocompatjs %>',
          '<%= dom_munger.data.libjs %>',
          'avConfig.js',
          'avThemes.js',
          'avWidgets.js',
          '<%= dom_munger.data.appjs %>',
          '<%= ngtemplates.main.dest %>',
          'bower_components/angular-mocks/angular-mocks.js',
          createFolderGlobs('*-spec.js')
        ],
        logLevel:'ERROR',
        reporters:['mocha'],
        autoWatch: false, //watching is handled by grunt-contrib-watch
        singleRun: true
      },
      all_tests: {
        browsers: ['PhantomJS','Chrome','Firefox']
      },
      during_watch: {
        browsers: ['PhantomJS']
      },
    },
    protractor: {
      options: {
        configFile: "node_modules/protractor/referenceConf.js", // Default config file
        keepAlive: true, // If false, the grunt process stops when the test fails.
        noColor: false, // If true, protractor will not use colors in its output.
        args: {
        // Arguments passed to the command
      }
    },
    //your_target: {   // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
      all: {
      options: {
        configFile: "e2e.conf.js", // Target-specific config file
        args: {} // Target-specific arguments
      }
    },
  },

  });

  grunt.registerTask('build',['jshint','clean:before','less','autoprefixer','dom_munger','ngtemplates','cssmin','concat','merge-json','ngAnnotate','uglify','copy','htmlmin','imagemin','clean:after']);
  grunt.registerTask('serve', ['dom_munger:read','jshint','connect', 'watch']);
  grunt.registerTask('test',['dom_munger:read','karma:all_tests']);

  grunt.event.on('watch', function(action, filepath) {
    //https://github.com/gruntjs/grunt-contrib-watch/issues/156

    var tasksToRun = [];

    if ((filepath.lastIndexOf('.json') !== -1 && filepath.lastIndexOf('.json') === filepath.length - 5) ||
        (filepath.lastIndexOf('.js') !== -1 && filepath.lastIndexOf('.js') === filepath.length - 3)) {

      //lint the changed js file
      grunt.config('jshint.main.src', filepath);
      tasksToRun.push('jshint');

      //find the appropriate unit t est for the changed file
      var spec = filepath;
      if (filepath.lastIndexOf('-spec.js') === -1 || filepath.lastIndexOf('-spec.js') !== filepath.length - 8) {
        spec = filepath.substring(0,filepath.length - 3) + '-spec.js';
      }

      //if the spec exists then lets run it
      if (grunt.file.exists(spec)) {
        var files = [].concat(grunt.config('dom_munger.data.libnocompatjs'));
        files.concat(grunt.config('dom_munger.data.libjs'));
        files.push('bower_components/angular-mocks/angular-mocks.js');
        files.push('avConfig.js');
        files.push('avThemes.js');
        files.push('avWidgets.js');
        files.concat(grunt.config('dom_munger.data.appjs'));
        files.concat(grunt.config('ngtemplates.main.dest'));
        files.push(spec);
        grunt.config('karma.options.files', files);
        tasksToRun.push('karma:during_watch');
      }
    }

    //if index.html changed, we need to reread the <script> tags so our next run of karma
    //will have the correct environment
    if (filepath === 'index.html') {
      tasksToRun.push('dom_munger:read');
    }

    grunt.config('watch.main.tasks',tasksToRun);

  });

  grunt.loadNpmTasks('grunt-protractor-runner');
};
<commit_msg>Using generic avConfig.js not in the repo<commit_after>/*jslint node: true */
'use strict';

var pkg = require('./package.json');

//Using exclusion patterns slows down Grunt significantly
//instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**'
//this method is used to create a set of inclusive patterns for all subdirectories
//skipping node_modules, bower_components, dist, and any .dirs
//This enables users to create any directory structure they desire.
var createFolderGlobs = function(fileTypePatterns) {
  fileTypePatterns = Array.isArray(fileTypePatterns) ? fileTypePatterns : [fileTypePatterns];
  var ignore = ['node_modules','bower_components','dist','temp'];
  var fs = require('fs');
  return fs.readdirSync(process.cwd())
          .map(function(file){
            if (ignore.indexOf(file) !== -1 ||
                file.indexOf('.') === 0 ||
                !fs.lstatSync(file).isDirectory()) {
              return null;
            } else {
              return fileTypePatterns.map(function(pattern) {
                return file + '/**/' + pattern;
              });
            }
          })
          .filter(function(patterns){
            return patterns;
          })
          .concat(fileTypePatterns);
};

module.exports = function (grunt) {

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

  // Project configuration.
  grunt.initConfig({
    connect: {
      main: {
        options: {
          port: 9001
        }
      }
    },
    watch: {
      main: {
        options: {
            livereload: true,
            livereloadOnError: false,
            spawn: false
        },
        files: [createFolderGlobs(['*.js','*.less','*.html']),'!_SpecRunner.html','!.grunt'],
        tasks: [] //all the tasks are run dynamically during the watch event handler
      }
    },
    jshint: {
      main: {
        options: {
            jshintrc: '.jshintrc'
        },
        src: createFolderGlobs('*.js')
      }
    },
    clean: {
      before:{
        src:['dist','temp']
      },
      after: {
        src:['temp']
      }
    },
    less: {
      production: {
        options: {
        },
        files: [{
          expand: true,
          src: ['bower_components/avCommon/themes/**/app.less'],
          dest: 'temp/',
          ext: '.css',
        }]
      }
    },
    autoprefixer: {
      options: {
        browsers: ['ie >= 8', 'ff > 4', 'last 8 versions']
      },
      main: {
        src: 'temp/bower_components/avCommon/themes/**/app.css'
      }
    },
    ngtemplates: {
      main: {
        options: {
            module: pkg.name,
            htmlmin:'<%= htmlmin.main.options %>'
        },
        src: [createFolderGlobs('*.html'),'!index.html','!_SpecRunner.html'],
        dest: 'temp/templates.js'
      }
    },
    copy: {
      main: {
        files: [
          {src: ['img/**'], dest: 'dist/'},
          {src: ['img/**'], dest: 'dist/'},
          {src: ['temp_data/**'], dest: 'dist/'},
          {
            expand: true,
            cwd:'bower_components/avCommon/themes',
            src: ['**/*.png'],
            dest: 'dist/themes/',
            ext: '.png',
            extDot: 'first'
          },
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/themes/fonts/'
          },
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/themes/fonts/'
          },
          {
            expand: true,
            cwd: 'bower_components/font-awesome/fonts/',
            src: ['**'],
            dest: 'dist/fonts/'
          }
          //{src: ['bower_components/angular-ui-utils/ui-utils-ieshiv.min.js'], dest: 'dist/'},
          //{src: ['bower_components/select2/*.png','bower_components/select2/*.gif'], dest:'dist/css/',flatten:true,expand:true},
          //{src: ['bower_components/angular-mocks/angular-mocks.js'], dest: 'dist/'}
        ]
      }
    },
    dom_munger:{
      read: {
        options: {
          read:[
            {selector:'script[class="libnocompat"]',attribute:'src',writeto:'libnocompatjs'},
            {selector:'script[class="lib"]',attribute:'src',writeto:'libjs'},
            {selector:'script[class="app"]',attribute:'src',writeto:'appjs'},
            {selector:'link[rel="stylesheet"][data-concat!="false"]',attribute:'href',writeto:'appcss'}
          ]
        },
        src: 'index.html'
      },
      update: {
        options: {
          remove: ['script[data-remove!="false"]','link[data-remove!="false"]'],
          append: [
            {selector:'body',html:'<!--[if lte IE 8]><script src="/libcompat-v3.0.1.min.js"></script><![endif]--><!--[if gte IE 9]><script src="/libnocompat-v3.0.1.min.js"></script><![endif]--><!--[if !IE]><!--><script src="/libnocompat-v3.0.1.min.js"></script><!--<![endif]-->'},
            {selector:'body',html:'<!--All the source code of this program under copyright. Take a look at the license details at https://github.com/agoravoting/agora-core-view/blob/master/README.md -->'},
            {selector:'body',html:'<script src="/lib-v3.0.1.min.js"></script>'},
            {selector:'body',html:'<script src="/avConfig-v3.0.1.js"></script>'},
            {selector:'body',html:'<script src="/avThemes-v3.0.1.js"></script>'},
            {selector:'body',html:'<script src="/app-v3.0.1.min.js"></script>'},
            {selector:'body',html:'<script src="/avPlugins-v3.0.1.js"></script>'},
            {selector:'head',html:'<link rel="stylesheet" id="theme" href="/themes/default/app.min.css">'}
          ]
        },
        src:'index.html',
        dest: 'dist/index.html'
      }
    },
    cssmin: {
      main: {
        files: [{
            expand: true,
            cwd:'temp/bower_components/avCommon/themes',
            src: ['**/app.css'],
            dest: 'dist/themes/',
            ext: '.min.css',
            extDot: 'first'
        }]
      },
    },
    concat: {
      main: {
        files: {
          'temp/libcompat.js': [
            'vendor/jquery.compat/jquery-1.11.1.js',
            'vendor/json3/json-v3.3.2.js',
            'vendor/crypto/unsupportedBrowser.js'
          ],
          'temp/libnocompat.js': ['<%= dom_munger.data.libnocompatjs %>'],
          'temp/lib.js': ['<%= dom_munger.data.libjs %>'],
          'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'],
          'dist/avConfig-v3.0.1.js': ['avConfig.js'],
          'dist/avThemes-v3.0.1.js': ['bower_components/avCommon/dist/avThemes-v3.0.1.js'],
          'dist/avPlugins-v3.0.1.js': ['plugins/**/*.js']
        }
      }
    },
    "merge-json": {
      main: {
        files: {
            "dist/locales/en.json": ["locales/en.json", "plugins/**/locales/en.json"],
            "dist/locales/es.json": ["locales/es.json", "plugins/**/locales/es.json"],
            "dist/locales/gl.json": ["locales/gl.json", "plugins/**/locales/gl.json"],
            "dist/locales/ca.json": ["locales/ca.json", "plugins/**/locales/ca.json"]
        }
      }
    },
    ngAnnotate: {
      main: {
        files: {
        'temp/app.js':['temp/app.js'],
        'temp/lib.js': ['temp/lib.js'],
        'temp/libnocompat.js': ['temp/libnocompat.js'],
        'temp/libcompat.js': ['temp/libcompat.js']
        }
      }
    },
    uglify: {
      main: {
        options:{
          mangle: false,
          compress: {},
          beautify: true
        },
        files: {
          'dist/app-v3.0.1.min.js': 'temp/app.js',
          'dist/lib-v3.0.1.min.js': 'temp/lib.js',
          'dist/libnocompat-v3.0.1.min.js': 'temp/libnocompat.js',
          'dist/libcompat-v3.0.1.min.js': 'temp/libcompat.js',
          'dist/avWidgets.min.js': 'bower_components/avCommon/dist/avWidgets.js',

          "dist/locales/moment/es.js": "bower_components/moment/lang/es.js",
          "dist/locales/moment/gl.js": "bower_components/moment/lang/gl.js",
          "dist/locales/moment/ca.js": "bower_components/moment/lang/ca.js"
        }
      }
    },
    htmlmin: {
      main: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: false,
          removeComments: false,
          removeEmptyAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        },
        files: {
          'dist/index.html': 'dist/index.html'
        }
      }
    },
    imagemin: {
      main:{
        files: [{
          expand: true, cwd:'dist/',
          src:['**/{*.png,*.jpg}'],
          dest: 'dist/'
        }]
      }
    },
    karma: {
      options: {
        frameworks: ['jasmine'],
        files: [  //this files data is also updated in the watch handler, if updated change there too
          '<%= dom_munger.data.libnocompatjs %>',
          '<%= dom_munger.data.libjs %>',
          'avConfig.js',
          'avThemes.js',
          'avWidgets.js',
          '<%= dom_munger.data.appjs %>',
          '<%= ngtemplates.main.dest %>',
          'bower_components/angular-mocks/angular-mocks.js',
          createFolderGlobs('*-spec.js')
        ],
        logLevel:'ERROR',
        reporters:['mocha'],
        autoWatch: false, //watching is handled by grunt-contrib-watch
        singleRun: true
      },
      all_tests: {
        browsers: ['PhantomJS','Chrome','Firefox']
      },
      during_watch: {
        browsers: ['PhantomJS']
      },
    },
    protractor: {
      options: {
        configFile: "node_modules/protractor/referenceConf.js", // Default config file
        keepAlive: true, // If false, the grunt process stops when the test fails.
        noColor: false, // If true, protractor will not use colors in its output.
        args: {
        // Arguments passed to the command
      }
    },
    //your_target: {   // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
      all: {
      options: {
        configFile: "e2e.conf.js", // Target-specific config file
        args: {} // Target-specific arguments
      }
    },
  },

  });

  grunt.registerTask('build',['jshint','clean:before','less','autoprefixer','dom_munger','ngtemplates','cssmin','concat','merge-json','ngAnnotate','uglify','copy','htmlmin','imagemin','clean:after']);
  grunt.registerTask('serve', ['dom_munger:read','jshint','connect', 'watch']);
  grunt.registerTask('test',['dom_munger:read','karma:all_tests']);

  grunt.event.on('watch', function(action, filepath) {
    //https://github.com/gruntjs/grunt-contrib-watch/issues/156

    var tasksToRun = [];

    if ((filepath.lastIndexOf('.json') !== -1 && filepath.lastIndexOf('.json') === filepath.length - 5) ||
        (filepath.lastIndexOf('.js') !== -1 && filepath.lastIndexOf('.js') === filepath.length - 3)) {

      //lint the changed js file
      grunt.config('jshint.main.src', filepath);
      tasksToRun.push('jshint');

      //find the appropriate unit t est for the changed file
      var spec = filepath;
      if (filepath.lastIndexOf('-spec.js') === -1 || filepath.lastIndexOf('-spec.js') !== filepath.length - 8) {
        spec = filepath.substring(0,filepath.length - 3) + '-spec.js';
      }

      //if the spec exists then lets run it
      if (grunt.file.exists(spec)) {
        var files = [].concat(grunt.config('dom_munger.data.libnocompatjs'));
        files.concat(grunt.config('dom_munger.data.libjs'));
        files.push('bower_components/angular-mocks/angular-mocks.js');
        files.push('avConfig.js');
        files.push('avThemes.js');
        files.push('avWidgets.js');
        files.concat(grunt.config('dom_munger.data.appjs'));
        files.concat(grunt.config('ngtemplates.main.dest'));
        files.push(spec);
        grunt.config('karma.options.files', files);
        tasksToRun.push('karma:during_watch');
      }
    }

    //if index.html changed, we need to reread the <script> tags so our next run of karma
    //will have the correct environment
    if (filepath === 'index.html') {
      tasksToRun.push('dom_munger:read');
    }

    grunt.config('watch.main.tasks',tasksToRun);

  });

  grunt.loadNpmTasks('grunt-protractor-runner');
};
<|endoftext|>


<commit_before>
module.exports = function (grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    browserify: {
      basic: {
        src: ['node_modules/usco-assetmanager/src/assetManager.coffee',
        'node_modules/usco-xhr-store/src/xhrStore.coffee',
        'node_modules/usco-stl-parser/STLParser.js',
        'node_modules/usco-amf-parser/AMFParser_stream.js',
        'node_modules/usco-obj-parser/OBJParser.js',
        'node_modules/usco-ply-parser/PLYParser.js',
        ],
        dest: 'public/main.js',
        options: {
          transform: ['coffeeify'],
          ignore:["three"],
          external: [],
          alias:[
            'node_modules/usco-assetmanager/src/assetManager.coffee:assetManager',
            'node_modules/usco-xhr-store/src/xhrStore.coffee:usco-xhr-store',
            'node_modules/usco-stl-parser/STLParser.js:usco-stl-parser',
            'node_modules/usco-amf-parser/AMFParser_stream.js:usco-amf-parser',
            'node_modules/usco-obj-parser/OBJParser.js:usco-obj-parser',
            'node_modules/usco-ply-parser/PLYParser.js:usco-ply-parser'
          ],
          aliasMappings: [
            {
              cwd: 'shared',
              src: ['**/*.js'],
              dest: 'lib',
            },
          ]
        }
      }
    },
    uglify: {
      main:{
        options: {
          banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
        },
        dist: {
          files: {
            'public/<%= pkg.name %>.min.js': ['public/main.js']
          }
        }
      },
      integration:
      {
        options:{
          //compress:true,
          //sourceMap:'build/integration/usco-ultiviewer.js.map',
          //sourceMappingURL:'/'
          //sourceMapIn:'build/integration/platform.js.map'
        },
        files: {
            'build/integration/usco-ultiviewer.min.js': ['build/integration/usco-ultiviewer.js'],
            'build/integration/platform.min.js': ['build/integration/platform.js']
          }
      }
    },
    exec: {
      vulcan: {
        command: 'vulcanize --csp -i index.html -o build/build.html',
        stdout: true,
        stderr: true
      },
      integration: {
        command: 'vulcanize --csp -i smoke.html -o build/integration/usco-ultiviewer.html',
        stdout: true,
        stderr: true
      }
    },
    nodewebkit: {
      options: {
          build_dir: './build/desktop', // Where the build version of my node-webkit app is saved
          mac: false, // We want to build it for mac
          win: false, // We want to build it for win
          linux32: false, // We don't need linux32
          linux64: true // We don't need linux64
      },
      src: ['./release/**'] // Your node-wekit app
    },
    replace: {
      integration:{
        src: ['build/integration/usco-ultiviewer.html'],
        dest: 'build/integration/usco-ultiviewer.html',
        replacements: [
            {from:'../components/platform', to:''},
            {from: '../components/',      to: ''},
            {from: 'usco-ultiviewer.js',      to: 'usco-ultiviewer.min.js'},
            ]
      },
      testing:{
        src: ['components/platform/platform.js'],
        dest: 'components/platform/platform_.js',
        replacements: [{
              from: 'global',                   // string replacement
              to: 'fakeGlobal'
            }]
       }
    },
    copy: {
      integration: {
        files:[
        //{src: 'components/platform/platform.js.map',dest: 'build/integration/platform.js.map'} ,
        {src: 'components/platform/platform.js',dest: 'build/integration/platform.js'} ,
       ]
     },
    },

    htmlmin: {
    integration: {
      options: {
      },
      files: {                                   // Dictionary of files
        'build/integration/usco-ultiviewer.html': 'build/integration/usco-ultiviewer.html',
      }
    },
  },
  clean:{
    integration:["build/integration"],
    postIntegration:["build/integration/platform.js","build/integration/usco-ultiviewer.js"]
  }

  });

  //generic
  grunt.loadNpmTasks('grunt-exec');
  grunt.loadNpmTasks('grunt-text-replace');
  grunt.loadNpmTasks('grunt-contrib-clean');

  //builds generation
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-node-webkit-builder');

  //release cycle
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');

  // Task(s).
  grunt.registerTask('test', ['jshint', 'jasmine_node']);
  grunt.registerTask('build', ['jshint', 'jasmine_node','concat','uglify']);
  grunt.registerTask('release', ['concat','uglify','jasmine_node','release']);
  grunt.registerTask('default', ['browserify','uglify']);

  //test for polymer vulcanizer (ie full release)
  grunt.registerTask('vulcan', ['exec']);

  //should be a sub task/target
  grunt.registerTask('desktopBuild', ['nodewebkit']);

  //integration
  grunt.registerTask('fullbuild', ['clean:integration', 'copy:integration','exec:integration','replace:integration','uglify:integration','clean:postIntegration']);
  //issues with ,'htmlmin:integration'

};

//see https://github.com/jmreidy/grunt-browserify/blob/master/examples/mappings/Gruntfile.js

<commit_msg>- a bit of cleanup of build process<commit_after>
module.exports = function (grunt) {

  //different builds:
  // browser, standalone
  // browser, integration
  // desktop
  // node.js

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

    browserify: {
      basic: {
        src: ['node_modules/usco-assetmanager/src/assetManager.coffee',
        'node_modules/usco-xhr-store/src/xhrStore.coffee',
        'node_modules/usco-stl-parser/STLParser.js',
        'node_modules/usco-amf-parser/AMFParser_stream.js',
        'node_modules/usco-obj-parser/OBJParser.js',
        'node_modules/usco-ply-parser/PLYParser.js',
        ],
        dest: 'public/main.js',
        options: {
          transform: ['coffeeify'],
          ignore:["three"],
          external: [],
          alias:[
            'node_modules/usco-assetmanager/src/assetManager.coffee:assetManager',
            'node_modules/usco-xhr-store/src/xhrStore.coffee:usco-xhr-store',
            'node_modules/usco-stl-parser/STLParser.js:usco-stl-parser',
            'node_modules/usco-amf-parser/AMFParser_stream.js:usco-amf-parser',
            'node_modules/usco-obj-parser/OBJParser.js:usco-obj-parser',
            'node_modules/usco-ply-parser/PLYParser.js:usco-ply-parser'
          ],
          aliasMappings: [
            {
              cwd: 'shared',
              src: ['**/*.js'],
              dest: 'lib',
            },
          ]
        }
      }
    },
    uglify: {
      main:{
        options: {
          banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
        },
        dist: {
          files: {
            'public/<%= pkg.name %>.min.js': ['public/main.js']
          }
        }
      },
      integration:
      {
        options:{
          //compress:true,
          //sourceMap:'build/integration/usco-ultiviewer.js.map',
          //sourceMappingURL:'/'
          //sourceMapIn:'build/integration/platform.js.map'
        },
        files: {
            'build/integration/usco-ultiviewer.min.js': ['build/integration/usco-ultiviewer.js'],
            'build/integration/platform.min.js': ['build/integration/platform.js']
          }
      }
    },
    exec: {
      standalone: {
        command: 'vulcanize --csp -i index.html -o build/build.html',
        stdout: true,
        stderr: true
      },
      integration: {
        command: 'vulcanize --csp -i smoke.html -o build/integration/usco-ultiviewer.html',
        stdout: true,
        stderr: true
      }
    },
    nodewebkit: {
      options: {
          version:"0.8.2",// 0.6.3 works with polymer , does not work from 0.7.0 onwards
          build_dir: 'build/desktop', // Where the build version of my node-webkit app is saved
          mac: false, // We want to build it for mac
          win: false, // We want to build it for win
          linux32: false, // We don't need linux32
          linux64: true // We don't need linux64
      },
      src: ['build/**'] // Your node-wekit app
    },
    replace: {
      integration:{
        src: ['build/integration/usco-ultiviewer.html'],
        dest: 'build/integration/usco-ultiviewer.html',
        replacements: [
            {from:'../components/platform', to:''},
            {from: '../components/',      to: ''},
            {from: 'usco-ultiviewer.js',      to: 'usco-ultiviewer.min.js'},
            ]
      },
      testing:{
        src: ['components/platform/platform.js'],
        dest: 'components/platform/platform_.js',
        replacements: [{
              from: 'global',                   // string replacement
              to: 'fakeGlobal'
            }]
       }
    },
    copy: {
      integration: {
        files:[
        //{src: 'components/platform/platform.js.map',dest: 'build/integration/platform.js.map'} ,
        {src: 'components/platform/platform.js',dest: 'build/integration/platform.js'} ,
       ]
     },
    },

    htmlmin: {
    integration: {
      options: {
      },
      files: {                                   // Dictionary of files
        'build/integration/usco-ultiviewer.html': 'build/integration/usco-ultiviewer.html',
      }
    },
  },
  clean:{
    integration:["build/integration"],
    postIntegration:["build/integration/platform.js","build/integration/usco-ultiviewer.js"]
  }

  });

  //generic
  grunt.loadNpmTasks('grunt-exec');
  grunt.loadNpmTasks('grunt-text-replace');
  grunt.loadNpmTasks('grunt-contrib-clean');

  //builds generation
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-node-webkit-builder');

  //release cycle
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');

  // Task(s).
  grunt.registerTask('test', ['jshint', 'jasmine_node']);
  grunt.registerTask('build', ['jshint', 'jasmine_node','concat','uglify']);
  grunt.registerTask('release', ['concat','uglify','jasmine_node','release']);
  grunt.registerTask('default', ['browserify','uglify']);

  //test for polymer vulcanizer (ie full release)
  grunt.registerTask('vulcan', ['exec']);

  //should be a sub task/target
  grunt.registerTask('desktopBuild', ['nodewebkit']);

  //integration build
  grunt.registerTask('integrationbuild', ['clean:integration', 'copy:integration','exec:integration','replace:integration','uglify:integration','clean:postIntegration']);//issues with ,'htmlmin:integration'

  //desktop build
  grunt.registerTask('desktopbuild', ['clean:integration', 'copy:integration','exec:standalone','replace:integration','uglify:integration','clean:postIntegration']);

};

//see https://github.com/jmreidy/grunt-browserify/blob/master/examples/mappings/Gruntfile.js

<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      all: [
        'Gruntfile.js',
        'annyang.js',
        'sites/facebook.js',
        'sites/geektime.js',
      ],
      options: {
        "node"      : true,
        "browser"   : true,
        "devel"     : false,
        "camelcase" : true,
        "curly"     : true,
        "latedef"   : true,
        "unused"    : true,
        "trailing"  : true,
        "eqeqeq"    : true,
        "eqnull"    : true,
        "evil"      : false,
        "forin"     : true,
        "immed"     : true,
        "laxbreak"  : false,
        "newcap"    : true,
        "noarg"     : true,
        "noempty"   : false,
        "nonew"     : true,
        "onevar"    : false,
        "plusplus"  : false,
        "undef"     : true,
        "sub"       : true,
        "strict"    : true,
        "white"     : false,
        "indent"    : 2
      }
    },
    watch: {
      files: ['annyang.js', 'sites/facebook.js', 'sites/geektime.js', 'demo/css/main.css', '!**/node_modules/**'],
      tasks: ['default'],
    },
    uglify: {
      options: {
        preserveComments: 'some'
      },
      all: {
        files: {
          'annyang.min.js': ['annyang.js'],
          'sites/facebook.min.js': ['annyang.js', 'sites/facebook.js'],
          'sites/geektime.min.js': ['annyang.js', 'sites/geektime.js'],
        }
      }
    },
    imagemin: {
      demoimages: {                       // Target
        options: {                        // Target options
        },
        files: [{
          expand: true,                   // Enable dynamic expansion
          cwd: 'demo/images',             // Src matches are relative to this path
          src: ['*.{png,jpg,gif}'],       // Actual patterns to match
          dest: 'demo/images'             // Destination path prefix
        }]
      },
    },
    cssmin: {
      combine: {
        files: {
          'demo/css/main.min.css': ['demo/css/main.css', 'demo/vendor/css/default.css', 'demo/vendor/css/github.css']
        }
      }
    },
    connect: {
      server: {
        options: {
          protocol: 'https',
          port: 8443,
          hostname: '*',
          base: '.'
        }
      }
    }
  });

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

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

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

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

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

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

  // Default task(s).
  grunt.registerTask('default', ['jshint', 'uglify', 'cssmin']);

  grunt.registerTask('dev', ['default', 'connect', 'watch']);

};
<commit_msg>dev task now opens demo page automatically<commit_after>module.exports = function(grunt) {
  "use strict";

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
      all: [
        'Gruntfile.js',
        'annyang.js',
        'sites/facebook.js',
        'sites/geektime.js',
      ],
      options: {
        "node"      : true,
        "browser"   : true,
        "devel"     : false,
        "camelcase" : true,
        "curly"     : true,
        "latedef"   : true,
        "unused"    : true,
        "trailing"  : true,
        "eqeqeq"    : true,
        "eqnull"    : true,
        "evil"      : false,
        "forin"     : true,
        "immed"     : true,
        "laxbreak"  : false,
        "newcap"    : true,
        "noarg"     : true,
        "noempty"   : false,
        "nonew"     : true,
        "onevar"    : false,
        "plusplus"  : false,
        "undef"     : true,
        "sub"       : true,
        "strict"    : true,
        "white"     : false,
        "indent"    : 2
      }
    },
    watch: {
      files: ['annyang.js', 'sites/facebook.js', 'sites/geektime.js', 'demo/css/main.css', '!**/node_modules/**'],
      tasks: ['default'],
    },
    uglify: {
      options: {
        preserveComments: 'some'
      },
      all: {
        files: {
          'annyang.min.js': ['annyang.js'],
          'sites/facebook.min.js': ['annyang.js', 'sites/facebook.js'],
          'sites/geektime.min.js': ['annyang.js', 'sites/geektime.js'],
        }
      }
    },
    imagemin: {
      demoimages: {                       // Target
        options: {                        // Target options
        },
        files: [{
          expand: true,                   // Enable dynamic expansion
          cwd: 'demo/images',             // Src matches are relative to this path
          src: ['*.{png,jpg,gif}'],       // Actual patterns to match
          dest: 'demo/images'             // Destination path prefix
        }]
      },
    },
    cssmin: {
      combine: {
        files: {
          'demo/css/main.min.css': ['demo/css/main.css', 'demo/vendor/css/default.css', 'demo/vendor/css/github.css']
        }
      }
    },
    connect: {
      server: {
        options: {
          protocol: 'https',
          port: 8443,
          hostname: '*',
          base: '.',
          open: 'https://localhost:8443/demo'
        }
      }
    }
  });

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

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

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

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

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

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

  // Default task(s).
  grunt.registerTask('default', ['jshint', 'uglify', 'cssmin']);

  grunt.registerTask('dev', ['default', 'connect', 'watch']);

};
<|endoftext|>


<commit_before>'use strict';

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

  // configurable paths
  var yeomanConfig = {
    lib: 'lib',
    dist: 'dist'
  };

  // Name the AMD modules so we can register them in the concatenated build.
  var processNamedAMD = function (src, filepath) {
    // Use the two last components of the path, e.g. 'hyperagent/agent'
    var name = filepath.replace(/dist\/amd\//, '').replace(/\.js$/, '');
    return src.replace(/define\(/, 'define(\'' + name + '\',');
  };

  var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
  };

  grunt.initConfig({
    yeoman: yeomanConfig,

    clean: {
      dist: ['<%= yeoman.dist %>/*', '.tmp/']
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.lib %>/{,*/}*.js'
      ]
    },

    transpile: {
      amd: {
        type: 'amd',
        files: [{
          expand: true,
          cwd: '<%= yeoman.lib %>',
          src: ['{,**/}*.js', '!loader.js'],
          dest: '<%= yeoman.dist %>/amd/'
        }]
      },
      cjs: {
        type: 'cjs',
        files: [{
          expand: true,
          cwd: '<%= yeoman.lib %>',
          src: ['{,**/}*.js', '!loader.js'],
          dest: '<%= yeoman.dist %>/commonjs/'
        }]
      }
    },

    connect: {
      options: {
        port: 9000,
        hostname: '0.0.0.0'
      },
      test: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, '.'),
              mountFolder(connect, 'dist')
            ];
          }
        }
      }
    },

    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      },
      ci: {
        configFile: 'karma-ci.conf.js',
        singleRun: true
      }
    },

    concat: {
      dist: {
        options: {
          banner: '(function () {\n',
          footer: '\nwindow.Hyperagent = requireModule(\'hyperagent\');\n}());',
          process: processNamedAMD
        },
        files: [{
          src: ['<%= yeoman.lib %>/loader.js', '<%= yeoman.dist %>/amd/{,**/}*.js'],
          dest: '<%= yeoman.dist %>/hyperagent.js'
        }]
      }
    },

    uglify: {
      dist: {
        files: [{'<%= yeoman.dist %>/hyperagent.min.js': '<%= yeoman.dist %>/hyperagent.js'}]
      }
    },

    watch: {
      options: {
        livereload: true
      },
      dist: {
        files: ['<%= yeoman.lib %>/{,**/}*.js', 'test/**/*.js'],
        tasks: ['build']
      }
    },

    open: {
      test: {
        path: 'http://localhost:<%= connect.options.port %>/test/'
      }
    }
  });

  grunt.registerTask('build', [
    'clean',
    'transpile',
    'concat',
    'uglify'
  ]);

  // Create an alias familiar to those using webapp/angular.
  grunt.registerTask('server', [
    'connect:test',
    'open',
    'watch'
  ]);

  grunt.registerTask('test', [
    'build',
    'karma:unit'
  ]);

  grunt.registerTask('test-ci', [
    'build',
    'karma:ci'
  ]);

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

  grunt.loadNpmTasks('grunt-devtools');
};
<commit_msg>Build before running test server<commit_after>'use strict';

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

  // configurable paths
  var yeomanConfig = {
    lib: 'lib',
    dist: 'dist'
  };

  // Name the AMD modules so we can register them in the concatenated build.
  var processNamedAMD = function (src, filepath) {
    // Use the two last components of the path, e.g. 'hyperagent/agent'
    var name = filepath.replace(/dist\/amd\//, '').replace(/\.js$/, '');
    return src.replace(/define\(/, 'define(\'' + name + '\',');
  };

  var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
  };

  grunt.initConfig({
    yeoman: yeomanConfig,

    clean: {
      dist: ['<%= yeoman.dist %>/*', '.tmp/']
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= yeoman.lib %>/{,*/}*.js'
      ]
    },

    transpile: {
      amd: {
        type: 'amd',
        files: [{
          expand: true,
          cwd: '<%= yeoman.lib %>',
          src: ['{,**/}*.js', '!loader.js'],
          dest: '<%= yeoman.dist %>/amd/'
        }]
      },
      cjs: {
        type: 'cjs',
        files: [{
          expand: true,
          cwd: '<%= yeoman.lib %>',
          src: ['{,**/}*.js', '!loader.js'],
          dest: '<%= yeoman.dist %>/commonjs/'
        }]
      }
    },

    connect: {
      options: {
        port: 9000,
        hostname: '0.0.0.0'
      },
      test: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, '.'),
              mountFolder(connect, 'dist')
            ];
          }
        }
      }
    },

    karma: {
      unit: {
        configFile: 'karma.conf.js',
        singleRun: true
      },
      ci: {
        configFile: 'karma-ci.conf.js',
        singleRun: true
      }
    },

    concat: {
      dist: {
        options: {
          banner: '(function () {\n',
          footer: '\nwindow.Hyperagent = requireModule(\'hyperagent\');\n}());',
          process: processNamedAMD
        },
        files: [{
          src: ['<%= yeoman.lib %>/loader.js', '<%= yeoman.dist %>/amd/{,**/}*.js'],
          dest: '<%= yeoman.dist %>/hyperagent.js'
        }]
      }
    },

    uglify: {
      dist: {
        files: [{'<%= yeoman.dist %>/hyperagent.min.js': '<%= yeoman.dist %>/hyperagent.js'}]
      }
    },

    watch: {
      options: {
        livereload: true
      },
      dist: {
        files: ['<%= yeoman.lib %>/{,**/}*.js', 'test/**/*.js'],
        tasks: ['build']
      }
    },

    open: {
      test: {
        path: 'http://localhost:<%= connect.options.port %>/test/'
      }
    }
  });

  grunt.registerTask('build', [
    'clean',
    'transpile',
    'concat',
    'uglify'
  ]);

  // Create an alias familiar to those using webapp/angular.
  grunt.registerTask('server', [
    'build',
    'connect:test',
    'open',
    'watch'
  ]);

  grunt.registerTask('test', [
    'build',
    'karma:unit'
  ]);

  grunt.registerTask('test-ci', [
    'build',
    'karma:ci'
  ]);

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

  grunt.loadNpmTasks('grunt-devtools');
};
<|endoftext|>


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

  var bower = require( 'bower' );
  var path = require( 'path' );

  mavenProperties = grunt.file.readJSON( 'maven-properties.json' );
  grunt.log.writeln( 'Thymol version is: ' + mavenProperties.thymolVersion );
  grunt.log.writeln( 'Release date is: ' + mavenProperties.thymolReleaseDate );
  grunt.log.writeln( '\n' );
  grunt.log.writeln( 'bower path to jQuery is: ' + mavenProperties.bowerJQuerySource );
  grunt.log.writeln( 'sourceforge path to jQuery is: ' + mavenProperties.sourceforgeJQuerySource );
  grunt.log.writeln( 'jsdelivr path to jQuery is: ' + mavenProperties.jsdelivrJQuerySource );

  var tmpDir = "target/dist-tmp/";
  var bowerThymolPath = "bower_components/thymol/";
  var bowerThymolDistPath = bowerThymolPath + "dist/";

  var fullFile = "thymol-full.js";
  var fullFileMin = "thymol-full.min.js";

  var tmpThymolFile = tmpDir + "thymol.js";
  var tmpThymolFileMin = tmpDir + "thymol.min.js";
  var tmpLiteFile = tmpDir + "thymol-lite.js";
  var tmpFullFile = tmpDir + fullFile;
  var tmpLiteFileMin = tmpDir + "thymol-lite.min.js";
  var tmpFullFileMin = tmpDir + fullFileMin;

  var nodeFile = "thymol-node.js";
  var nodeFileMin = "thymol-node.min.js";
  var tmpNodeFile = tmpDir + nodeFile;
  var tmpNodeFileMin = tmpDir + nodeFileMin;

  var thymolBootstrap = [ "src/main/js/thymol.js" ];

  var tmpThymolFileObj = {};
  tmpThymolFileObj[ tmpThymolFile ] = thymolBootstrap;

  var coreThymolFiles = [
      "src/main/js/core/thymol-core.js",
      "src/main/js/core/thymol-context.js",
      "src/main/js/core/thymol-utils.js",
      "src/main/js/core/thymol-parser.js",
      "src/main/js/core/thymol-standarddialect.js",
      "src/main/js/core/thymol-http.js"
  ];

  var optionalThymolFiles = [
      "src/main/js/obj/aggregates-object.js",
      "src/main/js/obj/arrays-object.js",
      "src/main/js/obj/bools-object.js",
      "src/main/js/obj/dates-object.js",
      "src/main/js/obj/calendars-object.js",
      "src/main/js/obj/ids-object.js",
      "src/main/js/obj/lists-object.js",
      "src/main/js/obj/maps-object.js",
      "src/main/js/obj/messages-object.js",
      "src/main/js/obj/numbers-object.js",
      "src/main/js/obj/objects-object.js",
      "src/main/js/obj/sets-object.js",
      "src/main/js/obj/strings-object.js",
      "src/main/js/obj/objects-modules-config.js"
  ];

  var mainThymolFiles = [
      "src/main/js/thymol-system.js",
      "src/main/js/thymol-main.js"
  ];

  var nodeThymolFiles = [
      "src/main/js/thymol-exports.js"
  ];

  var tmpLiteFileObj = {};
  tmpLiteFileObj[ tmpLiteFile ] = coreThymolFiles.concat( mainThymolFiles );

  var tmpFullFileObj = {};
  tmpFullFileObj[ tmpFullFile ] = coreThymolFiles.concat( optionalThymolFiles ).concat( mainThymolFiles );

  var tmpNodeFileObj = {};
  tmpNodeFileObj[ tmpNodeFile ] = coreThymolFiles.concat( optionalThymolFiles ).concat( nodeThymolFiles );

  var tmpLiteFileMinObj = {};
  tmpLiteFileMinObj[ tmpLiteFileMin ] = [ tmpLiteFile ];

  var tmpFullFileMinObj = {};
  tmpFullFileMinObj[ tmpFullFileMin ] = [ tmpFullFile ];

  var tmpNodeFileMinObj = {};
  tmpNodeFileMinObj[ tmpNodeFileMin ] = [ tmpNodeFile ];

  var tmpThymolFileMinObj = {};
  tmpThymolFileMinObj[ tmpThymolFileMin ] = thymolBootstrap;

  var pckJSON = grunt.file.readJSON( 'package.json' );

  pckJSON.version = mavenProperties.thymolVersion;

  var shortBannerComment = "/* <%= pkg.title %> version <%= pkg.version %> | Copyright (C) 2012-<%= grunt.template.today('yyyy') %> <%= pkg.author.name %> | <%= pkg.short_license %> */";

  var mediumBannerComment = "<%= pkg.strapline %>\n\n"
    + "   <%= pkg.title %> version <%= pkg.version %> Copyright (C) 2012-<%= grunt.template.today('yyyy') %> <%= pkg.author.name %>\n"
    + "   <%= pkg.author.email %> <%= pkg.author.url %>\n\n"
    + "<%= pkg.license %>\n"
    + "<%= pkg.tail %>\n\n";

  grunt.initConfig( {

    pkg : pckJSON,

    banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - '
      + '<%= grunt.template.today("yyyy-mm-dd") %>\n'
      + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>'
      + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;'
      + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',

    clean : [ "npm/", "dist/", "sourceforge/", "jsdelivr/", tmpDir, bowerThymolPath ],

    uglify : {
      thymol : {
        files : tmpThymolFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      lite : {
        files : tmpLiteFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      full : {
        files : tmpFullFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      node : {
        files : tmpNodeFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      thymol_min : {
        files : tmpThymolFileMinObj,
        options : {
          compress : true,
          mangle : true,
          banner : shortBannerComment
        }
      },
      lite_min : {
        files : tmpLiteFileMinObj,
        options : {
          compress : true,
          mangle : true,
          banner : shortBannerComment
        }
      },
      full_min : {
        files : tmpFullFileMinObj,
        options : {
          compress : true,
          mangle : true,
          banner : shortBannerComment
        }
      },
      node_min : {
        files : tmpNodeFileMinObj,
        options : {
          compress : true,
          mangle : true,
          banner : shortBannerComment
        }
      }
    },

    copy : {
      thymol_bower : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*.js" ],
        dest : "dist/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFile );
            return content.replace( "${thJQuerySource}", mavenProperties.bowerJQuerySource );
          }
        }
      },
      thymol_sourceforge : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*.js" ],
        dest : "sourceforge/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFile );
            return content.replace( "${thJQuerySource}", mavenProperties.sourceforgeJQuerySource );
          }
        }
      },
      thymol_jsdelivr : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*min*.js" ],
        dest : "jsdelivr/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFileMin );
            content = content.replace( "${thThymolSource}", nodeFileMin );
            return content.replace( "${thJQuerySource}", mavenProperties.jsdelivrJQuerySource );
          }
        }
      },
      thymol_npm : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*node.js" ],
        dest : "npm/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFileMin );
            content = content.replace( "${thThymolSource}", nodeFileMin );
            return content.replace( "${thJQuerySource}", mavenProperties.jsdelivrJQuerySource );
          }
        }
      },
      json_npm : {
        expand : true,
        cwd : "src/build/npm",
        src : [ "**/*" ],
        dest : "npm/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            return content.replace( "${project.version}", mavenProperties.thymolVersion );
          }
        }
      },
      bower_dist : {
        expand : true,
        cwd : "dist/",
        src : [ "**/*.js" ],
        dest : bowerThymolDistPath
      }
    }

  } );

  grunt.loadNpmTasks( "grunt-contrib-clean" );
  grunt.loadNpmTasks( "grunt-contrib-uglify" );
  grunt.loadNpmTasks( "grunt-contrib-copy" );

  grunt.registerTask( "default", [ "clean", "uglify", "copy" ] );

};<commit_msg>Fixed minor issues with compress config.<commit_after>module.exports = function( grunt ) {

  var bower = require( 'bower' );
  var path = require( 'path' );

  mavenProperties = grunt.file.readJSON( 'maven-properties.json' );
  grunt.log.writeln( 'Thymol version is: ' + mavenProperties.thymolVersion );
  grunt.log.writeln( 'Release date is: ' + mavenProperties.thymolReleaseDate );
  grunt.log.writeln( '\n' );
  grunt.log.writeln( 'bower path to jQuery is: ' + mavenProperties.bowerJQuerySource );
  grunt.log.writeln( 'sourceforge path to jQuery is: ' + mavenProperties.sourceforgeJQuerySource );
  grunt.log.writeln( 'jsdelivr path to jQuery is: ' + mavenProperties.jsdelivrJQuerySource );

  var tmpDir = "target/dist-tmp/";
  var bowerThymolPath = "bower_components/thymol/";
  var bowerThymolDistPath = bowerThymolPath + "dist/";

  var fullFile = "thymol-full.js";
  var fullFileMin = "thymol-full.min.js";

  var tmpThymolFile = tmpDir + "thymol.js";
  var tmpThymolFileMin = tmpDir + "thymol.min.js";
  var tmpLiteFile = tmpDir + "thymol-lite.js";
  var tmpFullFile = tmpDir + fullFile;
  var tmpLiteFileMin = tmpDir + "thymol-lite.min.js";
  var tmpFullFileMin = tmpDir + fullFileMin;

  var nodeFile = "thymol-node.js";
  var nodeFileMin = "thymol-node.min.js";
  var tmpNodeFile = tmpDir + nodeFile;
  var tmpNodeFileMin = tmpDir + nodeFileMin;

  var thymolBootstrap = [ "src/main/js/thymol.js" ];

  var tmpThymolFileObj = {};
  tmpThymolFileObj[ tmpThymolFile ] = thymolBootstrap;

  var coreThymolFiles = [
      "src/main/js/core/thymol-core.js",
      "src/main/js/core/thymol-context.js",
      "src/main/js/core/thymol-utils.js",
      "src/main/js/core/thymol-parser.js",
      "src/main/js/core/thymol-standarddialect.js",
      "src/main/js/core/thymol-http.js"
  ];

  var optionalThymolFiles = [
      "src/main/js/obj/aggregates-object.js",
      "src/main/js/obj/arrays-object.js",
      "src/main/js/obj/bools-object.js",
      "src/main/js/obj/dates-object.js",
      "src/main/js/obj/calendars-object.js",
      "src/main/js/obj/ids-object.js",
      "src/main/js/obj/lists-object.js",
      "src/main/js/obj/maps-object.js",
      "src/main/js/obj/messages-object.js",
      "src/main/js/obj/numbers-object.js",
      "src/main/js/obj/objects-object.js",
      "src/main/js/obj/sets-object.js",
      "src/main/js/obj/strings-object.js",
      "src/main/js/obj/objects-modules-config.js"
  ];

  var mainThymolFiles = [
      "src/main/js/thymol-system.js",
      "src/main/js/thymol-main.js"
  ];

  var nodeThymolFiles = [
      "src/main/js/thymol-exports.js"
  ];

  var tmpLiteFileObj = {};
  tmpLiteFileObj[ tmpLiteFile ] = coreThymolFiles.concat( mainThymolFiles );

  var tmpFullFileObj = {};
  tmpFullFileObj[ tmpFullFile ] = coreThymolFiles.concat( optionalThymolFiles ).concat( mainThymolFiles );

  var tmpNodeFileObj = {};
  tmpNodeFileObj[ tmpNodeFile ] = coreThymolFiles.concat( optionalThymolFiles ).concat( nodeThymolFiles );

  var tmpLiteFileMinObj = {};
  tmpLiteFileMinObj[ tmpLiteFileMin ] = [ tmpLiteFile ];

  var tmpFullFileMinObj = {};
  tmpFullFileMinObj[ tmpFullFileMin ] = [ tmpFullFile ];

  var tmpNodeFileMinObj = {};
  tmpNodeFileMinObj[ tmpNodeFileMin ] = [ tmpNodeFile ];

  var tmpThymolFileMinObj = {};
  tmpThymolFileMinObj[ tmpThymolFileMin ] = thymolBootstrap;

  var pckJSON = grunt.file.readJSON( 'package.json' );

  pckJSON.version = mavenProperties.thymolVersion;

  var shortBannerComment = "/* <%= pkg.title %> version <%= pkg.version %> | Copyright (C) 2012-<%= grunt.template.today('yyyy') %> <%= pkg.author.name %> | <%= pkg.short_license %> */";

  var mediumBannerComment = "<%= pkg.strapline %>\n\n"
    + "   <%= pkg.title %> version <%= pkg.version %> Copyright (C) 2012-<%= grunt.template.today('yyyy') %> <%= pkg.author.name %>\n"
    + "   <%= pkg.author.email %> <%= pkg.author.url %>\n\n"
    + "<%= pkg.license %>\n"
    + "<%= pkg.tail %>\n\n";

  grunt.initConfig( {

    pkg : pckJSON,

    banner : '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - '
      + '<%= grunt.template.today("yyyy-mm-dd") %>\n'
      + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>'
      + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;'
      + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',

    clean : [ "npm/", "dist/", "sourceforge/", "jsdelivr/", tmpDir, bowerThymolPath ],

    uglify : {
      thymol : {
        files : tmpThymolFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      lite : {
        files : tmpLiteFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      full : {
        files : tmpFullFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      node : {
        files : tmpNodeFileObj,
        options : {
          beautify : true,
          mangle : false,
          compress : false,
          banner : mediumBannerComment
        }
      },
      thymol_min : {
        files : tmpThymolFileMinObj,
        options : {
          compress : {},
          mangle : true,
          banner : shortBannerComment
        }
      },
      lite_min : {
        files : tmpLiteFileMinObj,
        options : {
          compress : {},
          mangle : true,
          banner : shortBannerComment
        }
      },
      full_min : {
        files : tmpFullFileMinObj,
        options : {
          compress : {},
          mangle : true,
          banner : shortBannerComment
        }
      },
      node_min : {
        files : tmpNodeFileMinObj,
        options : {
          compress : {},
          mangle : true,
          banner : shortBannerComment
        }
      }
    },

    copy : {
      thymol_bower : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*.js" ],
        dest : "dist/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFile );
            return content.replace( "${thJQuerySource}", mavenProperties.bowerJQuerySource );
          }
        }
      },
      thymol_sourceforge : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*.js" ],
        dest : "sourceforge/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFile );
            return content.replace( "${thJQuerySource}", mavenProperties.sourceforgeJQuerySource );
          }
        }
      },
      thymol_jsdelivr : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*min*.js" ],
        dest : "jsdelivr/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFileMin );
            content = content.replace( "${thThymolSource}", nodeFileMin );
            return content.replace( "${thJQuerySource}", mavenProperties.jsdelivrJQuerySource );
          }
        }
      },
      thymol_npm : {
        expand : true,
        cwd : tmpDir,
        src : [ "**/*node.js" ],
        dest : "npm/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymolVersion}", mavenProperties.thymolVersion );
            content = content.replace( "${thymolReleaseDate}", mavenProperties.thymolReleaseDate );
            content = content.replace( "${thThymolSource}", fullFileMin );
            content = content.replace( "${thThymolSource}", nodeFileMin );
            return content.replace( "${thJQuerySource}", mavenProperties.jsdelivrJQuerySource );
          }
        }
      },
      json_npm : {
        expand : true,
        cwd : "src/build/npm",
        src : [ "**/*" ],
        dest : "npm/",
        options : {
          flatten : true,
          process : function( content, srcpath ) {
            content = content.replace( "${thymol-jquery-version}", mavenProperties.thymolJQueryVersion );
            return content.replace( "${project.version}", mavenProperties.thymolVersion );
          }
        }
      },
      bower_dist : {
        expand : true,
        cwd : "dist/",
        src : [ "**/*.js" ],
        dest : bowerThymolDistPath
      }
    }

  } );

  grunt.loadNpmTasks( "grunt-contrib-clean" );
  grunt.loadNpmTasks( "grunt-contrib-uglify" );
  grunt.loadNpmTasks( "grunt-contrib-copy" );

  grunt.registerTask( "default", [ "clean", "uglify", "copy" ] );

};<|endoftext|>


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

    // Load the task plugins
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-jade');

    grunt.registerMultiTask('blah', 'blah blah', function() {

    });

    // Project configuration
    grunt.initConfig({
        clean: {
            src: ['build']
        },
        jade: {
            options: {
                pretty: true,
                data: function(dest, src) {
                    return {
                        from: src,
                        to: dest
                    };
                }
            },
            technologies: {
                files: {
                    "build/foo.html": "src/foo.jade"
                }
            }
        }
    });

    // Define the default task
    grunt.registerTask('default', ['clean', 'jade']);
};<commit_msg>grunt tasks<commit_after>module.exports = function(grunt) {

    // Load the task plugins
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-jade');

    //TODO: correct name of task
    grunt.registerMultiTask('blah', 'blah blah', function() {
        //TODO: implement task
    });

    //TODO: jshint task for json data?

    //TODO: search for task to generate many jade files from one
    //http://stackoverflow.com/questions/24559380/creating-multiple-html-files-from-a-single-jade-template-with-grunt
    //http://stackoverflow.com/questions/17798358/grunt-compiling-jade-files
    //https://github.com/gruntjs/grunt-contrib-jade

    // Project configuration
    grunt.initConfig({
        clean: {
            src: ['build']
        },
        blah: {
            technologies: {
                data: "data/technologies.json"
            }
        },
        jade: {
            options: {
                pretty: true,
                data: function(dest, src) {
                    return {
                        from: src,
                        to: dest
                    };
                }
            },
            technologies: {
                files: {
                    "build/foo.html": "src/foo.jade"
                }
            }
        }
    });

    // Define the default task
    grunt.registerTask('default', ['clean', 'jade']);
};<|endoftext|>


<commit_before>'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
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);

    // configurable paths
    var config = {
        name: 'gl10n',
        src: 'src',
        lib: 'lib',
        dist: 'dist',
        example: 'examples'
    };

    try {
        config.src = require('./component.json').appPath || config.src;
    } catch (e) {}

    grunt.initConfig({
        config: config,
        livereload: {
            port: 35723
        },
        watch: {
            livereload: {
                files: [
                    '<%= config.example %>/{,*/}*.html',
                    '{.tmp,<%= config.example %>}/{,*/}*.css',
                    '<%= config.example %>/{,*/}*.js',
                    '{.tmp,<%= config.src %>}/{,*/}*.js'
                ],
                tasks: ['livereload']
            }
        },
        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, '.tmp'),
                            mountFolder(connect, config.lib),
                            mountFolder(connect, config.src),
                            mountFolder(connect, config.example)
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function(connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test')
                        ];
                    }
                }
            },
            dev: {
                options: {}
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= connect.options.port %>'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= config.dist %>/*',
                        '!<%= config.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= config.src %>/{,*/}*.js'
            ]
        },
        karma: {
            options: {
                configFile: 'karma.conf.js',
                runnerPort: 9999,
                browsers: ['Chrome', 'Firefox']
            },
            unit: {
                reporters: 'dots'
            },
            debug: {
                singleRun: true,
                browsers: ['Chrome']
            },
            ci: {
                singleRun: true,
                browsers: ['PhantomJS']
            }
        },
        concat: {
            dist: {
                files: {
                    '<%= config.dist %>/<%= config.name %>.js': [
                        '.tmp/{,*/}*.js',
                        '<%= config.src %>/{,*/}*.js'
                    ]
                }
            }
        },
        uglify: {
            dist: {
                files: {
                    '<%= config.dist %>/<%= config.name %>.min.js': [
                        '<%= config.dist %>/<%= config.name %>.js'
                    ]
                }
            }
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= config.src %>',
                    dest: '<%= config.dist %>',
                    src: []
                }]
            }
        },
        bower: {
            install: {
                options: {
                    targetDir: './<%= config.lib %>',
                    install: true,
                    verbose: true,
                    cleanTargetDir: false,
                    cleanBowerDir: false,
                    bowerOptions: {},
                    layout: function(type, component) {
                        console.warn(type, component);
                        //grunt-bower-install wants to do component/type/file but
                        //we need component/file
                        var path = require('path');
                        var renamedType = type;
                        console.warn(path);
                        console.warn(type);
                        if (type === 'js') renamedType = '';
                        return path.join(component, renamedType);
                    }
                }
            }
        },
        //https://github.com/vojtajina/grunt-bump
        bump: {
            options: {
                files: ['package.json', 'bower.json', 'component.json'],
                updateConfigs: [],
                commit: true,
                commitMessage: 'Release v%VERSION%',
                commitFiles: ['package.json', 'bower.json', 'component.json'], // '-a' for all files
                createTag: true,
                tagName: 'v%VERSION%',
                tagMessage: 'Version %VERSION%',
                push: true,
                pushTo: 'origin',
                gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'
            }
        }
    });

    grunt.renameTask('regarde', 'watch');

    grunt.registerTask('server', [
        'clean:server',
        'livereload-start',
        'connect:livereload',
        'open',
        'watch'
    ]);

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

    grunt.registerTask('build', [
        'clean:dist',
        'jshint',
        'test',
        'concat',
        'copy',
        'uglify',
    ]);

    grunt.registerTask('default', ['build']);
};<commit_msg>remove cruft<commit_after><|endoftext|>


<commit_before>/* global module */

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

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

        meta: {
            componentsJsFiles: [
                'src/**/*.js'
            ],
            testJsFiles: [
                'tests/**/*Spec.js'
            ],
            visualTestFiles: [
                'visual-tests/src/**/*'
            ],
            visualTestJsFiles: [
                'visual-tests/src/**/*.js'
            ],
            visualTestSiteFiles: [
                {
                    expand: true,
                    cwd: 'visual-tests/src/site/pages/',
                    src: ['index.hbs'],
                    dest: 'visual-tests/dist/'
                },
                {
                    expand: true,
                    cwd: 'visual-tests/src/test-fixtures/',
                    src: ['**/*.hbs'],
                    dest: 'visual-tests/dist/'
                }
            ],
            componentsCssFiles: [
                'src/**/*.css'
            ],
            ourJsFiles: [
                '<%= meta.componentsJsFiles %>',
                '<%= meta.testJsFiles %>',
                '<%= meta.visualTestJsFiles %>'
            ],
            siteFiles: [
                {
                    expand: true,
                    cwd: 'site/src',
                    src: ['**/*.md', '*.md', '**/*.hbs', '*.hbs', '!_*/*'],
                    dest: 'site/dist'
                }
            ]
        },

        assemble: {
            visualTests: {
                options: {
                    assets: 'visual-tests/dist/assets',
                    partials: 'visual-tests/src/site/templates/includes/*.hbs',
                    layoutdir: 'visual-tests/src/site/templates/layouts',
                    layout: 'test.hbs'
                },
                files: '<%= meta.visualTestSiteFiles %>'
            },
            site: {
                options: {
                    assets: 'site/dist',
                    data: ['package.json', 'site/src/_config.yml'],
                    partials: 'site/src/_includes/*.hbs',
                    layoutdir: 'site/src/_layouts',
                    layout: 'default',
                    layoutext: '.hbs'
                },
                files: '<%= meta.siteFiles %>'
            }
        },

        concat: {
            options: {
                sourceMap: false
            },
            dist: {
                src: ['src/fc.js', 'src/utilities/*.js', '<%= meta.componentsJsFiles %>'],
                dest: 'dist/<%= pkg.name %>.js'
            },
            site: {
                src: [
                        'node_modules/d3/d3.js',
                        'node_modules/css-layout/src/Layout.js',
                        'dist/d3fc.js',
                        'node_modules/jquery/dist/jquery.js',
                        'node_modules/bootstrap/js/collapse.js',
                        'site/src/lib/init.js',
                ],
                dest: 'site/dist/scripts.js'
            }
        },

        connect: {
            options: {
                useAvailablePort: true
            },
            dev: {
                options: {
                    base: 'visual-tests/dist'
                }
            },
            site: {
                options: {
                    base: 'site/dist'
                }
            },
            keepalive: {
                options: {
                    keepalive: true
                }
            }
        },

        copy: {
            visualTests: {
                files: [
                    {
                        expand: true,
                        cwd: 'visual-tests/src/site/assets/',
                        src: ['**/*.css', '**/*.js'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/d3/',
                        src: ['d3.js'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/css-layout/src/',
                        src: ['Layout.js'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'dist',
                        src: ['d3fc.js', 'd3fc.css'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/bootstrap/dist/',
                        src: ['**'],
                        dest: 'visual-tests/dist/assets/bootstrap/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/jquery/dist/',
                        src: ['jquery.min.*'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'visual-tests/src/test-fixtures/',
                        src: ['**/*', '!**/*.hbs'],
                        dest: 'visual-tests/dist/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/seedrandom/',
                        src: ['seedrandom.min.js'],
                        dest: 'visual-tests/dist/assets/',
                    }
                ]
            },
            site: {
                files: [
                    {
                        expand: true,
                        cwd: 'site/src/images/',
                        src: ['*'],
                        dest: 'site/dist/images/',
                    }
                ]
            }
        },

        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
                sourceMap: true
            },
            dist: {
                files: {
                    'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
                }
            },
            site: {
                files: {
                    'site/dist/scripts.js': 'site/dist/scripts.js'
                }
            }
        },

        concat_css: {
            options: {},
            all: {
                src: ['<%= meta.componentsCssFiles %>'],
                dest: 'dist/<%= pkg.name %>.css'
            }
        },

        cssmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['<%= pkg.name %>.css'],
                    dest: 'dist/',
                    ext: '.min.css'
                }]
            }
        },

        watch: {
            components: {
                files: [
                    '<%= meta.componentsJsFiles %>',
                    '<%= meta.testJsFiles %>',
                    '<%= meta.componentsCssFiles %>'
                ],
                tasks: ['build']
            },
            visualTests: {
                files: [
                    '<%= meta.visualTestFiles %>'
                ],
                tasks: ['build:visual-tests']
            },
            site: {
                files: [
                    'Gruntfile.js',
                    'site/src/**/*'
                ],
                tasks: ['site:dev']
            },
            options: {
                livereload: true,
                atBegin: true
            }
        },

        jscs: {
            options: {
                config: '.jscsrc'
            },
            failOnError: {
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            },
            warnOnly: {
                options: {
                    force: true
                },
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            }
        },

        jshint: {
            options: {
                jshintrc: true
            },
            failOnError: {
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            },
            warnOnly: {
                options: {
                    force: true
                },
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            }
        },

        jasmine: {
            options: {
                specs: '<%= meta.testJsFiles %>',
                vendor: [
                    'node_modules/d3/d3.js',
                    'node_modules/css-layout/src/Layout.js'
                ],
                helpers: 'tests/beforeEachSpec.js'
            },
            test: {
                src: ['dist/*.js'],
                options: {
                    keepRunner: true
                }
            }
        },

        clean: {
            dist: ['dist/*', '!dist/README.md'],
            visualTests: ['visual-tests/dist'],
            site: ['site/dist']
        },

        version: {
            defaults: {
                src: ['src/fc.js']
            }
        },

        less: {
            site: {
                files: {
                    "site/dist/styles.css": "site/src/style/styles.less"
                }
            }
        }
    });

    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
    grunt.loadNpmTasks('assemble');

    grunt.registerTask('check:failOnError', ['jshint:failOnError', 'jscs:failOnError']);
    grunt.registerTask('check:warnOnly', ['jshint:warnOnly', 'jscs:warnOnly']);
    grunt.registerTask('check', ['check:failOnError']);
    grunt.registerTask('build:visual-tests', ['check', 'clean:visualTests', 'copy:visualTests', 'assemble:visualTests']);
    grunt.registerTask('build:components', ['check', 'clean:dist', 'version', 'concat:dist', 'uglify:dist', 'concat_css:all', 'cssmin:dist', 'jasmine:test']);
    grunt.registerTask('build', ['build:components', 'build:visual-tests']);
    grunt.registerTask('dev:serve', ['connect:dev', 'watch:dev']);
    grunt.registerTask('dev', ['build', 'watch']);
    grunt.registerTask('ci', ['default', 'site']);
    grunt.registerTask('test', ['jasmine:test', 'build:visual-tests']);
    grunt.registerTask('serve', ['connect:keepalive']);
    grunt.registerTask('site:dev', ['clean:site', 'copy:site', 'concat:site', 'less:site', 'assemble:site']);
    grunt.registerTask('site:serve', ['connect:site', 'watch:site']);
    grunt.registerTask('site', ['site:dev', 'uglify:site']);
    grunt.registerTask('default', ['build']);
};
<commit_msg>Fix dev:serve task (watch:dev should be watch:components)<commit_after>/* global module */

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

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

        meta: {
            componentsJsFiles: [
                'src/**/*.js'
            ],
            testJsFiles: [
                'tests/**/*Spec.js'
            ],
            visualTestFiles: [
                'visual-tests/src/**/*'
            ],
            visualTestJsFiles: [
                'visual-tests/src/**/*.js'
            ],
            visualTestSiteFiles: [
                {
                    expand: true,
                    cwd: 'visual-tests/src/site/pages/',
                    src: ['index.hbs'],
                    dest: 'visual-tests/dist/'
                },
                {
                    expand: true,
                    cwd: 'visual-tests/src/test-fixtures/',
                    src: ['**/*.hbs'],
                    dest: 'visual-tests/dist/'
                }
            ],
            componentsCssFiles: [
                'src/**/*.css'
            ],
            ourJsFiles: [
                '<%= meta.componentsJsFiles %>',
                '<%= meta.testJsFiles %>',
                '<%= meta.visualTestJsFiles %>'
            ],
            siteFiles: [
                {
                    expand: true,
                    cwd: 'site/src',
                    src: ['**/*.md', '*.md', '**/*.hbs', '*.hbs', '!_*/*'],
                    dest: 'site/dist'
                }
            ]
        },

        assemble: {
            visualTests: {
                options: {
                    assets: 'visual-tests/dist/assets',
                    partials: 'visual-tests/src/site/templates/includes/*.hbs',
                    layoutdir: 'visual-tests/src/site/templates/layouts',
                    layout: 'test.hbs'
                },
                files: '<%= meta.visualTestSiteFiles %>'
            },
            site: {
                options: {
                    assets: 'site/dist',
                    data: ['package.json', 'site/src/_config.yml'],
                    partials: 'site/src/_includes/*.hbs',
                    layoutdir: 'site/src/_layouts',
                    layout: 'default',
                    layoutext: '.hbs'
                },
                files: '<%= meta.siteFiles %>'
            }
        },

        concat: {
            options: {
                sourceMap: false
            },
            dist: {
                src: ['src/fc.js', 'src/utilities/*.js', '<%= meta.componentsJsFiles %>'],
                dest: 'dist/<%= pkg.name %>.js'
            },
            site: {
                src: [
                        'node_modules/d3/d3.js',
                        'node_modules/css-layout/src/Layout.js',
                        'dist/d3fc.js',
                        'node_modules/jquery/dist/jquery.js',
                        'node_modules/bootstrap/js/collapse.js',
                        'site/src/lib/init.js',
                ],
                dest: 'site/dist/scripts.js'
            }
        },

        connect: {
            options: {
                useAvailablePort: true
            },
            dev: {
                options: {
                    base: 'visual-tests/dist'
                }
            },
            site: {
                options: {
                    base: 'site/dist'
                }
            },
            keepalive: {
                options: {
                    keepalive: true
                }
            }
        },

        copy: {
            visualTests: {
                files: [
                    {
                        expand: true,
                        cwd: 'visual-tests/src/site/assets/',
                        src: ['**/*.css', '**/*.js'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/d3/',
                        src: ['d3.js'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/css-layout/src/',
                        src: ['Layout.js'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'dist',
                        src: ['d3fc.js', 'd3fc.css'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/bootstrap/dist/',
                        src: ['**'],
                        dest: 'visual-tests/dist/assets/bootstrap/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/jquery/dist/',
                        src: ['jquery.min.*'],
                        dest: 'visual-tests/dist/assets/',
                    },
                    {
                        expand: true,
                        cwd: 'visual-tests/src/test-fixtures/',
                        src: ['**/*', '!**/*.hbs'],
                        dest: 'visual-tests/dist/',
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/seedrandom/',
                        src: ['seedrandom.min.js'],
                        dest: 'visual-tests/dist/assets/',
                    }
                ]
            },
            site: {
                files: [
                    {
                        expand: true,
                        cwd: 'site/src/images/',
                        src: ['*'],
                        dest: 'site/dist/images/',
                    }
                ]
            }
        },

        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
                sourceMap: true
            },
            dist: {
                files: {
                    'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
                }
            },
            site: {
                files: {
                    'site/dist/scripts.js': 'site/dist/scripts.js'
                }
            }
        },

        concat_css: {
            options: {},
            all: {
                src: ['<%= meta.componentsCssFiles %>'],
                dest: 'dist/<%= pkg.name %>.css'
            }
        },

        cssmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['<%= pkg.name %>.css'],
                    dest: 'dist/',
                    ext: '.min.css'
                }]
            }
        },

        watch: {
            components: {
                files: [
                    '<%= meta.componentsJsFiles %>',
                    '<%= meta.testJsFiles %>',
                    '<%= meta.componentsCssFiles %>'
                ],
                tasks: ['build']
            },
            visualTests: {
                files: [
                    '<%= meta.visualTestFiles %>'
                ],
                tasks: ['build:visual-tests']
            },
            site: {
                files: [
                    'Gruntfile.js',
                    'site/src/**/*'
                ],
                tasks: ['site:dev']
            },
            options: {
                livereload: true,
                atBegin: true
            }
        },

        jscs: {
            options: {
                config: '.jscsrc'
            },
            failOnError: {
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            },
            warnOnly: {
                options: {
                    force: true
                },
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            }
        },

        jshint: {
            options: {
                jshintrc: true
            },
            failOnError: {
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            },
            warnOnly: {
                options: {
                    force: true
                },
                files: {
                    src: ['<%= meta.ourJsFiles %>']
                }
            }
        },

        jasmine: {
            options: {
                specs: '<%= meta.testJsFiles %>',
                vendor: [
                    'node_modules/d3/d3.js',
                    'node_modules/css-layout/src/Layout.js'
                ],
                helpers: 'tests/beforeEachSpec.js'
            },
            test: {
                src: ['dist/*.js'],
                options: {
                    keepRunner: true
                }
            }
        },

        clean: {
            dist: ['dist/*', '!dist/README.md'],
            visualTests: ['visual-tests/dist'],
            site: ['site/dist']
        },

        version: {
            defaults: {
                src: ['src/fc.js']
            }
        },

        less: {
            site: {
                files: {
                    "site/dist/styles.css": "site/src/style/styles.less"
                }
            }
        }
    });

    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
    grunt.loadNpmTasks('assemble');

    grunt.registerTask('check:failOnError', ['jshint:failOnError', 'jscs:failOnError']);
    grunt.registerTask('check:warnOnly', ['jshint:warnOnly', 'jscs:warnOnly']);
    grunt.registerTask('check', ['check:failOnError']);
    grunt.registerTask('build:visual-tests', ['check', 'clean:visualTests', 'copy:visualTests', 'assemble:visualTests']);
    grunt.registerTask('build:components', ['check', 'clean:dist', 'version', 'concat:dist', 'uglify:dist', 'concat_css:all', 'cssmin:dist', 'jasmine:test']);
    grunt.registerTask('build', ['build:components', 'build:visual-tests']);
    grunt.registerTask('dev:serve', ['connect:dev', 'watch:components']);
    grunt.registerTask('dev', ['build', 'watch']);
    grunt.registerTask('ci', ['default', 'site']);
    grunt.registerTask('test', ['jasmine:test', 'build:visual-tests']);
    grunt.registerTask('serve', ['connect:keepalive']);
    grunt.registerTask('site:dev', ['clean:site', 'copy:site', 'concat:site', 'less:site', 'assemble:site']);
    grunt.registerTask('site:serve', ['connect:site', 'watch:site']);
    grunt.registerTask('site', ['site:dev', 'uglify:site']);
    grunt.registerTask('default', ['build']);
};
<|endoftext|>