<commit_before>module.exports = function(grunt) {
    grunt.loadNpmTasks("grunt-ts");

    function typescriptConfig(watch) {
        return {
            // The source TypeScript files, http://gruntjs.com/configuring-tasks#files
            src: [
                "src/main/resources/META-INF/public-web-resources/ts/infrastructure/*.ts",
                "src/main/resources/META-INF/public-web-resources/ts/tasks/*.ts"
            ],
            // The source html files, https://github.com/grunt-ts/grunt-ts#html-2-typescript-support
            html: [
                "src/main/resources/META-INF/public-web-resources/ts/infrastructure/*.tpl.html",
                "src/main/resources/META-INF/public-web-resources/ts/tasks/*.tpl.html"
            ],
            // If specified, generate this file that to can use for reference management
            reference: "src/main/resources/ts/_reference.ts",
            // If specified, generate an out.js file which is the merged js file
            out: 'src/main/resources/META-INF/public-web-resources/js/app/app.js',
            // If specified, the generate JavaScript files are placed here. Only works if out is not specified
//                outDir: 'src/main/resources/META-INF/public-web-resources/js',
            // If specified, watches this directory for changes, and re-runs the current target
            watch: watch ? 'src/main/resources/META-INF/public-web-resources/ts' : undefined,
            // Use to override the default options, http://gruntjs.com/configuring-tasks#options
            options: {
                // 'es3' (default) | 'es5'
                target: 'es3',
                // 'amd' (default) | 'commonjs'
                module: 'commonjs',
                // true (default) | false
                sourceMap: true,
                // true | false (default)
                declaration: false,
                // true (default) | false
                removeComments: true
            }
        };
    }

    grunt.initConfig({
        ts: {
            build: typescriptConfig(false),
            watch: typescriptConfig(true)
        }
    });
    grunt.registerTask("default", ["ts:build"]);
};
<commit_msg>fixed build<commit_after>module.exports = function(grunt) {
    grunt.loadNpmTasks("grunt-ts");

    function typescriptConfig(watch) {
        return {
            // The source TypeScript files, http://gruntjs.com/configuring-tasks#files
            src: [
                "src/main/resources/META-INF/public-web-resources/ts/infrastructure/*.ts",
                "src/main/resources/META-INF/public-web-resources/ts/tasks/*.ts"
            ],
            // The source html files, https://github.com/grunt-ts/grunt-ts#html-2-typescript-support
            html: [
                "src/main/resources/META-INF/public-web-resources/ts/infrastructure/*.tpl.html",
                "src/main/resources/META-INF/public-web-resources/ts/tasks/*.tpl.html"
            ],
            // If specified, generate this file that to can use for reference management
            reference: "src/main/resources/META-INF/public-web-resources/ts/_reference.ts",
            // If specified, generate an out.js file which is the merged js file
            out: 'src/main/resources/META-INF/public-web-resources/js/app/app.js',
            // If specified, the generate JavaScript files are placed here. Only works if out is not specified
//                outDir: 'src/main/resources/META-INF/public-web-resources/js',
            // If specified, watches this directory for changes, and re-runs the current target
            watch: watch ? 'src/main/resources/META-INF/public-web-resources/ts' : undefined,
            // Use to override the default options, http://gruntjs.com/configuring-tasks#options
            options: {
                // 'es3' (default) | 'es5'
                target: 'es3',
                // 'amd' (default) | 'commonjs'
                module: 'commonjs',
                // true (default) | false
                sourceMap: true,
                // true | false (default)
                declaration: false,
                // true (default) | false
                removeComments: true
            }
        };
    }

    grunt.initConfig({
        ts: {
            build: typescriptConfig(false),
            watch: typescriptConfig(true)
        }
    });
    grunt.registerTask("default", ["ts:build"]);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  if (grunt.option('timer') || false) {
    // shows how long grunt tasks take ~ https://github.com/sindresorhus/time-grunt
    require('time-grunt')(grunt);
  }

  // Initialize global configuration variables.
  var config = grunt.file.readJSON('Gruntconfig.json');
  grunt.initConfig({
    config: config
  });

  // Load all included tasks.
  grunt.loadTasks(__dirname + '/tasks');

  // Define the default task to fully build and configure the project.
  var tasksDefault = [
    'validate',
    'newer:drushmake:default',
    'symlink:profiles',
    'symlink:modules',
    'symlink:themes',
    'clean:sites',
    'symlink:sites',
    'mkdir:files',
    'copy:static'
  ];
  if (grunt.config.get(['composer', 'install'])) {
    tasksDefault.unshift('composer:install');
  }
  if (grunt.task.exists('compile-theme')) {
    tasksDefault.push('compile-theme');
  }
  if (grunt.config.get('behat')) {
   // tasksDefault.push('behat');
  }
  grunt.registerTask('default', tasksDefault);

};
<commit_msg>Minor code clean up for PR.<commit_after>module.exports = function(grunt) {
  if (grunt.option('timer')) {
    // shows how long grunt tasks take ~ https://github.com/sindresorhus/time-grunt
    require('time-grunt')(grunt);
  }

  // Initialize global configuration variables.
  var config = grunt.file.readJSON('Gruntconfig.json');
  grunt.initConfig({
    config: config
  });

  // Load all included tasks.
  grunt.loadTasks(__dirname + '/tasks');

  // Define the default task to fully build and configure the project.
  var tasksDefault = [
    'validate',
    'newer:drushmake:default',
    'symlink:profiles',
    'symlink:modules',
    'symlink:themes',
    'clean:sites',
    'symlink:sites',
    'mkdir:files',
    'copy:static'
  ];
  if (grunt.config.get(['composer', 'install'])) {
    tasksDefault.unshift('composer:install');
  }
  if (grunt.task.exists('compile-theme')) {
    tasksDefault.push('compile-theme');
  }
  if (grunt.config.get('behat')) {
   // tasksDefault.push('behat');
  }
  grunt.registerTask('default', tasksDefault);

};
<|endoftext|>


<commit_before>'use strict';

var paths = {
    js: ['*.js', 'server/**/*.js', 'public/**/*.js', 'test/**/*.js', '!test/coverage/**', '!public/system/lib/**', 'packages/**/*.js', '!packages/**/node_modules/**'],
    html: ['public/**/views/**', 'server/views/**', 'packages/**/public/**/views/**', 'packages/**/server/views/**'],
    css: ['public/**/css/*.css', '!public/system/lib/**', 'packages/**/public/**/css/*.css']
};

module.exports = function(grunt) {

    if (process.env.NODE_ENV !== 'production') {
        require('time-grunt')(grunt);
    }

    // Project Configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        assets: grunt.file.readJSON('server/config/assets.json'),
        clean: ['public/build'],
        watch: {
            js: {
                files: paths.js,
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            html: {
                files: paths.html,
                options: {
                    livereload: true
                }
            },
            css: {
                files: paths.css,
                tasks: ['csslint'],
                options: {
                    livereload: true
                }
            }
        },
        jshint: {
            all: {
                src: paths.js,
                options: {
                    jshintrc: true
                }
            }
        },
        uglify: {
            core: {
                options: {
                    mangle: false
                },
                files: '<%= assets.core.js %>'
            }
        },
        csslint: {
            options: {
                csslintrc: '.csslintrc'
            },
            src: paths.css
        },
        cssmin: {
            core: {
                files: '<%= assets.core.css %>'
            }
        },
        nodemon: {
            dev: {
                script: 'server.js',
                options: {
                    args: [],
                    ignore: ['public/**', 'node_modules/**'],
                    ext: 'js,html',
                    nodeArgs: ['--debug'],
                    delayTime: 1,
                    env: {
                        PORT: require('./server/config/config').port
                    },
                    cwd: __dirname
                }
            }
        },
        concurrent: {
            tasks: ['nodemon', 'watch'],
            options: {
                logConcurrentOutput: true
            }
        },
        mochaTest: {
            options: {
                reporter: 'spec',
                require: 'server.js'
            },
            src: ['test/mocha/**/*.js', 'packages/**/test/mocha/**/*.js']
        },
        env: {
            test: {
                NODE_ENV: 'test'
            }
        },
        karma: {
            unit: {
                configFile: 'test/karma/karma.conf.js'
            }
        }
    });

    //Load NPM tasks
    require('load-grunt-tasks')(grunt);

    //Default task(s).
    if (process.env.NODE_ENV === 'production') {
        grunt.registerTask('default', ['clean','cssmin', 'uglify', 'concurrent']);
    } else {
        grunt.registerTask('default', ['clean','jshint', 'csslint', 'concurrent']);
    }

    //Test task.
    grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);

    // For Heroku users only.
    // Docs: https://github.com/linnovate/mean/wiki/Deploying-on-Heroku
    grunt.registerTask('heroku:production', ['cssmin', 'uglify']);
};
<commit_msg>Add a Grunt task to seed the default cities<commit_after>'use strict';

var paths = {
    js: ['*.js', 'server/**/*.js', 'public/**/*.js', 'test/**/*.js', '!test/coverage/**', '!public/system/lib/**', 'packages/**/*.js', '!packages/**/node_modules/**'],
    html: ['public/**/views/**', 'server/views/**', 'packages/**/public/**/views/**', 'packages/**/server/views/**'],
    css: ['public/**/css/*.css', '!public/system/lib/**', 'packages/**/public/**/css/*.css']
};

