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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    concat: {
      options: {
        // define a string to put between each file in the concatenated output
        separator: ';',
        stripBanners: true
      },
      app: {
        src: ['res/js/dogfeed.js',
              'res/js/feeds/feeds.js',
              'vendor/angular-shared/ngRemoteStorage.js',
              'vendor/angular-shared/ngCommandQueue.js',
              'vendor/angular-shared/ngMessages.js',
              'vendor/sockethub-client/angular/ngSockethubClient.js',
              'vendor/sockethub-client/angular/ngSockethubRemoteStorage.js'],
        dest: 'build/app.js.tmp'
      },
      modules: {
        src: ['vendor/remotestorage/*-*.js'],
        dest: 'build/remotestorage-modules.js.tmp'
      },
      sockethub: {
        src: ['vendor/sockethub-client/sockethub-client.js'],
        dest: 'build/sockethub-client.js.tmp'
      },
      css: {
        src: ['res/**/*.css'],
        dest: 'build/app.css.tmp'
      },
      flatuiCSS: {
        src: ['vendor/flat-ui/*.css'],
        dest: 'build/flat-ui.css.tmp'
      }
    },
    copy: {
      main: {
        files: [
          {expand: true, src: ['*.html'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['*.ico'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['*.png'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['*.jpg'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['res/img/*'], dest: 'build/', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: true, src: ['res/js/feeds/*.html.tpl'], dest: 'build/', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.eot'], dest: 'build/res/fonts/glyphicons-halflings-regular.eot', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.svg'], dest: 'build/res/fonts/glyphicons-halflings-regular.svg', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf'], dest: 'build/res/fonts/glyphicons-halflings-regular.ttf', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.woff'], dest: 'build/res/fonts/glyphicons-halflings-regular.woff', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/jquery.min.js'], dest: 'build/res/js/jquery.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/angular.min.js'], dest: 'build/res/js/angular.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/remotestorage/remotestorage.min.js'], dest: 'build/res/js/remotestorage.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/js/bootstrap.min.js'], dest: 'build/res/js/bootstrap.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/js/bootstrap-theme.min.js'], dest: 'build/res/js/bootstrap-theme.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/css/bootstrap.min.css'], dest: 'build/res/css/bootstrap.min.css', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/css/bootstrap-theme.min.css'], dest: 'build/res/css/bootstrap-theme.min.css', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['<%= concat.app.dest %>'], dest: 'build/res/js/app.min.js', filter: 'isFile'} // includes files in path and its subdirs

        ]
      }
    },
    uglify: {
      options: {
        compress: true,
        banner: '/*! built for <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      dist: {
        files: {
          //'build/res/js/app.min.js': ['<%= concat.app.dest %>'],
          'build/res/js/sockethub-client.min.js': ['<%= concat.sockethub.dest %>'],
          'build/res/js/remotestorage-modules.min.js': ['<%= concat.modules.dest %>']
        }
      }
    },
    cssmin: {
      minify: {
        expand: true,
        cwd: 'build/',
        src: ['*.css.tmp', '!*.min.css'],
        dest: 'build/res/css/',
        ext: '.min.css'
      }
    },

    useminPrepare: {
      html: ['build/index.html', 'build/rscallback.html']
    },
    usemin: {
      html: ['build/index.html', 'build/rscallback.html']
    },
    clean: ['build/*.tmp']
  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-usemin');

  //grunt.file.write('build/VERSION', grunt.pkg.version);

  // Default task(s).
  grunt.registerTask('default', ['concat', 'copy', 'uglify', 'cssmin', 'usemin', 'clean']);
};
<commit_msg>updating gruntfile<commit_after>module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    concat: {
      options: {
        // define a string to put between each file in the concatenated output
        separator: ';',
        stripBanners: true
      },
      app: {
        src: ['res/js/dogfeed.js',
              'res/js/feeds/feeds.js',
              'vendor/angular-shared/ngRemoteStorage.js',
              'vendor/angular-shared/ngCommandQueue.js',
              'vendor/angular-shared/ngMessages.js',
              'vendor/sockethub-client/angular/ngSockethubClient.js',
              'vendor/sockethub-client/angular/ngSockethubRemoteStorage.js'],
        dest: 'build/app.js.tmp'
      },
      modules: {
        src: ['vendor/remotestorage/*-*.js'],
        dest: 'build/remotestorage-modules.js.tmp'
      },
      sockethub: {
        src: ['vendor/sockethub-client/sockethub-client.js'],
        dest: 'build/sockethub-client.js.tmp'
      },
      css: {
        src: ['res/**/*.css'],
        dest: 'build/app.css.tmp'
      },
      flatuiCSS: {
        src: ['vendor/flat-ui/*.css'],
        dest: 'build/flat-ui.css.tmp'
      }
    },
    copy: {
      main: {
        files: [
          {expand: true, src: ['*.html'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['*.ico'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['*.png'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['*.jpg'], dest: 'build/'}, // includes files in path and its subdirs
          {expand: true, src: ['res/img/*'], dest: 'build/', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: true, src: ['res/js/feeds/*.html.tpl'], dest: 'build/', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.eot'], dest: 'build/res/fonts/glyphicons-halflings-regular.eot', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.svg'], dest: 'build/res/fonts/glyphicons-halflings-regular.svg', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf'], dest: 'build/res/fonts/glyphicons-halflings-regular.ttf', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/fonts/glyphicons-halflings-regular.woff'], dest: 'build/res/fonts/glyphicons-halflings-regular.woff', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/jquery.min.js'], dest: 'build/res/js/jquery.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/angular.min.js'], dest: 'build/res/js/angular.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/snap.min.js'], dest: 'build/res/js/snap.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/matchMedia.js'], dest: 'build/res/js/matchMedia.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/remotestorage/remotestorage.min.js'], dest: 'build/res/js/remotestorage.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/js/bootstrap.min.js'], dest: 'build/res/js/bootstrap.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/js/bootstrap-theme.min.js'], dest: 'build/res/js/bootstrap-theme.min.js', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/css/bootstrap.min.css'], dest: 'build/res/css/bootstrap.min.css', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['vendor/bootstrap/css/bootstrap-theme.min.css'], dest: 'build/res/css/bootstrap-theme.min.css', filter: 'isFile'}, // includes files in path and its subdirs
          {expand: false, src: ['<%= concat.app.dest %>'], dest: 'build/res/js/app.min.js', filter: 'isFile'} // includes files in path and its subdirs

        ]
      }
    },
    uglify: {
      options: {
        compress: true,
        banner: '/*! built for <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
      },
      dist: {
        files: {
          //'build/res/js/app.min.js': ['<%= concat.app.dest %>'],
          'build/res/js/sockethub-client.min.js': ['<%= concat.sockethub.dest %>'],
          'build/res/js/remotestorage-modules.min.js': ['<%= concat.modules.dest %>']
        }
      }
    },
    cssmin: {
      minify: {
        expand: true,
        cwd: 'build/',
        src: ['*.css.tmp', '!*.min.css'],
        dest: 'build/res/css/',
        ext: '.min.css'
      }
    },
    useminPrepare: {
      html: ['build/index.html', 'build/rscallback.html']
    },
    usemin: {
      html: ['build/index.html', 'build/rscallback.html']
    },
    clean: ['build/*.tmp']
  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-usemin');

  //grunt.file.write('build/VERSION', grunt.pkg.version);

  // Default task(s).
  grunt.registerTask('default', ['concat', 'copy', 'uglify', 'cssmin', 'usemin', 'clean']);
};
<|endoftext|>


<commit_before>'use strict';

var matchdep = require('matchdep');
var path = require('path');
var appConf = require('./app.conf.js');

/**
 * @param {{util, loadTasks, loadNpmTasks, initConfig, renameTask, registerTask, file:{readJSON}}} grunt
 */
