<commit_before>/*jshint node:true,camelcase:false*/
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to match all subfolders:
// 'test/spec/**/*.js'

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

  grunt.loadTasks('./tasks');

  // configurable paths
  var appPaths = {
    app: 'app',
    dist: 'public'
  };
  var cachebust = +(new Date());

  grunt.initConfig({
    appConfig: appPaths,
    cachebust: cachebust,
    watch: {
      scripts: {
        files: ['<%= jshint.browser %>'],
        tasks: ['jshint:browser', 'transpilejs']
      },
      nodescripts: {
        files: ['<%= jshint.node %>'],
        tasks: ['jshint:node']
      },
      livereload: {
        options: {
          livereload: true
        },
        files: [
          '<%= appConfig.app %>/*.html',
          '<%= appConfig.app %>/styles/{,*/}*.css',
          '.tmp/scripts/{,*/}*.js',
          '<%= appConfig.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}'
        ]
      }
    },
    browserify: {
      dist: {
        options: {
          transform: [['babelify', { presets: ['es2015'] }]]
        },
        files: {
          '.tmp/scripts/iterateconf.js': '<%= appConfig.app %>/scripts/main.js'
        }
      }
    },
    connect: {
      options: {
        port: 9090,
        // change this to '0.0.0.0' to access the server from outside
        hostname: '0.0.0.0'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.tmp'),
              mountFolder(connect, 'app')
            ];
          }
        }
      },
      dist: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, '<%= appConfig.dist %>')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://localhost:<%= connect.options.port %>'
      }
    },
    clean: {
      dist: ['.tmp'],
      server: '.tmp'
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        force: true
      },
      node: [
        'Gruntfile.js',
        'bin/{,*/}*.js',
        'tasks/{,*/}*.js'
      ],
      browser: [
        '<%= appConfig.app %>/scripts/{,*/}*.js',
        '!<%= appConfig.app %>/scripts/vendor/*'
      ]
    },
    useminPrepare: {
      html: '<%= appConfig.app %>/index.html',
      options: {
        dest: '<%= appConfig.dist %>'
      }
    },
    usemin: {
      html: ['<%= appConfig.dist %>/{,*/}*.html'],
      css: ['<%= appConfig.dist %>/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= appConfig.dist %>']
      }
    },
    autoprefixer: {
      dist: {
        options: {
          browsers: [
            'last 2 version'
          ],
          cascade: true
        },
        src: '<%= appConfig.dist %>/styles/index.css'
      }
    },
    cssmin: {
      dist: {
        files: {
          '<%= appConfig.dist %>/styles/index.css': [
            '.tmp/styles/{,*/}*.css',
            '<%= appConfig.app %>/styles/{,*/}*.css'
          ]
        }
      }
    },
    htmlmin: {
      dist: {
        options: {
          removeCommentsFromCDATA: true,
          collapseBooleanAttributes: true,
          removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true
        },
        files: [{
          expand: true,
          cwd: '<%= appConfig.app %>',
          src: '*.html',
          dest: '<%= appConfig.dist %>'
        }]
      },
      deploy: {
        options: {
          collapseWhitespace: true
        },
        files: [{
          expand: true,
          cwd: '<%= appConfig.dist %>',
          src: '*.html',
          dest: '<%= appConfig.dist %>'
        }]
      }
    },
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= appConfig.app %>',
          dest: '<%= appConfig.dist %>',
          src: [
            '*.{ico,txt}',
            '.htaccess',
            'images/**/*'
          ]
        }]
      }
    }

  });

  grunt.registerTask('transpilejs', [
    'browserify'
  ]);

  grunt.registerTask('server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'transpilejs',
      'connect:livereload',
      'open',
      'watch'
    ]);
  });

  grunt.registerTask('build', [
    'jshint',
    'clean:dist',
    'useminPrepare',
    'transpilejs',
    'htmlmin:dist',
    'cssmin',
    'autoprefixer',
    'copy',
    'usemin',
    'htmlmin:deploy'
  ]);

  grunt.registerTask('default', [ 'build' ]);
};
<commit_msg>Add PWA files to copy task<commit_after>/*jshint node:true,camelcase:false*/
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
  return connect.static(require('path').resolve(dir));
};

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to match all subfolders:
// 'test/spec/**/*.js'

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

  grunt.loadTasks('./tasks');

  // configurable paths
  var appPaths = {
    app: 'app',
    dist: 'public'
  };
  var cachebust = +(new Date());

  grunt.initConfig({
    appConfig: appPaths,
    cachebust: cachebust,
    watch: {
      scripts: {
        files: ['<%= jshint.browser %>'],
        tasks: ['jshint:browser', 'transpilejs']
      },
      nodescripts: {
        files: ['<%= jshint.node %>'],
        tasks: ['jshint:node']
      },
      livereload: {
        options: {
          livereload: true
        },
        files: [
          '<%= appConfig.app %>/*.html',
          '<%= appConfig.app %>/styles/{,*/}*.css',
          '.tmp/scripts/{,*/}*.js',
          '<%= appConfig.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}'
        ]
      }
    },
    browserify: {
      dist: {
        options: {
          transform: [['babelify', { presets: ['es2015'] }]]
        },
        files: {
          '.tmp/scripts/iterateconf.js': '<%= appConfig.app %>/scripts/main.js'
        }
      }
    },
    connect: {
      options: {
        port: 9090,
        // change this to '0.0.0.0' to access the server from outside
        hostname: '0.0.0.0'
      },
      livereload: {
        options: {
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.tmp'),
              mountFolder(connect, 'app')
            ];
          }
        }
      },
      dist: {
        options: {
          middleware: function (connect) {
            return [
              mountFolder(connect, '<%= appConfig.dist %>')
            ];
          }
        }
      }
    },
    open: {
      server: {
        path: 'http://localhost:<%= connect.options.port %>'
      }
    },
    clean: {
      dist: ['.tmp'],
      server: '.tmp'
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        force: true
      },
      node: [
        'Gruntfile.js',
        'bin/{,*/}*.js',
        'tasks/{,*/}*.js'
      ],
      browser: [
        '<%= appConfig.app %>/scripts/{,*/}*.js',
        '!<%= appConfig.app %>/scripts/vendor/*'
      ]
    },
    useminPrepare: {
      html: '<%= appConfig.app %>/index.html',
      options: {
        dest: '<%= appConfig.dist %>'
      }
    },
    usemin: {
      html: ['<%= appConfig.dist %>/{,*/}*.html'],
      css: ['<%= appConfig.dist %>/styles/{,*/}*.css'],
      options: {
        dirs: ['<%= appConfig.dist %>']
      }
    },
    autoprefixer: {
      dist: {
        options: {
          browsers: [
            'last 2 version'
          ],
          cascade: true
        },
        src: '<%= appConfig.dist %>/styles/index.css'
      }
    },
    cssmin: {
      dist: {
        files: {
          '<%= appConfig.dist %>/styles/index.css': [
            '.tmp/styles/{,*/}*.css',
            '<%= appConfig.app %>/styles/{,*/}*.css'
          ]
        }
      }
    },
    htmlmin: {
      dist: {
        options: {
          removeCommentsFromCDATA: true,
          collapseBooleanAttributes: true,
          removeAttributeQuotes: true,
          removeRedundantAttributes: true,
          useShortDoctype: true,
          removeEmptyAttributes: true
        },
        files: [{
          expand: true,
          cwd: '<%= appConfig.app %>',
          src: '*.html',
          dest: '<%= appConfig.dist %>'
        }]
      },
      deploy: {
        options: {
          collapseWhitespace: true
        },
        files: [{
          expand: true,
          cwd: '<%= appConfig.dist %>',
          src: '*.html',
          dest: '<%= appConfig.dist %>'
        }]
      }
    },
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= appConfig.app %>',
          dest: '<%= appConfig.dist %>',
          src: [
            '*.{ico,txt}',
            '.htaccess',
            'images/**/*',
            'manifest.json',
            'service-worker.js',
            'scripts/iterateconf.js'
          ]
        }]
      }
    }

  });

  grunt.registerTask('transpilejs', [
    'browserify'
  ]);

  grunt.registerTask('server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
    }

    grunt.task.run([
      'clean:server',
      'transpilejs',
      'connect:livereload',
      'open',
      'watch'
    ]);
  });

  grunt.registerTask('build', [
    'jshint',
    'clean:dist',
    'useminPrepare',
    'transpilejs',
    'htmlmin:dist',
    'cssmin',
    'autoprefixer',
    'copy',
    'usemin',
    'htmlmin:deploy'
  ]);

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