module.exports = function(grunt) {

    if (process.env.NODE_ENV !== 'production') {
        require('time-grunt')(grunt);
    }

    // Project Configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        assets: grunt.file.readJSON('server/config/assets.json'),
        clean: ['public/build'],
        watch: {
            js: {
                files: paths.js,
                tasks: ['jshint'],
                options: {
                    livereload: true
                }
            },
            html: {
                files: paths.html,
                options: {
                    livereload: true
                }
            },
            css: {
                files: paths.css,
                tasks: ['csslint'],
                options: {
                    livereload: true
                }
            }
        },
        jshint: {
            all: {
                src: paths.js,
                options: {
                    jshintrc: true
                }
            }
        },
        uglify: {
            core: {
                options: {
                    mangle: false
                },
                files: '<%= assets.core.js %>'
            }
        },
        csslint: {
            options: {
                csslintrc: '.csslintrc'
            },
            src: paths.css
        },
        cssmin: {
            core: {
                files: '<%= assets.core.css %>'
            }
        },
        nodemon: {
            dev: {
                script: 'server.js',
                options: {
                    args: [],
                    ignore: ['public/**', 'node_modules/**'],
                    ext: 'js,html',
                    nodeArgs: ['--debug'],
                    delayTime: 1,
                    env: {
                        PORT: require('./server/config/config').port
                    },
                    cwd: __dirname
                }
            }
        },
        concurrent: {
            tasks: ['nodemon', 'watch'],
            options: {
                logConcurrentOutput: true
            }
        },
        mochaTest: {
            options: {
                reporter: 'spec',
                require: 'server.js'
            },
            src: ['test/mocha/**/*.js', 'packages/**/test/mocha/**/*.js']
        },
        env: {
            test: {
                NODE_ENV: 'test'
            }
        },
        karma: {
            unit: {
                configFile: 'test/karma/karma.conf.js'
            }
        }
    });

    //Load NPM tasks
    require('load-grunt-tasks')(grunt);

    //Default task(s).
    if (process.env.NODE_ENV === 'production') {
        grunt.registerTask('default', ['clean','cssmin', 'uglify', 'concurrent']);
    } else {
        grunt.registerTask('default', ['clean','jshint', 'csslint', 'concurrent']);
    }

    //Test task.
    grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);

    // For Heroku users only.
    // Docs: https://github.com/linnovate/mean/wiki/Deploying-on-Heroku
    grunt.registerTask('heroku:production', ['cssmin', 'uglify']);

    grunt.registerTask('cities', 'seeds with few cities', function(n,e,i,a) {
        var config = require('./server/config/config');
        var mongoose = require('mongoose');
        var connection = mongoose.connection;
        var City = require(__dirname + '/packages/atmos/server/models/city');

        var _ = require('lodash');

        var done = this.async();
        mongoose.connect(config.db);

        var requiredCities = [
            {'name': 'paris'},
            {'name': 'marseille'},
            {'name': 'lyon'},
            {'name': 'toulouse'},
            {'name': 'nice'},
            {'name': 'nantes'},
            {'name': 'strasbourg'},
            {'name': 'montpellier'},
            {'name': 'bordeaux'},
            {'name': 'lille'}
        ];

        var citiesToAdd = [];

        connection.on('open', function () {

            City.find().exec(function(err, fetchedCities) {
                if (err) {
                    console.log(err);
                    done(false);
                    return;
                }

                _.each(requiredCities, function(requiredCity) {
                    if (!_.where(fetchedCities, requiredCity).length){
                        requiredCity.records = [{ atmo: 2 }, { atmo: 2 }];
                        citiesToAdd.push(requiredCity);
                    }
                });

                console.log('It adds the following cities :');
                console.log(citiesToAdd);

                if (citiesToAdd.length) {
                    City.create(citiesToAdd, function (err) {
                        if (err) {
                            console.log(err);
                            done(false);
                            return;
                        }

                        console.log('success!');
                        // close the database after 'city' is saved.
                        connection.close();
                        done(true);
                    });
                } else {
                    console.log('nothing to do');
                    done(true);
                }
            });
        });
    });
};
<|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'
          ]
        }
      },
      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',
            'vendor/skycons/skycons.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:dist',
    'uglify:dist',
    'version'
  ]);
  grunt.registerTask('dev', [
    'watch'
  ]);

};
<commit_msg>use sass source maps<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: true
        },
        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',
            'vendor/skycons/skycons.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:dist',
    'uglify:dist',
    'version'
  ]);
  grunt.registerTask('dev', [
    'watch'
  ]);

};
<|endoftext|>


<commit_before>module.exports = function ( grunt ) {
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.initConfig({
		jshint: {
			src: ['src/**/*.js', '!src/js/dest/*.js'],
			gruntfile: ['Gruntfile.js'],
			options: {
				curly:  true,
				immed:  true,
				newcap: true,
				noarg:  true,
				sub:    true,
				boss:   true,
				eqnull: true,
				node:   true,
				undef:  true,
				globals: {
					_:       false,
					jQuery:  false,
					angular: false,
					moment:  false,
					console: false,
					$:       false
				}
			}
		},
		uglify: {
			my_target: {
		      	files: {
		        	'src/js/dest/output.min.js': ['src/js/dest/built.js']
		      	}
		    }
		},
		concat: {
		    options: {
		    	separator: ';',
		    },
		    dist: {
				src: ['src/**/*.js', 'node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js'],
		      	dest: 'src/js/dest/built.js',
		    },
		 }
	});
	grunt.registerTask('checkjs', ['jshint']);
	grunt.registerTask('minify', ['uglify']);
	grunt.registerTask('makeonefile', ['concat']);
	grunt.registerTask('makejs', ['concat', 'uglify']);
	grunt.registerTask('default', ['jshint', 'uglify']);
};<commit_msg>io is a okey global varible<commit_after>module.exports = function ( grunt ) {
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.initConfig({
		jshint: {
			src: ['src/**/*.js', '!src/js/dest/*.js'],
			gruntfile: ['Gruntfile.js'],
			options: {
				curly:  true,
				immed:  true,
				newcap: true,
				noarg:  true,
				sub:    true,
				boss:   true,
				eqnull: true,
				node:   true,
				undef:  true,
				globals: {
					_:       false,
					jQuery:  false,
					angular: false,
					moment:  false,
					console: false,
					$:       false,
					io:      false
				}
			}
		},
		uglify: {
			my_target: {
		      	files: {
		        	'src/js/dest/output.min.js': ['src/js/dest/built.js']
		      	}
		    }
		},
		concat: {
		    options: {
		    	separator: ';',
		    },
		    dist: {
				src: ['src/**/*.js', 'node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js'],
		      	dest: 'src/js/dest/built.js',
		    },
		 }
	});
	grunt.registerTask('checkjs', ['jshint']);
	grunt.registerTask('minify', ['uglify']);
	grunt.registerTask('makeonefile', ['concat']);
	grunt.registerTask('makejs', ['concat', 'uglify']);
	grunt.registerTask('default', ['jshint', 'uglify']);
};<|endoftext|>


