<commit_before>// Generated on 2015-03-25 using generator-angular-fullstack 2.0.13
'use strict';

module.exports = function (grunt) {
  var localConfig;
  try {
    localConfig = require('./server/config/local.env');
  } catch(e) {
    localConfig = {};
  }

  // Load grunt tasks automatically, when needed
  require('jit-grunt')(grunt, {
    express: 'grunt-express-server',
    useminPrepare: 'grunt-usemin',
    ngtemplates: 'grunt-angular-templates',
    cdnify: 'grunt-google-cdn',
    protractor: 'grunt-protractor-runner',
    injector: 'grunt-asset-injector',
    buildcontrol: 'grunt-build-control'
  });

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

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

    // Project settings
    pkg: grunt.file.readJSON('package.json'),
    yeoman: {
      // configurable paths
      client: require('./bower.json').appPath || 'client',
      dist: 'dist'
    },
    express: {
      options: {
        port: process.env.PORT || 9000
      },
      dev: {
        options: {
          script: 'server/app.js',
          debug: true
        }
      },
      prod: {
        options: {
          script: 'dist/server/app.js'
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= express.options.port %>'
      }
    },
    watch: {
      injectJS: {
        files: [
          '<%= yeoman.client %>/{app,components}/**/*.js',
          '!<%= yeoman.client %>/{app,components}/**/*.spec.js',
          '!<%= yeoman.client %>/{app,components}/**/*.mock.js',
          '!<%= yeoman.client %>/app/app.js'],
        tasks: ['injector:scripts']
      },
      injectCss: {
        files: [
          '<%= yeoman.client %>/{app,components}/**/*.css'
        ],
        tasks: ['injector:css']
      },
      mochaTest: {
        files: ['server/**/*.spec.js'],
        tasks: ['env:test', 'mochaTest']
      },
      jsTest: {
        files: [
          '<%= yeoman.client %>/{app,components}/**/*.spec.js',
          '<%= yeoman.client %>/{app,components}/**/*.mock.js'
        ],
        tasks: ['newer:jshint:all', 'karma']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        files: [
          '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.css',
          '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.html',
          '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js',
          '!{.tmp,<%= yeoman.client %>}{app,components}/**/*.spec.js',
          '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js',
          '<%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
        ],
        options: {
          livereload: {
            port: 9000
          }
        }
      },
      express: {
        files: [
          'server/**/*.{js,json}'
        ],
        tasks: ['express:dev', 'wait'],
        options: {
          livereload: {
            port: 9000
          },
          nospawn: true //Without this option specified express won't be reloaded
        }
      }
    },

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

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

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

    // Debugging with node inspector
    'node-inspector': {
      custom: {
        options: {
          'web-host': 'localhost'
        }
      }
    },

    // Use nodemon to run server in debug mode with an initial breakpoint
    nodemon: {
      debug: {
        script: 'server/app.js',
        options: {
          nodeArgs: ['--debug-brk'],
          env: {
            PORT: process.env.PORT || 9000
          },
          callback: function (nodemon) {
            nodemon.on('log', function (event) {
              console.log(event.colour);
            });

            // opens browser on initial server start
            nodemon.on('config:update', function () {
              setTimeout(function () {
                require('open')('http://localhost:8080/debug?port=5858');
              }, 500);
            });
          }
        }
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      target: {
        src: '<%= yeoman.client %>/index.html',
        ignorePath: '<%= yeoman.client %>/',
        exclude: [/bootstrap-sass-official/, /bootstrap.js/, '/json3/', '/es5-shim/']
      }
    },

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

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

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
      js: ['<%= yeoman.dist %>/public/{,*/}*.js'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>/public',
          '<%= yeoman.dist %>/public/assets/images'
        ],
        // This is so we update image references in our ng-templates
        patterns: {
          js: [
            [/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images']
          ]
        }
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.client %>/assets/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/public/assets/images'
        }]
      }
    },

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

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat',
          src: '*/**.js',
          dest: '.tmp/concat'
        }]
      }
    },

    // Package all the html partials into a single javascript payload
    ngtemplates: {
      options: {
        // This should be the name of your apps angular module
        module: 'fahrtenbuchApp',
        htmlmin: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true,
          removeEmptyAttributes: true,
          removeRedundantAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        },
        usemin: 'app/app.js'
      },
      main: {
        cwd: '<%= yeoman.client %>',
        src: ['{app,components}/**/*.html'],
        dest: '.tmp/templates.js'
      },
      tmp: {
        cwd: '.tmp',
        src: ['{app,components}/**/*.html'],
        dest: '.tmp/tmp-templates.js'
      }
    },

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

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.client %>',
          dest: '<%= yeoman.dist %>/public',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            'bower_components/**/*',
            'assets/images/{,*/}*.{webp}',
            'assets/fonts/**/*',
            'index.html',
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/public/assets/images',
          src: ['generated/*']
        }, {
          expand: true,
          dest: '<%= yeoman.dist %>',
          src: [
            'package.json',
            'server/**/*'
          ]
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.client %>',
        dest: '.tmp/',
        src: ['{app,components}/**/*.css']
      }
    },

    buildcontrol: {
      options: {
        dir: 'dist',
        commit: true,
        push: true,
        connectCommits: false,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
      },
      heroku: {
        options: {
          remote: 'heroku',
          branch: 'master'
        }
      },
      openshift: {
        options: {
          remote: 'openshift',
          branch: 'master'
        }
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
      ],
      test: [
      ],
      debug: {
        tasks: [
          'nodemon',
          'node-inspector'
        ],
        options: {
          logConcurrentOutput: true
        }
      },
      dist: [
        'imagemin',
        'svgmin'
      ]
    },

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

    mochaTest: {
      options: {
        reporter: 'spec'
      },
      src: ['server/**/*.spec.js']
    },

    protractor: {
      options: {
        configFile: 'protractor.conf.js'
      },
      chrome: {
        options: {
          args: {
            browser: 'chrome'
          }
        }
      }
    },

    env: {
      test: {
        NODE_ENV: 'test'
      },
      prod: {
        NODE_ENV: 'production'
      },
      all: localConfig
    },

    injector: {
      options: {

      },
      // Inject application script files into index.html (doesn't include bower)
      scripts: {
        options: {
          transform: function(filePath) {
            filePath = filePath.replace('/client/', '');
            filePath = filePath.replace('/.tmp/', '');
            return '<script src="' + filePath + '"></script>';
          },
          starttag: '<!-- injector:js -->',
          endtag: '<!-- endinjector -->'
        },
        files: {
          '<%= yeoman.client %>/index.html': [
              ['{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js',
               '!{.tmp,<%= yeoman.client %>}/app/app.js',
               '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.spec.js',
               '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js']
            ]
        }
      },

      // Inject component css into index.html
      css: {
        options: {
          transform: function(filePath) {
            filePath = filePath.replace('/client/', '');
            filePath = filePath.replace('/.tmp/', '');
            return '<link rel="stylesheet" href="' + filePath + '">';
          },
          starttag: '<!-- injector:css -->',
          endtag: '<!-- endinjector -->'
        },
        files: {
          '<%= yeoman.client %>/index.html': [
            '<%= yeoman.client %>/{app,components}/**/*.css'
          ]
        }
      }
    },
  });

  // Used for delaying livereload until after server has restarted
  grunt.registerTask('wait', function () {
    grunt.log.ok('Waiting for server reload...');

    var done = this.async();

    setTimeout(function () {
      grunt.log.writeln('Done waiting!');
      done();
    }, 1500);
  });

  grunt.registerTask('express-keepalive', 'Keep grunt running', function() {
    this.async();
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'wait', 'open', 'express-keepalive']);
    }

    if (target === 'debug') {
      return grunt.task.run([
        'clean:server',
        'env:all',
        'concurrent:server',
        'injector',
        'wiredep',
        'autoprefixer',
        'concurrent:debug'
      ]);
    }

    grunt.task.run([
      'clean:server',
      'env:all',
      'concurrent:server',
      'injector',
      'wiredep',
      'autoprefixer',
      'express:dev',
      'wait',
      'open',
      'watch'
    ]);
  });

  grunt.registerTask('server', function () {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve']);
  });

  grunt.registerTask('test', function(target) {
    if (target === 'server') {
      return grunt.task.run([
        'env:all',
        'env:test',
        'mochaTest'
      ]);
    }

    else if (target === 'client') {
      return grunt.task.run([
        'clean:server',
        'env:all',
        'concurrent:test',
        'injector',
        'autoprefixer',
        'karma'
      ]);
    }

    else if (target === 'e2e') {
      return grunt.task.run([
        'clean:server',
        'env:all',
        'env:test',
        'concurrent:test',
        'injector',
        'wiredep',
        'autoprefixer',
        'express:dev',
        'protractor'
      ]);
    }

    else grunt.task.run([
      'test:server',
      'test:client'
    ]);
  });

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

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>third try<commit_after>// Generated on 2015-03-25 using generator-angular-fullstack 2.0.13
'use strict';