<commit_before>/*
 * Assemble
 * http://github.com/assemble/assemble
 *
 * Copyright (c) 2013 Assemble
 * MIT License
 */

module.exports = function(grunt) {

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

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

    // Release management
    release: {
      options: {
        bump: true,
        add: false,
        commit: false,
        tag: false,
        push: false,
        pushTags: false,
        npm: false
      }
    },

    // Update Version
    version: {
      check: {
        src: ['package.json']
      },
      release: {
        options: {
          release: 'patch'
        },
        src: ['<%= version.check.src %>']
      }
    },

    // Run tests.
    mochaTest: {
      files: ['test/**/*.js']
    },
    mochaTestConfig: {
      options: {
        reporter: 'nyan'
      }
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      files: [
        'Gruntfile.js',
        'lib/**/*.js',
        'tasks/**/*.js',
        'test/**/*.js'
      ]
    },

    concat: {
      dist: {
        src: [
          '<banner:meta.banner>',
          '<file_strip_banner:lib/<%= pkg.name %>.js>'
        ],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },

    min: {
      dist: {
        src: [
          '<banner:meta.banner>',
          '<config:concat.dist.dest>'
        ],
        dest: '<%= pkg.name %>.min.js'
      }
    },

    uglify: {},

    // Run other gruntfiles in project
    subgrunt: {
      examples: ['examples/**/Gruntfile.js']
    },

    watch: {
      all: {
        files: ['<%= jshint.files %>'],
        tasks: ['jshint', 'mochaTest'],
        options: {
          debounceDelay: 250
        }
      }
    }

  });

  // Load npm plugins to provide necessary tasks.
  // "grunt-version": "https://github.com/kswedberg/grunt-version/tarball/master"
  // issue with putting this in the package.json file is that it updates it's own line since it has version": in it.
  grunt.loadNpmTasks('grunt-version');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-mocha-test');

  // Load local tasks.
  grunt.loadTasks('tasks');

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

  // Default task.
  grunt.registerTask('examples', [
    'subgrunt'
  ]);

  // Tests to be run.
  grunt.registerTask('test', [
    'jshint',
    'mochaTest'
  ]);
};
<commit_msg>subgrunt now works properly, improved task formatting, updated registered tasks<commit_after>/*
 * Assemble
 * http://github.com/assemble/assemble
 *
 * Copyright (c) 2013 Assemble
 * MIT License
 */

module.exports = function(grunt) {

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

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

    // Release management
    release: {
      options: {
        bump: true,
        add: false,
        commit: false,
        tag: false,
        push: false,
        pushTags: false,
        npm: false
      }
    },

    // Update Version
    version: {
      check: {
        src: ['package.json']
      },
      release: {
        options: {
          release: 'patch'
        },
        src: ['<%= version.check.src %>']
      }
    },

    nodeunit: {
      all: ['test/{grunt,tasks,util}/**/*.js']
    },

    // Run tests.
    mochaTest: {
      files: ['test/**/*.js']
    },
    mochaTestConfig: {
      options: {
        reporter: 'nyan'
      }
    },

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

    concat: {
      dist: {
        src: [
          '<banner:meta.banner>',
          '<file_strip_banner:lib/<%= pkg.name %>.js>'
        ],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },

    min: {
      dist: {
        src: [
          '<banner:meta.banner>',
          '<config:concat.dist.dest>'
        ],
        dest: '<%= pkg.name %>.min.js'
      }
    },

    uglify: {},

    // Run other gruntfiles in project
    subgrunt: {
      examples: [
        'examples/handlebars/Gruntfile.js',
        'examples/grid/Gruntfile.js'
      ]
    },

    watch: {
      all: {
        options: { debounceDelay: 250 },
        files: ['<%= jshint.files %>'],
        tasks: ['jshint', 'mochaTest']
      }
    }

  });

  // Load npm plugins to provide necessary tasks.
  // "grunt-version": "https://github.com/kswedberg/grunt-version/tarball/master"
  // issue with putting this in the package.json file is that it updates it's own line since it has version": in it.
  grunt.loadNpmTasks('grunt-version');
  grunt.loadNpmTasks('grunt-release');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-mocha-test');

  // Load local tasks.
  grunt.loadTasks('tasks');

  // Default task.
  grunt.registerTask('default', [
    'test',
    'release'
  ]);

  // Default task.
  grunt.registerTask('sub', [
    'subgrunt:examples'
  ]);

  // Tests to be run.
  grunt.registerTask('test', [
    'nodeunit',
    'jshint',
    'mochaTest'
  ]);
};
<|endoftext|>


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

  grunt.initConfig({
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'assets/js/*.js',
        '!assets/js/scripts.min.js'
      ]
    },
    sass: {
      dist: {
        options: {
          style: 'compressed',
					compass: true,
					// Source maps are available, but require Sass 3.3.0 to be installed
					// https://github.com/gruntjs/grunt-contrib-sass#sourcemap
					sourcemap: false
        },
        files: {
          'assets/css/main.min.css': [
            'assets/scss/app.scss'
          ]
        }
      }
    },
    uglify: {
      dist: {
        files: {
          'assets/js/scripts.min.js': [
            'vendor/fitvids/jquery.fitvids.js',
            'vendor/flexslider/jquery.flexslider.js',
            'assets/js/plugins/*.js',
            'assets/js/_*.js'
          ]
        },
        options: {
          // JS source map: to enable, uncomment the lines below and update sourceMappingURL based on your install
          // sourceMap: 'assets/js/scripts.min.js.map',
          // sourceMappingURL: '/app/themes/roots/assets/js/scripts.min.js.map'
        }
      }
    },
    version: {
      options: {
        file: 'lib/scripts.php',
        css: 'assets/css/main.min.css',
        cssHandle: 'roots_main',
        js: 'assets/js/scripts.min.js',
        jsHandle: 'roots_scripts'
      }
    },
    watch: {
      sass: {
        files: [
          'assets/scss/**/*.scss'
        ],
        tasks: ['sass', 'version']
      },
      js: {
        files: [
          '<%= jshint.all %>'
        ],
        tasks: ['jshint', 'uglify', 'version']
      },
      livereload: {
        // Browser live reloading
        // https://github.com/gruntjs/grunt-contrib-watch#live-reloading
        options: {
          livereload: true
        },
        files: [
          'assets/css/main.min.css',
          'assets/js/scripts.min.js',
          'templates/*.php',
          '*.php'
        ]
      }
    },
    clean: {
      dist: [
        'assets/css/main.min.css',
        'assets/js/scripts.min.js'
      ]
    }
  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-wp-version');

  // Register tasks
  grunt.registerTask('default', [
    'clean',
    'sass',
    'uglify',
    'version'
  ]);
  grunt.registerTask('dev', [
    'watch'
  ]);

};
<commit_msg>add dev task to grunt watch<commit_after>'use strict';
module.exports = function(grunt) {

  grunt.initConfig({
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'assets/js/*.js',
        '!assets/js/scripts.min.js'
      ]
    },
    sass: {
      dist: {
        options: {
          style: 'compressed',
					compass: true,
					// Source maps are available, but require Sass 3.3.0 to be installed
					// https://github.com/gruntjs/grunt-contrib-sass#sourcemap
					sourcemap: false
        },
        files: {
          'assets/css/main.min.css': [
            'assets/scss/app.scss'
          ]
        }
      },
      dev: {
        options: {
          style: 'expanded',
          compass: true,
          // Source maps are available, but require Sass 3.3.0 to be installed
          // https://github.com/gruntjs/grunt-contrib-sass#sourcemap
          sourcemap: false
        },
        files: {
          'assets/css/main.min.css': [
            'assets/scss/app.scss'
          ]
        }
      }
    },
    uglify: {
      dist: {
        files: {
          'assets/js/scripts.min.js': [
            'vendor/fitvids/jquery.fitvids.js',
            'vendor/flexslider/jquery.flexslider.js',
            'assets/js/plugins/*.js',
            'assets/js/_*.js'
          ]
        },
        options: {
          // JS source map: to enable, uncomment the lines below and update sourceMappingURL based on your install
          // sourceMap: 'assets/js/scripts.min.js.map',
          // sourceMappingURL: '/app/themes/roots/assets/js/scripts.min.js.map'
        }
      },
      dev: {
        files: {
          'assets/js/scripts.min.js': [
            'vendor/fitvids/jquery.fitvids.js',
            'vendor/flexslider/jquery.flexslider.js',
            'vendor/skycons/skycons.js',
            'assets/js/plugins/*.js',
            'assets/js/_*.js'
          ]
        },
        options: {
          mangle: false,
          beautify: true
        }
      }
    },
    version: {
      options: {
        file: 'lib/scripts.php',
        css: 'assets/css/main.min.css',
        cssHandle: 'roots_main',
        js: 'assets/js/scripts.min.js',
        jsHandle: 'roots_scripts'
      }
    },
    watch: {
      sass: {
        files: [
          'assets/scss/**/*.scss'
        ],
        tasks: ['sass:dev', 'version']
      },
      js: {
        files: [
          '<%= jshint.all %>'
        ],
        tasks: ['jshint', 'uglify:dev', 'version']
      },
      livereload: {
        // Browser live reloading
        // https://github.com/gruntjs/grunt-contrib-watch#live-reloading
        options: {
          livereload: true
        },
        files: [
          'assets/css/main.min.css',
          'assets/js/scripts.min.js',
          'templates/*.php',
          '*.php'
        ]
      }
    },
    clean: {
      dist: [
        'assets/css/main.min.css',
        'assets/js/scripts.min.js'
      ]
    }
  });

  // Load tasks
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-wp-version');

  // Register tasks
  grunt.registerTask('default', [
    'clean',
    'sass',
    'uglify',
    'version'
  ]);
  grunt.registerTask('dev', [
    'watch'
  ]);

};
<|endoftext|>