<commit_before>module.exports = function(grunt) {
	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		jshint: {
			boot: {
				// define the files to lint
				src: ['boot/lib/**/*.js', '!boot/lib/**/*.min.js'],
				options: {
					globals: {
						jQuery: true,
						console: true,
						module: false
					}
				}
			},
			usr: {
				src: ['usr/**/*.js', '!usr/**/*.min.js'],
				options: {
					globals: {
						jQuery: true,
						console: true,
						module: false
					}
				}
			}
		},
		clean: {
			tmp: {
				src: ['tmp/**/*']
			}
		},
		convert: {
			ui: {
				files: [
					{
						expand: true,
						src: 'boot/uis/**/*.xml',
						dest: 'dist/',
						ext: '.json'
					}
				]
			},
			applications: {
				options: {
					explicitRoot: false,
					mergeAttrs: true
				},
				files: [
					{
						expand: true,
						src: 'usr/share/applications/*.xml',
						dest: 'dist/',
						ext: '.json'
					}
				]
			},
			categories: {
				options: {
					explicitRoot: false,
					mergeAttrs: true
				},
				files: [
					{
						expand: true,
						src: 'usr/share/categories/*.xml',
						dest: 'dist/',
						ext: '.json'
					}
				]
			}
		},
		uglify: {
			boot: {
				options: {
					banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
				},
				files: [
					{
						src: ['build/boot/boot.min.js'],
						dest: 'build/boot/boot.min.js'
					}
				]
			}
		},
		copy: {
			//Build
			build: {
				files: [
					{src: 'boot/includes/index-built.html', dest: 'build/index.php'},
					{
						expand: true,
						dot: true,
						src: ['boot/**', 'etc/**', 'home/**', 'lib/**', 'sbin/**', 'usr/**', 'var/**'],
						dest: 'build/'
					},
					{src: [/*'index.php',*/ '.htaccess'], dest: 'build/'}
				]
			},

			//Standalone
			standalone: {
				files: [
					{src: ['boot/includes/index-standalone.html'], dest: 'build/index.html'},
					{
						expand: true,
						dot: true,
						src: ['boot/uis/**', 'usr/**', 'etc/ske1/**', 'etc/uis.json'],
						dest: 'build/'
					}
				]
			}
		},
		watch: {
			files: ['<%= jshint.files %>'],
			tasks: ['jshint']
		}
	});

	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	//grunt.loadNpmTasks('grunt-contrib-qunit');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-convert');

	grunt.registerTask('gen-boot', 'Concatenate boot files.', function() {
		var bootIncludes = grunt.file.readJSON('etc/boot-includes.json'), bootIncludesList = [];
		for (var filepath in bootIncludes) {
			bootIncludesList.push('./'+filepath);
		}

		grunt.config('concat.boot', {
			options: {
				separator: ';\n'
			},
			files: {
				'build/boot/boot.min.js': bootIncludesList
			}
		});

		grunt.task.run('concat:boot');
		grunt.task.run('uglify:boot');
	});

	grunt.registerTask('gen-ui', 'Concatenate UI files.', function() {
		var uisConcat = {}, uisJsUglify = [], uisCssMinify = [];
		if (grunt.file.isDir('dist/boot/uis')) {
			var uisList = grunt.file.expand({
				cwd: 'dist/boot/uis/',
				filter: 'isDirectory'
			}, '*');

			for (var i = 0; i < uisList.length; i++) {
				var uiName = uisList[i];
				var rootPath = 'dist/boot/uis/'+uiName;

				if (!grunt.file.exists(rootPath+'/config.json')) {
					continue;
				}

				var uiMetadata = grunt.file.readJSON(rootPath+'/config.json');

				var deps = uiMetadata.userinterface.includes[0].file,
					jsDepsList = [],
					cssDepsList = [];
				for (var j = 0; j < deps.length; j++) {
					var filePath = deps[j].path[0];

					if (/\.js$/.test(filePath)) {
						jsDepsList.push('./'+filePath);
					} else if (/\.css$/.test(filePath)) {
						cssDepsList.push('./'+filePath);
					}
				}

				jsDepsList.push('boot/uis/'+uiName+'/index.js');

				var jsPath = 'build/boot/uis/'+uiName+'/main.min.js',
					cssPath = 'build/boot/uis/'+uiName+'/style.min.css';

				uisConcat[jsPath] = jsDepsList;
				uisConcat[cssPath] = cssDepsList;

				uisJsUglify.push({
					src: jsPath,
					dest: jsPath
				});
				uisCssMinify.push({
					src: cssPath,
					dest: cssPath
				});
			}
		}

		grunt.config('concat.ui', {
			options: {
				separator: ';\n'
			},
			files: uisConcat
		});
		grunt.config('uglify.ui', {
			files: uisJsUglify
		});
		grunt.config('cssmin.ui', {
			files: uisCssMinify
		});

		grunt.task.run('concat:ui');
		grunt.task.run('uglify:ui');
		grunt.task.run('cssmin:ui');
	});

	grunt.registerTask('gen-theme', 'Concatenate theme files.', function() {
		var themesConcat = {}, themesMinify = [];
		var themesList = grunt.file.expand({
			cwd: 'usr/share/css/themes/',
			filter: 'isDirectory'
		}, '*');
		for (var i = 0; i < themesList.length; i++) {
			var themeName = themesList[i];
			var rootPath = 'usr/share/css/themes/'+themeName;

			var basicFiles = grunt.file.expand(rootPath+'/*.css');

			var supportedUis = grunt.file.expand({
				cwd: rootPath,
				filter: 'isDirectory'
			}, '*');

			for (var j = 0; j < supportedUis.length; j++) {
				var uiName = supportedUis[j];

				var uisFiles = grunt.file.expand(rootPath+'/'+uiName+'/*.css');

				var cssPath = 'build/usr/share/css/themes/'+themeName+'/'+uiName+'/main.min.css';

				themesConcat[cssPath] = basicFiles.concat(uisFiles);
				themesMinify.push({
					src: cssPath,
					dest: cssPath
				});
			}
		}

		grunt.config('concat.theme', {
			options: {
				process: function (src, filepath) {
					return '/*! ' + filepath + ' */\n' + src;
				}
			},
			files: themesConcat
		});
		grunt.config('cssmin.theme', {
			files: themesMinify
		});

		grunt.task.run('concat:theme');
		grunt.task.run('cssmin:theme');
	});

	grunt.registerTask('gen-launcher', 'Concatenate launchers.', function(type) {
		type = (type || 'applications');
		var rootPath = 'dist/usr/share/'+type+'/';

		var itemsList = grunt.file.expand({
			cwd: rootPath
		}, '*.json');

		var items = {};

		for (var i = 0; i < itemsList.length; i++) {
			var itemName = itemsList[i];
			var itemPath = rootPath+'/'+itemName;

			var itemData = grunt.file.readJSON(itemPath)['attribute'], item = {};
			for (var j = 0; j < itemData.length; j++) {
				var attr = itemData[j],
					attrName = (attr.name || [])[0],
					attrLang = (attr.lang || [])[0],
					attrValue = (attr.value || [])[0];

				if (attrLang) {
					if (!item[attrLang]) {
						item[attrLang] = {};
					}

					item[attrLang][attrName] = attrValue;
				} else {
					item[attrName] = attrValue;
				}
			}

			if (!item.name) {
				item.name = itemName.substr(0, itemName.lastIndexOf('.'));
			}

			items[item.name] = item;
			grunt.file.write(itemPath, JSON.stringify(item));
		}

		grunt.file.write('build/usr/share/'+type+'.json', JSON.stringify(items));
	});

	grunt.registerTask('gen-icon', 'Build icon themes index files.', function() {
		var rootPath = 'usr/share/icons/';

		var items = grunt.file.expand({
			cwd: rootPath
		}, '**/*.{png,svg}');

		grunt.file.write('build/usr/share/icons/index.json', JSON.stringify(items));
	});

	grunt.registerTask('convert-ui', 'Convert UIs files.', [
		'convert:ui'
	]);

	grunt.registerTask('convert-launcher', 'Convert launchers.', [
		'convert:categories',
		'convert:applications',
		'gen-launcher:categories',
		'gen-launcher:applications'
	]);

	grunt.registerTask('standalone', 'Build a standalone version of the web desktop.', [
		'clean',
		'gen-boot',
		'gen-ui',
		'gen-theme',
		'gen-icon',
		'copy:standalone',
		'convert-ui',
		'convert-launcher'
	]);

	grunt.registerTask('build', 'Build the web desktop.', [
		'clean',
		'gen-boot',
		'gen-ui',
		'gen-theme',
		'copy:build'

		//Useless tasks here: the webos API is used instead for now
		//'convert-ui',
		//'convert-launcher',
		//'gen-icon'
	]);

	//TODO: outdated
	/*grunt.registerTask('quickbuild', 'Quickly re-build the web desktop.', [
		//'jshint',
		//'clean',
		'concat:build',
		'concat:uis',
		//'concat:themes',
		//'copy:index',
		//'copy:uis',
		//'copy:usr',
		//'copy:ske1',
	]);*/

	grunt.registerTask('default', ['build']);
};<commit_msg>Adds README.md and COPYING to build folder.<commit_after>module.exports = function(grunt) {
	// Project configuration.
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		jshint: {
			boot: {
				// define the files to lint
				src: ['boot/lib/**/*.js', '!boot/lib/**/*.min.js'],
				options: {
					globals: {
						jQuery: true,
						console: true,
						module: false
					}
				}
			},
			usr: {
				src: ['usr/**/*.js', '!usr/**/*.min.js'],
				options: {
					globals: {
						jQuery: true,
						console: true,
						module: false
					}
				}
			}
		},
		clean: {
			tmp: {
				src: ['tmp/**/*']
			}
		},
		convert: {
			ui: {
				files: [
					{
						expand: true,
						src: 'boot/uis/**/*.xml',
						dest: 'dist/',
						ext: '.json'
					}
				]
			},
			applications: {
				options: {
					explicitRoot: false,
					mergeAttrs: true
				},
				files: [
					{
						expand: true,
						src: 'usr/share/applications/*.xml',
						dest: 'dist/',
						ext: '.json'
					}
				]
			},
			categories: {
				options: {
					explicitRoot: false,
					mergeAttrs: true
				},
				files: [
					{
						expand: true,
						src: 'usr/share/categories/*.xml',
						dest: 'dist/',
						ext: '.json'
					}
				]
			}
		},
		uglify: {
			boot: {
				options: {
					banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
				},
				files: [
					{
						src: ['build/boot/boot.min.js'],
						dest: 'build/boot/boot.min.js'
					}
				]
			}
		},
		copy: {
			//Build
			build: {
				files: [
					{src: 'boot/includes/index-built.html', dest: 'build/index.php'},
					{
						expand: true,
						dot: true,
						src: ['boot/**', 'etc/**', 'home/**', 'lib/**', 'sbin/**', 'usr/**', 'var/**'],
						dest: 'build/'
					},
					{src: [/*'index.php',*/ 'README.md', 'COPYING', '.htaccess'], dest: 'build/'}
				]
			},

			//Standalone
			standalone: {
				files: [
					{src: ['boot/includes/index-standalone.html'], dest: 'build/index.html'},
					{
						expand: true,
						dot: true,
						src: ['boot/uis/**', 'usr/**', 'etc/ske1/**', 'etc/uis.json', 'README.md', 'COPYING'],
						dest: 'build/'
					}
				]
			}
		},
		watch: {
			files: ['<%= jshint.files %>'],
			tasks: ['jshint']
		}
	});

	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	//grunt.loadNpmTasks('grunt-contrib-qunit');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-convert');

	grunt.registerTask('gen-boot', 'Concatenate boot files.', function() {
		var bootIncludes = grunt.file.readJSON('etc/boot-includes.json'), bootIncludesList = [];
		for (var filepath in bootIncludes) {
			bootIncludesList.push('./'+filepath);
		}

		grunt.config('concat.boot', {
			options: {
				separator: ';\n'
			},
			files: {
				'build/boot/boot.min.js': bootIncludesList
			}
		});

		grunt.task.run('concat:boot');
		grunt.task.run('uglify:boot');
	});

	grunt.registerTask('gen-ui', 'Concatenate UI files.', function() {
		var uisConcat = {}, uisJsUglify = [], uisCssMinify = [];
		if (grunt.file.isDir('dist/boot/uis')) {
			var uisList = grunt.file.expand({
				cwd: 'dist/boot/uis/',
				filter: 'isDirectory'
			}, '*');

			for (var i = 0; i < uisList.length; i++) {
				var uiName = uisList[i];
				var rootPath = 'dist/boot/uis/'+uiName;

				if (!grunt.file.exists(rootPath+'/config.json')) {
					continue;
				}

				var uiMetadata = grunt.file.readJSON(rootPath+'/config.json');

				var deps = uiMetadata.userinterface.includes[0].file,
					jsDepsList = [],
					cssDepsList = [];
				for (var j = 0; j < deps.length; j++) {
					var filePath = deps[j].path[0];

					if (/\.js$/.test(filePath)) {
						jsDepsList.push('./'+filePath);
					} else if (/\.css$/.test(filePath)) {
						cssDepsList.push('./'+filePath);
					}
				}

				jsDepsList.push('boot/uis/'+uiName+'/index.js');

				var jsPath = 'build/boot/uis/'+uiName+'/main.min.js',
					cssPath = 'build/boot/uis/'+uiName+'/style.min.css';

				uisConcat[jsPath] = jsDepsList;
				uisConcat[cssPath] = cssDepsList;

				uisJsUglify.push({
					src: jsPath,
					dest: jsPath
				});
				uisCssMinify.push({
					src: cssPath,
					dest: cssPath
				});
			}
		}

		grunt.config('concat.ui', {
			options: {
				separator: ';\n'
			},
			files: uisConcat
		});
		grunt.config('uglify.ui', {
			files: uisJsUglify
		});
		grunt.config('cssmin.ui', {
			files: uisCssMinify
		});

		grunt.task.run('concat:ui');
		grunt.task.run('uglify:ui');
		grunt.task.run('cssmin:ui');
	});

	grunt.registerTask('gen-theme', 'Concatenate theme files.', function() {
		var themesConcat = {}, themesMinify = [];
		var themesList = grunt.file.expand({
			cwd: 'usr/share/css/themes/',
			filter: 'isDirectory'
		}, '*');
		for (var i = 0; i < themesList.length; i++) {
			var themeName = themesList[i];
			var rootPath = 'usr/share/css/themes/'+themeName;

			var basicFiles = grunt.file.expand(rootPath+'/*.css');

			var supportedUis = grunt.file.expand({
				cwd: rootPath,
				filter: 'isDirectory'
			}, '*');

			for (var j = 0; j < supportedUis.length; j++) {
				var uiName = supportedUis[j];

				var uisFiles = grunt.file.expand(rootPath+'/'+uiName+'/*.css');

				var cssPath = 'build/usr/share/css/themes/'+themeName+'/'+uiName+'/main.min.css';

				themesConcat[cssPath] = basicFiles.concat(uisFiles);
				themesMinify.push({
					src: cssPath,
					dest: cssPath
				});
			}
		}

		grunt.config('concat.theme', {
			options: {
				process: function (src, filepath) {
					return '/*! ' + filepath + ' */\n' + src;
				}
			},
			files: themesConcat
		});
		grunt.config('cssmin.theme', {
			files: themesMinify
		});

		grunt.task.run('concat:theme');
		grunt.task.run('cssmin:theme');
	});

	grunt.registerTask('gen-launcher', 'Concatenate launchers.', function(type) {
		type = (type || 'applications');
		var rootPath = 'dist/usr/share/'+type+'/';

		var itemsList = grunt.file.expand({
			cwd: rootPath
		}, '*.json');

		var items = {};

		for (var i = 0; i < itemsList.length; i++) {
			var itemName = itemsList[i];
			var itemPath = rootPath+'/'+itemName;

			var itemData = grunt.file.readJSON(itemPath)['attribute'], item = {};
			for (var j = 0; j < itemData.length; j++) {
				var attr = itemData[j],
					attrName = (attr.name || [])[0],
					attrLang = (attr.lang || [])[0],
					attrValue = (attr.value || [])[0];

				if (attrLang) {
					if (!item[attrLang]) {
						item[attrLang] = {};
					}

					item[attrLang][attrName] = attrValue;
				} else {
					item[attrName] = attrValue;
				}
			}

			if (!item.name) {
				item.name = itemName.substr(0, itemName.lastIndexOf('.'));
			}

			items[item.name] = item;
			grunt.file.write(itemPath, JSON.stringify(item));
		}

		grunt.file.write('build/usr/share/'+type+'.json', JSON.stringify(items));
	});

	grunt.registerTask('gen-icon', 'Build icon themes index files.', function() {
		var rootPath = 'usr/share/icons/';

		var items = grunt.file.expand({
			cwd: rootPath
		}, '**/*.{png,svg}');

		grunt.file.write('build/usr/share/icons/index.json', JSON.stringify(items));
	});

	grunt.registerTask('convert-ui', 'Convert UIs files.', [
		'convert:ui'
	]);

	grunt.registerTask('convert-launcher', 'Convert launchers.', [
		'convert:categories',
		'convert:applications',
		'gen-launcher:categories',
		'gen-launcher:applications'
	]);

	grunt.registerTask('standalone', 'Build a standalone version of the web desktop.', [
		'clean',
		'gen-boot',
		'gen-ui',
		'gen-theme',
		'gen-icon',
		'copy:standalone',
		'convert-ui',
		'convert-launcher'
	]);

	grunt.registerTask('build', 'Build the web desktop.', [
		'clean',
		'gen-boot',
		'gen-ui',
		'gen-theme',
		'copy:build'

		//Useless tasks here: the webos API is used instead for now
		//'convert-ui',
		//'convert-launcher',
		//'gen-icon'
	]);

	//TODO: outdated
	/*grunt.registerTask('quickbuild', 'Quickly re-build the web desktop.', [
		//'jshint',
		//'clean',
		'concat:build',
		'concat:uis',
		//'concat:themes',
		//'copy:index',
		//'copy:uis',
		//'copy:usr',
		//'copy:ske1',
	]);*/

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