module.exports = function (grunt) {
  var localConfig;
  try {
    localConfig = require('./server/config/local.env');
  } catch(e) {
    localConfig = {};
  }

  // Load grunt tasks automatically, when needed
  require('jit-grunt')(grunt, {
    express: 'grunt-express-server',
    useminPrepare: 'grunt-usemin',
    ngtemplates: 'grunt-angular-templates',
    cdnify: 'grunt-google-cdn',
    protractor: 'grunt-protractor-runner',
    injector: 'grunt-asset-injector',
    buildcontrol: 'grunt-build-control'
  });

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

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

    // Project settings
    pkg: grunt.file.readJSON('package.json'),
    yeoman: {
      // configurable paths
      client: require('./bower.json').appPath || 'client',
      dist: 'dist'
    },
    express: {
      options: {
        port: process.env.PORT || 9000
      },
      dev: {
        options: {
          script: 'server/app.js',
          debug: true
        }
      },
      prod: {
        options: {
          script: 'dist/server/app.js'
        }
      }
    },
    open: {
      server: {
        url: 'http://localhost:<%= express.options.port %>'
      }
    },
    watch: {
      injectJS: {
        files: [
          '<%= yeoman.client %>/{app,components}/**/*.js',
          '!<%= yeoman.client %>/{app,components}/**/*.spec.js',
          '!<%= yeoman.client %>/{app,components}/**/*.mock.js',
          '!<%= yeoman.client %>/app/app.js'],
        tasks: ['injector:scripts']
      },
      injectCss: {
        files: [
          '<%= yeoman.client %>/{app,components}/**/*.css'
        ],
        tasks: ['injector:css']
      },
      mochaTest: {
        files: ['server/**/*.spec.js'],
        tasks: ['env:test', 'mochaTest']
      },
      jsTest: {
        files: [
          '<%= yeoman.client %>/{app,components}/**/*.spec.js',
          '<%= yeoman.client %>/{app,components}/**/*.mock.js'
        ],
        tasks: ['newer:jshint:all', 'karma']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        files: [
          '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.css',
          '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.html',
          '{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js',
          '!{.tmp,<%= yeoman.client %>}{app,components}/**/*.spec.js',
          '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js',
          '<%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
        ],
        options: {
          livereload: {
            port: 443
          }
        }
      },
      express: {
        files: [
          'server/**/*.{js,json}'
        ],
        tasks: ['express:dev', 'wait'],
        options: {
          livereload: {
            port: '<%%= livereload.options.livereload.port %>'
          },
          nospawn: true //Without this option specified express won't be reloaded
        }
      }
    },

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

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

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

    // Debugging with node inspector
    'node-inspector': {
      custom: {
        options: {
          'web-host': 'localhost'
        }
      }
    },

    // Use nodemon to run server in debug mode with an initial breakpoint
    nodemon: {
      debug: {
        script: 'server/app.js',
        options: {
          nodeArgs: ['--debug-brk'],
          env: {
            PORT: process.env.PORT || 9000
          },
          callback: function (nodemon) {
            nodemon.on('log', function (event) {
              console.log(event.colour);
            });

            // opens browser on initial server start
            nodemon.on('config:update', function () {
              setTimeout(function () {
                require('open')('http://localhost:8080/debug?port=5858');
              }, 500);
            });
          }
        }
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      target: {
        src: '<%= yeoman.client %>/index.html',
        ignorePath: '<%= yeoman.client %>/',
        exclude: [/bootstrap-sass-official/, /bootstrap.js/, '/json3/', '/es5-shim/']
      }
    },

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

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

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
      js: ['<%= yeoman.dist %>/public/{,*/}*.js'],
      options: {
        assetsDirs: [
          '<%= yeoman.dist %>/public',
          '<%= yeoman.dist %>/public/assets/images'
        ],
        // This is so we update image references in our ng-templates
        patterns: {
          js: [
            [/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images']
          ]
        }
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.client %>/assets/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/public/assets/images'
        }]
      }
    },

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

    // Allow the use of non-minsafe AngularJS files. Automatically makes it
    // minsafe compatible so Uglify does not destroy the ng references
    ngAnnotate: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat',
          src: '*/**.js',
          dest: '.tmp/concat'
        }]
      }
    },

    // Package all the html partials into a single javascript payload
    ngtemplates: {
      options: {
        // This should be the name of your apps angular module
        module: 'fahrtenbuchApp',
        htmlmin: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true,
          removeEmptyAttributes: true,
          removeRedundantAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        },
        usemin: 'app/app.js'
      },
      main: {
        cwd: '<%= yeoman.client %>',
        src: ['{app,components}/**/*.html'],
        dest: '.tmp/templates.js'
      },
      tmp: {
        cwd: '.tmp',
        src: ['{app,components}/**/*.html'],
        dest: '.tmp/tmp-templates.js'
      }
    },

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

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.client %>',
          dest: '<%= yeoman.dist %>/public',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            'bower_components/**/*',
            'assets/images/{,*/}*.{webp}',
            'assets/fonts/**/*',
            'index.html',
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/public/assets/images',
          src: ['generated/*']
        }, {
          expand: true,
          dest: '<%= yeoman.dist %>',
          src: [
            'package.json',
            'server/**/*'
          ]
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.client %>',
        dest: '.tmp/',
        src: ['{app,components}/**/*.css']
      }
    },

    buildcontrol: {
      options: {
        dir: 'dist',
        commit: true,
        push: true,
        connectCommits: false,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
      },
      heroku: {
        options: {
          remote: 'heroku',
          branch: 'master'
        }
      },
      openshift: {
        options: {
          remote: 'openshift',
          branch: 'master'
        }
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
      ],
      test: [
      ],
      debug: {
        tasks: [
          'nodemon',
          'node-inspector'
        ],
        options: {
          logConcurrentOutput: true
        }
      },
      dist: [
        'imagemin',
        'svgmin'
      ]
    },

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

    mochaTest: {
      options: {
        reporter: 'spec'
      },
      src: ['server/**/*.spec.js']
    },

    protractor: {
      options: {
        configFile: 'protractor.conf.js'
      },
      chrome: {
        options: {
          args: {
            browser: 'chrome'
          }
        }
      }
    },

    env: {
      test: {
        NODE_ENV: 'test'
      },
      prod: {
        NODE_ENV: 'production'
      },
      all: localConfig
    },

    injector: {
      options: {

      },
      // Inject application script files into index.html (doesn't include bower)
      scripts: {
        options: {
          transform: function(filePath) {
            filePath = filePath.replace('/client/', '');
            filePath = filePath.replace('/.tmp/', '');
            return '<script src="' + filePath + '"></script>';
          },
          starttag: '<!-- injector:js -->',
          endtag: '<!-- endinjector -->'
        },
        files: {
          '<%= yeoman.client %>/index.html': [
              ['{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js',
               '!{.tmp,<%= yeoman.client %>}/app/app.js',
               '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.spec.js',
               '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js']
            ]
        }
      },

      // Inject component css into index.html
      css: {
        options: {
          transform: function(filePath) {
            filePath = filePath.replace('/client/', '');
            filePath = filePath.replace('/.tmp/', '');
            return '<link rel="stylesheet" href="' + filePath + '">';
          },
          starttag: '<!-- injector:css -->',
          endtag: '<!-- endinjector -->'
        },
        files: {
          '<%= yeoman.client %>/index.html': [
            '<%= yeoman.client %>/{app,components}/**/*.css'
          ]
        }
      }
    },
  });

  // Used for delaying livereload until after server has restarted
  grunt.registerTask('wait', function () {
    grunt.log.ok('Waiting for server reload...');

    var done = this.async();

    setTimeout(function () {
      grunt.log.writeln('Done waiting!');
      done();
    }, 1500);
  });

  grunt.registerTask('express-keepalive', 'Keep grunt running', function() {
    this.async();
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'wait', 'open', 'express-keepalive']);
    }

    if (target === 'debug') {
      return grunt.task.run([
        'clean:server',
        'env:all',
        'concurrent:server',
        'injector',
        'wiredep',
        'autoprefixer',
        'concurrent:debug'
      ]);
    }

    grunt.task.run([
      'clean:server',
      'env:all',
      'concurrent:server',
      'injector',
      'wiredep',
      'autoprefixer',
      'express:dev',
      'wait',
      'open',
      'watch'
    ]);
  });

  grunt.registerTask('server', function () {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve']);
  });

  grunt.registerTask('test', function(target) {
    if (target === 'server') {
      return grunt.task.run([
        'env:all',
        'env:test',
        'mochaTest'
      ]);
    }

    else if (target === 'client') {
      return grunt.task.run([
        'clean:server',
        'env:all',
        'concurrent:test',
        'injector',
        'autoprefixer',
        'karma'
      ]);
    }

    else if (target === 'e2e') {
      return grunt.task.run([
        'clean:server',
        'env:all',
        'env:test',
        'concurrent:test',
        'injector',
        'wiredep',
        'autoprefixer',
        'express:dev',
        'protractor'
      ]);
    }

    else grunt.task.run([
      'test:server',
      'test:client'
    ]);
  });

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

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