module.exports = function (grunt) {
  // load all grunt tasks
  matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  grunt.loadTasks('tasks');

  var conf = {};
  //Temporary fix for https://github.com/shama/gaze/issues/41
  grunt.util._.each(appConf, function (val, key) {
    if (typeof val === 'string') {
      if (val.indexOf('/') === 0) {
        conf[key] = path.relative(__dirname, val);
        if (conf[key].slice(-1) === '/') {
          conf[key] = conf[key].substring(0, conf[key].length - 1);
        }
        return;
      }
    }
    conf[key] = val;
  });

  //noinspection SpellCheckingInspection
  grunt.initConfig({
    appConf: conf,

    //General tasks
    watch: {
      options: {
        livereload: true
      },
      compass: {
        files: '<%= appConf.clientApp %>/styles/{,*/}*.{scss,sass}',
        tasks: ['compass:dev']
      },
      templates: {
        files: '<%= appConf.clientApp %>/templates/**.html',
        tasks: ['ngtemplates:dev']
      },
      index: {
        files: '<%= appConf.clientApp %>/index.html'
      },
      js: {
        files: '<%= appConf.clientApp %>/scripts/{,*/}*.js'
      },
      css: {
        files: '{<%= appConf.clientTmp %>,<%= appConf.clientApp %>}/styles/{,*/}*.css'
      },
      images: {
        files: '<%= appConf.clientApp %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
      },
      fonts: {
        files: '<%= appConf.clientApp %>/styles/fonts/{,*/}*.*'
      }
    },
    clean: {
      dist: {
        files: [
          {
            dot: true,
            src: [
              '<%= appConf.clientTmp %>',
              '<%= appConf.dist %>/*',
              '!<%= appConf.dist %>/.git*'
            ]
          }
        ]
      },
      temp: '<%= appConf.clientTmp %>',
      final: {
        files: [
          {
            dot: true,
            src: [
              '<%= appConf.server %>',
              '<%= appConf.client %>',
              '.bowerrc',
              '.editorconfig',
              '.jshintrc',
              'bower.json',
              'app.conf.js',
              'Gruntfile.js',
              'tasks',
              '.sass-cache',
              '*.log',
              'README.md',
              '<%= appConf.dist %>/js/templates.js'
            ]
          }
        ]
      },
      templates: [
        '<%= appConf.dist %>/scripts/templates.js',
        '<%= appConf.clientApp %>/scripts/templates.js',
        '<%= appConf.clientTmp %>/scripts/templates.js'
      ]
    },

    //Build-related Tasks
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'tasks/{,*/}*.js',
        '<%= appConf.clientApp %>/scripts/{,*/}*.js',
        '<%= appConf.serverApp %>/{,*/}*.js'
      ]
    },
    compass: {
      options: {
        sassDir: '<%= appConf.clientApp %>/styles',
        imagesDir: '<%= appConf.clientApp %>/images',
        javascriptsDir: '<%= appConf.clientApp %>/scripts',
        fontsDir: '<%= appConf.clientApp %>/styles/fonts',
        importPath: '<%= appConf.clientApp %>/vendor',
        relativeAssets: true
      },
      dist: {
        options: {
          debugInfo: false,
          cssDir: '<%= appConf.clientApp %>/styles'
        }
      },
      dev: {
        options: {
          debugInfo: true,
          cssDir: '<%= appConf.clientTmp %>/styles'
        }
      }
    },
    useminPrepare: {
      html: '<%= appConf.clientApp %>/index.html',
      options: {
        dest: '<%= appConf.dist %>'
      }
    },
    imagemin: {
      dist: {
        files: [
          {
            expand: true,
            cwd: '<%= appConf.clientApp %>/images',
            src: '{,*/}*.{png,jpg,jpeg}',
            dest: '<%= appConf.dist %>/images'
          }
        ]
      }
    },
    copy: {
      dist: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= appConf.clientApp %>',
            dest: '<%= appConf.dist %>',
            src: [
              '*.{ico,txt}',
              '.htaccess',
              'vendor/**/*',
              'images/{,*/}*.{gif,webp}',
              'styles/fonts/*'
            ]
          },
          {
            expand: true,
            dot: true,
            cwd: '<%= appConf.server %>',
            dest: __dirname,
            src: [
              '**/*',
              '!test/**'
            ]
          }
        ]
      }
    },
    cdnify: {
      dist: {
        html: ['<%= appConf.clientApp %>/**.html']
      }
    },
    ngmin: {
      dist: {
        files: [
          {
            expand: true,
            cwd: '<%= appConf.dist %>/scripts',
            src: 'scripts.js',
            dest: '<%= appConf.dist %>/scripts'
          }
        ]
      }
    },
    rev: {
      dist: {
        files: {
          src: [
            '<%= appConf.dist %>/scripts/{,*/}*.js',
            '<%= appConf.dist %>/styles/{,*/}*.css',
            '<%= appConf.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= appConf.dist %>/styles/fonts/*'
          ]
        }
      }
    },
    usemin: {
      html: ['<%= appConf.dist %>/{,*/}*.html'],
      css: ['<%= appConf.dist %>/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= appConf.dist %>']
      }
    },
    htmlmin: {
      dist:{
        options: {
          //removeCommentsFromCDATA: true,
          //collapseWhitespace: true,
          collapseBooleanAttributes: true,
          //removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true
          //removeOptionalTags: true
        },
        files: [
          {
            expand: true,
            cwd: '<%= appConf.clientApp %>',
            src: ['index.html', 'templates/**.html'],
            dest: '<%= appConf.dist %>'
          }
        ]
      }
    },
    ngtemplates: {
      options: {
        module: {
          name: 'compiled-templates',
          define: true
        }
      },
      dist: {
        options: {
          base: '<%= appConf.dist %>'
        },
        src: '<%= appConf.dist %>/templates/**.html',
        dest: '<%= appConf.clientApp %>/scripts/templates.js'
      },
      dev: {
        options: {
          base: '<%= appConf.clientApp %>'
        },
        src: '<%= appConf.clientApp %>/templates/**.html',
        dest: '<%= appConf.clientTmp %>/scripts/templates.js'
      }
    },
    shell: {
      bowerupdate: {
        command: 'bower update',
        options: {
          stdout: true,
          failOnError: true
        }
      },
      init: {
        command: 'node init.js',
        options: {
          stdout: true,
          stdin: true,
          failOnError: true
        }
      }
    }
  });

  grunt.registerTask('init', [
    'shell:bowerupdate',
    'shell:init'
  ]);

  grunt.registerTask('dev', [
    'clean:temp',
    'compass:dev',
    'ngtemplates:dev',
    'start-server',
    'watch'
  ]);

  grunt.registerTask('client-test', [
    'clean:temp',
    'compass:dev',
    'wrapped-test:client'
  ]);

  grunt.registerTask('server-test', [
    'wrapped-test:server'
  ]);

  grunt.registerTask('test', [
    'client-test',
    'server-test'
  ]);

  grunt.registerTask('build', [
    'shell:bowerupdate',
    'clean:dist',
    'jshint',
    'test',
    'compass:dist',
    'useminPrepare',
    'imagemin',
    'cdnify',
    'htmlmin',
    'ngtemplates:dist',
    'concat',
    'cssmin',
    'clean:templates',
    'copy',
    'ngmin',
    'uglify',
    'rev',
    'usemin',
    'clean:final'
  ]);

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

/* Old config blocks for safe keeping just in case:
 uglify: {
 dist: {
 files: {
 '<%= appConf.dist %>/scripts/scripts.js': [
 '<%= appConf.dist %>/scripts/scripts.js'
 ]
 }
 }
 }
 cssmin: {
 dist: {
 files: {
 '<%= appConf.dist %>/styles/main.css': [
 '<%= appConf.clientTmp %>/styles/{,*//*}*.css',
 '<%= appConf.clientApp %>/styles/{,*//*}*.css'
 ]
 }
 }
 }
 concat: {
 dist: {
 files: {
 '<%= appConf.dist %>/scripts/scripts.js': [
 '<%= appConf.clientApp %>/scripts/{,*//*}*.js'
 ]
 }
 }
 }
 */
<commit_msg>Excluded client/app/vendor from final clean phase when building for convenience since it's ignored by git anyway<commit_after>'use strict';

var matchdep = require('matchdep');
var path = require('path');
var appConf = require('./app.conf.js');

/**
 * @param {{util, loadTasks, loadNpmTasks, initConfig, renameTask, registerTask, file:{readJSON}}} grunt
 */