<commit_before>module.exports = function (grunt) {
    require("time-grunt")(grunt);

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        opt: {
            client: {
                "tsMain": "lib",
                "tsTest": "test",

                "jsMainOut": "lib",
                "jsTestOut": "test"
            }
        },

        ts: {
            options: {
                compile: true,                 // perform compilation. [true (default) | false]
                comments: true,               // same as !removeComments. [true | false (default)]
                target: 'es5',                 // target javascript language. [es3 (default) | es5]
                module: 'commonjs',            // target javascript module style. [amd (default) | commonjs]
                noImplicitAny: true,
                sourceMap: true,              // generate a source map for every output js file. [true (default) | false]
                sourceRoot: '',                // where to locate TypeScript files. [(default) '' == source ts location]
                mapRoot: '',                   // where to locate .map.js files. [(default) '' == generated js location.]
                declaration: false             // generate a declaration .d.ts file for every output js file. [true | false (default)]
            },
            clientMain: {
                src: ['<%= opt.client.tsMain %>/fs.ts'],
                options: {
                    declaration: true
                }
            },
            clientTest: {
                src: ['<%= opt.client.tsTest %>/main_spec.ts']
            }
        },
        tslint: {
            options: {
                configuration: grunt.file.readJSON("tslint.json")
            },
            files: {
                src: [
                    '<%= opt.client.tsMain %>/**/*.ts',
                    '<%= opt.client.tsTest %>/**/*.ts',
                    '!<%= opt.client.tsMain %>/**/*.d.ts'
                ]
            }
        },
        typedoc: {
            main: {
                options: {
                    module: "<%= ts.options.module %>",
                    out: './docs',
                    name: '<%= pkg.name %>',
                    target: "<%= ts.options.target %>"
                },
                src: [
                    '<%= opt.client.tsMain %>/**/*.ts'
                ]
            }
        },
        dtsm: {
            client: {
                options: {
                    // optional: specify config file
                    confog: './dtsm.json'
                }
            }
        },
        clean: {
            clientScript: {
                src: [
                    // client
                    '<%= opt.client.jsMainOut %>/*.js',
                    '<%= opt.client.jsMainOut %>/*.d.ts',
                    '<%= opt.client.jsMainOut %>/*.js.map',
                    // client test
                    '<%= opt.client.jsTestOut %>/*.js',
                    '<%= opt.client.jsTestOut %>/*.js.map',
                    '<%= opt.client.jsTestOut %>/*.d.ts'
                ]
            },
            dtsm: {
                src: [
                    "typings/"
                ]
            }
        },
        dts_bundle: {
            build: {
                options: {
                    name: "fs-git",
                    main: "lib/fs.d.ts",
                    baseDir: "",
                    out: "fs-git.d.ts"
                }
            }
        },
        mochaTest: {
            test: {
                options: {
                    reporter: 'spec',
                    require: [
                        function () {
                            require('espower-loader')({
                                cwd: process.cwd() + '/' + grunt.config.get("opt.client.jsTestOut"),
                                pattern: '**/*.js'
                            });
                        },
                        function () {
                            assert = require('power-assert');
                        }
                    ]
                },
                src: [
                    '<%= opt.client.jsTestOut %>/**/*_spec.js'
                ]
            }
        },
        changelog: {
            options: {
            }
        }
    });

    grunt.registerTask(
        'setup',
        ['clean', 'dtsm']);

    grunt.registerTask(
        'default',
        ['ts:clientMain', 'tslint', 'dts_bundle']);

    grunt.registerTask(
        'test',
        ['default', 'ts:clientTest', 'mochaTest']);

    require('load-grunt-tasks')(grunt);
};
<commit_msg>fix(fs-git): set mocha timeout to 10000ms<commit_after>module.exports = function (grunt) {
    require("time-grunt")(grunt);

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        opt: {
            client: {
                "tsMain": "lib",
                "tsTest": "test",

                "jsMainOut": "lib",
                "jsTestOut": "test"
            }
        },

        ts: {
            options: {
                compile: true,                 // perform compilation. [true (default) | false]
                comments: true,               // same as !removeComments. [true | false (default)]
                target: 'es5',                 // target javascript language. [es3 (default) | es5]
                module: 'commonjs',            // target javascript module style. [amd (default) | commonjs]
                noImplicitAny: true,
                sourceMap: true,              // generate a source map for every output js file. [true (default) | false]
                sourceRoot: '',                // where to locate TypeScript files. [(default) '' == source ts location]
                mapRoot: '',                   // where to locate .map.js files. [(default) '' == generated js location.]
                declaration: false             // generate a declaration .d.ts file for every output js file. [true | false (default)]
            },
            clientMain: {
                src: ['<%= opt.client.tsMain %>/fs.ts'],
                options: {
                    declaration: true
                }
            },
            clientTest: {
                src: ['<%= opt.client.tsTest %>/main_spec.ts']
            }
        },
        tslint: {
            options: {
                configuration: grunt.file.readJSON("tslint.json")
            },
            files: {
                src: [
                    '<%= opt.client.tsMain %>/**/*.ts',
                    '<%= opt.client.tsTest %>/**/*.ts',
                    '!<%= opt.client.tsMain %>/**/*.d.ts'
                ]
            }
        },
        typedoc: {
            main: {
                options: {
                    module: "<%= ts.options.module %>",
                    out: './docs',
                    name: '<%= pkg.name %>',
                    target: "<%= ts.options.target %>"
                },
                src: [
                    '<%= opt.client.tsMain %>/**/*.ts'
                ]
            }
        },
        dtsm: {
            client: {
                options: {
                    // optional: specify config file
                    confog: './dtsm.json'
                }
            }
        },
        clean: {
            clientScript: {
                src: [
                    // client
                    '<%= opt.client.jsMainOut %>/*.js',
                    '<%= opt.client.jsMainOut %>/*.d.ts',
                    '<%= opt.client.jsMainOut %>/*.js.map',
                    // client test
                    '<%= opt.client.jsTestOut %>/*.js',
                    '<%= opt.client.jsTestOut %>/*.js.map',
                    '<%= opt.client.jsTestOut %>/*.d.ts'
                ]
            },
            dtsm: {
                src: [
                    "typings/"
                ]
            }
        },
        dts_bundle: {
            build: {
                options: {
                    name: "fs-git",
                    main: "lib/fs.d.ts",
                    baseDir: "",
                    out: "fs-git.d.ts"
                }
            }
        },
        mochaTest: {
            test: {
                options: {
                    reporter: 'spec',
                    timeout: 10000,
                    require: [
                        function () {
                            require('espower-loader')({
                                cwd: process.cwd() + '/' + grunt.config.get("opt.client.jsTestOut"),
                                pattern: '**/*.js'
                            });
                        },
                        function () {
                            assert = require('power-assert');
                        }
                    ]
                },
                src: [
                    '<%= opt.client.jsTestOut %>/**/*_spec.js'
                ]
            }
        },
        changelog: {
            options: {
            }
        }
    });

    grunt.registerTask(
        'setup',
        ['clean', 'dtsm']);

    grunt.registerTask(
        'default',
        ['ts:clientMain', 'tslint', 'dts_bundle']);

    grunt.registerTask(
        'test',
        ['default', 'ts:clientTest', 'mochaTest']);

    require('load-grunt-tasks')(grunt);
};
<|endoftext|>


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

  // track time spent doing specific tasks
  require('time-grunt')(grunt);
  // load all grunt modules
  require('load-grunt-tasks')(grunt);

  var BANNER = "/*! <%= pkg.name %> v<%= pkg.version %> - Copyright (c) 2014 Sören Gade - see <%= pkg.repository.url %> */";

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

    /*
     * ==========
     * Test
     * ==========
     * */
    jshint: {
      self: [ './*.js', './*.json' ],
      src: [ './src/**/*.js', '!./src/web/public/**/*.js' ]
    },

    /*
     * ==========
     * Documentation
     * ==========
     * */
    jsdoc: {
      src: {
        src: [ './Readme.md', './src/**/*.js' ],
        dest: 'doc'
      }
    },

    /*
     * ==========
     * Webserver
     * ==========
     * */
    /* Build */
    uglify: {
      src: {
        options: {
          sourceMap: true,
          banner: BANNER
        },
        files: {
          './src/web/public/js/index.js': [ './bower_components/jquery/dist/jquery.js', './src/web/client/js/index/index.js' ],
          './src/web/public/js/app.js': [ './bower_components/jquery/dist/jquery.js', './bower_components/bootstrap/dist/js/bootstrap.js', './bower_components/handlebars/handlebars.js', './bower_components/ember/ember.js', './bower_components/ember-data/ember-data.js', './src/web/client/js/app/**/*.js' ]
        }
      }
    },
    sass: {
      src: {
        files: {
          './src/web/public/css/style.css': [ './src/web/client/sass/style.scss' ]
        }
      }
    },
    cssmin: {
      src: {
        options: {
          banner: BANNER
        },
        files: {
          './src/web/public/css/style.css': [ './bower_components/bootstrap/dist/css/bootstrap.css', './bower_components/bootflatv2/bootflat/css/bootflat.css', './src/web/public/css/style.css' ]
        }
      }
    },
    /* Watch */
    watch: {
      options: {
        livereload: true
      },

      js: {
        files: [ './src/web/client/js/**/*.js' ],
        tasks: [ 'build-js' ]
      },
      css: {
        files: [ './src/web/client/sass/**/*.scss' ],
        tasks: [ 'build-css' ]
      }
    },
    /* Serverside Tests */
    mochaTest: {
      test: {
        options: {
          reporter: 'spec'
        },
        src: ['src/web/test/**/*.js']
      }
    }
  });

  grunt.registerTask('default', [ 'jshint', 'build' ]);
  grunt.registerTask('dev', [ 'default', 'watch' ]);
  /* Single purpose tasks */
  grunt.registerTask('test', [ 'jshint', 'mochaTest' ]);
  grunt.registerTask('build', [ 'build-js', 'build-css' ]);
  grunt.registerTask('build-js', [ 'uglify' ]);
  grunt.registerTask('doc', [ 'jsdoc' ]);
  grunt.registerTask('build-css', [ 'sass', 'cssmin' ]);

};
<commit_msg>Separated build of index and app pages.<commit_after>module.exports = function(grunt) {

  // track time spent doing specific tasks
  require('time-grunt')(grunt);
  // load all grunt modules
  require('load-grunt-tasks')(grunt);

  var BANNER = "/*! <%= pkg.name %> v<%= pkg.version %> - Copyright (c) 2014 Sören Gade - see <%= pkg.repository.url %> */";

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

    /*
     * ==========
     * Test
     * ==========
     * */
    jshint: {
      self: [ './*.js', './*.json' ],
      src: [ './src/**/*.js', '!./src/web/public/**/*.js' ]
    },

    /*
     * ==========
     * Documentation
     * ==========
     * */
    jsdoc: {
      src: {
        src: [ './Readme.md', './src/**/*.js' ],
        dest: 'doc'
      }
    },

    /*
     * ==========
     * Webserver
     * ==========
     * */
    /* Build */
    uglify: {
      options: {
        sourceMap: true,
        banner: BANNER
      },
      index: {
        files: {
          './src/web/public/js/index.js': [ './bower_components/jquery/dist/jquery.js', './src/web/client/js/index/index.js' ]
        }
      },
      app: {
        files: {
          './src/web/public/js/app.js': [ './bower_components/jquery/dist/jquery.js', './bower_components/bootstrap/dist/js/bootstrap.js', './bower_components/handlebars/handlebars.js', './bower_components/ember/ember.js', './bower_components/ember-data/ember-data.js', './src/web/client/js/app/**/*.js' ]
        }
      }
    },
    sass: {
      src: {
        files: {
          './src/web/public/css/style.css': [ './src/web/client/sass/style.scss' ]
        }
      }
    },
    cssmin: {
      src: {
        options: {
          banner: BANNER
        },
        files: {
          './src/web/public/css/style.css': [ './bower_components/bootstrap/dist/css/bootstrap.css', './bower_components/bootflatv2/bootflat/css/bootflat.css', './src/web/public/css/style.css' ]
        }
      }
    },
    /* Watch */
    watch: {
      options: {
        livereload: true
      },

      jsIndex: {
        files: [ './src/web/client/js/index/**/*.js' ],
        tasks: [ 'build-js-index' ]
      },
      jsapp: {
        files: [ './src/web/client/js/app/**/*.js' ],
        tasks: [ 'build-js-app' ]
      },

      css: {
        files: [ './src/web/client/sass/**/*.scss' ],
        tasks: [ 'build-css' ]
      }
    },
    /* Serverside Tests */
    mochaTest: {
      test: {
        options: {
          reporter: 'spec'
        },
        src: ['src/web/test/**/*.js']
      }
    }
  });

  grunt.registerTask('default', [ 'jshint', 'build' ]);
  grunt.registerTask('dev', [ 'default', 'watch' ]);
  /* Single purpose tasks */
  grunt.registerTask('test', [ 'jshint', 'mochaTest' ]);
  grunt.registerTask('build', [ 'build-js', 'build-css' ]);
  grunt.registerTask('build-js', [ 'build-js-app', 'build-js-index' ]);
  grunt.registerTask('build-js-index', [ 'uglify:index' ]);
  grunt.registerTask('build-js-app', [ 'uglify:app' ]);
  grunt.registerTask('doc', [ 'jsdoc' ]);
  grunt.registerTask('build-css', [ 'sass', 'cssmin' ]);

};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    bower: {
      install: {
        options: {
          targetDir: 'app/lib',
          verbose: true
        }
      }
    },
    copy: {
      closureLibrary: {
        files: [
          {
            expand: true,
            cwd: 'node_modules/',
            src: [
              'google-closure-library/closure/goog/**/*.js',
              'google-closure-library/third_party/closure/goog/**/*.js'
            ],
            dest: 'app/lib/'
          }
        ]
      }
    },
    shell: {
      test: { command: 'mocha --require espower-babel/guess test/js/KeepMeContributing/' },
      lint: { command: 'eslint Gruntfile.js app/js/ test' }
    }
  });

  grunt.registerTask('install', [
    'bower:install',
    'copy:closureLibrary'
  ]);

  grunt.registerTask('default', [
    'shell:lint',
    'shell:test'
  ]);
};
<commit_msg>add task to copy libraries to lib installed by bower<commit_after>module.exports = function (grunt) {
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    bower: {
      install: {
        options: {
          targetDir: 'app/lib',
          verbose: true
        }
      }
    },
    copy: {
      bowerForTest: {
        files: [
          {
            expand: true,
            cwd: 'app/',
            src: [
              'lib/**/*.js',
              'lib/**/*.css'
            ],
            dest: 'test/lib/'
          }
        ]
      },
      closureLibrary: {
        files: [
          {
            expand: true,
            cwd: 'node_modules/',
            src: [
              'google-closure-library/closure/goog/**/*.js',
              'google-closure-library/third_party/closure/goog/**/*.js'
            ],
            dest: 'app/lib/'
          }
        ]
      }
    },
    shell: {
      test: { command: 'mocha --require espower-babel/guess test/js/KeepMeContributing/' },
      lint: { command: 'eslint Gruntfile.js app/js/ test' }
    }
  });

  grunt.registerTask('install', [
    'bower:install',
    'copy:closureLibrary'
  ]);

  grunt.registerTask('default', [
    'shell:lint',
    'shell:test'
  ]);
};
<|endoftext|>