<commit_before>/* File: GruntFile.js
 *
 * Copyright (c) 2014
 * Centre National d’Enseignement à Distance (Cned), Boulevard Nicephore Niepce, 86360 CHASSENEUIL-DU-POITOU, France
 * (direction-innovation@cned.fr)
 *
 * GNU Affero General Public License (AGPL) version 3.0 or later version
 *
 * This file is part of a program which is free software: you can
 * redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 */

'use strict';

var path = require('path');

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

    // configurable paths
    var yeomanConfig = {
        app: '.',
        dist: 'dist',
        generated: 'generated'
    };

    try {
        yeomanConfig.app = require('./bower.json').appPath || yeomanConfig.app;
    } catch (e) {}

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            main: {
                files: ['app/**/*.{html,css,png,jpeg,GIF,jpg,eot,svg,ttf,woff}'],
            },
            options: {
                livereload: true/*,
                port: 3000,
                key: grunt.file.read('../sslcert/key.pem'),
                cert: grunt.file.read('../sslcert/cert.pem')*/
            }
        },
        express: {
            options: {
                hostname: '0.0.0.0'
            },
            livereload: {
                options: {
                    server: path.resolve('./app.js'),
                    livereload: true,
                    serverreload: false,
                    bases: [path.resolve('./.tmp'), path.resolve(__dirname, yeomanConfig.app)],
                    spawn: false
                }
            },
            test: {
                options: {
                    server: path.resolve('./app.js'),
                    bases: [path.resolve('./.tmp'), path.resolve(__dirname, 'test')]
                }
            },
            dist: {
                options: {
                    server: path.resolve('./app.js'),
                    bases: path.resolve(__dirname, yeomanConfig.dist)
                }
            },
            server: {
                options: {
                    port: 80
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= express.options.port %>'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '<%= yeoman.generated %>/*',
                        '!<%= yeoman.dist %>/.git*']
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: 'checkstyle',
                reporterOutput: 'generated/jshint/resultJSHint.xml'
            },
            all: {
                src: ['Gruntfile.js', 'app/scripts/**/*.js', 'api/**/*.js', 'test/spec/**/*.js']
            }
        },
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
                        '<%= yeoman.dist %>/styles/fonts/*']
                }
            }
        },
        useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= yeoman.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            // By default, your `index.html` <!-- Usemin Block --> will take care of
            // minification. This option is pre-configured if you do not wish to use
            // Usemin blocks.
            // dist: {
            //   files: {
            //     '<%= yeoman.dist %>/styles/main.css': [
            //       '.tmp/styles/{,*/}*.css',
            //       '<%= yeoman.app %>/styles/{,*/}*.css'
            //     ]
            //   }
            // }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
                     // https://github.com/yeoman/grunt-usemin/issues/44
                     //collapseWhitespace: true,
                     collapseBooleanAttributes: true,
                     removeAttributeQuotes: true,
                     removeRedundantAttributes: true,
                     useShortDoctype: true,
                     removeEmptyAttributes: true,
                     removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: ['*.html', 'views/*.html'],
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        'app/**/*.{html,css,png,jpeg,GIF,jpg,eot,svg,ttf,woff,appcache,gif}',
                        'app/bower_components/**/*.js',
                        'api/**/*',
                        'models/**/*',
                        'routes/**/*',
                        'custom_node_modules/**',
                        'app.js',
                        'Gruntfile.js',
                        'package.json',
                        'files/**/**/**',
                        'po/**']
                }, {
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: ['../env/config.<%= [NODE_ENV] %>.json'],
                    rename: function(dest) {
                        return dest + '/env/config.json';
                    }
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*']
                }]
            }
        },
        concurrent: {
            dist: [
                'imagemin',
                'svgmin']
        },
        ngmin: {
            controllers: {
                expand: true,
                cwd: 'app',
                src: ['scripts/**/*.js'],
                dest: 'generated/'
            }
        },
        uglify: {
            build: {
                src: ' <%= yeoman.generated %>/scripts/**/*.js',
                dest: '<%= yeoman.dist %>/app/scripts/front.js'
            }
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js',
                singleRun: true
            }
        },
        cdnify: {
            dist: {
                html: ['<%= yeoman.dist %>/*.html']
            }
        },
        nggettext_extract: {
            pot: {
                files: {
                    'po/template.pot': ['app/views/**/*.html']
                }
            }
        },
        nggettext_compile: {
            all: {
                files: {
                    'app/scripts/translations.js': ['po/*.po']
                }
            }
        },
        /**
         * Specification de chaque configuration d'un ENV comme task
         */
        env: {
            dev: {
                src: '../env/config.json'
            },
            test: {
                src: '../env/config.test.json'
            },
            integ: {
                src: '../env/config.integ.json'
            },
            recette: {
                src: '../env/config.recette.json'
            },
            recettecned: {
                src: '../env/config.recette.cned.json'
            },
            prerecette: {
                src: '../env/config.prerecette.json'
            },
            prod: {
                src: '../env/config.prod.json'
            }
        },
        /**
         *  Generation des fichiers avec
         *  des liens absoluts selon l'environnement
         */
        template: {
            'generate-from-tpl': {
                options: {
                    data: {
                        'URL_REQUEST': '<%= [URL_REQUEST] %>',
                        'DROPBOX_TYPE': '<%= [DROPBOX_TYPE] %>',
                        'CATALOGUE_NAME':'<%= [CATALOGUE_NAME] %>'
                    }
                },
                files: {
                    './app/index.html': ['./app/index.html.tpl'],
                    './app/scripts/app.js': ['./app/scripts/app.js.tpl'],
                    './app/scripts/services/config.js': ['./app/scripts/services/config.js.tpl'],
                    './app/listDocument.appcache': ['./app/listDocument.appcache.tpl'],
                }
            },
            'replace-custom-node-modules': {
                files: {
                    './node_modules/passport-local/lib/passport-local/strategy.js': ['./custom_node_modules/passport-local/lib/passport-local/strategy.js']
                }
            }
        }

    });

    grunt.registerTask('build', [
        'clean:dist',
        'copy:dist',
        'useminPrepare',
        'ngmin',
        'uglify',
        'usemin']);

    grunt.registerTask('setEnv', function() {
        grunt.config('NODE_ENV', process.env.NODE_ENV);
        grunt.config('URL_REQUEST', process.env.URL_REQUEST);
        grunt.config('DROPBOX_TYPE', process.env.DROPBOX_TYPE);
        grunt.config('CATALOGUE_NAME',process.env.CATALOGUE_NAME);
        grunt.config('SSL_KEY',process.env.SSL_KEY);
        grunt.config('SSL_CERT',process.env.SSL_CERT);
        console.log('ENV = ' + process.env.NODE_ENV);
    });

    grunt.registerTask('build-dev', [
        'env:dev',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-integ', [
        'env:integ',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-prerecette', [
        'env:prerecette',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-recette', [
        'env:recette',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-recettecned', [
        'env:recettecned',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-prod', [
        'env:prod',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('server', function(target) {
        if (target === 'dist') {
            return grunt.task.run(['build', 'open', 'express:dist:keepalive']);
        }

        var env = grunt.file.readJSON('./env/config.json').NODE_ENV;
        if (env === 'dev') {
            grunt.task.run([
                'env:dev',
                'setEnv',
                'template:generate-from-tpl',
                'template:replace-custom-node-modules',
                'clean:server',
                'express:livereload',
                'watch:main']);
            //'concurrent:server',
        } else {
            grunt.task.run([
                'template:replace-custom-node-modules',
                'clean:server',
            //'concurrent:server',
            'express:livereload',
                'watch:main']);
        }
    });

    grunt.registerTask('generate-test', [
        'env:test',
        'setEnv',
        'template:generate-from-tpl',
        'template:replace-custom-node-modules']);

    grunt.registerTask('test', [
        'env:test',
        'setEnv',
        'template:generate-from-tpl',
        'template:replace-custom-node-modules',
        'clean:server',
        'express:test',
        'jshint:all',
        'karma']);
};<commit_msg>Changement de la configuration pour la génération du fichier de configuration pour l'environnement de recette CNED<commit_after>/* File: GruntFile.js
 *
 * Copyright (c) 2014
 * Centre National d’Enseignement à Distance (Cned), Boulevard Nicephore Niepce, 86360 CHASSENEUIL-DU-POITOU, France
 * (direction-innovation@cned.fr)
 *
 * GNU Affero General Public License (AGPL) version 3.0 or later version
 *
 * This file is part of a program which is free software: you can
 * redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 */

'use strict';

var path = require('path');

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

    // configurable paths
    var yeomanConfig = {
        app: '.',
        dist: 'dist',
        generated: 'generated'
    };

    try {
        yeomanConfig.app = require('./bower.json').appPath || yeomanConfig.app;
    } catch (e) {}

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            main: {
                files: ['app/**/*.{html,css,png,jpeg,GIF,jpg,eot,svg,ttf,woff}'],
            },
            options: {
                livereload: true/*,
                port: 3000,
                key: grunt.file.read('../sslcert/key.pem'),
                cert: grunt.file.read('../sslcert/cert.pem')*/
            }
        },
        express: {
            options: {
                hostname: '0.0.0.0'
            },
            livereload: {
                options: {
                    server: path.resolve('./app.js'),
                    livereload: true,
                    serverreload: false,
                    bases: [path.resolve('./.tmp'), path.resolve(__dirname, yeomanConfig.app)],
                    spawn: false
                }
            },
            test: {
                options: {
                    server: path.resolve('./app.js'),
                    bases: [path.resolve('./.tmp'), path.resolve(__dirname, 'test')]
                }
            },
            dist: {
                options: {
                    server: path.resolve('./app.js'),
                    bases: path.resolve(__dirname, yeomanConfig.dist)
                }
            },
            server: {
                options: {
                    port: 80
                }
            }
        },
        open: {
            server: {
                url: 'http://localhost:<%= express.options.port %>'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '<%= yeoman.generated %>/*',
                        '!<%= yeoman.dist %>/.git*']
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                reporter: 'checkstyle',
                reporterOutput: 'generated/jshint/resultJSHint.xml'
            },
            all: {
                src: ['Gruntfile.js', 'app/scripts/**/*.js', 'api/**/*.js', 'test/spec/**/*.js']
            }
        },
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
                        '<%= yeoman.dist %>/styles/fonts/*']
                }
            }
        },
        useminPrepare: {
            html: '<%= yeoman.app %>/index.html',
            options: {
                dest: '<%= yeoman.dist %>'
            }
        },
        usemin: {
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
            options: {
                dirs: ['<%= yeoman.dist %>']
            }
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            // By default, your `index.html` <!-- Usemin Block --> will take care of
            // minification. This option is pre-configured if you do not wish to use
            // Usemin blocks.
            // dist: {
            //   files: {
            //     '<%= yeoman.dist %>/styles/main.css': [
            //       '.tmp/styles/{,*/}*.css',
            //       '<%= yeoman.app %>/styles/{,*/}*.css'
            //     ]
            //   }
            // }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
                     // https://github.com/yeoman/grunt-usemin/issues/44
                     //collapseWhitespace: true,
                     collapseBooleanAttributes: true,
                     removeAttributeQuotes: true,
                     removeRedundantAttributes: true,
                     useShortDoctype: true,
                     removeEmptyAttributes: true,
                     removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: ['*.html', 'views/*.html'],
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        'app/**/*.{html,css,png,jpeg,GIF,jpg,eot,svg,ttf,woff,appcache,gif}',
                        'app/bower_components/**/*.js',
                        'api/**/*',
                        'models/**/*',
                        'routes/**/*',
                        'custom_node_modules/**',
                        'app.js',
                        'Gruntfile.js',
                        'package.json',
                        'files/**/**/**',
                        'po/**']
                }, {
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: ['../../env/config.<%= [NODE_ENV] %>.json'],
                    rename: function(dest) {
                        return dest + '/env/config.json';
                    }
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*']
                }]
            }
        },
        concurrent: {
            dist: [
                'imagemin',
                'svgmin']
        },
        ngmin: {
            controllers: {
                expand: true,
                cwd: 'app',
                src: ['scripts/**/*.js'],
                dest: 'generated/'
            }
        },
        uglify: {
            build: {
                src: ' <%= yeoman.generated %>/scripts/**/*.js',
                dest: '<%= yeoman.dist %>/app/scripts/front.js'
            }
        },
        karma: {
            unit: {
                configFile: 'karma.conf.js',
                singleRun: true
            }
        },
        cdnify: {
            dist: {
                html: ['<%= yeoman.dist %>/*.html']
            }
        },
        nggettext_extract: {
            pot: {
                files: {
                    'po/template.pot': ['app/views/**/*.html']
                }
            }
        },
        nggettext_compile: {
            all: {
                files: {
                    'app/scripts/translations.js': ['po/*.po']
                }
            }
        },
        /**
         * Specification de chaque configuration d'un ENV comme task
         */
        env: {
            dev: {
                src: '../../env/config.json'
            },
            test: {
                src: '../../env/config.test.json'
            },
            integ: {
                src: '../../env/config.integ.json'
            },
            recette: {
                src: '../../env/config.recette.json'
            },
            recettecned: {
                src: '../../env/config.recettecned.json'
            },
            prerecette: {
                src: '../../env/config.prerecette.json'
            },
            prod: {
                src: '../../env/config.prod.json'
            }
        },
        /**
         *  Generation des fichiers avec
         *  des liens absoluts selon l'environnement
         */
        template: {
            'generate-from-tpl': {
                options: {
                    data: {
                        'URL_REQUEST': '<%= [URL_REQUEST] %>',
                        'DROPBOX_TYPE': '<%= [DROPBOX_TYPE] %>',
                        'CATALOGUE_NAME':'<%= [CATALOGUE_NAME] %>'
                    }
                },
                files: {
                    './app/index.html': ['./app/index.html.tpl'],
                    './app/scripts/app.js': ['./app/scripts/app.js.tpl'],
                    './app/scripts/services/config.js': ['./app/scripts/services/config.js.tpl'],
                    './app/listDocument.appcache': ['./app/listDocument.appcache.tpl'],
                }
            },
            'replace-custom-node-modules': {
                files: {
                    './node_modules/passport-local/lib/passport-local/strategy.js': ['./custom_node_modules/passport-local/lib/passport-local/strategy.js']
                }
            }
        }

    });

    grunt.registerTask('build', [
        'clean:dist',
        'copy:dist',
        'useminPrepare',
        'ngmin',
        'uglify',
        'usemin']);

    grunt.registerTask('setEnv', function() {
        grunt.config('NODE_ENV', process.env.NODE_ENV);
        grunt.config('URL_REQUEST', process.env.URL_REQUEST);
        grunt.config('DROPBOX_TYPE', process.env.DROPBOX_TYPE);
        grunt.config('CATALOGUE_NAME',process.env.CATALOGUE_NAME);
        grunt.config('SSL_KEY',process.env.SSL_KEY);
        grunt.config('SSL_CERT',process.env.SSL_CERT);
        console.log('ENV = ' + process.env.NODE_ENV);
    });

    grunt.registerTask('build-dev', [
        'env:dev',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-integ', [
        'env:integ',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-prerecette', [
        'env:prerecette',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-recette', [
        'env:recette',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-recettecned', [
        'env:recettecned',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('build-prod', [
        'env:prod',
        'setEnv',
        'template:generate-from-tpl',
        'build']);

    grunt.registerTask('server', function(target) {
        if (target === 'dist') {
            return grunt.task.run(['build', 'open', 'express:dist:keepalive']);
        }

        var env = grunt.file.readJSON('./env/config.json').NODE_ENV;
        if (env === 'dev') {
            grunt.task.run([
                'env:dev',
                'setEnv',
                'template:generate-from-tpl',
                'template:replace-custom-node-modules',
                'clean:server',
                'express:livereload',
                'watch:main']);
            //'concurrent:server',
        } else {
            grunt.task.run([
                'template:replace-custom-node-modules',
                'clean:server',
            //'concurrent:server',
            'express:livereload',
                'watch:main']);
        }
    });

    grunt.registerTask('generate-test', [
        'env:test',
        'setEnv',
        'template:generate-from-tpl',
        'template:replace-custom-node-modules']);

    grunt.registerTask('test', [
        'env:test',
        'setEnv',
        'template:generate-from-tpl',
        'template:replace-custom-node-modules',
        'clean:server',
        'express:test',
        'jshint:all',
        'karma']);
};<|endoftext|>


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

	"use strict";

	var gzip = require( "gzip-js" );

	// Project configuration
	grunt.initConfig( {
		pkg: grunt.file.readJSON( "package.json" ),
		jsonlint: {
			pkg: {
				src: [ "package.json" ]
			}
		},
		jshint: {
			grunt: {
				src: [ "Gruntfile.js" ],
				options: {
					jshintrc: ".jshintrc"
				}
			},
			build: {
				src: [ "src/script.js" ],
				options: {
					jshintrc: "src/.jshintrc"
				}
			},
			test: {
				src: [ "test/test.js" ],
				options: {
					jshintrc: "test/.jshintrc"
				}
			}
		},
		concat: {
			options: {
				banner: "<!-- <%= pkg.name %> v<%= pkg.version %> | " +
					"(c) 2012-2013 <%= pkg.author.name %> | " +
					"MIT License -->\n"
			},
			build: {
				files: {
					"backgroundsize.htc": [ "src/intro.htc", "src/script.js", "src/outro.htc" ]
				}
			},
			dist: {
				files: {
					"backgroundsize.min.htc": [ "src/intro.htc", "build/script.min.js", "src/outro.min.htc" ]
				},
				options: {
					separator: ""
				}
			}
		},
		uglify: {
			dist: {
				files: {
					"build/script.min.js": [ "src/script.js" ]
				},
				options: {
					report: "min",
					beautify: {
						ascii_only: true
					},
					compress: {
						hoist_funs: false,
						join_vars: false,
						loops: false,
						unused: false
					}
				},
			}
		},
		compare_size: {
			files: [ "backgroundsize.htc", "backgroundsize.min.htc" ],
			options: {
				compress: {
					gz: function( contents ) {
						return gzip.zip( contents, {} ).length;
					}
				},
				cache: "build/.sizecache.json"
			}
		},
		watch: {
			files: [
				"<%= jshint.grunt.src %>",
				"<%= jshint.build.src %>",
				"src/*.htc",
				"<%= jshint.test.src %>"
			],
			tasks: "build"
		}
	} );

	// Load tasks from NPM packages
	grunt.loadNpmTasks( "grunt-jsonlint" );
	grunt.loadNpmTasks( "grunt-contrib-jshint" );
	grunt.loadNpmTasks( "grunt-contrib-concat" );
	grunt.loadNpmTasks( "grunt-contrib-uglify" );
	grunt.loadNpmTasks( "grunt-compare-size" );
	grunt.loadNpmTasks( "grunt-contrib-watch" );
	grunt.loadNpmTasks( "grunt-git-authors" );

	grunt.registerTask( "build", [ "jshint", "concat:build" ] );

	// Default task(s)
	grunt.registerTask( "default", [ "jsonlint", "build", "uglify:dist", "concat:dist", "compare_size" ] );

};
<commit_msg>let's not go crazy with the arrays<commit_after>module.exports = function( grunt ) {

	"use strict";

	var gzip = require( "gzip-js" );

	// Project configuration
	grunt.initConfig( {
		pkg: grunt.file.readJSON( "package.json" ),
		jsonlint: {
			pkg: {
				src: [ "package.json" ]
			}
		},
		jshint: {
			grunt: {
				src: [ "Gruntfile.js" ],
				options: {
					jshintrc: ".jshintrc"
				}
			},
			build: {
				src: [ "src/script.js" ],
				options: {
					jshintrc: "src/.jshintrc"
				}
			},
			test: {
				src: [ "test/test.js" ],
				options: {
					jshintrc: "test/.jshintrc"
				}
			}
		},
		concat: {
			options: {
				banner: "<!-- <%= pkg.name %> v<%= pkg.version %> | " +
					"(c) 2012-2013 <%= pkg.author.name %> | " +
					"MIT License -->\n"
			},
			build: {
				files: {
					"backgroundsize.htc": [
						"src/intro.htc",
						"src/script.js",
						"src/outro.htc"
					]
				}
			},
			dist: {
				files: {
					"backgroundsize.min.htc": [
						"src/intro.htc",
						"build/script.min.js",
						"src/outro.min.htc"
					]
				},
				options: {
					separator: ""
				}
			}
		},
		uglify: {
			dist: {
				files: {
					"build/script.min.js": [ "src/script.js" ]
				},
				options: {
					report: "min",
					beautify: {
						ascii_only: true
					},
					compress: {
						hoist_funs: false,
						join_vars: false,
						loops: false,
						unused: false
					}
				},
			}
		},
		compare_size: {
			files: [
				"backgroundsize.htc",
				"backgroundsize.min.htc"
			],
			options: {
				compress: {
					gz: function( contents ) {
						return gzip.zip( contents, {} ).length;
					}
				},
				cache: "build/.sizecache.json"
			}
		},
		watch: {
			files: [
				"<%= jshint.grunt.src %>",
				"<%= jshint.build.src %>",
				"src/*.htc",
				"<%= jshint.test.src %>"
			],
			tasks: "build"
		}
	} );

	// Load tasks from NPM packages
	grunt.loadNpmTasks( "grunt-jsonlint" );
	grunt.loadNpmTasks( "grunt-contrib-jshint" );
	grunt.loadNpmTasks( "grunt-contrib-concat" );
	grunt.loadNpmTasks( "grunt-contrib-uglify" );
	grunt.loadNpmTasks( "grunt-compare-size" );
	grunt.loadNpmTasks( "grunt-contrib-watch" );
	grunt.loadNpmTasks( "grunt-git-authors" );

	grunt.registerTask( "build", [
		"jshint",
		"concat:build"
	] );

	// Default task(s)
	grunt.registerTask( "default", [
		"jsonlint",
		"build",
		"uglify:dist",
		"concat:dist",
		"compare_size"
	] );

};
<|endoftext|>


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

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

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