module.exports = function (grunt) {
  // load all grunt tasks
  matchdep.filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  grunt.loadTasks('tasks');

  var conf = {};
  //Temporary fix for https://github.com/shama/gaze/issues/41
  grunt.util._.each(appConf, function (val, key) {
    if (typeof val === 'string') {
      if (val.indexOf('/') === 0) {
        conf[key] = path.relative(__dirname, val);
        if (conf[key].slice(-1) === '/') {
          conf[key] = conf[key].substring(0, conf[key].length - 1);
        }
        return;
      }
    }
    conf[key] = val;
  });

  //noinspection SpellCheckingInspection
  grunt.initConfig({
    appConf: conf,

    //General tasks
    watch: {
      options: {
        livereload: true
      },
      compass: {
        files: '<%= appConf.clientApp %>/styles/{,*/}*.{scss,sass}',
        tasks: ['compass:dev']
      },
      templates: {
        files: '<%= appConf.clientApp %>/templates/**.html',
        tasks: ['ngtemplates:dev']
      },
      index: {
        files: '<%= appConf.clientApp %>/index.html'
      },
      js: {
        files: '<%= appConf.clientApp %>/scripts/{,*/}*.js'
      },
      css: {
        files: '{<%= appConf.clientTmp %>,<%= appConf.clientApp %>}/styles/{,*/}*.css'
      },
      images: {
        files: '<%= appConf.clientApp %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
      },
      fonts: {
        files: '<%= appConf.clientApp %>/styles/fonts/{,*/}*.*'
      }
    },
    clean: {
      dist: {
        files: [
          {
            dot: true,
            src: [
              '<%= appConf.clientTmp %>',
              '<%= appConf.dist %>/*',
              '!<%= appConf.dist %>/.git*'
            ]
          }
        ]
      },
      temp: '<%= appConf.clientTmp %>',
      final: {
        files: [
          {
            dot: true,
            src: [
              '<%= appConf.server %>',
              '<%= appConf.client %>',
              '.bowerrc',
              '.editorconfig',
              '.jshintrc',
              'bower.json',
              'app.conf.js',
              'Gruntfile.js',
              'tasks',
              '.sass-cache',
              '*.log',
              'README.md',
              '<%= appConf.dist %>/js/templates.js'
              '!<%= appConf.client %>/app/vendor',
            ]
          }
        ]
      },
      templates: [
        '<%= appConf.dist %>/scripts/templates.js',
        '<%= appConf.clientApp %>/scripts/templates.js',
        '<%= appConf.clientTmp %>/scripts/templates.js'
      ]
    },

    //Build-related Tasks
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'tasks/{,*/}*.js',
        '<%= appConf.clientApp %>/scripts/{,*/}*.js',
        '<%= appConf.serverApp %>/{,*/}*.js'
      ]
    },
    compass: {
      options: {
        sassDir: '<%= appConf.clientApp %>/styles',
        imagesDir: '<%= appConf.clientApp %>/images',
        javascriptsDir: '<%= appConf.clientApp %>/scripts',
        fontsDir: '<%= appConf.clientApp %>/styles/fonts',
        importPath: '<%= appConf.clientApp %>/vendor',
        relativeAssets: true
      },
      dist: {
        options: {
          debugInfo: false,
          cssDir: '<%= appConf.clientApp %>/styles'
        }
      },
      dev: {
        options: {
          debugInfo: true,
          cssDir: '<%= appConf.clientTmp %>/styles'
        }
      }
    },
    useminPrepare: {
      html: '<%= appConf.clientApp %>/index.html',
      options: {
        dest: '<%= appConf.dist %>'
      }
    },
    imagemin: {
      dist: {
        files: [
          {
            expand: true,
            cwd: '<%= appConf.clientApp %>/images',
            src: '{,*/}*.{png,jpg,jpeg}',
            dest: '<%= appConf.dist %>/images'
          }
        ]
      }
    },
    copy: {
      dist: {
        files: [
          {
            expand: true,
            dot: true,
            cwd: '<%= appConf.clientApp %>',
            dest: '<%= appConf.dist %>',
            src: [
              '*.{ico,txt}',
              '.htaccess',
              'vendor/**/*',
              'images/{,*/}*.{gif,webp}',
              'styles/fonts/*'
            ]
          },
          {
            expand: true,
            dot: true,
            cwd: '<%= appConf.server %>',
            dest: __dirname,
            src: [
              '**/*',
              '!test/**'
            ]
          }
        ]
      }
    },
    cdnify: {
      dist: {
        html: ['<%= appConf.clientApp %>/**.html']
      }
    },
    ngmin: {
      dist: {
        files: [
          {
            expand: true,
            cwd: '<%= appConf.dist %>/scripts',
            src: 'scripts.js',
            dest: '<%= appConf.dist %>/scripts'
          }
        ]
      }
    },
    rev: {
      dist: {
        files: {
          src: [
            '<%= appConf.dist %>/scripts/{,*/}*.js',
            '<%= appConf.dist %>/styles/{,*/}*.css',
            '<%= appConf.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
            '<%= appConf.dist %>/styles/fonts/*'
          ]
        }
      }
    },
    usemin: {
      html: ['<%= appConf.dist %>/{,*/}*.html'],
      css: ['<%= appConf.dist %>/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= appConf.dist %>']
      }
    },
    htmlmin: {
      dist:{
        options: {
          //removeCommentsFromCDATA: true,
          //collapseWhitespace: true,
          collapseBooleanAttributes: true,
          //removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true
          //removeOptionalTags: true
        },
        files: [
          {
            expand: true,
            cwd: '<%= appConf.clientApp %>',
            src: ['index.html', 'templates/**.html'],
            dest: '<%= appConf.dist %>'
          }
        ]
      }
    },
    ngtemplates: {
      options: {
        module: {
          name: 'compiled-templates',
          define: true
        }
      },
      dist: {
        options: {
          base: '<%= appConf.dist %>'
        },
        src: '<%= appConf.dist %>/templates/**.html',
        dest: '<%= appConf.clientApp %>/scripts/templates.js'
      },
      dev: {
        options: {
          base: '<%= appConf.clientApp %>'
        },
        src: '<%= appConf.clientApp %>/templates/**.html',
        dest: '<%= appConf.clientTmp %>/scripts/templates.js'
      }
    },
    shell: {
      bowerupdate: {
        command: 'bower update',
        options: {
          stdout: true,
          failOnError: true
        }
      },
      init: {
        command: 'node init.js',
        options: {
          stdout: true,
          stdin: true,
          failOnError: true
        }
      }
    }
  });

  grunt.registerTask('init', [
    'shell:bowerupdate',
    'shell:init'
  ]);

  grunt.registerTask('dev', [
    'clean:temp',
    'compass:dev',
    'ngtemplates:dev',
    'start-server',
    'watch'
  ]);

  grunt.registerTask('client-test', [
    'clean:temp',
    'compass:dev',
    'wrapped-test:client'
  ]);

  grunt.registerTask('server-test', [
    'wrapped-test:server'
  ]);

  grunt.registerTask('test', [
    'client-test',
    'server-test'
  ]);

  grunt.registerTask('build', [
    'shell:bowerupdate',
    'clean:dist',
    'jshint',
    'test',
    'compass:dist',
    'useminPrepare',
    'imagemin',
    'cdnify',
    'htmlmin',
    'ngtemplates:dist',
    'concat',
    'cssmin',
    'clean:templates',
    'copy',
    'ngmin',
    'uglify',
    'rev',
    'usemin',
    'clean:final'
  ]);

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

/* Old config blocks for safe keeping just in case:
 uglify: {
 dist: {
 files: {
 '<%= appConf.dist %>/scripts/scripts.js': [
 '<%= appConf.dist %>/scripts/scripts.js'
 ]
 }
 }
 }
 cssmin: {
 dist: {
 files: {
 '<%= appConf.dist %>/styles/main.css': [
 '<%= appConf.clientTmp %>/styles/{,*//*}*.css',
 '<%= appConf.clientApp %>/styles/{,*//*}*.css'
 ]
 }
 }
 }
 concat: {
 dist: {
 files: {
 '<%= appConf.dist %>/scripts/scripts.js': [
 '<%= appConf.clientApp %>/scripts/{,*//*}*.js'
 ]
 }
 }
 }
 */
<|endoftext|>


<commit_before>'use strict';

module.exports = GruntConfig;