<commit_before>/*
 * Copyright 2013, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/eduardolundgren/dotfiles/blob/master/LICENSE.md
 *
 * @author Eduardo Lundgren <eduardo.lundgren@gmail.com>
 */

'use strict';

var userhome = require('userhome');

module.exports = function(grunt) {

    grunt.initConfig({

        // -- Bump -------------------------------------------------------------

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

        // -- Config -----------------------------------------------------------

        config: {

            git: {
                path_gitconfig: userhome('.gitconfig'),
                path_gitignore: userhome('.gitignore_global')
            },

            osx: {
                path_osx: userhome('.osx')
            },

            ruby: {
                path_build: userhome('.rbenv/plugins/ruby-build'),
                path_rbenv: userhome('.rbenv')
            },

            themes: {
                path_dracula: userhome('.themes/dracula'),
            },

            zsh: {
                path_oh_my_zsh: userhome('.oh-my-zsh'),
                path_syntax_highlighting: userhome('.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'),
                path_theme_dracula: userhome('.oh-my-zsh/themes/dracula.zsh-theme'),
                path_z: userhome('.z'),
                path_zshrc: userhome('.zshrc')
            }

        },

        // -- Prompt -----------------------------------------------------------

        prompt: {
            config: {
                options: {
                    questions: [
                        {
                            config: 'config.osx.computername',
                            default: 'eduardo',
                            message: 'Which computer name would you like to use?'
                        },
                        {
                            config: 'config.git.name',
                            default: 'Eduardo Lundgren',
                            message: 'Which Git name would you like to use?'
                        },
                        {
                            config: 'config.git.email',
                            default: 'eduardo.lundgren@liferay.com',
                            message: 'Which Git email would you like to use?'
                        },
                        {
                            config: 'config.editor',
                            default: 'subl',
                            message: 'Which editor would you like to use?'
                        },
                        {
                            config: 'config.zsh.plugins',
                            default: 'ant git history-substring-search z zsh-syntax-highlighting',
                            message: 'Which Oh My Zsh plugins would you like to use?'
                        },
                        {
                            config: 'config.zsh.theme_oh_my_zsh',
                            default: 'dracula',
                            message: 'Which Oh My Zsh theme would you like to use?'
                        }
                    ]
                }
            }
        },

        // -- Clean ------------------------------------------------------------

        clean: {

            all: {
                options: {
                    force: true
                },
                src: [
                    '<%= config.git.path_gitconfig %>',
                    '<%= config.git.path_gitignore %>',
                    '<%= config.osx.path_osx %>',
                    '<%= config.ruby.path_build %>',
                    '<%= config.ruby.path_rbenv %>',
                    '<%= config.themes.path_dracula %>',
                    '<%= config.zsh.path_oh_my_zsh %>',
                    '<%= config.zsh.path_syntax_highlighting %>',
                    '<%= config.zsh.path_theme_dracula %>',
                    '<%= config.zsh.path_zshrc %>'
                ]
            }

        },

        // -- Templates --------------------------------------------------------

        template: {

            git: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.git.path_gitconfig %>': ['templates/.gitconfig'],
                    '<%= config.git.path_gitignore %>': ['templates/.gitignore_global']
                }
            },

            osx: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.osx.path_osx %>': ['templates/.osx']
                }
            },

            zsh: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.zsh.path_zshrc %>': ['templates/.zshrc']
                }
            }

        },

        // -- Git --------------------------------------------------------------

        gitclone: {

            ruby_rbenv: {
                options: {
                    directory: '<%= config.ruby.path_rbenv %>',
                    repository: 'https://github.com/sstephenson/rbenv.git'
                }
            },

            ruby_build: {
                options: {
                    directory: '<%= config.ruby.path_build %>',
                    repository: 'https://github.com/sstephenson/ruby-build.git'
                }
            },

            oh_my_zsh: {
                options: {
                    directory: '<%= config.zsh.path_oh_my_zsh %>',
                    repository: 'https://github.com/robbyrussell/oh-my-zsh.git'
                }
            },

            theme_dracula: {
                options: {
                    directory: '<%= config.themes.path_dracula %>',
                    repository: 'https://github.com/zenorocha/dracula-theme.git'
                }
            },

            zsh_syntax_highlighting: {
                options: {
                    directory: '<%= config.zsh.path_syntax_highlighting %>',
                    repository: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
                }
            }

        },

        // -- Symbolic links ---------------------------------------------------

        symlink: {

            sublime: {
                dest: '/usr/local/bin/subl',
                relativeSrc: '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'
            },

            zsh_theme_dracula: {
                dest: '<%= config.zsh.path_theme_dracula %>',
                relativeSrc: '<%= config.themes.path_dracula %>/zsh/dracula.zsh-theme'
            }

        },

        // -- Exec -------------------------------------------------------------

        shell: {

            osx: {
                command: 'source <%= config.osx.path_osx %>'
            },

            z: {
                command: 'touch <%= config.zsh.path_z %>'
            },

            zsh: {
                command: 'chsh -s /bin/zsh'
            },

            theme_alfred: {
                command: 'open <%= config.themes.path_dracula %>/alfred/Dracula.alfredappearance'
            },

            theme_iterm: {
                command: 'open <%= config.themes.path_dracula %>/iterm/Dracula.itermcolors'
            },

            node_latest: {
                command: 'sudo n latest'
            },

            node_stable: {
                command: 'sudo n stable'
            },

            ruby_compass: {
                command: 'sudo gem install compass'
            },

            ruby_jekyll: {
                command: 'sudo gem install jekyll'
            },

            ruby_update: {
                command: 'sudo gem update --system'
            }

        }

    });

    grunt.task.registerTask('banner', function() {
        console.log(grunt.file.read('templates/.banner'));
    });

    grunt.loadNpmTasks('grunt-bump');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-git');
    grunt.loadNpmTasks('grunt-prompt');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-symlink');
    grunt.loadNpmTasks('grunt-template');

    grunt.registerTask('setup', ['banner', 'prompt', 'clean', 'template', 'gitclone', 'shell', 'symlink']);

};<commit_msg>Source formatting<commit_after>/*
 * Copyright 2013, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/eduardolundgren/dotfiles/blob/master/LICENSE.md
 *
 * @author Eduardo Lundgren <eduardo.lundgren@gmail.com>
 */

'use strict';

var userhome = require('userhome');