module.exports = function (grunt) {

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

  // Project configuration.
  grunt.initConfig({
    connect: {
      main: {
        options: {
          port: 9001
        }
      }
    },
    watch: {
      main: {
        options: {
            livereload: true,
            livereloadOnError: false,
            spawn: false
        },
        files: [createFolderGlobs(['*.js','*.less','*.html']),'!_SpecRunner.html','!.grunt'],
        tasks: [] //all the tasks are run dynamically during the watch event handler
      }
    },
    jshint: {
      main: {
        options: {
            jshintrc: '.jshintrc'
        },
        src: createFolderGlobs('*.js')
      }
    },
    clean: {
      before:{
        src:['dist','temp']
      },
      after: {
        src:['temp']
      }
    },
    less: {
      production: {
        options: {
        },
        files: {
          'temp/app.css': 'app.less'
        }
      }
    },
    autoprefixer: {
      options: {
        browsers: ['ie >= 8', 'ff > 4', 'last 8 versions']
      },
      main: {
        src: 'temp/app.css'
      }
    },
    ngtemplates: {
      main: {
        options: {
            module: pkg.name,
            htmlmin:'<%= htmlmin.main.options %>'
        },
        src: [createFolderGlobs('*.html'),'!index.html','!_SpecRunner.html'],
        dest: 'temp/templates.js'
      }
    },
    copy: {
      main: {
        files: [
          {src: ['img/**'], dest: 'dist/'},
          {src: ['temp_data/**'], dest: 'dist/'},
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/fonts/'
          },
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/fonts/'
          },
          {
            src: ['locales/**'],
            dest: 'dist/'
          },
//           {src: ['bower_components/font-awesome/fonts/**'], dest: 'dist/',filter:'isFile',expand:true}
          //{src: ['bower_components/angular-ui-utils/ui-utils-ieshiv.min.js'], dest: 'dist/'},
          //{src: ['bower_components/select2/*.png','bower_components/select2/*.gif'], dest:'dist/css/',flatten:true,expand:true},
          //{src: ['bower_components/angular-mocks/angular-mocks.js'], dest: 'dist/'}
        ]
      }
    },
    dom_munger:{
      read: {
        options: {
          read:[
            {selector:'script[class="libnocompat"]',attribute:'src',writeto:'libnocompatjs'},
            {selector:'script[class="lib"]',attribute:'src',writeto:'libjs'},
            {selector:'script[class="app"]',attribute:'src',writeto:'appjs'},
            {selector:'link[rel="stylesheet"][data-concat!="false"]',attribute:'href',writeto:'appcss'}
          ]
        },
        src: 'index.html'
      },
      update: {
        options: {
          remove: ['script[data-remove!="false"]','link[data-remove!="false"]'],
          append: [
            {selector:'body',html:'<!--[if lte IE 8]><script src="libcompat-v1.0.13.min.js"></script><![endif]--><!--[if gte IE 9]><script src="libnocompat-v1.0.13.min.js"></script><![endif]--><!--[if !IE]><!--><script src="libnocompat-v1.0.13.min.js"></script><!--<![endif]-->'},
            {selector:'body',html:'<script src="lib-v1.0.13.min.js"></script>'},
            {selector:'body',html:'<script src="avConfig-v1.0.13.js"></script>'},
            {selector:'body',html:'<script src="app-v1.0.13.min.js"></script>'},
            {selector:'head',html:'<link rel="stylesheet" href="app-v1.0.13.full.min.css">'}
          ]
        },
        src:'index.html',
        dest: 'dist/index.html'
      }
    },
    cssmin: {
      main: {
        src:['temp/app.css','<%= dom_munger.data.appcss %>'],
        dest:'dist/app-v1.0.13.full.min.css'
      },
    },
    concat: {
      main: {
        files: {
          'temp/libcompat.js': [
             'vendor/jquery.compat/jquery-1.11.1.js',
             'vendor/json3/json-v3.3.2.js',
             'vendor/crypto/unsupportedBrowser.js'
          ],
          'temp/libnocompat.js': ['<%= dom_munger.data.libnocompatjs %>'],
          'temp/lib.js': ['<%= dom_munger.data.libjs %>'],
          'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'],
          'dist/avConfig-v1.0.13.js': ['avConfig.js']
        }
      }
    },
    ngAnnotate: {
      main: {
        files: {
        'temp/app.js':['temp/app.js'],
        'temp/lib.js': ['temp/lib.js'],
        'temp/libnocompat.js': ['temp/libnocompat.js'],
        'temp/libcompat.js': ['temp/libcompat.js']
        }
      }
    },
    uglify: {
      main: {
        /*options:{
          mangle: false,
          compress: false,
          beautify: true
        },*/
        files: {
          'dist/app-v1.0.13.min.js': 'temp/app.js',
          'dist/lib-v1.0.13.min.js': 'temp/lib.js',
          'dist/libnocompat-v1.0.13.min.js': 'temp/libnocompat.js',
          'dist/libcompat-v1.0.13.min.js': 'temp/libcompat.js'
        }
      }
    },
    htmlmin: {
      main: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: false,
          removeComments: false,
          removeEmptyAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        },
        files: {
          'dist/index.html': 'dist/index.html'
        }
      }
    },
    imagemin: {
      main:{
        files: [{
          expand: true, cwd:'dist/',
          src:['**/{*.png,*.jpg}'],
          dest: 'dist/'
        }]
      }
    },
    karma: {
      options: {
        frameworks: ['jasmine'],
        files: [  //this files data is also updated in the watch handler, if updated change there too
          '<%= dom_munger.data.libnocompatjs %>',
          '<%= dom_munger.data.libjs %>',
          'avConfig.js',
          '<%= dom_munger.data.appjs %>',
          '<%= ngtemplates.main.dest %>',
          'bower_components/angular-mocks/angular-mocks.js',
          createFolderGlobs('*-spec.js')
        ],
        logLevel:'ERROR',
        reporters:['mocha'],
        autoWatch: false, //watching is handled by grunt-contrib-watch
        singleRun: true
      },
      all_tests: {
        browsers: ['PhantomJS','Chrome','Firefox']
      },
      during_watch: {
        browsers: ['PhantomJS']
      },
    },
    protractor: {
      options: {
        configFile: "node_modules/protractor/referenceConf.js", // Default config file
        keepAlive: true, // If false, the grunt process stops when the test fails.
        noColor: false, // If true, protractor will not use colors in its output.
        args: {
        // Arguments passed to the command
      }
    },
    //your_target: {   // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
      all: {
      options: {
        configFile: "e2e.conf.js", // Target-specific config file
        args: {} // Target-specific arguments
      }
    },
  },

  });

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

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

    var tasksToRun = [];

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

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

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

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

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

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

  });

  grunt.loadNpmTasks('grunt-protractor-runner');
};
<commit_msg>bump version<commit_after>/*jslint node: true */
'use strict';

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

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