<commit_before>/*jshint node: true */
"use strict";

module.exports = function(grunt) {

  grunt.initConfig({
    sass: {
      main: {
        src: 'style.scss',
        dest: '_build/style.css'
      }
    },
    browserify2: {
      main: {
        entry: './main.js',
        compile: '_build/main.browser.js'
      }
    },
    uglify: {
      my_target: {
        files: {
          '_build/app.min.js': ['vquery.js', '_build/main.browser.js']
        }
      }
    },
    cssmin: {
      combine: {
        files: {
          '_build/style.min.css': ['style.css']
        }
      }
    },
    watch: {
      js: {
        files: ['main.js', 'vquery.js'],
        tasks: ['browserify2', 'uglify']
      },
      css: {
        files: ['style.scss'],
        tasks: ['sass', 'cssmin']
      }
    }
  });

  grunt.loadNpmTasks('grunt-browserify2');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('build', ['sass', 'browserify2', 'uglify', 'cssmin']);
  grunt.registerTask('default', ['build']);
  grunt.registerTask('dev', ['build', 'watch']);

};
<commit_msg>Fix broken CSS minification in Gruntfile<commit_after>/*jshint node: true */
"use strict";

module.exports = function(grunt) {

  grunt.initConfig({
    sass: {
      main: {
        src: 'style.scss',
        dest: '_build/style.css'
      }
    },
    browserify2: {
      main: {
        entry: './main.js',
        compile: '_build/main.browser.js'
      }
    },
    uglify: {
      my_target: {
        files: {
          '_build/app.min.js': ['vquery.js', '_build/main.browser.js']
        }
      }
    },
    cssmin: {
      combine: {
        files: {
          '_build/style.min.css': ['_build/style.css']
        }
      }
    },
    watch: {
      js: {
        files: ['main.js', 'vquery.js'],
        tasks: ['browserify2', 'uglify']
      },
      css: {
        files: ['style.scss'],
        tasks: ['sass', 'cssmin']
      }
    }
  });

  grunt.loadNpmTasks('grunt-browserify2');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.registerTask('build', ['sass', 'browserify2', 'uglify', 'cssmin']);
  grunt.registerTask('default', ['build']);
  grunt.registerTask('dev', ['build', 'watch']);

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    products: {
      'argos-saleslogix': {
        basePath: '.',
      },
      'argos-sdk': {
        basePath: '../../argos-sdk',
      },
    },
    'lang-pack': {
      'de': {
        bundleName: "Mobile 3.4.2 DE",
      },
      'en-GB': {
        bundleName: "Mobile 3.4.2 EN-GB"
      },
      'fr': {
        bundleName: "Mobile 3.4.2 FR",
      },
      'it': {
        bundleName: "Mobile 3.4.2 IT",
      },
      'ru': {
        bundleName: "Mobile 3.4.2 RU",
      },
      'zh-CN': {
        bundleName: "Mobile 3.4.2 ZH-CN",
        includes: [
          {
            src: './index-nocache.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index-nocache.aspx'
          }, {
            src: './index.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index.aspx'
        }],
      },
      'zh-TW': {
        bundleName: "Mobile 3.4.2 ZH-TW",
        includes: [
          {
            src: './index-nocache.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index-nocache.aspx'
          }, {
            src: './index.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index.aspx'
        }],
      }
    },
    // modules.json is the same format as the productions configuration above.
    // Use grunt release:all or grunt release:modules to include them in a release build.
    modules: grunt.file.readJSON('modules.json'),
  });

  // Load per-task config from separate files
  grunt.loadTasks('grunt-tasks');

  // Register alias tasks
  grunt.registerTask('build', ['clean', 'babel', 'less']);
  grunt.registerTask('test', ['babel', 'connect', 'jasmine:coverage']);
  grunt.registerTask('server', ['connect:server:keepalive']);
  grunt.registerTask('bundle', ['babel', 'less', 'shell:bundle:<%= pkg.version %>']);
  grunt.registerTask('lint', ['babel', 'eslint']);
  grunt.registerTask('default', ['test']);
};
<commit_msg>Adding es and pt locals<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    products: {
      'argos-saleslogix': {
        basePath: '.',
      },
      'argos-sdk': {
        basePath: '../../argos-sdk',
      },
    },
    'lang-pack': {
      'de': {
        bundleName: "Mobile 3.4.2 DE",
      },
      'es': {
        bundleName: "Mobile 3.4.2 ES",
      },
      'pt': {
        bundleName: "Mobile 3.4.2 PT",
      },
      'en-GB': {
        bundleName: "Mobile 3.4.2 EN-GB"
      },
      'fr': {
        bundleName: "Mobile 3.4.2 FR",
      },
      'it': {
        bundleName: "Mobile 3.4.2 IT",
      },
      'ru': {
        bundleName: "Mobile 3.4.2 RU",
      },
      'zh-CN': {
        bundleName: "Mobile 3.4.2 ZH-CN",
        includes: [
          {
            src: './index-nocache.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index-nocache.aspx'
          }, {
            src: './index.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index.aspx'
        }],
      },
      'zh-TW': {
        bundleName: "Mobile 3.4.2 ZH-TW",
        includes: [
          {
            src: './index-nocache.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index-nocache.aspx'
          }, {
            src: './index.aspx',
            dest: './deploy/bundle/model/Portal/SlxMobile/SourceFiles/products/argos-saleslogix/index.aspx'
        }],
      }
    },
    // modules.json is the same format as the productions configuration above.
    // Use grunt release:all or grunt release:modules to include them in a release build.
    modules: grunt.file.readJSON('modules.json'),
  });

  // Load per-task config from separate files
  grunt.loadTasks('grunt-tasks');

  // Register alias tasks
  grunt.registerTask('build', ['clean', 'babel', 'less']);
  grunt.registerTask('test', ['babel', 'connect', 'jasmine:coverage']);
  grunt.registerTask('server', ['connect:server:keepalive']);
  grunt.registerTask('bundle', ['babel', 'less', 'shell:bundle:<%= pkg.version %>']);
  grunt.registerTask('lint', ['babel', 'eslint']);
  grunt.registerTask('default', ['test']);
};
<|endoftext|>


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

  'use strict';

  require('time-grunt')(grunt);  // log individual task runtime

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

    // Jekyll builds the site
    jekyll: {
      dev: { // build the site without using 'lsi' to create similar posts content
        src: ['.'],
        dest: '_site'
      },
      prod: { // build the site using 'lsi' to create similar posts content
        src: ['.'],
        dest: '_deploy',
        lsi: true
      }
    },

    // minify all .html files in the '_site' directory. only runs when 'grunt ppush' is called
    htmlmin: {
      dist: {
        options: {
          removeComments: true,
          collapseWhitespace: true
        },
        expand: true,
        cwd: '_deploy',
        src: ['**/*.html', '*.index.html', '!samples/**/*.html'],
        dest: '_deploy'
      }
    },

    // convert main sass file to a development build of 'css/styles.css'
    sass: {
      dist: {
        files: {
          'css/styles.css': 'grunt/cssSource/styles.scss'
        },
        options: {
          style: 'expanded'
        }
      }
    },

    // minify 'css/styles.css & move it to the '_site' folder
    cssmin: {
      buildProductionCSS: {
        src: 'css/styles.css',
        dest: 'css/styles.min.css'
      }
    },

    // minify all images
    imagemin: {
      dist: {
        options: {
          optimizationLevel: 3,
          progressive: true
        },
        files: [{
          expand: true,
          cwd: 'img',
          src: '*.{png,jpg,jpeg,gif}',
          dest: 'img'
        }]
      }
    },

    // all the 'watch' tasks
    watch: {
      // pageOnlyTask: { // run 'jekyll build' on .html, .md, .php & .xml file changes globally...EXCEPT the '_site' directory
      //   files: ['*.html', '**/*.html','!_site/**/*.html', '!_site/*.html', 'email.php', '_posts/*.md', '!jekyllOutput.html', 'search.html'],
      //   tasks: ['jekyll:dev']
      // },
      layoutOnlyTask: { // run 'jekyll build' on .html, .md, .php & .xml file changes globally...EXCEPT the '_site' directory
        files: ['_templates/*.html'],
        tasks: ['targethtml:dev', 'jekyll:dev']
      },

      jsOnlyTask: { // run 'jekyll build' on .js file changes
        files: ['requireBuildOut/*.js'],
        tasks: ['requirejs', 'jekyll:dev']
      },

      cssOnlyTask: { // run 'jekyll build' on .scss/.css file changes
        files: ['grunt/cssSource/*.scss'],
        tasks: ['sassbuild', 'jekyll:dev']
      }

      // imgOnlyTask: { // run 'jekyll build' when the 'img/' directory changes
      //   files: ['img/*.{png,jpg,jpeg,gif}'],
      //   tasks: ['imagemin', 'jekyll:dev']
      // }
     },

    // create a custom 'modernizr' file
    modernizr: {

      "devFile" : "grunt/modernizr/modernizr-dev.js", //modernizr full build

      // Path to save out the built file.
      "outputFile" : "js/libs/modernizr.min.js",

      // Based on default settings on http://modernizr.com/download/
      "extra" : {
        "shiv" : true,
        "printshiv" : false,
        "load" : true,
        "mq" : false,
        "cssclasses" : true
      },

      // Based on default settings on http://modernizr.com/download/
      "extensibility" : {
        "addtest" : true,
        "prefixed" : false,
        "teststyles" : false,
        "testprops" : false,
        "testallprops" : false,
        "hasevents" : false,
        "prefixes" : false,
        "domprefixes" : false
      },

      // By default, source is uglified before saving
      "uglify" : true,

      // Define any tests you want to impliticly include.
      "tests" : [],

      // By default, this task will crawl your project for references to Modernizr tests.
      // Set to false to disable.
      "parseFiles" : true,

      // When parseFiles = true, this task will crawl all *.js, *.css, *.scss files.
      // You can override this by defining a "files" array below.
      "files" : ["css/styles.min.css","requireBuildOut/*.js","requireBuildOut/**/*.js"],

      // When parseFiles = true, matchCommunityTests = true will attempt to
      // match user-contributed tests.
      "matchCommunityTests" : false,

      // Have custom Modernizr tests? Add paths to their location here.
      "customTests" : [],

      // Files added here will be excluded when looking for Modernizr refs.
      "excludeFiles" : "Gruntfile.js"
    },

    // CDN task
    cdn: {
      options: {
          /** @required - root URL of your CDN (may contains sub-paths as shown below) */
          cdn: 'http://cdn.kaidez.com',
          /** @optional  - if provided both absolute and relative paths will be converted */
          flatten: false,
          /** @optional  - if provided will be added to the default supporting types */
          supportedTypes: { 'phtml': 'html' }
      },
      dist: {
          /** @required  - string (or array of) including grunt glob variables */
          src: ['_deploy/*.html', '_deploy/**/*.html', '_deploy/css/styles.min.css']
            }
        },

    // properties to be loaded into the application cache (manifest.appcache) file.  they load in via a template in the 'manifest task'
    site_files: [
      'js/libs/*.js'
    ],

    // create application cache (manifest.appcache) file for the whole site
    manifest: {
      generate: {
        options: {
          basePath: '_deploy/',
          cache: [
            'affiliate-disclaimer.html',
            'colophon.html',
            'index.html',
            'search.html',
            'search.json',
            'sitemap.html',
            'css/styles.min.css',
            'img/profilepic.jpg',
            'img/footer-bg.png',
            'img/homePageDefault.jpg',
            'img/kaidez-sprite.png',
            'img/kaidez-sprite@2x.png',
            'js/scripts.min.js',
            'font/FontAwesome.otf',
            'font/fontawesome-webfont.eot',
            'font/fontawesome-webfont.svg',
            'font/fontawesome-webfont.ttf',
            'font/fontawesome-webfont.woff'
          ],
          network: ['*'],
          preferOnline: true,
          verbose: true,
          timestamp: true,
        },
        src: '<%= site_files %>',
        dest: '_deploy/manifest.appcache'
      }
    },

    // automagically concat/minify site jS based on RequireJS settings
    requirejs: {
      compile: {
        options: {
          baseUrl: "requireBuildOut/",
          mainConfigFile: "requireBuildOut/config.js",
          name: 'config',
          out: "js/scripts.min.js",
           preserveLicenseComments: false,
             paths: {
              requireLib: 'require'
            },
            include: 'requireLib'
          }
        }
      },

      // copy task...used for updating Bower stuff
      copy: {
        backbone: {
          files: [
            {expand: true,
            cwd: 'bower_components/backbone/',
            src: ['backbone-min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        },
        enquire: {
          files: [
            {expand: true,
            cwd: 'bower_components/enquire/dist/',
            src: ['enquire.min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        },
        jquery: {
          files: [
            {expand: true,
            cwd: 'bower_components/jquery/',
            src: ['jquery.min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        },
        fontAwesome: {
          files: [
            {expand: true,
            cwd: 'bower_components/font-awesome/css/',
            src: ['font-awesome.css'],
            dest: 'grunt/cssSource/',
            rename: function(dest, src) {
              return dest + '_' + src.substring(12, src.indexOf('/')) + '.scss';
            },
            filter: 'isFile'}
          ]
        },
        matchMedia: {
          files: [
            {expand: true,
            cwd: 'bower_components/matchMedia/',
            src: ['*.js'],
            dest: 'js/libs/',
            filter: 'isFile'}
          ]
        },
        require: {
          files: [
            {expand: true,
            cwd: 'bower_components/requirejs/',
            src: ['require.js'],
            dest: 'requireBuildOut/', filter: 'isFile'}
          ]
        },
        spin: {
          files: [
            {expand: true,
            cwd: 'bower_components/spinjs/',
            src: ['spin.js'],
            dest: 'requireBuildOut/libs', filter: 'isFile'}
          ]
        },
        underscore: {
          files: [
            {expand: true,
            cwd: 'bower_components/underscore/',
            src: ['underscore-min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        }
      },

      targethtml: {
        dev: {
          files: {
            '_layouts/homePage.html': '_templates/homePage.html',
            '_layouts/categories.html': '_templates/categories.html',
            '_layouts/post.html': '_templates/post.html',
            '_layouts/default.html': '_templates/default.html',
          }
        },
        prod: {
          files: {
            '_layouts/homePage.html': '_templates/homePage.html',
            '_layouts/categories.html': '_templates/categories.html',
            '_layouts/post.html': '_templates/post.html',
            '_layouts/default.html': '_templates/default.html',
          }
        }
      },

      // Shell commands for creating and removing '_deploy' folder
      shell: {
        makeDeploy: {
          command: 'mkdir _deploy'
        },
        removeDeploy: {
          command: 'rm -rf _deploy'
        }
      },

      // deployments
     'sftp-deploy': {
      // deploy to the development site
      staging: {
        auth: {
        host: 's46798.gridserver.com',
        port: 22,
        authKey: 'key1'
      },
      src: '_site',
      dest: '/nfs/c02/h08/mnt/46798/domains/dev.kaidez.com/html'
    },

    // deploy to the live site
    production: {
      auth: {
        host: 's46798.gridserver.com',
        port: 22,
        authKey: 'key1'
      },
      src: '_deploy',
      dest: '/nfs/c02/h08/mnt/46798/domains/kaidez.com/html'
      }
    }
  });

  // Use 'loadNpmTasks' to enable plugins
  grunt.loadNpmTasks('grunt-css');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-modernizr');
  grunt.loadNpmTasks('grunt-sftp-deploy');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');
  grunt.loadNpmTasks('grunt-manifest');
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-cdn');
  grunt.loadNpmTasks('grunt-targethtml');
  grunt.loadNpmTasks('grunt-shell');

  // Default task(s)
  grunt.registerTask('default', ['watch']);
  grunt.registerTask('sassbuild', ['sass', 'cssmin']);
  grunt.registerTask('md', ['modernizr']);
  grunt.registerTask('rq', ['requirejs']);
  grunt.registerTask('dpush', ['jekyll:dev','sftp-deploy:staging']);
  grunt.registerTask('ppush', ['shell:makeDeploy','targethtml:prod', 'jekyll:prod', 'cdn', 'htmlmin', 'manifest', 'sftp-deploy:production']);
};<commit_msg>update ppush task in Gruntfile.js<commit_after>module.exports = function(grunt) {

  'use strict';

  require('time-grunt')(grunt);  // log individual task runtime

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

    // Jekyll builds the site
    jekyll: {
      dev: { // build the site without using 'lsi' to create similar posts content
        src: ['.'],
        dest: '_site'
      },
      prod: { // build the site using 'lsi' to create similar posts content
        src: ['.'],
        dest: '_deploy',
        lsi: true
      }
    },

    // minify all .html files in the '_site' directory. only runs when 'grunt ppush' is called
    htmlmin: {
      dist: {
        options: {
          removeComments: true,
          collapseWhitespace: true
        },
        expand: true,
        cwd: '_deploy',
        src: ['**/*.html', '*.index.html', '!samples/**/*.html'],
        dest: '_deploy'
      }
    },

    // convert main sass file to a development build of 'css/styles.css'
    sass: {
      dist: {
        files: {
          'css/styles.css': 'grunt/cssSource/styles.scss'
        },
        options: {
          style: 'expanded'
        }
      }
    },

    // minify 'css/styles.css & move it to the '_site' folder
    cssmin: {
      buildProductionCSS: {
        src: 'css/styles.css',
        dest: 'css/styles.min.css'
      }
    },

    // minify all images
    imagemin: {
      dist: {
        options: {
          optimizationLevel: 3,
          progressive: true
        },
        files: [{
          expand: true,
          cwd: 'img',
          src: '*.{png,jpg,jpeg,gif}',
          dest: 'img'
        }]
      }
    },

    // all the 'watch' tasks
    watch: {
      // pageOnlyTask: { // run 'jekyll build' on .html, .md, .php & .xml file changes globally...EXCEPT the '_site' directory
      //   files: ['*.html', '**/*.html','!_site/**/*.html', '!_site/*.html', 'email.php', '_posts/*.md', '!jekyllOutput.html', 'search.html'],
      //   tasks: ['jekyll:dev']
      // },
      layoutOnlyTask: { // run 'jekyll build' on .html, .md, .php & .xml file changes globally...EXCEPT the '_site' directory
        files: ['_templates/*.html'],
        tasks: ['targethtml:dev', 'jekyll:dev']
      },

      jsOnlyTask: { // run 'jekyll build' on .js file changes
        files: ['requireBuildOut/*.js'],
        tasks: ['requirejs', 'jekyll:dev']
      },

      cssOnlyTask: { // run 'jekyll build' on .scss/.css file changes
        files: ['grunt/cssSource/*.scss'],
        tasks: ['sassbuild', 'jekyll:dev']
      }

      // imgOnlyTask: { // run 'jekyll build' when the 'img/' directory changes
      //   files: ['img/*.{png,jpg,jpeg,gif}'],
      //   tasks: ['imagemin', 'jekyll:dev']
      // }
     },

    // create a custom 'modernizr' file
    modernizr: {

      "devFile" : "grunt/modernizr/modernizr-dev.js", //modernizr full build

      // Path to save out the built file.
      "outputFile" : "js/libs/modernizr.min.js",

      // Based on default settings on http://modernizr.com/download/
      "extra" : {
        "shiv" : true,
        "printshiv" : false,
        "load" : true,
        "mq" : false,
        "cssclasses" : true
      },

      // Based on default settings on http://modernizr.com/download/
      "extensibility" : {
        "addtest" : true,
        "prefixed" : false,
        "teststyles" : false,
        "testprops" : false,
        "testallprops" : false,
        "hasevents" : false,
        "prefixes" : false,
        "domprefixes" : false
      },

      // By default, source is uglified before saving
      "uglify" : true,

      // Define any tests you want to impliticly include.
      "tests" : [],

      // By default, this task will crawl your project for references to Modernizr tests.
      // Set to false to disable.
      "parseFiles" : true,

      // When parseFiles = true, this task will crawl all *.js, *.css, *.scss files.
      // You can override this by defining a "files" array below.
      "files" : ["css/styles.min.css","requireBuildOut/*.js","requireBuildOut/**/*.js"],

      // When parseFiles = true, matchCommunityTests = true will attempt to
      // match user-contributed tests.
      "matchCommunityTests" : false,

      // Have custom Modernizr tests? Add paths to their location here.
      "customTests" : [],

      // Files added here will be excluded when looking for Modernizr refs.
      "excludeFiles" : "Gruntfile.js"
    },

    // CDN task
    cdn: {
      options: {
          /** @required - root URL of your CDN (may contains sub-paths as shown below) */
          cdn: 'http://cdn.kaidez.com',
          /** @optional  - if provided both absolute and relative paths will be converted */
          flatten: false,
          /** @optional  - if provided will be added to the default supporting types */
          supportedTypes: { 'phtml': 'html' }
      },
      dist: {
          /** @required  - string (or array of) including grunt glob variables */
          src: ['_deploy/*.html', '_deploy/**/*.html', '_deploy/css/styles.min.css']
            }
        },

    // properties to be loaded into the application cache (manifest.appcache) file.  they load in via a template in the 'manifest task'
    site_files: [
      'js/libs/*.js'
    ],

    // create application cache (manifest.appcache) file for the whole site
    manifest: {
      generate: {
        options: {
          basePath: '_deploy/',
          cache: [
            'affiliate-disclaimer.html',
            'colophon.html',
            'index.html',
            'search.html',
            'search.json',
            'sitemap.html',
            'css/styles.min.css',
            'img/profilepic.jpg',
            'img/footer-bg.png',
            'img/homePageDefault.jpg',
            'img/kaidez-sprite.png',
            'img/kaidez-sprite@2x.png',
            'js/scripts.min.js',
            'font/FontAwesome.otf',
            'font/fontawesome-webfont.eot',
            'font/fontawesome-webfont.svg',
            'font/fontawesome-webfont.ttf',
            'font/fontawesome-webfont.woff'
          ],
          network: ['*'],
          preferOnline: true,
          verbose: true,
          timestamp: true,
        },
        src: '<%= site_files %>',
        dest: '_deploy/manifest.appcache'
      }
    },

    // automagically concat/minify site jS based on RequireJS settings
    requirejs: {
      compile: {
        options: {
          baseUrl: "requireBuildOut/",
          mainConfigFile: "requireBuildOut/config.js",
          name: 'config',
          out: "js/scripts.min.js",
           preserveLicenseComments: false,
             paths: {
              requireLib: 'require'
            },
            include: 'requireLib'
          }
        }
      },

      // copy task...used for updating Bower stuff
      copy: {
        backbone: {
          files: [
            {expand: true,
            cwd: 'bower_components/backbone/',
            src: ['backbone-min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        },
        enquire: {
          files: [
            {expand: true,
            cwd: 'bower_components/enquire/dist/',
            src: ['enquire.min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        },
        jquery: {
          files: [
            {expand: true,
            cwd: 'bower_components/jquery/',
            src: ['jquery.min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        },
        fontAwesome: {
          files: [
            {expand: true,
            cwd: 'bower_components/font-awesome/css/',
            src: ['font-awesome.css'],
            dest: 'grunt/cssSource/',
            rename: function(dest, src) {
              return dest + '_' + src.substring(12, src.indexOf('/')) + '.scss';
            },
            filter: 'isFile'}
          ]
        },
        matchMedia: {
          files: [
            {expand: true,
            cwd: 'bower_components/matchMedia/',
            src: ['*.js'],
            dest: 'js/libs/',
            filter: 'isFile'}
          ]
        },
        require: {
          files: [
            {expand: true,
            cwd: 'bower_components/requirejs/',
            src: ['require.js'],
            dest: 'requireBuildOut/', filter: 'isFile'}
          ]
        },
        spin: {
          files: [
            {expand: true,
            cwd: 'bower_components/spinjs/',
            src: ['spin.js'],
            dest: 'requireBuildOut/libs', filter: 'isFile'}
          ]
        },
        underscore: {
          files: [
            {expand: true,
            cwd: 'bower_components/underscore/',
            src: ['underscore-min.js'],
            dest: 'requireBuildOut/libs/', filter: 'isFile'}
          ]
        }
      },

      targethtml: {
        dev: {
          files: {
            '_layouts/homePage.html': '_templates/homePage.html',
            '_layouts/categories.html': '_templates/categories.html',
            '_layouts/post.html': '_templates/post.html',
            '_layouts/default.html': '_templates/default.html',
          }
        },
        prod: {
          files: {
            '_layouts/homePage.html': '_templates/homePage.html',
            '_layouts/categories.html': '_templates/categories.html',
            '_layouts/post.html': '_templates/post.html',
            '_layouts/default.html': '_templates/default.html',
          }
        }
      },

      // Shell commands for creating and removing '_deploy' folder
      shell: {
        makeDeploy: {
          command: 'mkdir _deploy'
        },
        removeDeploy: {
          command: 'rm -rf _deploy'
        }
      },

      // deployments
     'sftp-deploy': {
      // deploy to the development site
      staging: {
        auth: {
          host: 's46798.gridserver.com',
          port: 22,
          authKey: 'key1'
        },
        src: '_site',
        dest: '/nfs/c02/h08/mnt/46798/domains/dev.kaidez.com/html'
    },

    // deploy to the live site
    production: {
      auth: {
        host: 's46798.gridserver.com',
        port: 22,
        authKey: 'key1'
      },
      src: '_deploy',
      dest: '/nfs/c02/h08/mnt/46798/domains/kaidez.com/html'
      }
    }
  });

  // Use 'loadNpmTasks' to enable plugins
  grunt.loadNpmTasks('grunt-css');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-modernizr');
  grunt.loadNpmTasks('grunt-sftp-deploy');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-jekyll');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');
  grunt.loadNpmTasks('grunt-manifest');
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-cdn');
  grunt.loadNpmTasks('grunt-targethtml');
  grunt.loadNpmTasks('grunt-shell');

  // Default task(s)
  grunt.registerTask('default', ['watch']);
  grunt.registerTask('sassbuild', ['sass', 'cssmin']);
  grunt.registerTask('md', ['modernizr']);
  grunt.registerTask('rq', ['requirejs']);
  grunt.registerTask('dpush', ['jekyll:dev','sftp-deploy:staging']);
  grunt.registerTask('ppush', ['shell:makeDeploy','targethtml:prod', 'jekyll:prod', 'cdn', 'htmlmin', 'manifest', 'sftp-deploy:production', 'targethtml:dev', 'jekyll:dev','shell:removeDeploy']);
};<|endoftext|>