module.exports = function(grunt) {

    grunt.initConfig({

        // -- Bump -------------------------------------------------------------

        bump: {

            options: {
                commit: true,
                commitFiles: ['package.json'],
                commitMessage: 'Release v%VERSION%',
                createTag: true,
                files: ['package.json'],
                push: true,
                pushTo: 'origin',
                tagMessage: '',
                tagName: 'v%VERSION%'
            }

        },

        // -- Config -----------------------------------------------------------

        config: {

            git: {
                path_gitconfig: userhome('.gitconfig'),
                path_gitignore: userhome('.gitignore_global')
            },

            osx: {
                path_osx: userhome('.osx')
            },

            ruby: {
                path_build: userhome('.rbenv/plugins/ruby-build'),
                path_rbenv: userhome('.rbenv')
            },

            themes: {
                path_dracula: userhome('.themes/dracula'),
            },

            zsh: {
                path_oh_my_zsh: userhome('.oh-my-zsh'),
                path_syntax_highlighting: userhome('.oh-my-zsh/custom/plugins/zsh-syntax-highlighting'),
                path_theme_dracula: userhome('.oh-my-zsh/themes/dracula.zsh-theme'),
                path_z: userhome('.z'),
                path_zshrc: userhome('.zshrc')
            }

        },

        // -- Prompt -----------------------------------------------------------

        prompt: {

            config: {
                options: {
                    questions: [
                        {
                            config: 'config.osx.computername',
                            default: 'eduardo',
                            message: 'Which computer name would you like to use?'
                        },
                        {
                            config: 'config.git.name',
                            default: 'Eduardo Lundgren',
                            message: 'Which Git name would you like to use?'
                        },
                        {
                            config: 'config.git.email',
                            default: 'eduardo.lundgren@liferay.com',
                            message: 'Which Git email would you like to use?'
                        },
                        {
                            config: 'config.editor',
                            default: 'subl',
                            message: 'Which editor would you like to use?'
                        },
                        {
                            config: 'config.zsh.plugins',
                            default: 'ant git history-substring-search z zsh-syntax-highlighting',
                            message: 'Which Oh My Zsh plugins would you like to use?'
                        },
                        {
                            config: 'config.zsh.theme_oh_my_zsh',
                            default: 'dracula',
                            message: 'Which Oh My Zsh theme would you like to use?'
                        }
                    ]
                }
            }

        },

        // -- Clean ------------------------------------------------------------

        clean: {

            all: {
                options: {
                    force: true
                },
                src: [
                    '<%= config.git.path_gitconfig %>',
                    '<%= config.git.path_gitignore %>',
                    '<%= config.osx.path_osx %>',
                    '<%= config.ruby.path_build %>',
                    '<%= config.ruby.path_rbenv %>',
                    '<%= config.themes.path_dracula %>',
                    '<%= config.zsh.path_oh_my_zsh %>',
                    '<%= config.zsh.path_syntax_highlighting %>',
                    '<%= config.zsh.path_theme_dracula %>',
                    '<%= config.zsh.path_zshrc %>'
                ]
            }

        },

        // -- Templates --------------------------------------------------------

        template: {

            git: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.git.path_gitconfig %>': ['templates/.gitconfig'],
                    '<%= config.git.path_gitignore %>': ['templates/.gitignore_global']
                }
            },

            osx: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.osx.path_osx %>': ['templates/.osx']
                }
            },

            zsh: {
                options: {
                    data: '<%= config %>'
                },
                files: {
                    '<%= config.zsh.path_zshrc %>': ['templates/.zshrc']
                }
            }

        },

        // -- Git --------------------------------------------------------------

        gitclone: {

            ruby_rbenv: {
                options: {
                    directory: '<%= config.ruby.path_rbenv %>',
                    repository: 'https://github.com/sstephenson/rbenv.git'
                }
            },

            ruby_build: {
                options: {
                    directory: '<%= config.ruby.path_build %>',
                    repository: 'https://github.com/sstephenson/ruby-build.git'
                }
            },

            oh_my_zsh: {
                options: {
                    directory: '<%= config.zsh.path_oh_my_zsh %>',
                    repository: 'https://github.com/robbyrussell/oh-my-zsh.git'
                }
            },

            theme_dracula: {
                options: {
                    directory: '<%= config.themes.path_dracula %>',
                    repository: 'https://github.com/zenorocha/dracula-theme.git'
                }
            },

            zsh_syntax_highlighting: {
                options: {
                    directory: '<%= config.zsh.path_syntax_highlighting %>',
                    repository: 'https://github.com/zsh-users/zsh-syntax-highlighting.git'
                }
            }

        },

        // -- Symbolic links ---------------------------------------------------

        symlink: {

            sublime: {
                dest: '/usr/local/bin/subl',
                relativeSrc: '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'
            },

            zsh_theme_dracula: {
                dest: '<%= config.zsh.path_theme_dracula %>',
                relativeSrc: '<%= config.themes.path_dracula %>/zsh/dracula.zsh-theme'
            }

        },

        // -- Exec -------------------------------------------------------------

        shell: {

            osx: {
                command: 'source <%= config.osx.path_osx %>'
            },

            z: {
                command: 'touch <%= config.zsh.path_z %>'
            },

            zsh: {
                command: 'chsh -s /bin/zsh'
            },

            theme_alfred: {
                command: 'open <%= config.themes.path_dracula %>/alfred/Dracula.alfredappearance'
            },

            theme_iterm: {
                command: 'open <%= config.themes.path_dracula %>/iterm/Dracula.itermcolors'
            },

            node_latest: {
                command: 'sudo n latest'
            },

            node_stable: {
                command: 'sudo n stable'
            },

            ruby_compass: {
                command: 'sudo gem install compass'
            },

            ruby_jekyll: {
                command: 'sudo gem install jekyll'
            },

            ruby_update: {
                command: 'sudo gem update --system'
            }

        }

    });

    grunt.task.registerTask('banner', function() {
        console.log(grunt.file.read('templates/.banner'));
    });

    grunt.loadNpmTasks('grunt-bump');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-git');
    grunt.loadNpmTasks('grunt-prompt');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-symlink');
    grunt.loadNpmTasks('grunt-template');

    grunt.registerTask('setup', ['banner', 'prompt', 'clean', 'template', 'gitclone', 'shell', 'symlink']);

};<|endoftext|>


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

	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON( 'package.json' ),
		meta: {
			banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
				'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
				'* <%= pkg.homepage %>\n' +
				'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
				' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n' +
				'\n' +
				'/*jslint eqeq: true, plusplus: true */\n' +
				'/*global document, HTMLElement */\n' +
				'\n\n',
			wrapper: {
				start: '(function ( global ) {\n\n' +
						'"use strict";',
				end: '\n\n// export\n' +
						'if ( typeof module !== "undefined" && module.exports ) module.exports = Anglebars // Common JS\n' +
						'else if ( typeof define === "function" && define.amd ) define( function () { return Anglebars } ) // AMD\n' +
						'else { global.Anglebars = Anglebars }\n\n' +
						'}( this ));'
			}
		},
		lint: {
			files: ['grunt.js', 'src/**/*.js'] // TODO add tests
		},
		qunit: {
			files: [ 'test/core.html', 'test/compile.html', 'test/render.html' ]
		},
		clean: {
			files: [ 'build/**/*.js' ]
		},
		concat: {
			options: {
				banner: '<%= meta.banner %><%= meta.wrapper.start %>',
				footer: '<%= meta.wrapper.end %>'
			},
			compile: {
				src: [ 'src/compile.js', 'src/tokenize.js', 'src/types.js' ],
				dest: 'build/compile/Anglebars.compile.js'
			},
			runtime: {
				src: [ 'src/Anglebars.js', 'src/types.js', 'src/formatters.js', 'src/ViewModel.js', 'src/DomViews.js', 'src/TextViews.js' ],
				dest: 'build/runtime/Anglebars.runtime.js'
			},
			full: {
				src: [ 'src/Anglebars.js', 'src/types.js', 'src/compile.js', 'src/tokenize.js', 'src/formatters.js', 'src/ViewModel.js', 'src/DomViews.js', 'src/TextViews.js' ],
				dest: 'build/Anglebars.js'
			}
		},
		watch: {
			files: ['<config:lint.files>', 'package.json'],
			tasks: ['concat','min']
		},
		jshint: {
			options: {
				jshintrc: '.jshintrc'
			}
		},
		uglify: {
			compile: {
				src: ['<%= concat.compile.dest %>'],
				dest: 'build/compile/Anglebars.compile.min.js'
			},
			runtime: {
				src: ['<%= concat.runtime.dest %>'],
				dest: 'build/runtime/Anglebars.runtime.min.js'
			},
			full: {
				src: ['<%= concat.full.dest %>'],
				dest: 'build/Anglebars.min.js'
			}
		}
	});

	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
	grunt.loadNpmTasks( 'grunt-contrib-clean' );
	grunt.loadNpmTasks( 'grunt-contrib-qunit' );
	grunt.loadNpmTasks( 'grunt-contrib-concat' );
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );

	// Default task.
	grunt.registerTask('default', [ 'jshint', 'qunit', 'clean', 'concat', 'uglify' ]);

};
<commit_msg>updated gruntfile<commit_after>/*global module:false*/
module.exports = function(grunt) {

	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON( 'package.json' ),
		meta: {
			banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
				'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
				'* <%= pkg.homepage %>\n' +
				'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
				' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n' +
				'\n' +
				'/*jslint eqeq: true, plusplus: true */\n' +
				'/*global document, HTMLElement */\n' +
				'\n\n',
			wrapper: {
				start: '(function ( global ) {\n\n' +
						'"use strict";',
				end: '\n\n// export\n' +
						'if ( typeof module !== "undefined" && module.exports ) module.exports = Anglebars // Common JS\n' +
						'else if ( typeof define === "function" && define.amd ) define( function () { return Anglebars } ) // AMD\n' +
						'else { global.Anglebars = Anglebars }\n\n' +
						'}( this ));'
			}
		},
		lint: {
			files: ['grunt.js', 'src/**/*.js'] // TODO add tests
		},
		qunit: {
			files: [ 'test/core.html', 'test/compile.html', 'test/render.html' ]
		},
		clean: {
			files: [ 'build/**/*.js' ]
		},
		concat: {
			options: {
				banner: '<%= meta.banner %><%= meta.wrapper.start %>',
				footer: '<%= meta.wrapper.end %>'
			},
			compile: {
				src: [ 'src/compile.js', 'src/tokenize.js', 'src/types.js' ],
				dest: 'build/compile/Anglebars.compile.js'
			},
			runtime: {
				src: [ 'src/Anglebars.js', 'src/types.js', 'src/events.js', 'src/formatters.js', 'src/ViewModel.js', 'src/DomViews.js', 'src/TextViews.js' ],
				dest: 'build/runtime/Anglebars.runtime.js'
			},
			full: {
				src: [ 'src/Anglebars.js', 'src/types.js', 'src/events.js', 'src/compile.js', 'src/tokenize.js', 'src/formatters.js', 'src/ViewModel.js', 'src/DomViews.js', 'src/TextViews.js' ],
				dest: 'build/Anglebars.js'
			}
		},
		watch: {
			files: ['<config:lint.files>', 'package.json'],
			tasks: ['concat','min']
		},
		jshint: {
			options: {
				jshintrc: '.jshintrc'
			}
		},
		uglify: {
			compile: {
				src: ['<%= concat.compile.dest %>'],
				dest: 'build/compile/Anglebars.compile.min.js'
			},
			runtime: {
				src: ['<%= concat.runtime.dest %>'],
				dest: 'build/runtime/Anglebars.runtime.min.js'
			},
			full: {
				src: ['<%= concat.full.dest %>'],
				dest: 'build/Anglebars.min.js'
			}
		}
	});

	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
	grunt.loadNpmTasks( 'grunt-contrib-clean' );
	grunt.loadNpmTasks( 'grunt-contrib-qunit' );
	grunt.loadNpmTasks( 'grunt-contrib-concat' );
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );

	// Default task.
	grunt.registerTask('default', [ 'jshint', 'qunit', 'clean', 'concat', 'uglify' ]);

};
<|endoftext|>