function GruntConfig(grunt) {

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

		concat: {
			options: {
				sourceMap: true
			},
			js: {
				src: [
					'src/js/**/*module.js',
					'src/js/**/*service.js',
					'src/js/**/*filter.js',
					'src/js/**/*controller.js',
					'src/js/**/*directive.js',
					//'src/js/**/*.js',
					'!**/*.spec.js'
				],
				dest: 'bin/js/app/<%= pkg.name %>-<%= pkg.version %>.js'
			}
		},

		copy: {
			main: {
				files: [

					// Our stuff
					{
						src: [
							'**/*.html',
							//'js/**'
						],
						expand: true,
						cwd: 'src',
						dest: 'bin'
					},

					// Angular
					{
						src: [
							'angular.min.js*'
						],
						expand: true,
						cwd: 'node_modules/angular',
						dest: 'bin/lib/angular'
					},

					// jQuery
					{
						src: [
							'jquery.min.js*'
						],
						expand: true,
						cwd: 'node_modules/jquery/dist',
						dest: 'bin/lib/_jquery' // '_' is a hack to get jQuery to load before Bootstrap JS
					},

					// Bootstrap
					{
						src: [
							'css/bootstrap.min.css*',
							'js/bootstrap.min.js*',
							'fonts/**'
						],
						expand: true,
						cwd: 'node_modules/bootstrap/dist',
						dest: 'bin/lib/bootstrap'
					}
				]
			}
		},

		includeSource: {
			options: {
				basePath: 'bin/',
				baseUrl: './'
			},
			angular: {
				files: {
					'bin/index.html': 'bin/index.html'
				}
			}
		},

		ngtemplates:  {
			app:        {
				src:      'src/js/**/*.html',
				dest:     'bin/js/app/pagespeed.templates.module.js',
				options:  {
					module: 'pagespeed.templates',
					standalone: true,
					url: function(url) {
						return url.replace('src/', '');
					}
				}
			}
		},

		uglify: {
			options: {
				sourceMap: true
			},
			prod: {
				files: {
					'bin/js/app/<%= pkg.name %>-<%= pkg.version %>.min.js': [
						'bin/js/app/<%= pkg.name %>-<%= pkg.version %>.js'
					]
				}
			}
		}
	});

	grunt.registerTask('default', [
		'concat',
		'copy',
		'ngtemplates',
		'uglify',
		'includeSource'
	]);

	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-include-source');
	grunt.loadNpmTasks('grunt-angular-templates');

}
<commit_msg>Remove template HTML files from build<commit_after>'use strict';

module.exports = GruntConfig;

function GruntConfig(grunt) {

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

		concat: {
			options: {
				sourceMap: true
			},
			js: {
				src: [
					'src/js/**/*module.js',
					'src/js/**/*service.js',
					'src/js/**/*filter.js',
					'src/js/**/*controller.js',
					'src/js/**/*directive.js',
					//'src/js/**/*.js',
					'!**/*.spec.js'
				],
				dest: 'bin/js/app/<%= pkg.name %>-<%= pkg.version %>.js'
			}
		},

		copy: {
			main: {
				files: [

					// Our stuff
					{
						src: [
							'index.html'
							//'**/*.html',
							//'js/**'
						],
						expand: true,
						cwd: 'src',
						dest: 'bin'
					},

					// Angular
					{
						src: [
							'angular.min.js*'
						],
						expand: true,
						cwd: 'node_modules/angular',
						dest: 'bin/lib/angular'
					},

					// jQuery
					{
						src: [
							'jquery.min.js*'
						],
						expand: true,
						cwd: 'node_modules/jquery/dist',
						dest: 'bin/lib/_jquery' // '_' is a hack to get jQuery to load before Bootstrap JS
					},

					// Bootstrap
					{
						src: [
							'css/bootstrap.min.css*',
							'js/bootstrap.min.js*',
							'fonts/**'
						],
						expand: true,
						cwd: 'node_modules/bootstrap/dist',
						dest: 'bin/lib/bootstrap'
					}
				]
			}
		},

		includeSource: {
			options: {
				basePath: 'bin/',
				baseUrl: './'
			},
			angular: {
				files: {
					'bin/index.html': 'bin/index.html'
				}
			}
		},

		ngtemplates:  {
			app:        {
				src:      'src/js/**/*.html',
				dest:     'bin/js/app/pagespeed.templates.module.js',
				options:  {
					module: 'pagespeed.templates',
					standalone: true,
					url: function(url) {
						return url.replace('src/', '');
					}
				}
			}
		},

		uglify: {
			options: {
				sourceMap: true
			},
			prod: {
				files: {
					'bin/js/app/<%= pkg.name %>-<%= pkg.version %>.min.js': [
						'bin/js/app/<%= pkg.name %>-<%= pkg.version %>.js'
					]
				}
			}
		}
	});

	grunt.registerTask('default', [
		'concat',
		'copy',
		'ngtemplates',
		'uglify',
		'includeSource'
	]);

	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-include-source');
	grunt.loadNpmTasks('grunt-angular-templates');

}
<|endoftext|>


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

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

    /**
     * Uglifies the /src/js/ folder and outputs the files to /assets/ directory
     *
     * @task uglify
     */
    uglify : {
      options : {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n\n @author Vu Tran \n @link <http://vu-tran.com> \n @package <%= pkg.name %> \n @license <%= pkg.license %> \n*/\n'
      },
      build : {
        expand : true,
        cwd : 'src/',
        src : ['*.js'],
        dest : 'build/',
        ext : '.min.js'
      }
    }

  });

  // Load plugins
  grunt.loadNpmTasks('grunt-contrib-uglify');

  // Register the default task
  grunt.registerTask('default', ['uglify']);

};<commit_msg>fixed type in Gruntfile<commit_after>module.exports = function(grunt) {

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

    /**
     * Uglifies the /src/ folder and outputs the files to /build/ directory
     *
     * @task uglify
     */
    uglify : {
      options : {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> \n\n @author Vu Tran \n @link <http://vu-tran.com> \n @package <%= pkg.name %> \n @license <%= pkg.license %> \n*/\n'
      },
      build : {
        expand : true,
        cwd : 'src/',
        src : ['*.js'],
        dest : 'build/',
        ext : '.min.js'
      }
    }

  });

  // Load plugins
  grunt.loadNpmTasks('grunt-contrib-uglify');

  // Register the default task
  grunt.registerTask('default', ['uglify']);

};<|endoftext|>