module.exports = function (grunt) {

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

  // Project configuration.
  grunt.initConfig({
    connect: {
      main: {
        options: {
          port: 9001
        }
      }
    },
    watch: {
      main: {
        options: {
            livereload: true,
            livereloadOnError: false,
            spawn: false
        },
        files: [createFolderGlobs(['*.js','*.less','*.html']),'!_SpecRunner.html','!.grunt'],
        tasks: [] //all the tasks are run dynamically during the watch event handler
      }
    },
    jshint: {
      main: {
        options: {
            jshintrc: '.jshintrc'
        },
        src: createFolderGlobs('*.js')
      }
    },
    clean: {
      before:{
        src:['dist','temp']
      },
      after: {
        src:['temp']
      }
    },
    less: {
      production: {
        options: {
        },
        files: {
          'temp/app.css': 'app.less'
        }
      }
    },
    autoprefixer: {
      options: {
        browsers: ['ie >= 8', 'ff > 4', 'last 8 versions']
      },
      main: {
        src: 'temp/app.css'
      }
    },
    ngtemplates: {
      main: {
        options: {
            module: pkg.name,
            htmlmin:'<%= htmlmin.main.options %>'
        },
        src: [createFolderGlobs('*.html'),'!index.html','!_SpecRunner.html'],
        dest: 'temp/templates.js'
      }
    },
    copy: {
      main: {
        files: [
          {src: ['img/**'], dest: 'dist/'},
          {src: ['temp_data/**'], dest: 'dist/'},
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/fonts/'
          },
          {
            expand: true,
            cwd: 'bower_components/bootstrap/fonts/',
            src: ['**'],
            dest: 'dist/fonts/'
          },
          {
            src: ['locales/**'],
            dest: 'dist/'
          },
//           {src: ['bower_components/font-awesome/fonts/**'], dest: 'dist/',filter:'isFile',expand:true}
          //{src: ['bower_components/angular-ui-utils/ui-utils-ieshiv.min.js'], dest: 'dist/'},
          //{src: ['bower_components/select2/*.png','bower_components/select2/*.gif'], dest:'dist/css/',flatten:true,expand:true},
          //{src: ['bower_components/angular-mocks/angular-mocks.js'], dest: 'dist/'}
        ]
      }
    },
    dom_munger:{
      read: {
        options: {
          read:[
            {selector:'script[class="libnocompat"]',attribute:'src',writeto:'libnocompatjs'},
            {selector:'script[class="lib"]',attribute:'src',writeto:'libjs'},
            {selector:'script[class="app"]',attribute:'src',writeto:'appjs'},
            {selector:'link[rel="stylesheet"][data-concat!="false"]',attribute:'href',writeto:'appcss'}
          ]
        },
        src: 'index.html'
      },
      update: {
        options: {
          remove: ['script[data-remove!="false"]','link[data-remove!="false"]'],
          append: [
            {selector:'body',html:'<!--[if lte IE 8]><script src="libcompat-v1.0.14.min.js"></script><![endif]--><!--[if gte IE 9]><script src="libnocompat-v1.0.14.min.js"></script><![endif]--><!--[if !IE]><!--><script src="libnocompat-v1.0.14.min.js"></script><!--<![endif]-->'},
            {selector:'body',html:'<script src="lib-v1.0.14.min.js"></script>'},
            {selector:'body',html:'<script src="avConfig-v1.0.14.js"></script>'},
            {selector:'body',html:'<script src="app-v1.0.14.min.js"></script>'},
            {selector:'head',html:'<link rel="stylesheet" href="app-v1.0.14.full.min.css">'}
          ]
        },
        src:'index.html',
        dest: 'dist/index.html'
      }
    },
    cssmin: {
      main: {
        src:['temp/app.css','<%= dom_munger.data.appcss %>'],
        dest:'dist/app-v1.0.14.full.min.css'
      },
    },
    concat: {
      main: {
        files: {
          'temp/libcompat.js': [
             'vendor/jquery.compat/jquery-1.11.1.js',
             'vendor/json3/json-v3.3.2.js',
             'vendor/crypto/unsupportedBrowser.js'
          ],
          'temp/libnocompat.js': ['<%= dom_munger.data.libnocompatjs %>'],
          'temp/lib.js': ['<%= dom_munger.data.libjs %>'],
          'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'],
          'dist/avConfig-v1.0.14.js': ['avConfig.js']
        }
      }
    },
    ngAnnotate: {
      main: {
        files: {
        'temp/app.js':['temp/app.js'],
        'temp/lib.js': ['temp/lib.js'],
        'temp/libnocompat.js': ['temp/libnocompat.js'],
        'temp/libcompat.js': ['temp/libcompat.js']
        }
      }
    },
    uglify: {
      main: {
        /*options:{
          mangle: false,
          compress: false,
          beautify: true
        },*/
        files: {
          'dist/app-v1.0.14.min.js': 'temp/app.js',
          'dist/lib-v1.0.14.min.js': 'temp/lib.js',
          'dist/libnocompat-v1.0.14.min.js': 'temp/libnocompat.js',
          'dist/libcompat-v1.0.14.min.js': 'temp/libcompat.js'
        }
      }
    },
    htmlmin: {
      main: {
        options: {
          collapseBooleanAttributes: true,
          collapseWhitespace: true,
          removeAttributeQuotes: false,
          removeComments: false,
          removeEmptyAttributes: true,
          removeScriptTypeAttributes: true,
          removeStyleLinkTypeAttributes: true
        },
        files: {
          'dist/index.html': 'dist/index.html'
        }
      }
    },
    imagemin: {
      main:{
        files: [{
          expand: true, cwd:'dist/',
          src:['**/{*.png,*.jpg}'],
          dest: 'dist/'
        }]
      }
    },
    karma: {
      options: {
        frameworks: ['jasmine'],
        files: [  //this files data is also updated in the watch handler, if updated change there too
          '<%= dom_munger.data.libnocompatjs %>',
          '<%= dom_munger.data.libjs %>',
          'avConfig.js',
          '<%= dom_munger.data.appjs %>',
          '<%= ngtemplates.main.dest %>',
          'bower_components/angular-mocks/angular-mocks.js',
          createFolderGlobs('*-spec.js')
        ],
        logLevel:'ERROR',
        reporters:['mocha'],
        autoWatch: false, //watching is handled by grunt-contrib-watch
        singleRun: true
      },
      all_tests: {
        browsers: ['PhantomJS','Chrome','Firefox']
      },
      during_watch: {
        browsers: ['PhantomJS']
      },
    },
    protractor: {
      options: {
        configFile: "node_modules/protractor/referenceConf.js", // Default config file
        keepAlive: true, // If false, the grunt process stops when the test fails.
        noColor: false, // If true, protractor will not use colors in its output.
        args: {
        // Arguments passed to the command
      }
    },
    //your_target: {   // Grunt requires at least one target to run so you can simply put 'all: {}' here too.
      all: {
      options: {
        configFile: "e2e.conf.js", // Target-specific config file
        args: {} // Target-specific arguments
      }
    },
  },

  });

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

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

    var tasksToRun = [];

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

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

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

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

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

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

  });

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


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

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

    // configurable paths
    var packageConfig = {
        src: 'src',
        libs: 'lib',
        dist: 'dist',
        name: 'igniteui'
    };

    grunt.initConfig({
        pkg: packageConfig,
        watch: {
            options: {
                nospawn: true,
                livereload: true
            },

            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '{.tmp,<%= pkg.src %>}/js/{,*/}*.js',
                    '<%= pkg.src %>/img/{,*/}*.{png,jpg,jpeg,gif,webp}'
                ]
            }
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, packageConfig.libs),
                            mountFolder(connect, packageConfig.src)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, packageConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        clean: {
            dist: ['.tmp', '<%= pkg.dist %>/*'],
            server: '.tmp'
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= pkg.src %>',
                    dest: '<%= pkg.dist %>/<%= pkg.name %>',
                    src: [
                        'toolbox.json',
                        'config/**',
                        'icons/**',
                        'plugins/**',
                        'css/**',
                        'js/**'
                    ]
                },
                ]
            }
        }
    });

    grunt.registerTask('server', function (target) {
        if (target === 'dist') {
            return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
        }

        grunt.task.run([
            'clean:server',
            'connect:livereload',
            'copy',
            'open',
            'watch'
        ]);
    });

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

    grunt.registerTask('default', [
        'build'
    ]);
};
<commit_msg>added autocomplete folder to grunt build<commit_after>'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

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

    // configurable paths
    var packageConfig = {
        src: 'src',
        libs: 'lib',
        dist: 'dist',
        name: 'igniteui'
    };

    grunt.initConfig({
        pkg: packageConfig,
        watch: {
            options: {
                nospawn: true,
                livereload: true
            },

            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '{.tmp,<%= pkg.src %>}/js/{,*/}*.js',
                    '<%= pkg.src %>/img/{,*/}*.{png,jpg,jpeg,gif,webp}'
                ]
            }
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, packageConfig.libs),
                            mountFolder(connect, packageConfig.src)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, packageConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        clean: {
            dist: ['.tmp', '<%= pkg.dist %>/*'],
            server: '.tmp'
        },
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= pkg.src %>',
                    dest: '<%= pkg.dist %>/<%= pkg.name %>',
                    src: [
                        'toolbox.json',
                        'config/**',
                        'icons/**',
                        'plugins/**',
                        'css/**',
                        'js/**',
                        'autocomplete/**'
                    ]
                },
                ]
            }
        }
    });

    grunt.registerTask('server', function (target) {
        if (target === 'dist') {
            return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
        }

        grunt.task.run([
            'clean:server',
            'connect:livereload',
            'copy',
            'open',
            'watch'
        ]);
    });

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

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