<commit_before>var DEFAULTS = {
    minify: true,
    firebaseUrl: 'https://teste-login.firebaseio.com/',
    buildDest: 'build/'
};

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        clean: ['<%= buildDest %>**/*'],
        copy: {
            min: {
                files: [{
                    src: ['css/bootstrap.min.css', 'css/hint.min.css'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['favicon.ico', 'apple-touch-icon.png'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['fonts/**/*'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['img/**/*'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['js/bootstrap.min.js'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['partials/config.html'],
                    dest: '<%= buildDest %>partials/config-<%= pkg.version %>.html'
                }, {
                    src: ['partials/data.html'],
                    dest: '<%= buildDest %>partials/data-<%= pkg.version %>.html'
                }, {
                    src: ['partials/detail.html'],
                    dest: '<%= buildDest %>partials/detail-<%= pkg.version %>.html'
                }, {
                    src: ['partials/list.html'],
                    dest: '<%= buildDest %>partials/list-<%= pkg.version %>.html'
                }, {
                    src: ['partials/help.html'],
                    dest: '<%= buildDest %>partials/help-<%= pkg.version %>.html'
                }, {
                    src: ['partials/login.html'],
                    dest: '<%= buildDest %>partials/login-<%= pkg.version %>.html'
                }]
            },
            css: {
                files: [{
                    src: ['css/meuponto.css'],
                    dest: '<%= buildDest %>css/<%= pkg.name %>-<%= pkg.version %>.css'
                }]
            }
        },
        uglify: {
            build: {
                src: 'js/**/*',
                dest: '<%= buildDest %>js/<%= pkg.name %>-<%= pkg.version %>.min.js'
            }
        },
        cssmin: {
            minify: {
                src: ['css/<%= pkg.name %>.css'],
                dest: '<%= buildDest %>css/<%= pkg.name %>-<%= pkg.version %>.min.css'
            }
        },
        combine: {
            single: {
                input: 'index.html',
                output: '<%= buildDest %>index.html',
                tokens: [{
                    token: '__VERSION__',
                    string: '<%= pkg.version %>'
                }, {
                    token: '__VERSION_SUFIX__',
                    string: '<%= pkg.version %><%= minSufix %>'
                }, {
                    token: '__FIREBASE_URL__',
                    string: '<%= firebaseUrl %>'
                }]
            }
        },
        csslint: {
            strict: {
                src: ['css/<%= pkg.name %>.css'],
                options: {
                    ids: false
                }
            }
        },
        jshint: {
            files: ['js/<%= pkg.name %>.js']
        },
        concat: {
            options: {
                separator: ';',
            },
            lib: {
                src: ['lib/jquery-1.10.2.min.js', 'lib/angular-1.0.8.min.js', 'lib/firebase.min.js', 'lib/firebase-auth-client.min.js', 'lib/angularfire.min.js', 'lib/facebook-all.min.js', 'lib/moment-2.2.1.min.js', 'lib/moment-pt-br.min.js', 'lib/mousetrap.min.js', 'lib/bootstrap.min.js'],
                dest: '<%= buildDest %>js/libs-<%= pkg.version %>.min.js'
            },
            js: {
                src: ['js/**/*'],
                dest: '<%= buildDest %>js/<%= pkg.name %>-<%= pkg.version %>.js'
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-combine');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');

    grunt.registerTask('default', function() {
        grunt.log.writeln('Available tasks:');
        grunt.log.writeln('-lint');
        grunt.log.writeln('  grunt lint');
        grunt.log.writeln('-build');
        grunt.log.writeln('  grunt build[:minify] [--dest] [--firebase]');
        grunt.log.writeln('  Example: grunt build:' + DEFAULTS.minify + ' --dest ' + DEFAULTS.buildDest + ' --firebase ' + DEFAULTS.firebaseUrl);
        grunt.fail.fatal('Task (lint or build) must be specified.');
    });
    grunt.registerTask('lint', ['csslint', 'jshint']);
    grunt.registerTask('build', function(minify) {
        if (minify === undefined) {
            minify = DEFAULTS.minify;
        } else {
            minify = minify !== '0' && minify !== 'false' && minify !== 'no' ? true : false;
        }
        buildDest = grunt.option('dest') ? grunt.option('dest') : DEFAULTS.buildDest;
        if (buildDest[buildDest.length - 1] !== '/') {
            buildDest = buildDest + '/';
        }
        firebaseUrl = grunt.option('firebase') ? grunt.option('firebase') : DEFAULTS.firebaseUrl;
        grunt.config('buildDest', buildDest);
        grunt.config('firebaseUrl', firebaseUrl);
        grunt.config('minSufix', minify ? '.min' : '');
        grunt.log.writeln('Build path: ' + buildDest);
        grunt.log.writeln('Firebase URL: ' + firebaseUrl);
        grunt.log.writeln('Minify: ' + minify);
        if (minify) {
            grunt.task.run(['clean', 'copy:min', 'cssmin', 'uglify', 'combine:single', 'concat:lib']);
        } else {
            grunt.task.run(['clean', 'copy:min', 'copy:css', 'concat:js', 'combine:single', 'concat:lib']);
        }
    });
};
<commit_msg>Fix lint task<commit_after>var DEFAULTS = {
    minify: true,
    firebaseUrl: 'https://teste-login.firebaseio.com/',
    buildDest: 'build/'
};

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        clean: ['<%= buildDest %>**/*'],
        copy: {
            min: {
                files: [{
                    src: ['css/bootstrap.min.css', 'css/hint.min.css'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['favicon.ico', 'apple-touch-icon.png'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['fonts/**/*'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['img/**/*'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['js/bootstrap.min.js'],
                    dest: '<%= buildDest %>'
                }, {
                    src: ['partials/config.html'],
                    dest: '<%= buildDest %>partials/config-<%= pkg.version %>.html'
                }, {
                    src: ['partials/data.html'],
                    dest: '<%= buildDest %>partials/data-<%= pkg.version %>.html'
                }, {
                    src: ['partials/detail.html'],
                    dest: '<%= buildDest %>partials/detail-<%= pkg.version %>.html'
                }, {
                    src: ['partials/list.html'],
                    dest: '<%= buildDest %>partials/list-<%= pkg.version %>.html'
                }, {
                    src: ['partials/help.html'],
                    dest: '<%= buildDest %>partials/help-<%= pkg.version %>.html'
                }, {
                    src: ['partials/login.html'],
                    dest: '<%= buildDest %>partials/login-<%= pkg.version %>.html'
                }]
            },
            css: {
                files: [{
                    src: ['css/meuponto.css'],
                    dest: '<%= buildDest %>css/<%= pkg.name %>-<%= pkg.version %>.css'
                }]
            }
        },
        uglify: {
            build: {
                src: 'js/**/*',
                dest: '<%= buildDest %>js/<%= pkg.name %>-<%= pkg.version %>.min.js'
            }
        },
        cssmin: {
            minify: {
                src: ['css/<%= pkg.name %>.css'],
                dest: '<%= buildDest %>css/<%= pkg.name %>-<%= pkg.version %>.min.css'
            }
        },
        combine: {
            single: {
                input: 'index.html',
                output: '<%= buildDest %>index.html',
                tokens: [{
                    token: '__VERSION__',
                    string: '<%= pkg.version %>'
                }, {
                    token: '__VERSION_SUFIX__',
                    string: '<%= pkg.version %><%= minSufix %>'
                }, {
                    token: '__FIREBASE_URL__',
                    string: '<%= firebaseUrl %>'
                }]
            }
        },
        csslint: {
            strict: {
                src: ['css/<%= pkg.name %>.css'],
                options: {
                    ids: false
                }
            }
        },
        jshint: {
            files: ['js/*.js']
        },
        concat: {
            options: {
                separator: ';',
            },
            lib: {
                src: ['lib/jquery-1.10.2.min.js', 'lib/angular-1.0.8.min.js', 'lib/firebase.min.js', 'lib/firebase-auth-client.min.js', 'lib/angularfire.min.js', 'lib/facebook-all.min.js', 'lib/moment-2.2.1.min.js', 'lib/moment-pt-br.min.js', 'lib/mousetrap.min.js', 'lib/bootstrap.min.js'],
                dest: '<%= buildDest %>js/libs-<%= pkg.version %>.min.js'
            },
            js: {
                src: ['js/**/*'],
                dest: '<%= buildDest %>js/<%= pkg.name %>-<%= pkg.version %>.js'
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-combine');
    grunt.loadNpmTasks('grunt-contrib-csslint');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-concat');

    grunt.registerTask('default', function() {
        grunt.log.writeln('Available tasks:');
        grunt.log.writeln('-lint');
        grunt.log.writeln('  grunt lint');
        grunt.log.writeln('-build');
        grunt.log.writeln('  grunt build[:minify] [--dest] [--firebase]');
        grunt.log.writeln('  Example: grunt build:' + DEFAULTS.minify + ' --dest ' + DEFAULTS.buildDest + ' --firebase ' + DEFAULTS.firebaseUrl);
        grunt.fail.fatal('Task (lint or build) must be specified.');
    });
    grunt.registerTask('lint', ['csslint', 'jshint']);
    grunt.registerTask('build', function(minify) {
        if (minify === undefined) {
            minify = DEFAULTS.minify;
        } else {
            minify = minify !== '0' && minify !== 'false' && minify !== 'no' ? true : false;
        }
        buildDest = grunt.option('dest') ? grunt.option('dest') : DEFAULTS.buildDest;
        if (buildDest[buildDest.length - 1] !== '/') {
            buildDest = buildDest + '/';
        }
        firebaseUrl = grunt.option('firebase') ? grunt.option('firebase') : DEFAULTS.firebaseUrl;
        grunt.config('buildDest', buildDest);
        grunt.config('firebaseUrl', firebaseUrl);
        grunt.config('minSufix', minify ? '.min' : '');
        grunt.log.writeln('Build path: ' + buildDest);
        grunt.log.writeln('Firebase URL: ' + firebaseUrl);
        grunt.log.writeln('Minify: ' + minify);
        if (minify) {
            grunt.task.run(['clean', 'copy:min', 'cssmin', 'uglify', 'combine:single', 'concat:lib']);
        } else {
            grunt.task.run(['clean', 'copy:min', 'copy:css', 'concat:js', 'combine:single', 'concat:lib']);
        }
    });
};
<|endoftext|>


<commit_before>/*global module, require*/
module.exports = function (grunt) {
  'use strict';
  require('matchdep').filterDev('*').forEach(grunt.loadNpmTasks);

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

    assemble : {
      options: {
        assets: 'docs/src/assets',
        flatten: false,
        partials: ['docs/src/partials/*.hbs'],
        layout: 'docs/src/layouts/default.hbs',
        data: ['docs/src/data/*.{json,yml}']
      },
      pages: {
        files: [{
          expand: true,
          cwd: 'docs/src/templates/',
          src: ['**/*.hbs'],
          dest: 'docs/dist/'
        }]
      }
    },
    sass: {
      dist: {
        options: {
          sourceComments: 'map',
        },
        files : {
          'dist/stylesheets/style.css': 'src/style.scss'
        }
      },
      docs: {
        options: {
          sourceComments: 'map',
        },
        files : {
          'docs/dist/assets/stylesheets/style.css': 'src/style.scss',
          'docs/dist/assets/stylesheets/docs.css': 'docs/src/assets/stylesheets/docs.scss'
        }
      }
    },
    myth: {
      options: {
        sourcemap: true
      },
      dist: {
        files: {
          'dist/stylesheets/style.css': 'dist/stylesheets/style.css'
        }
      },
      docs: {
        files: {
          'docs/dist/assets/stylesheets/docs.css': 'docs/dist/assets/stylesheets/docs.css'
        }
      }
    },
    clean: {
      dist: {
        files: [
        {
          dot: true,
          src: ['dist/*']
        }
        ]
      },
      docs: {
        files: [
        {
          dot: true,
          src: ['docs/dist/*']
        }
        ]
      }
    },
    copy: {
      dist: {
        files: [
        {
          expand: true,
          flatten: true,
          cwd: 'src/',
          src: ['**/*.js'],
          dest: 'dist/javascripts/'
        }
        ]
      },
      docs: {
        files: [
        {
          expand: true,
          cwd: 'docs/src/assets/',
          src: ['images/*', 'javascripts/*'],
          dest: 'docs/dist/assets/'
        },
        {
          expand: true,
          cwd: 'dist/javascripts/',
          src: ['*.js'],
          dest: 'docs/dist/assets/javascripts/lib/'
        }
        ]
      }
    },
    watch: {
      hbs: {
        files: ['docs/src/**/*.hbs'],
        tasks: ['assemble']
      },
      docs: {
        files: ['docs/src/assets/images/*', 'docs/src/assets/javascripts/*'],
        tasks: ['copy:docs']
      },
      docsass: {
        files: ['docs/src/assets/stylesheets/*'],
        tasks: ['sass:docs', 'myth:docs']
      },
      sass: {
        files: ['src/**/*.scss'],
        tasks: ['compile', 'copy:docs']
      },
      js: {
        files: ['src/**/*.js'],
        tasks: ['copy:dist', 'copy:docs']
      }
    }
  });

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

grunt.registerTask('compile', ['sass:dist', 'myth:dist']);

grunt.registerTask('dist', ['clean:dist', 'copy:dist', 'compile']);

grunt.registerTask('build', ['dist', 'clean:docs', 'copy:docs', 'sass:docs', 'myth:docs', 'assemble']);

};
<commit_msg>grunt task cleanup to support seperate docs and dist css builds.<commit_after>/*global module, require*/
module.exports = function (grunt) {
  'use strict';
  require('matchdep').filterDev('*').forEach(grunt.loadNpmTasks);

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

    assemble : {
      options: {
        assets: 'docs/src/assets',
        flatten: false,
        partials: ['docs/src/partials/*.hbs'],
        layout: 'docs/src/layouts/default.hbs',
        data: ['docs/src/data/*.{json,yml}']
      },
      pages: {
        files: [{
          expand: true,
          cwd: 'docs/src/templates/',
          src: ['**/*.hbs'],
          dest: 'docs/dist/'
        }]
      }
    },
    sass: {
      dist: {
        options: {
          sourceComments: 'map',
        },
        files : {
          'dist/stylesheets/style.css': 'src/style.scss'
        }
      },
      docs: {
        options: {
          sourceComments: 'map',
        },
        files : {
          'docs/dist/assets/stylesheets/style.css': 'src/style.scss',
          'docs/dist/assets/stylesheets/docs.css': 'docs/src/assets/stylesheets/docs.scss'
        }
      }
    },
    myth: {
      options: {
        sourcemap: true
      },
      dist: {
        files: {
          'dist/stylesheets/style.css': 'dist/stylesheets/style.css'
        }
      },
      docs: {
        files: {
          'docs/dist/assets/stylesheets/docs.css': 'docs/dist/assets/stylesheets/docs.css',
          'docs/dist/assets/stylesheets/style.css': 'docs/dist/assets/stylesheets/style.css'
        }
      }
    },
    clean: {
      dist: {
        files: [
        {
          dot: true,
          src: ['dist/*']
        }
        ]
      },
      docs: {
        files: [
        {
          dot: true,
          src: ['docs/dist/*']
        }
        ]
      }
    },
    copy: {
      dist: {
        files: [
        {
          expand: true,
          flatten: true,
          cwd: 'src/',
          src: ['**/*.js'],
          dest: 'dist/javascripts/'
        }
        ]
      },
      docs: {
        files: [
        {
          expand: true,
          cwd: 'docs/src/assets/',
          src: ['images/*', 'javascripts/*'],
          dest: 'docs/dist/assets/'
        },
        {
          expand: true,
          cwd: 'dist/javascripts/',
          src: ['*.js'],
          dest: 'docs/dist/assets/javascripts/lib/'
        }
        ]
      }
    },
    watch: {
      hbs: {
        files: ['docs/src/**/*.hbs'],
        tasks: ['assemble']
      },
      docs: {
        files: ['docs/src/assets/images/*', 'docs/src/assets/javascripts/*'],
        tasks: ['copy:docs']
      },
      docsass: {
        files: ['docs/src/assets/stylesheets/*'],
        tasks: ['doccss']
      },
      sass: {
        files: ['src/**/*.scss'],
        tasks: ['distcss', 'copy:docs', 'doccss']
      },
      js: {
        files: ['src/**/*.js'],
        tasks: ['copy:dist', 'copy:docs']
      }
    }
  });

grunt.registerTask('default', ['build']);
grunt.registerTask('distcss', ['sass:dist', 'myth:dist']);
grunt.registerTask('doccss', ['sass:docs', 'myth:docs']);
grunt.registerTask('dist', ['clean:dist', 'copy:dist', 'distcss']);
grunt.registerTask('build', ['dist', 'clean:docs', 'copy:docs', 'doccss', 'assemble']);

};
<|endoftext|>


<commit_before>/* global require: false */
'use strict';

/**
  This file is used to configure the [grunt](http://gruntjs.com/) tasks
  aimed to generate the web frontend of the camunda BPM platform.
  @author Valentin Vago <valentin.vago@camunda.com>
  @author Nico Rehwaldt  <nico.rehwaldt@camunda.com>
 */

module.exports = function(grunt) {
  require('load-grunt-tasks')(grunt);
  require('time-grunt')(grunt);

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

  var config = pkg.gruntConfig || {};

  config.grunt = grunt;
  config.pkg = pkg;

  grunt.initConfig({
    // the default value should be the "dev" destination
    // this is not exactly the best solution, but otherwise, when tasks are "rerunned"
    // with the watch tasks, the value get lost...
    // so, it's fine for the "dist" build mode
    // who will override the value but only run once
    buildTarget:      grunt.option('target') || config.devTarget,

    pkg:              pkg,

    bower:            require('camunda-commons-ui/grunt/config/bower')(config),

    jasmine_node:     require('camunda-commons-ui/grunt/config/jasmine_node')(config),

    karma:            require('camunda-commons-ui/grunt/config/karma')(config),

    protractor:       require('camunda-commons-ui/grunt/config/protractor')(config),

    seleniuminstall:  require('camunda-commons-ui/grunt/config/seleniuminstall')(config),

    requirejs:        require('./grunt/config/requirejs')(config),

    less:             require('camunda-commons-ui/grunt/config/less')(config),

    copy:             require('./grunt/config/copy')(config),

    watch:            require('./grunt/config/watch')(config),

    connect:          require('camunda-commons-ui/grunt/config/connect')(config),

    jsdoc:            require('camunda-commons-ui/grunt/config/jsdoc')(config),

    jshint:           require('camunda-commons-ui/grunt/config/jshint')(config),

    changelog:        require('camunda-commons-ui/grunt/config/changelog')(config),

    clean:            require('camunda-commons-ui/grunt/config/clean')(config)
  });

  grunt.registerTask('custom-copy', function() {
    var smthRandom = 'ad'+ (new Date()).getTime();
    var tasks = [
      'copy:'+ smthRandom,
      '-custom-copy:'+ smthRandom
    ];

    grunt.config.data.copy[smthRandom] = {
      options: {
        process: function(content, srcpath) {
          var processing = (grunt.config.get('buildTarget') !== 'dist' ? 'dev' : 'dist') +'FileProcessing';

          return (require('./grunt/config/copy')[processing]).call(grunt, content, srcpath);
        }
      },
      files: [
        {
          expand: true,
          cwd: '<%= pkg.gruntConfig.clientDir %>/bower_components/camunda-commons-ui/',
          src: [
            'lib/**/*.*',
            'lib/*.*'
          ],
          dest: '<%= buildTarget %>/assets/vendor/camunda-commons-ui/',
        },
        {
          expand: true,
          cwd: '<%= pkg.gruntConfig.clientDir %>/scripts/',
          src: [
            '**/*.*',
            '*.*'
          ],
          dest: '<%= buildTarget %>/',
        }
      ]
    };

    grunt.task.run(tasks);
  });

  grunt.registerTask('-custom-copy', function(id) {
    for (var t in grunt.config.data) {
      for (var tt in grunt.config.data[t]) {
        if (tt.slice(0 - id.length) === id) {
          delete grunt.config.data[t][tt];
        }
      }
    }
  });

  grunt.registerTask('build', function(mode) {
    mode = mode || 'prod';

    grunt.config.data.buildTarget = (mode === 'prod' ? config.prodTarget : config.devTarget);
    grunt.log.subhead('Will build the "'+ pkg.name +'" project in "'+ mode +'" mode and place it in "'+ grunt.config('buildTarget') +'"');
    if (mode === 'dev') {
      grunt.log.writeln('Will serve on port "'+
        config.connectPort +
        '" and liverreload available on port "'+
        config.livereloadPort +
        '"');
    }

    var tasks = [
      'clean',
//       'jshint',
//       'jsdoc',
      'bower',
      'copy',
      'less',
      // NOTE: the requirejs task is actually
      // overriden using "grunt.renameTask".
      // In a world of unicorns and rainbows,
      // the normal requirejs should of course be used.
      'requirejs'
    ];

    grunt.task.run(tasks);
  });

  grunt.renameTask('custom-copy', 'requirejs');

  grunt.registerTask('auto-build', [
    'build:dev',
    // 'connect',
    'watch'
  ]);

  grunt.registerTask('postinstall', ['seleniuminstall']);

  grunt.registerTask('prepublish', ['build', 'changelog']);

  grunt.registerTask('default', ['build']);
};
<commit_msg>fix(grunt): commons ui path<commit_after>/* global require: false */
'use strict';

/**
  This file is used to configure the [grunt](http://gruntjs.com/) tasks
  aimed to generate the web frontend of the camunda BPM platform.
  @author Valentin Vago <valentin.vago@camunda.com>
  @author Nico Rehwaldt  <nico.rehwaldt@camunda.com>
 */

module.exports = function(grunt) {
  require('load-grunt-tasks')(grunt);
  require('time-grunt')(grunt);

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

  var config = pkg.gruntConfig || {};

  config.grunt = grunt;
  config.pkg = pkg;

  grunt.initConfig({
    // the default value should be the "dev" destination
    // this is not exactly the best solution, but otherwise, when tasks are "rerunned"
    // with the watch tasks, the value get lost...
    // so, it's fine for the "dist" build mode
    // who will override the value but only run once
    buildTarget:      grunt.option('target') || config.devTarget,

    pkg:              pkg,

    bower:            require('camunda-commons-ui/grunt/config/bower')(config),

    jasmine_node:     require('camunda-commons-ui/grunt/config/jasmine_node')(config),

    karma:            require('camunda-commons-ui/grunt/config/karma')(config),

    protractor:       require('camunda-commons-ui/grunt/config/protractor')(config),

    seleniuminstall:  require('camunda-commons-ui/grunt/config/seleniuminstall')(config),

    requirejs:        require('./grunt/config/requirejs')(config),

    less:             require('camunda-commons-ui/grunt/config/less')(config),

    copy:             require('./grunt/config/copy')(config),

    watch:            require('./grunt/config/watch')(config),

    connect:          require('camunda-commons-ui/grunt/config/connect')(config),

    jsdoc:            require('camunda-commons-ui/grunt/config/jsdoc')(config),

    jshint:           require('camunda-commons-ui/grunt/config/jshint')(config),

    changelog:        require('camunda-commons-ui/grunt/config/changelog')(config),

    clean:            require('camunda-commons-ui/grunt/config/clean')(config)
  });

  grunt.registerTask('custom-copy', function() {
    var smthRandom = 'ad'+ (new Date()).getTime();
    var tasks = [
      'copy:'+ smthRandom,
      '-custom-copy:'+ smthRandom
    ];

    grunt.config.data.copy[smthRandom] = {
      options: {
        process: function(content, srcpath) {
          var processing = (grunt.config.get('buildTarget') !== 'dist' ? 'dev' : 'dist') +'FileProcessing';

          return (require('./grunt/config/copy')[processing]).call(grunt, content, srcpath);
        }
      },
      files: [
        {
          expand: true,
          cwd: 'node_modules/camunda-commons-ui/',
          src: [
            'lib/**/*.*',
            'lib/*.*'
          ],
          dest: '<%= buildTarget %>/assets/vendor/camunda-commons-ui/',
        },
        {
          expand: true,
          cwd: '<%= pkg.gruntConfig.clientDir %>/scripts/',
          src: [
            '**/*.*',
            '*.*'
          ],
          dest: '<%= buildTarget %>/',
        }
      ]
    };

    grunt.task.run(tasks);
  });

  grunt.registerTask('-custom-copy', function(id) {
    for (var t in grunt.config.data) {
      for (var tt in grunt.config.data[t]) {
        if (tt.slice(0 - id.length) === id) {
          delete grunt.config.data[t][tt];
        }
      }
    }
  });

  grunt.registerTask('build', function(mode) {
    mode = mode || 'prod';

    grunt.config.data.buildTarget = (mode === 'prod' ? config.prodTarget : config.devTarget);
    grunt.log.subhead('Will build the "'+ pkg.name +'" project in "'+ mode +'" mode and place it in "'+ grunt.config('buildTarget') +'"');
    if (mode === 'dev') {
      grunt.log.writeln('Will serve on port "'+
        config.connectPort +
        '" and liverreload available on port "'+
        config.livereloadPort +
        '"');
    }

    var tasks = [
      'clean',
//       'jshint',
//       'jsdoc',
      'bower',
      'copy',
      'less',
      // NOTE: the requirejs task is actually
      // overriden using "grunt.renameTask".
      // In a world of unicorns and rainbows,
      // the normal requirejs should of course be used.
      'requirejs'
    ];

    grunt.task.run(tasks);
  });

  grunt.renameTask('custom-copy', 'requirejs');

  grunt.registerTask('auto-build', [
    'build:dev',
    // 'connect',
    'watch'
  ]);

  grunt.registerTask('postinstall', ['seleniuminstall']);

  grunt.registerTask('prepublish', ['build', 'changelog']);

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


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

    grunt.initConfig( {

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

        jshint:
        {
            options:
            {
                force: true,
                jshintrc: ".jshintrc",
                report: "jslint"
            },
            all:
            {
                src: [ "source/<%= pkg.name %>.js", "Gruntfile.js" ]
            }
        },

        karma:
        {
            unit: { configFile: "tests/karma.conf.js" }
        },

        less:
        {
            all:
            {
                files: { "dist/svg-radial.css": "less/svg-radial.less" }
            }
        },

        ngtemplates:
        {
            options:
            {
                module: "svgRadial",
                htmlmin:
                {
                    collapseWhitespace: true,
                    removeAttributeQuotes: false,
                    removeComments: true
                }
            },
            all:
            {
                src: [ "templates/*.html" ],
                dest: "source/templates.js",
                cwd: "source"
            }
        },

        uglify:
        {
            options: {
                banner: "/*!\n"
                      + " * <%= pkg.name %> <%= pkg.version %>\n"
                      + " * (c) <%= grunt.template.today( 'yyyy' ) %> Vokal LLC\n"
                      + " * <%= pkg.homepage %>\n"
                      + " */\n",
                sourceMap: false,
                mangle: true,
                compress: true
            },
            min:
            {
                files: { "dist/<%= pkg.name %>.min.js": [
                    "source/<%= pkg.name %>.js",
                    "<%= ngtemplates.all.dest %>"
                ] }
            }
        },

        watch:
        {
            options: { atBegin: true },
            js:
            {
                files: "<%= jshint.all.src %>",
                tasks: [ "jshint" ]
            },
            templates:
            {
                files: "<%= ngtemplates.all.cwd %>/<%= ngtemplates.all.src %>",
                tasks: [ "ngtemplates" ]
            }
        }

    } );

    // Load plugins
    grunt.loadNpmTasks( "grunt-angular-templates" );
    grunt.loadNpmTasks( "grunt-contrib-jshint" );
    grunt.loadNpmTasks( "grunt-contrib-less" );
    grunt.loadNpmTasks( "grunt-contrib-uglify" );
    grunt.loadNpmTasks( "grunt-contrib-watch" );
    grunt.loadNpmTasks( "grunt-karma" );
};
<commit_msg>Clearer grunt watch target.<commit_after>module.exports = function( grunt )
{
    "use strict";

    grunt.initConfig( {

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

        jshint:
        {
            options:
            {
                force: true,
                jshintrc: ".jshintrc",
                report: "jslint"
            },
            all:
            {
                src: [ "source/<%= pkg.name %>.js", "Gruntfile.js" ]
            }
        },

        karma:
        {
            unit: { configFile: "tests/karma.conf.js" }
        },

        less:
        {
            all:
            {
                files: { "dist/svg-radial.css": "less/svg-radial.less" }
            }
        },

        ngtemplates:
        {
            options:
            {
                module: "svgRadial",
                htmlmin:
                {
                    collapseWhitespace: true,
                    removeAttributeQuotes: false,
                    removeComments: true
                }
            },
            all:
            {
                src: [ "templates/*.html" ],
                dest: "source/templates.js",
                cwd: "source"
            }
        },

        uglify:
        {
            options: {
                banner: "/*!\n"
                      + " * <%= pkg.name %> <%= pkg.version %>\n"
                      + " * (c) <%= grunt.template.today( 'yyyy' ) %> Vokal LLC\n"
                      + " * <%= pkg.homepage %>\n"
                      + " */\n",
                sourceMap: false,
                mangle: true,
                compress: true
            },
            min:
            {
                files: { "dist/<%= pkg.name %>.min.js": [
                    "source/<%= pkg.name %>.js",
                    "<%= ngtemplates.all.dest %>"
                ] }
            }
        },

        watch:
        {
            options: { atBegin: true },
            js:
            {
                files: "<%= jshint.all.src %>",
                tasks: [ "jshint" ]
            },
            templates:
            {
                options: { cwd: "<%= ngtemplates.all.cwd %>" },
                files: "<%= ngtemplates.all.src %>",
                tasks: [ "ngtemplates" ]
            }
        }

    } );

    // Load plugins
    grunt.loadNpmTasks( "grunt-angular-templates" );
    grunt.loadNpmTasks( "grunt-contrib-jshint" );
    grunt.loadNpmTasks( "grunt-contrib-less" );
    grunt.loadNpmTasks( "grunt-contrib-uglify" );
    grunt.loadNpmTasks( "grunt-contrib-watch" );
    grunt.loadNpmTasks( "grunt-karma" );
};
<|endoftext|>