<commit_before>/*!
 * CSS avatar's Gruntfile
 * https://github.com/rmhdev/css-avatars
 * Copyright 2014 Rober Martín H
 * Licensed under MIT (https://github.com/rmhdev/css-avatars/blob/master/LICENSE)
 */

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

    // Force use of Unix newlines
    grunt.util.linefeed = '\n';

    // Project configuration.
    grunt.initConfig({

        // Metadata.
        pkg: grunt.file.readJSON('package.json'),
        banner: '/*!\n' +
            ' * CSS avatars v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license %>\n' +
            ' */\n',

        less: {
            compileCore: {
                files: {
                    'dist/css/<%= pkg.name %>.css': 'less/<%= pkg.name %>.less'
                }
            }
        },

        cssmin: {
            options: {
                compatibility: 'ie8',
                keepSpecialComments: '*'
            },
            core: {
                files: {
                    'dist/css/<%= pkg.name %>.min.css': 'dist/css/<%= pkg.name %>.css'
                }
            }
        },

        usebanner: {
            options: {
                position: 'top',
                banner: '<%= banner %>'
            },
            files: {
                src: 'dist/css/*.css'
            }
        },

        watch: {
            less: {
                files: 'less/*.less',
                tasks: 'less'
            }
        },

        compress: {
            main: {
                options: {
                    mode: 'zip',
                    archive: 'dist/<%= pkg.name %>-<%= pkg.version %>-dist.zip'
                },
                expand: true,
                src: ['dist/**'],
                dest: '<%= pkg.name %>-<%= pkg.version %>-dist'
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-banner');

    // CSS distribution task.
    grunt.registerTask('less-compile', ['less:compileCore']);
    grunt.registerTask('dist-css', ['less-compile', 'usebanner', 'cssmin']);
    grunt.registerTask('default', ['watch']);

};
<commit_msg>Update year<commit_after>/*!
 * CSS avatar's Gruntfile
 * https://github.com/rmhdev/css-avatars
 * Copyright 2015 Rober Martín H
 * Licensed under MIT
 */

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

    // Force use of Unix newlines
    grunt.util.linefeed = '\n';

    // Project configuration.
    grunt.initConfig({

        // Metadata.
        pkg: grunt.file.readJSON('package.json'),
        banner: '/*!\n' +
            ' * CSS avatars v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license %>\n' +
            ' */\n',

        less: {
            compileCore: {
                files: {
                    'dist/css/<%= pkg.name %>.css': 'less/<%= pkg.name %>.less'
                }
            }
        },

        cssmin: {
            options: {
                compatibility: 'ie8',
                keepSpecialComments: '*'
            },
            core: {
                files: {
                    'dist/css/<%= pkg.name %>.min.css': 'dist/css/<%= pkg.name %>.css'
                }
            }
        },

        usebanner: {
            options: {
                position: 'top',
                banner: '<%= banner %>'
            },
            files: {
                src: 'dist/css/*.css'
            }
        },

        watch: {
            less: {
                files: 'less/*.less',
                tasks: 'less'
            }
        },

        compress: {
            main: {
                options: {
                    mode: 'zip',
                    archive: 'dist/<%= pkg.name %>-<%= pkg.version %>-dist.zip'
                },
                expand: true,
                src: ['dist/**'],
                dest: '<%= pkg.name %>-<%= pkg.version %>-dist'
            }
        }

    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-banner');

    // CSS distribution task.
    grunt.registerTask('less-compile', ['less:compileCore']);
    grunt.registerTask('dist-css', ['less-compile', 'usebanner', 'cssmin']);
    grunt.registerTask('default', ['watch']);

};
<|endoftext|>


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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        flake8: {
            options: {
                ignore: ['E501']
            },
            evething: {
                src: [
                    '*.py',
                    'core/*.py',
                    'evething/*.py',
                    '!evething/local_settings.py'
                ]
            },
            thing: {
                src: [
                    'thing/*.py',
                    'thing/tests/*.py',
                    'thing/templatetags/*.py'
                ]
            },
            thing_tasks: {
                src: 'thing/tasks/*.py'
            },
            thing_models: {
                src: 'thing/models/*.py'
            },
            thing_views: {
                src: 'thing/views/*.py'
            }
        },
        handlebars: {
            hanldbars: {
                options: {
                    namespace: 'Handlebars.templates',
                    processName: function (filePath) {
                        return filePath.replace(/^static\/handlebars\//, '').replace(/\.handlebars$/, '');
                    }
                },
                files: {
                    'static/js/templates.js': 'static/handlebars/*.handlebars'
                }
            }
        },
        concat: {
            bootstrap: {
                src: [
                    'static/js/bootstrap/alert.js',
                    'static/js/bootstrap/button.js',
                    'static/js/bootstrap/collapse.js',
                    'static/js/bootstrap/dropdown.js',
                    'static/js/bootstrap/modal.js',
                    'static/js/bootstrap/tooltip.js',
                    'static/js/bootstrap/popover.js',
                    'static/js/bootstrap/tab.js',
                    'static/js/bootstrap/scrollspy.js',
                    'static/js/bootstrap/affix.js',
                    'static/js/bootstrap-datepicker.js'
                ],
                dest: 'static/js/bootstrap.js'
            }
        },
        uglify: {
            combined: {
                options: {
                    sourceMap: true
                },
                src: [
                    'static/js/jquery.tablesorter.js',
                    'static/js/jquery.tablesorter.widgets.js',
                    'static/js/bootstrap.js',
                    'static/js/handlebars.runtime.js',
                    'static/js/templates.js',
                    'static/js/evething.js',
                    'static/js/evething/*.js'
                ],
                dest: 'static/js/evething-combined.min.js'
            }
        },
        less: {
            options: {
                cleancss: true,
                modifyVars: {
                    'icon-font-path': '"../fonts/"',
                    'fa-font-path': '"../fonts"'
                }
            },
            themes: {
                files: {
                    'static/css/theme-cerulean.min.css': 'static/less/theme-cerulean/bootstrap.less',
                    'static/css/theme-yeti.min.css': 'static/less/theme-yeti/bootstrap.less',
                    'static/css/theme-cosmo.min.css': 'static/less/theme-cosmo/bootstrap.less',
                    'static/css/theme-cyborg.min.css': 'static/less/theme-cyborg/bootstrap.less',
                    'static/css/theme-darkthing.min.css': 'static/less/theme-darkthing/bootstrap.less',
                    'static/css/theme-default.min.css': 'static/less/theme-default/bootstrap.less',
                    'static/css/theme-slate.min.css': 'static/less/theme-slate/bootstrap.less'
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-flake8');
    grunt.loadNpmTasks('grunt-contrib-handlebars');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-less');

    // Default task(s).
    grunt.registerTask('default', ['handlebars', 'concat', 'uglify', 'less']);
};
<commit_msg>Include all the required JS files when compiling<commit_after>module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        flake8: {
            options: {
                ignore: ['E501']
            },
            evething: {
                src: [
                    '*.py',
                    'core/*.py',
                    'evething/*.py',
                    '!evething/local_settings.py'
                ]
            },
            thing: {
                src: [
                    'thing/*.py',
                    'thing/tests/*.py',
                    'thing/templatetags/*.py'
                ]
            },
            thing_tasks: {
                src: 'thing/tasks/*.py'
            },
            thing_models: {
                src: 'thing/models/*.py'
            },
            thing_views: {
                src: 'thing/views/*.py'
            }
        },
        handlebars: {
            hanldbars: {
                options: {
                    namespace: 'Handlebars.templates',
                    processName: function (filePath) {
                        return filePath.replace(/^static\/handlebars\//, '').replace(/\.handlebars$/, '');
                    }
                },
                files: {
                    'static/js/templates.js': 'static/handlebars/*.handlebars'
                }
            }
        },
        concat: {
            bootstrap: {
                src: [
                    'static/js/bootstrap/alert.js',
                    'static/js/bootstrap/button.js',
                    'static/js/bootstrap/collapse.js',
                    'static/js/bootstrap/dropdown.js',
                    'static/js/bootstrap/modal.js',
                    'static/js/bootstrap/tooltip.js',
                    'static/js/bootstrap/popover.js',
                    'static/js/bootstrap/tab.js',
                    'static/js/bootstrap/scrollspy.js',
                    'static/js/bootstrap/affix.js',
                    'static/js/bootstrap-datepicker.js'
                ],
                dest: 'static/js/bootstrap.js'
            }
        },
        uglify: {
            combined: {
                options: {
                    sourceMap: true
                },
                src: [
                    'static/js/jquery.tablesorter.js',
                    'static/js/jquery.tablesorter.widgets.js',
                    'jquery.cookie.js',
                    'requestAnimationFrame.polyfill.js',
                    'static/js/bootstrap.js',
                    'static/js/handlebars.runtime.js',
                    'static/js/templates.js',
                    'static/js/evething.js',
                    'static/js/evething/*.js'
                ],
                dest: 'static/js/evething-combined.min.js'
            }
        },
        less: {
            options: {
                cleancss: true,
                modifyVars: {
                    'icon-font-path': '"../fonts/"',
                    'fa-font-path': '"../fonts"'
                }
            },
            themes: {
                files: {
                    'static/css/theme-cerulean.min.css': 'static/less/theme-cerulean/bootstrap.less',
                    'static/css/theme-yeti.min.css': 'static/less/theme-yeti/bootstrap.less',
                    'static/css/theme-cosmo.min.css': 'static/less/theme-cosmo/bootstrap.less',
                    'static/css/theme-cyborg.min.css': 'static/less/theme-cyborg/bootstrap.less',
                    'static/css/theme-darkthing.min.css': 'static/less/theme-darkthing/bootstrap.less',
                    'static/css/theme-default.min.css': 'static/less/theme-default/bootstrap.less',
                    'static/css/theme-slate.min.css': 'static/less/theme-slate/bootstrap.less'
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-flake8');
    grunt.loadNpmTasks('grunt-contrib-handlebars');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-less');

    // Default task(s).
    grunt.registerTask('default', ['handlebars', 'concat', 'uglify', 'less']);
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        bowercopy: {
            options: {
                srcPrefix: 'bower_components',
                destPrefix: 'web/assets'
            },
            scripts: {
                files: {
                    'js/jquery.min.js': 'jquery/dist/jquery.min.js',
                    'js/bootstrap.min.js': 'bootstrap/dist/js/bootstrap.min.js',
                    'js/summernote.min.js': 'summernote/dist/summernote.min.js',
                    'js/ready.min.js': 'domready/ready.min.js'
                }
            },
            stylesheets: {
                files: {
                    'css/bootstrap.min.css': 'bootstrap/dist/css/bootstrap.min.css',
                    'css/bootstrap-theme.min.css': 'bootstrap/dist/css/bootstrap-theme.min.css',
                    'css/font-awesome.css': 'fontawesome/css/font-awesome.min.css',
                    'css/summernote.css': 'summernote/dist/summernote.css',
                    'css/main.css':'../src/MyProject/Bundle/MainBundle/Resources/public/css/main.css',
                }
            },
            fonts: {
                files: {
                    'fonts': [
                        'bootstrap/dist/fonts',
                        'fontawesome/fonts'
                    ],
                }
            }
        },
        copy: {
            images: {
                expand: true,
                cwd: 'src/MyProject/Bundle/MainBundle/Resources/public/images',
                src: '*',
                dest: 'web/assets/images/'
            }
        }
    });

    grunt.loadNpmTasks('grunt-bowercopy');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.registerTask('default', ['bowercopy', 'copy']);
}
<commit_msg>Fix font-awesome.min.css in gruntfile<commit_after>module.exports = function (grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        bowercopy: {
            options: {
                srcPrefix: 'bower_components',
                destPrefix: 'web/assets'
            },
            scripts: {
                files: {
                    'js/jquery.min.js': 'jquery/dist/jquery.min.js',
                    'js/bootstrap.min.js': 'bootstrap/dist/js/bootstrap.min.js',
                    'js/summernote.min.js': 'summernote/dist/summernote.min.js',
                    'js/ready.min.js': 'domready/ready.min.js'
                }
            },
            stylesheets: {
                files: {
                    'css/bootstrap.min.css': 'bootstrap/dist/css/bootstrap.min.css',
                    'css/bootstrap-theme.min.css': 'bootstrap/dist/css/bootstrap-theme.min.css',
                    'css/font-awesome.min.css': 'fontawesome/css/font-awesome.min.css',
                    'css/summernote.css': 'summernote/dist/summernote.css',
                    'css/main.css':'../src/MyProject/Bundle/MainBundle/Resources/public/css/main.css',
                }
            },
            fonts: {
                files: {
                    'fonts': [
                        'bootstrap/dist/fonts',
                        'fontawesome/fonts'
                    ],
                }
            }
        },
        copy: {
            images: {
                expand: true,
                cwd: 'src/MyProject/Bundle/MainBundle/Resources/public/images',
                src: '*',
                dest: 'web/assets/images/'
            }
        }
    });

    grunt.loadNpmTasks('grunt-bowercopy');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.registerTask('default', ['bowercopy', 'copy']);
}
<|endoftext|>


<commit_before>/*jshint camelcase:false */
/*
 * node-asset-pipeline
 * https://github.com/thanpolas/node-asset-pipeline
 *
 * Copyright (c) 2013 Verbling
 * Licensed under the MIT license.
 */

var config = require('config');
var gruntAssets = require('./tasks/task-main');

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

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-s3');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-clean');

  gruntAssets(grunt);

  //
  // Grunt configuration:
  //
  //
  grunt.initConfig({

    assets: {
      options: {
        debug: true,
        progress: false,
      },

      testCase: {
        options: {
          cdnurl: 'http://s3.aws.com/testdelete/',
          rel: 'test/case/',
          truncateHash: 6,
          manifest: 'temp/testManifest.json',
          // force serialization of files so their order won't change on the
          // manifest file.
          maxOperations: 1
        },
        src: [
          'test/case/**',
          '!test/case/less/**',
          '!test/case/handlebars/**'
        ],
        dest: 'temp/testCase'
      },

      testCaseAbs: {
        options: {
          rel: 'test/case/',
          truncateHash: 6,
          manifest: 'temp/testManifestAbs.json',
          // force serialization of files so their order won't change on the
          // manifest file.
          maxOperations: 1,
          prepend: '/'
        },
        src: [
          'test/case/**',
          '!test/case/less/**',
          '!test/case/handlebars/**'
        ],
        dest: 'temp/testCaseAbs'
      },

      // replicating issue #11
      testCaseMWers: {
        options: {
          rel: 'test/caseMW',
          manifest: 'temp/manifestMW.json'
        },
        src: 'test/caseMW/img/**/*.png',
        dest: 'temp/testCaseMW'
      },
    },

    assetsReplace: {
      options: {
        manifest: 'temp/testManifest.json'
      },
      testCase: {
        options: {
          key: '__ASSET(%)'
        },
        files: {
          'temp/replace-testCase/': ['test/case/less/*.less']
        }
      },
      testCaseHbs: {
        options: {
          key: '{{asset "%"}}'
        },
        files: {
          'temp/handlebars/': ['test/case/handlebars/*.hbs']
        }
      },
      testCasePrepend: {
        options: {
          key: '__ASSET(%)',
          manifest: 'temp/testManifestAbs.json',
          prepend: '/'
        },
        files: {
          'temp/replace-prepend/': ['test/case/less/*.less']
        }
      }
    },

    assetsBundle: {
      options: {
        manifest: 'temp/testManifest.json',
        debug: false,
        assets:[
          'img/coding-weapons.png',
          'img/social-white-v2.png',
          'img/pdf-icon-bare.png'
        ]
      },
      testCase: {
        options: {
        },
        dest: 'temp/bundles/noexport.js'
      },
      testCaseNS: {
        options: {
          ns: 'car.zit.pof',
        },
        dest: 'temp/bundles/namespace.js'
      },
      testCaseAMD: {
        options: {
          amd: true,
        },
        dest: 'temp/bundles/amd.js'
      },
      testCaseCommonJS: {
        options: {
          commonjs: true,
        },
        dest: 'temp/bundles/commonjs.js'
      }

    },
    assetsS3: {
      options: {
        debug: false,
        checkS3Head: true,
        manifest: 'temp/testManifest.json',
        key: config.aws_key,
        secret: config.aws_secret,
        bucket: config.aws_static_bucket,
        access: 'public-read',
        progress: false
      },
      // Files to be uploaded.
      target: {
        // These options override the defaults
        options: {
          maxOperations: 0
        },
        upload: {
          src: 'temp/testCase/**',
          dest:  'testdelete/',
          rel: 'temp/testCase/test/case',
          gzip: true,
          gzipExclude: ['.jpeg', '.jpg', '.png', '.gif', '.less', '.mp3',
              '.mp4', '.mkv', '.webm', '.gz'],
          headers: {'Cache-Control': 'max-age=31536000, public'}
        }
      }
    },

    watch: {
      debug: {
        files: ['*.js', 'lib/**/*.js', 'tasks/**/*.js'],
        tasks: [
          'assetsBundle:testCase'
          //'assetsReplace:testCaseHbs'
          //'assetsS3'
        ]
      },
      test: {
        files: ['*.js', 'lib/**/*.js', 'tasks/**/*.js', 'test/spec/**/*.js'],
        tasks: ['test']
      }
    },

    s3: {
      options: {
        key: config.aws_key,
        secret: config.aws_secret,
        bucket: config.aws_static_bucket,
        access: 'public-read',
        maxOperations: 100
      },

      // Files to be uploaded.
      dev: {
        upload: [
          {
            src: 'temp/assets/**',
            dest:  'v/',
            rel: 'temp/assets',
            headers: {'Cache-Control': 'max-age=31536000, public'}
          }
        ]
      }
    },

    /**
     * TESTING
     *
     */
    clean: ['temp/*'],
    mochaTest: {
      gruntTasks: [ 'test/spec/**/*.js' ]
    },

    mochaTestConfig: {
      gruntTasks: {
        options: {
          reporter: 'nyan'
        }
      }
    },
    release: {
      options: {
        bump: true, //default: true
        file: 'package.json', //default: package.json
        add: true, //default: true
        commit: true, //default: true
        tag: true, //default: true
        push: true, //default: true
        pushTags: true, //default: true
        npm: true, //default: true
        tagName: 'v<%= version %>', //default: '<%= version %>'
        commitMessage: 'releasing v<%= version %>', //default: 'release <%= version %>'
        tagMessage: 'v<%= version %>' //default: 'Version <%= version %>'
      }
    }

  });

  grunt.registerTask('test', [
    'clean',
    'assets:testCase',
    'assets:testCaseAbs',
    'assetsBundle:testCase',
    'assetsBundle:testCaseNS',
    'assetsBundle:testCaseAMD',
    'assetsBundle:testCaseCommonJS',
    'assetsReplace:testCase',
    'assetsReplace:testCasePrepend',
    'mochaTest'
  ]);

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

};

<commit_msg>fix broken test<commit_after>/*jshint camelcase:false */
/*
 * node-asset-pipeline
 * https://github.com/thanpolas/node-asset-pipeline
 *
 * Copyright (c) 2013 Verbling
 * Licensed under the MIT license.
 */

var config = require('config');
var gruntAssets = require('./tasks/task-main');

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

  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-s3');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-clean');

  gruntAssets(grunt);

  //
  // Grunt configuration:
  //
  //
  grunt.initConfig({

    assets: {
      options: {
        debug: true,
        progress: false,
      },

      testCase: {
        options: {
          cdnurl: 'http://s3.aws.com/testdelete/',
          rel: 'test/case/',
          truncateHash: 6,
          manifest: 'temp/testManifest.json',
          // force serialization of files so their order won't change on the
          // manifest file.
          maxOperations: 1
        },
        src: [
          'test/case/**',
          '!test/case/less/**',
          '!test/case/handlebars/**'
        ],
        dest: 'temp/testCase'
      },

      testCaseAbs: {
        options: {
          rel: 'test/case/',
          cdnurl: 'http://s3.aws.com/testdelete/',
          truncateHash: 6,
          manifest: 'temp/testManifestAbs.json',
          // force serialization of files so their order won't change on the
          // manifest file.
          maxOperations: 1,
          prepend: '/'
        },
        src: [
          'test/case/**',
          '!test/case/less/**',
          '!test/case/handlebars/**'
        ],
        dest: 'temp/testCaseAbs'
      },

      // replicating issue #11
      testCaseMWers: {
        options: {
          rel: 'test/caseMW',
          manifest: 'temp/manifestMW.json'
        },
        src: 'test/caseMW/img/**/*.png',
        dest: 'temp/testCaseMW'
      },
    },

    assetsReplace: {
      options: {
        manifest: 'temp/testManifest.json'
      },
      testCase: {
        options: {
          key: '__ASSET(%)'
        },
        files: {
          'temp/replace-testCase/': ['test/case/less/*.less']
        }
      },
      testCaseHbs: {
        options: {
          key: '{{asset "%"}}'
        },
        files: {
          'temp/handlebars/': ['test/case/handlebars/*.hbs']
        }
      },
      testCasePrepend: {
        options: {
          key: '__ASSET(%)',
          manifest: 'temp/testManifestAbs.json',
          prepend: '/'
        },
        files: {
          'temp/replace-prepend/': ['test/case/less/*.less']
        }
      }
    },

    assetsBundle: {
      options: {
        manifest: 'temp/testManifest.json',
        debug: false,
        assets:[
          'img/coding-weapons.png',
          'img/social-white-v2.png',
          'img/pdf-icon-bare.png'
        ]
      },
      testCase: {
        options: {
        },
        dest: 'temp/bundles/noexport.js'
      },
      testCaseNS: {
        options: {
          ns: 'car.zit.pof',
        },
        dest: 'temp/bundles/namespace.js'
      },
      testCaseAMD: {
        options: {
          amd: true,
        },
        dest: 'temp/bundles/amd.js'
      },
      testCaseCommonJS: {
        options: {
          commonjs: true,
        },
        dest: 'temp/bundles/commonjs.js'
      }

    },
    assetsS3: {
      options: {
        debug: false,
        checkS3Head: true,
        manifest: 'temp/testManifest.json',
        key: config.aws_key,
        secret: config.aws_secret,
        bucket: config.aws_static_bucket,
        access: 'public-read',
        progress: false
      },
      // Files to be uploaded.
      target: {
        // These options override the defaults
        options: {
          maxOperations: 0
        },
        upload: {
          src: 'temp/testCase/**',
          dest:  'testdelete/',
          rel: 'temp/testCase/test/case',
          gzip: true,
          gzipExclude: ['.jpeg', '.jpg', '.png', '.gif', '.less', '.mp3',
              '.mp4', '.mkv', '.webm', '.gz'],
          headers: {'Cache-Control': 'max-age=31536000, public'}
        }
      }
    },

    watch: {
      debug: {
        files: ['*.js', 'lib/**/*.js', 'tasks/**/*.js'],
        tasks: [
          'assetsBundle:testCase'
          //'assetsReplace:testCaseHbs'
          //'assetsS3'
        ]
      },
      test: {
        files: ['*.js', 'lib/**/*.js', 'tasks/**/*.js', 'test/spec/**/*.js'],
        tasks: ['test']
      }
    },

    s3: {
      options: {
        key: config.aws_key,
        secret: config.aws_secret,
        bucket: config.aws_static_bucket,
        access: 'public-read',
        maxOperations: 100
      },

      // Files to be uploaded.
      dev: {
        upload: [
          {
            src: 'temp/assets/**',
            dest:  'v/',
            rel: 'temp/assets',
            headers: {'Cache-Control': 'max-age=31536000, public'}
          }
        ]
      }
    },

    /**
     * TESTING
     *
     */
    clean: ['temp/*'],
    mochaTest: {
      gruntTasks: [ 'test/spec/**/*.js' ]
    },

    mochaTestConfig: {
      gruntTasks: {
        options: {
          reporter: 'nyan'
        }
      }
    },
    release: {
      options: {
        bump: true, //default: true
        file: 'package.json', //default: package.json
        add: true, //default: true
        commit: true, //default: true
        tag: true, //default: true
        push: true, //default: true
        pushTags: true, //default: true
        npm: true, //default: true
        tagName: 'v<%= version %>', //default: '<%= version %>'
        commitMessage: 'releasing v<%= version %>', //default: 'release <%= version %>'
        tagMessage: 'v<%= version %>' //default: 'Version <%= version %>'
      }
    }

  });

  grunt.registerTask('test', [
    'clean',
    'assets:testCase',
    'assets:testCaseAbs',
    'assetsBundle:testCase',
    'assetsBundle:testCaseNS',
    'assetsBundle:testCaseAMD',
    'assetsBundle:testCaseCommonJS',
    'assetsReplace:testCase',
    'assetsReplace:testCasePrepend',
    'mochaTest'
  ]);

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

};

<|endoftext|>


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

module.exports = function (grunt) {
  // load all grunt tasks matching the `grunt-*` pattern
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
	jshint: {
      options: {
        reporter: require('jshint-stylish'),
        // https://gist.github.com/haschek/2595796
        jshintrc: './.jshintrc'
      },
	  all: ['Grunfile.js', 'routes/*.js',
      "models/*js", "forms/*js", 'test/**/*.js']
    },
    mochaTest: {
      test: {
        options: {
          reporter: 'spec'
        },
        src: ['test/unit/**/*.js']
      }
    },
    watch: {
      scripts: {
        options: { livereload: 35729 },
        files: ['./app.js', './Gruntfile.js', './bin/www',
        './models/*.js', './routes/*.js', './forms/*.js'],
        tasks: ['jshint','mochaTest','docco'],
        options: {
            debounceDelay: 750
        }
      },
      tests: {
        options: { livereload: 35729 },
        files: ['./test/**/*.js'],
        tasks: ['mochaTest', 'docco']
      },
      public: {
        files: ['./public/**/*', './views/**/*.jade', './views/**/*.styl'],
        options: {
            debounceDelay: 750,
            livereload: 35729
        },
        task: ['']
      },
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      }
    },
    nodemon: {
      dev: {
            script: './bin/www',
            options: {
                ignore: ['node_modules/**', 'public/js/**/*'],
                callback: function (nodemon) {
                    // opens browser on initial server start
                    nodemon.on('config:update', function () {
                      // Delay before server listens on port
                      setTimeout(function() {
                        require('open')('http://localhost:3000/');
                      }, 3000);
                    });
                }
            }
      }
    },
    docco: {
      debug: {
        src: ['test/**/*.js','models/*.js','routes/*.js'],
        options: {
          output: 'docs/'
        }
      }
    },
    wiredep: {
      target: {
        src: ['views/layout-admin.jade'],
        ignorePath: '../public'
      },
      options: {
        overrides: {
          "directory": "./bower_components/"
        }
      }
    },
    concurrent: {
      dev: {
        tasks: ['nodemon', 'watch'],
        options: {
          logConcurrentOutput: true,
          limit: 5
        }
      },
      test: ['mochaTest']
    }
  });

  grunt.task.registerTask('create', 'Create mongoose model + test', function(arg1, arg2) {
      grunt.log.debug(arg1, arg2);
      switch(arg1){
        case 'model':
            if(typeof arg2 !== 'undefined') {
              // create model
              var filemodel = grunt.template.process(grunt.file.read('./templates/mongoose-model.js.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filename = './models/'+arg2.toLowerCase()+'.js';
              grunt.file.write(filename, filemodel);

              // create test
              var filetest = grunt.template.process(grunt.file.read('./templates/mongoose-model-tests.js.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filenametest = './test/unit/models/'+arg2.toLowerCase()+'-tests.js';
              grunt.file.write(filenametest, filetest);

              // append model to ./routes/main.js
              var appendm = grunt.template.process(grunt.file.read('./templates/append-model-routes-main.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filename = './routes/main.js';
              var mainroutes = grunt.file.read(filename);
              grunt.file.write(filename, mainroutes.replace("/* models:end */",appendm+"  /* models:end */"));

            } else {
                grunt.log.warn('Parameter name missing for '+arg1+' task');
            }
        break;
        case 'page':
            if(typeof arg2 !== 'undefined') {
              // create model
              var filepage = grunt.template.process(grunt.file.read('./templates/view-page.jade.tpl'), {
                    data: {
                        'pagename': arg2
                    }
              });
              var filename = './views/'+arg2.toLowerCase()+'.jade';
              grunt.file.write(filename, filepage);

              // append page route to ./routes/main.js
              var appendp = grunt.template.process(grunt.file.read('./templates/append-page-routes-main.tpl'), {
                    data: {
                        'pagename': arg2
                    }
              });
              var filename = './routes/main.js';
              var mainroutes = grunt.file.read(filename);
              grunt.file.write(filename, mainroutes.replace("/* page:public:end */",appendp+"/* page:public:end */"));

              // append page link to ./views/partials/site-menu.jade
              var appendm = grunt.template.process(grunt.file.read('./templates/append-site-menu-item.tpl'), {
                    data: {
                        'pagename': arg2
                    }
              });
              var filename = './views/partials/site-menu.jade';
              var mainroutes = grunt.file.read(filename);
              grunt.file.write(filename, mainroutes.replace("// public:page:menu:end",appendm));
            } else {
                grunt.log.warn('Parameter name missing for '+arg1+' task');
            }
        break;
        case 'rest':
            if(typeof arg2 !== 'undefined') {
              // append rest to ./routes/main.js
              var appendp = grunt.template.process(grunt.file.read('./templates/append-model-rest-main.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filename = './routes/main.js';
              var mainroutes = grunt.file.read(filename);
              grunt.file.write(filename, mainroutes.replace("/* rest:public:end */",appendp));

              // create test
              var filetest = grunt.template.process(grunt.file.read('./templates/mongoose-model-rest-tests.js.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filenametest = './test/rest/models/'+arg2.toLowerCase()+'s-rest-tests.js';
              grunt.file.write(filenametest, filetest);
            } else {
                grunt.log.warn('Parameter name missing for '+arg1+' task');
            }
        break;
      }
  });

  grunt.registerTask('default', ['jshint', 'concurrent']);
};
<commit_msg>Prevent to append model twice<commit_after>var path = require('path');

module.exports = function (grunt) {
  // load all grunt tasks matching the `grunt-*` pattern
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
	jshint: {
      options: {
        reporter: require('jshint-stylish'),
        // https://gist.github.com/haschek/2595796
        jshintrc: './.jshintrc'
      },
	  all: ['Grunfile.js', 'routes/*.js',
      "models/*js", "forms/*js", 'test/**/*.js']
    },
    mochaTest: {
      test: {
        options: {
          reporter: 'spec'
        },
        src: ['test/unit/**/*.js']
      }
    },
    watch: {
      scripts: {
        options: { livereload: 35729 },
        files: ['./app.js', './Gruntfile.js', './bin/www',
        './models/*.js', './routes/*.js', './forms/*.js'],
        tasks: ['jshint','mochaTest','docco'],
        options: {
            debounceDelay: 750
        }
      },
      tests: {
        options: { livereload: 35729 },
        files: ['./test/**/*.js'],
        tasks: ['mochaTest', 'docco']
      },
      public: {
        files: ['./public/**/*', './views/**/*.jade', './views/**/*.styl'],
        options: {
            debounceDelay: 750,
            livereload: 35729
        },
        task: ['']
      },
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      }
    },
    nodemon: {
      dev: {
            script: './bin/www',
            options: {
                ignore: ['node_modules/**', 'public/js/**/*'],
                callback: function (nodemon) {
                    // opens browser on initial server start
                    nodemon.on('config:update', function () {
                      // Delay before server listens on port
                      setTimeout(function() {
                        require('open')('http://localhost:3000/');
                      }, 3000);
                    });
                }
            }
      }
    },
    docco: {
      debug: {
        src: ['test/**/*.js','models/*.js','routes/*.js'],
        options: {
          output: 'docs/'
        }
      }
    },
    wiredep: {
      target: {
        src: ['views/layout-admin.jade'],
        ignorePath: '../public'
      },
      options: {
        overrides: {
          "directory": "./bower_components/"
        }
      }
    },
    concurrent: {
      dev: {
        tasks: ['nodemon', 'watch'],
        options: {
          logConcurrentOutput: true,
          limit: 5
        }
      },
      test: ['mochaTest']
    }
  });

  grunt.task.registerTask('create', 'Create mongoose model + test', function(arg1, arg2) {
      grunt.log.debug(arg1, arg2);
      switch(arg1){
        case 'model':
            if(typeof arg2 !== 'undefined') {
              // create model
              var filemodel = grunt.template.process(grunt.file.read('./templates/mongoose-model.js.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filename = './models/'+arg2.toLowerCase()+'.js';
              grunt.file.write(filename, filemodel);

              // create test
              var filetest = grunt.template.process(grunt.file.read('./templates/mongoose-model-tests.js.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filenametest = './test/unit/models/'+arg2.toLowerCase()+'-tests.js';
              grunt.file.write(filenametest, filetest);

              // append model to ./routes/main.js
              var appendm = grunt.template.process(grunt.file.read('./templates/append-model-routes-main.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filename = './routes/main.js';
              var mainroutes = grunt.file.read(filename);
              var regexpm = new RegExp(".*"+appendm.replace("(", "\\(").replace(")","\\)")+".*");
              if(!mainroutes.match(regexpm)){
                  grunt.file.write(filename,
                      mainroutes.replace("/* models:end */",appendm+"  /* models:end */"));
              }

            } else {
                grunt.log.warn('Parameter name missing for '+arg1+' task');
            }
        break;
        case 'page':
            if(typeof arg2 !== 'undefined') {
              // create model
              var filepage = grunt.template.process(grunt.file.read('./templates/view-page.jade.tpl'), {
                    data: {
                        'pagename': arg2
                    }
              });
              var filename = './views/'+arg2.toLowerCase()+'.jade';
              grunt.file.write(filename, filepage);

              // append page route to ./routes/main.js
              var appendp = grunt.template.process(grunt.file.read('./templates/append-page-routes-main.tpl'), {
                    data: {
                        'pagename': arg2
                    }
              });
              var filename = './routes/main.js';
              var mainroutes = grunt.file.read(filename);
              grunt.file.write(filename, mainroutes.replace("/* page:public:end */",appendp+"/* page:public:end */"));

              // append page link to ./views/partials/site-menu.jade
              var appendm = grunt.template.process(grunt.file.read('./templates/append-site-menu-item.tpl'), {
                    data: {
                        'pagename': arg2
                    }
              });
              var filename = './views/partials/site-menu.jade';
              var mainroutes = grunt.file.read(filename);
              grunt.file.write(filename, mainroutes.replace("// public:page:menu:end",appendm));
            } else {
                grunt.log.warn('Parameter name missing for '+arg1+' task');
            }
        break;
        case 'rest':
            if(typeof arg2 !== 'undefined') {
              // append rest to ./routes/main.js
              var appendp = grunt.template.process(grunt.file.read('./templates/append-model-rest-main.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filename = './routes/main.js';
              var mainroutes = grunt.file.read(filename);
              grunt.file.write(filename, mainroutes.replace("/* rest:public:end */",appendp));

              // create test
              var filetest = grunt.template.process(grunt.file.read('./templates/mongoose-model-rest-tests.js.tpl'), {
                    data: {
                        'modelname': arg2
                    }
              });
              var filenametest = './test/rest/models/'+arg2.toLowerCase()+'s-rest-tests.js';
              grunt.file.write(filenametest, filetest);
            } else {
                grunt.log.warn('Parameter name missing for '+arg1+' task');
            }
        break;
      }
  });

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