<commit_before>/*
 * Dry
 * http://github.com/assemble/dry
 * Convert your CSS to LESS and DRY up your stylesheets.
 *
 * Copyright (c) 2013 Assemble
 * MIT License
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

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

    nodeunit: {
      files: ['test/**/*_test.js'],
    },
    jshint: {
      options: { jshintrc: '.jshintrc' },
      files: ['lib/**/*.js', 'test/**/*.js', 'Gruntfile.js']
    },

    concat: {
      banner:
      dist: {
        src: [
          '<banner:meta.banner>',
          '<file_strip_banner:lib/dry.js>',
          'src/dry.js',
          'src/rules/*.js',
          'src/build/footer.js'
        ],
        dest: 'tasks/dry.js'
      }
    },

    uglify: {
      options: { mangle: false },
      plugin: {
        files: {
          'dist/<%= pkg.name %>-<%= pkg.version %>.js' : ['<%= concat.dest %>']
        }
      }
    },

    dry: {
      // options: {
      //   variables: true,
      //   nesting: true
      // },
      tests: {
        files: {
          'test/results/test.less': [ 'test/fixtures/bootstrap.css' ]
        }
      }
    },

    watch: {
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint']
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-recess');

  // Load local tasks.
  grunt.loadTasks('tasks');

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

  // Tests to be run.
  grunt.registerTask('test', [
    'nodeunit',
    'jshint',
    'dry:tests'
  ]);
};
<commit_msg>adding header.js to concat task for building dry library file<commit_after>/*
 * Dry
 * http://github.com/assemble/dry
 * Convert your CSS to LESS and DRY up your stylesheets.
 *
 * Copyright (c) 2013 Assemble
 * MIT License
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

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

    nodeunit: {
      files: ['test/**/*_test.js'],
    },
    jshint: {
      options: { jshintrc: '.jshintrc' },
      files: ['lib/**/*.js', 'test/**/*.js', 'Gruntfile.js']
    },

    concat: {
      banner:
      dist: {
        src: [
          '<banner:meta.banner>',
          '<file_strip_banner:lib/dry.js>',
          'src/build/header.js',
          'src/dry.js',
          'src/rules/*.js',
          'src/build/footer.js'
        ],
        dest: 'tasks/dry.js'
      }
    },

    uglify: {
      options: { mangle: false },
      plugin: {
        files: {
          'dist/<%= pkg.name %>-<%= pkg.version %>.js' : ['<%= concat.dest %>']
        }
      }
    },

    dry: {
      // options: {
      //   variables: true,
      //   nesting: true
      // },
      tests: {
        files: {
          'test/results/test.less': [ 'test/fixtures/bootstrap.css' ]
        }
      }
    },

    watch: {
      test: {
        files: '<%= jshint.test.src %>',
        tasks: ['jshint']
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-recess');

  // Load local tasks.
  grunt.loadTasks('tasks');

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

  // Tests to be run.
  grunt.registerTask('test', [
    'nodeunit',
    'jshint',
    'dry:tests'
  ]);
};
<|endoftext|>


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

module.exports = function(grunt) {

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

    // JSHint to review JS code before build
    jshint: {
      files: [
        '<%= pkg.src_paths.js %>**/*.js',
      ],
      options: {
        // options here to override JSHint defaults
        globals: {
          jQuery: true,
          console: true,
          module: true,
          alert: true,
          document: true,
          window:true
        }
      }
    },

    // Pre-minify angular application
    ngAnnotate: {
      options: {
        remove: false, // Do not remove any annotations
        singleQuotes: true,
      },
      dist: {
        files: {
          '<%= pkg.dest_paths.js %>ngproject.js': ['<%= pkg.src_paths.js %>**/*.js']
        },
      },
    },

    // Concatenation of JS
    concat: {
      options: {
        separator: ';;\n\n'
      },
      dist: {
        src: [
          '<%= pkg.project_paths.bower_folder %>jquery/dist/jquery.min.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.accordion.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.alert.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.offcanvas.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.tab.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.reveal.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.topbar.js',
          '<%= pkg.project_paths.bower_folder %>notifyjs/dist/notify-combined.min.js',
          '<%= pkg.project_paths.bower_folder %>uri.js/src/URI.min.js',
          '<%= pkg.project_paths.bower_folder %>angular/angular.min.js',
          '<%= pkg.project_paths.bower_folder %>satellizer/satellizer.min.js',
          '<%= pkg.dest_paths.js %>ngproject.js',
        ],
        dest: '<%= pkg.dest_paths.js %>app.js'
      },
    },

    // Minification of JS
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          '<%= pkg.dest_paths.js %>app.js': ['<%= concat.dist.dest %>'],
          //'<%= pkg.dest_paths.js %>base.js': ['<%= concat.dist.dest %>'],
        }
      },
      dev: {
        files: {
          '<%= pkg.dest_paths.js %>modernizr.min.js': ['<%= pkg.project_paths.bower_folder %>modernizr/modernizr.js']
        }
      }
    },

    // CSSmin to minify CSS on production
    cssmin: {
        minify:{
        expand: true,
        cwd: '<%= pkg.dest_paths.css %>',
        src: ['*.css',],
        dest: '<%= pkg.dest_paths.css %>',
        ext: '.css'
      }
    },

    // Compass to handle CSS compilation and concatanation
    compass: {
      dist: {
        options: {
          config: "config.rb"
        }
      }
    },

    // Copy fonts and images to build output directory
    copy: {
      dist: {
        files: [
          // Fonts
          {
            expand: true,
            cwd: '<%= pkg.src_paths.fonts %>',
            src: ['**/*', '!**/*.json'],
            dest: '<%= pkg.dest_paths.fonts %>'
          },
          // Images
          {
            expand: true,
            cwd: '<%= pkg.src_paths.images %>',
            src: '**/*',
            dest: '<%= pkg.dest_paths.images %>'
          }
        ]
      }
    },

    // Watch task to compile files live
    watch: {
      js:{
        files: ['<%= jshint.files %>'],
        tasks: ['jshint', 'concat']
      },
      scss: {
        files: ['<%= pkg.src_paths.scss %>**/**/*.scss'],
        tasks: ['compass']
      },
      images: {
        files: [
          '<%= pkg.src_paths.images %>**/*.jpg',
          '<%= pkg.src_paths.images %>**/*.gif',
          '<%= pkg.src_paths.images %>**/*.png'
        ],
        tasks: ['copy']
      },
      fonts: {
        files: [
          '<%= pkg.src_paths.fonts %>**/*.eot',
          '<%= pkg.src_paths.fonts %>**/*.woff',
          '<%= pkg.src_paths.fonts %>**/*.svg',
          '<%= pkg.src_paths.fonts %>**/*.ttf'
        ],
        tasks: ['copy']
      }
    },
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-ng-annotate');

  grunt.registerTask('default', 'build');
  grunt.registerTask('testangular', ['ngAnnotate:dist']);
  //grunt.registerTask('build', ['jshint', 'concat', 'uglify:dev', 'compass', 'copy']);
  grunt.registerTask('dist', ['jshint', 'ngAnnotate:dist', 'concat:dist', 'uglify', 'compass', 'cssmin', 'copy']);
};
<commit_msg>Added animate to the gruntfile<commit_after>// Copyright 2014 Clione Software and Havas Worldwide London
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.

module.exports = function(grunt) {

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

    // JSHint to review JS code before build
    jshint: {
      files: [
        '<%= pkg.src_paths.js %>**/*.js',
      ],
      options: {
        // options here to override JSHint defaults
        globals: {
          jQuery: true,
          console: true,
          module: true,
          alert: true,
          document: true,
          window:true
        }
      }
    },

    // Pre-minify angular application
    ngAnnotate: {
      options: {
        remove: false, // Do not remove any annotations
        singleQuotes: true,
      },
      dist: {
        files: {
          '<%= pkg.dest_paths.js %>ngproject.js': ['<%= pkg.src_paths.js %>**/*.js']
        },
      },
    },

    // Concatenation of JS
    concat: {
      options: {
        separator: ';;\n\n'
      },
      dist: {
        src: [
          '<%= pkg.project_paths.bower_folder %>jquery/dist/jquery.min.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.accordion.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.alert.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.offcanvas.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.tab.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.reveal.js',
          '<%= pkg.project_paths.bower_folder %>foundation/js/foundation/foundation.topbar.js',
          '<%= pkg.project_paths.bower_folder %>notifyjs/dist/notify-combined.min.js',
          '<%= pkg.project_paths.bower_folder %>uri.js/src/URI.min.js',
          '<%= pkg.project_paths.bower_folder %>angular/angular.min.js',
          '<%= pkg.project_paths.bower_folder %>satellizer/satellizer.min.js',
          '<%= pkg.project_paths.bower_folder %>angular-animate/angular-animate.min.js',
          '<%= pkg.dest_paths.js %>ngproject.js',
        ],
        dest: '<%= pkg.dest_paths.js %>app.js'
      },
    },

    // Minification of JS
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          '<%= pkg.dest_paths.js %>app.js': ['<%= concat.dist.dest %>'],
          //'<%= pkg.dest_paths.js %>base.js': ['<%= concat.dist.dest %>'],
        }
      },
      dev: {
        files: {
          '<%= pkg.dest_paths.js %>modernizr.min.js': ['<%= pkg.project_paths.bower_folder %>modernizr/modernizr.js']
        }
      }
    },

    // CSSmin to minify CSS on production
    cssmin: {
        minify:{
        expand: true,
        cwd: '<%= pkg.dest_paths.css %>',
        src: ['*.css',],
        dest: '<%= pkg.dest_paths.css %>',
        ext: '.css'
      }
    },

    // Compass to handle CSS compilation and concatanation
    compass: {
      dist: {
        options: {
          config: "config.rb"
        }
      }
    },

    // Copy fonts and images to build output directory
    copy: {
      dist: {
        files: [
          // Fonts
          {
            expand: true,
            cwd: '<%= pkg.src_paths.fonts %>',
            src: ['**/*', '!**/*.json'],
            dest: '<%= pkg.dest_paths.fonts %>'
          },
          // Images
          {
            expand: true,
            cwd: '<%= pkg.src_paths.images %>',
            src: '**/*',
            dest: '<%= pkg.dest_paths.images %>'
          }
        ]
      }
    },

    // Watch task to compile files live
    watch: {
      js:{
        files: ['<%= jshint.files %>'],
        tasks: ['jshint', 'concat']
      },
      scss: {
        files: ['<%= pkg.src_paths.scss %>**/**/*.scss'],
        tasks: ['compass']
      },
      images: {
        files: [
          '<%= pkg.src_paths.images %>**/*.jpg',
          '<%= pkg.src_paths.images %>**/*.gif',
          '<%= pkg.src_paths.images %>**/*.png'
        ],
        tasks: ['copy']
      },
      fonts: {
        files: [
          '<%= pkg.src_paths.fonts %>**/*.eot',
          '<%= pkg.src_paths.fonts %>**/*.woff',
          '<%= pkg.src_paths.fonts %>**/*.svg',
          '<%= pkg.src_paths.fonts %>**/*.ttf'
        ],
        tasks: ['copy']
      }
    },
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-ng-annotate');

  grunt.registerTask('default', 'build');
  grunt.registerTask('testangular', ['ngAnnotate:dist']);
  //grunt.registerTask('build', ['jshint', 'concat', 'uglify:dev', 'compass', 'copy']);
  grunt.registerTask('dist', ['jshint', 'ngAnnotate:dist', 'concat:dist', 'uglify', 'compass', 'cssmin', 'copy']);
};
<|endoftext|>