<commit_before>/**
* CONFIDENTIAL
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
* This is unpublished proprietary source code of Red Hat.
**/
// Generated on 2014-03-05 using generator-angular 0.7.1
'use strict';

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

module.exports = function (grunt) {

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

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

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

    // Project settings
    app: {
      // configurable paths
      src: 'src',
      dist: 'www',
      url: '',
      default_local_server_url: 'http://localhost:8001'
    },

    copy: {
      static: {
        files: [
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.html'], dest: '<%= app.dist %>', filter: 'isFile'},
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.json'], dest: '<%= app.dist %>', filter: 'isFile'},
        ],
      },
      css: {
        files: [
          {src: 'node_modules/angular-material/angular-material.css', dest: '<%= app.dist %>/css/', expand: true, flatten: true },
        ]
      }
    },

    sass: {
        options: {
            sourceMap: true
        },
        dist: {
            files: {
                '<%= app.dist %>/css/app.css': '<%= app.src %>/sass/app.scss'
            }
        }
    },

    browserify: {
      options: {
        browserifyOptions: {
           debug: true
        }
      },
      all: {
        files: {
          "<%= app.dist %>/app/bundle.js": ["<%= app.src %>/app/app.js"]
        },
        options: {
          watch: true
        }
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['<%= app.dist %>/app/bundle.js'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      html: {
        files: ['<%= app.src %>/{,*/}*.html'],
        tasks: ['copy:static']
      },
      sass: {
        files: ['<%= app.src %>/sass/{,*/}*.scss'],
        tasks: ['sass']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= app.dist %>/**/*.html',
          '<%= app.dist %>/css/{,*/}*.css',
          '<%= app.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9002,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35730
      },
      livereload: {
        options: {
          open: {
            target: '<%= app.url %>'
          },
          base: [
            '.tmp',
            '<%= app.dist %>'
          ]
        }
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: ['<%= app.dist %>'],
      server: '.tmp'
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'local') {
      var conn = 'http://' + grunt.config.get('connect.options.hostname') + ':' +
        grunt.config.get('connect.options.port');
      var url = grunt.option('url') || grunt.config.get('app.default_local_server_url');
      grunt.config.set('app.url', conn + '/?url=' + url);
    } else {
      // open with no url passed to fh-js-sdk
      grunt.config.set('connect.livereload.options.open', true);
    }

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

  grunt.registerTask('default', ['serve']);
};
<commit_msg>Changed the scss watch to include node_modules<commit_after>/**
* CONFIDENTIAL
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
* This is unpublished proprietary source code of Red Hat.
**/
// Generated on 2014-03-05 using generator-angular 0.7.1
'use strict';

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

module.exports = function (grunt) {

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

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

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

    // Project settings
    app: {
      // configurable paths
      src: 'src',
      dist: 'www',
      url: '',
      default_local_server_url: 'http://localhost:8001'
    },

    copy: {
      static: {
        files: [
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.html'], dest: '<%= app.dist %>', filter: 'isFile'},
          {expand: true, cwd: '<%= app.src %>/', src: ['**/*.json'], dest: '<%= app.dist %>', filter: 'isFile'},
        ],
      },
      css: {
        files: [
          {src: 'node_modules/angular-material/angular-material.css', dest: '<%= app.dist %>/css/', expand: true, flatten: true },
        ]
      }
    },

    sass: {
        options: {
            sourceMap: true
        },
        dist: {
            files: {
                '<%= app.dist %>/css/app.css': '<%= app.src %>/sass/app.scss'
            }
        }
    },

    browserify: {
      options: {
        browserifyOptions: {
           debug: true
        }
      },
      all: {
        files: {
          "<%= app.dist %>/app/bundle.js": ["<%= app.src %>/app/app.js"]
        },
        options: {
          watch: true
        }
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['<%= app.dist %>/app/bundle.js'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      html: {
        files: ['<%= app.src %>/{,*/}*.html'],
        tasks: ['copy:static']
      },
      sass: {
        files: ['**/*.scss'],
        tasks: ['sass']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= app.dist %>/**/*.html',
          '<%= app.dist %>/css/{,*/}*.css',
          '<%= app.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9002,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35730
      },
      livereload: {
        options: {
          open: {
            target: '<%= app.url %>'
          },
          base: [
            '.tmp',
            '<%= app.dist %>'
          ]
        }
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: ['<%= app.dist %>'],
      server: '.tmp'
    }
  });

  grunt.registerTask('serve', function (target) {
    if (target === 'local') {
      var conn = 'http://' + grunt.config.get('connect.options.hostname') + ':' +
        grunt.config.get('connect.options.port');
      var url = grunt.option('url') || grunt.config.get('app.default_local_server_url');
      grunt.config.set('app.url', conn + '/?url=' + url);
    } else {
      // open with no url passed to fh-js-sdk
      grunt.config.set('connect.livereload.options.open', true);
    }

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

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


<commit_before>//jshint maxcomplexity: 12, maxstatements: false, camelcase: false
var testConfig = require('./build/test/config');
module.exports = function (grunt) {
	'use strict';

	grunt.loadNpmTasks('grunt-babel');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-mocha');
	grunt.loadTasks('build/tasks');

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		clean: ['dist', 'tmp'],
		babel: {
			dist: {
				files: {
					'./axe.es2016.js': './axe.js'
				}
			}
		},
		'update-help': {
			options: {
				version: '<%=pkg.version%>'
			},
			rules: {
				src: ['lib/rules/**/*.json']
			}
		},
		concat: {
			engine: {
				src: [
					'lib/intro.stub',
					'lib/core/index.js',
					'lib/core/*/index.js',
					'lib/core/**/index.js',
					'lib/core/**/*.js',
					'lib/core/export.js',
					'<%= configure.rules.dest.auto %>',
					'lib/outro.stub'
				],
				dest: 'axe.es2016.js',
				options: {
					process: true
				}
			},
			commons: {
				src: [
					'lib/commons/intro.stub',
					'lib/commons/index.js',
					'lib/commons/*/index.js',
					'lib/commons/**/*.js',
					'lib/commons/export.js',
					'lib/commons/outro.stub'
				],
				dest: 'tmp/commons.js'
			}
		},
		configure: {
			rules: {
				src: ['<%= concat.commons.dest %>'],
				options: {
					tags: grunt.option('tags')
				},
				dest: {
					auto: 'tmp/rules.js',
					descriptions: 'doc/rule-descriptions.md'
				}
			}
		},
		langs : {
			generate: {
				check: 'lib/checks/language/valid-lang'
			}
		},
		validate: {
			tools: {
				options: {
					type: 'tool'
				},
				src: 'lib/tools/**/*.json'
			},
			check: {
				options: {
					type: 'check'
				},
				src: 'lib/checks/**/*.json'
			},
			rule: {
				options: {
					type: 'rule'
				},
				src: 'lib/rules/**/*.json'
			}
		},
		uglify: {
			beautify: {
				files: [{
					src: ['<%= concat.engine.dest %>'],
					dest: '<%= concat.engine.dest %>'
				}],
				options: {
					mangle: false,
					compress: false,
					beautify: {
						beautify: true,
						indent_level: 2,
						bracketize: true,
						quote_style: 1
					},
					preserveComments: 'some'
				}
			},
			lib: {
				files: [{
					src: ['./axe.js'],
					dest: './axe.min.js'
				}],
				options: {
					preserveComments: 'some',
					mangle: {
						except: ['commons', 'utils', 'axe']
					}
				}
			}
		},
		watch: {
			files: ['lib/**/*', 'test/**/*.js', 'Gruntfile.js'],
			tasks: ['build', 'testconfig', 'fixture']
		},
		testconfig: {
			test: {
				src: ['test/integration/rules/**/*.json'],
				dest: 'tmp/integration-tests.js'
			}
		},
		fixture: {
			engine: {
				src: '<%= concat.engine.src %>',
				dest: 'test/core/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/core',
					data: {
						title: 'aXe Core Tests'
					}
				}
			},
			checks: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.dest.auto %>'
				],
				dest: 'test/checks/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/checks',
					data: {
						title: 'aXe Check Tests'
					}
				}
			},
			commons: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.dest.auto %>'
				],
				dest: 'test/commons/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/commons',
					data: {
						title: 'aXe Commons Tests'
					}
				}
			},
			integration: {
				src: ['<%= concat.engine.dest %>'],
				dest: 'test/integration/rules/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/integration/rules',
					tests: ['../../../tmp/integration-tests.js', 'runner.js'],
					data: {
						title: 'aXe Integration Tests'
					}
				}
			}
		},
		mocha: testConfig(grunt),
		'test-webdriver': testConfig(grunt, {
			browser: grunt.option('browser') || 'firefox'
		}),
		connect: {
			test: {
				options: {
					hostname: '0.0.0.0',
					port: grunt.option('port') || 9876,
					base: ['.']
				}
			}
		},
		jshint: {
			axe: {
				options: {
					jshintrc: true,
					reporter: grunt.option('report') ? 'checkstyle' : undefined,
					reporterOutput: grunt.option('report') ? 'tmp/lint.xml' : undefined
				},
				src: ['lib/**/*.js', 'test/**/*.js', 'build/tasks/**/*.js', 'doc/**/*.js', 'Gruntfile.js']
			}
		}
	});

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

	grunt.registerTask('build', ['clean', 'validate', 'concat:commons', 'configure',
		'concat:engine', 'babel', 'uglify']);

	grunt.registerTask('test', ['build', 'testconfig', 'fixture', 'connect',
		'mocha', 'jshint']);

	grunt.registerTask('test-browser', ['build',  'testconfig', 'fixture', 'connect',
		'test-webdriver', 'jshint']);

	grunt.registerTask('dev', ['build', 'testconfig', 'connect', 'watch']);
};
<commit_msg>fixed babel guild problem<commit_after>//jshint maxcomplexity: 12, maxstatements: false, camelcase: false
var testConfig = require('./build/test/config');
module.exports = function (grunt) {
	'use strict';

	grunt.loadNpmTasks('grunt-babel');
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-mocha');
	grunt.loadTasks('build/tasks');

	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		clean: ['dist', 'tmp'],
		babel: {
			dist: {
				files: {
					'./axe.js': './axe.es2016.js'
				}
			}
		},
		'update-help': {
			options: {
				version: '<%=pkg.version%>'
			},
			rules: {
				src: ['lib/rules/**/*.json']
			}
		},
		concat: {
			engine: {
				src: [
					'lib/intro.stub',
					'lib/core/index.js',
					'lib/core/*/index.js',
					'lib/core/**/index.js',
					'lib/core/**/*.js',
					'lib/core/export.js',
					'<%= configure.rules.dest.auto %>',
					'lib/outro.stub'
				],
				dest: 'axe.es2016.js',
				options: {
					process: true
				}
			},
			commons: {
				src: [
					'lib/commons/intro.stub',
					'lib/commons/index.js',
					'lib/commons/*/index.js',
					'lib/commons/**/*.js',
					'lib/commons/export.js',
					'lib/commons/outro.stub'
				],
				dest: 'tmp/commons.js'
			}
		},
		configure: {
			rules: {
				src: ['<%= concat.commons.dest %>'],
				options: {
					tags: grunt.option('tags')
				},
				dest: {
					auto: 'tmp/rules.js',
					descriptions: 'doc/rule-descriptions.md'
				}
			}
		},
		langs : {
			generate: {
				check: 'lib/checks/language/valid-lang'
			}
		},
		validate: {
			tools: {
				options: {
					type: 'tool'
				},
				src: 'lib/tools/**/*.json'
			},
			check: {
				options: {
					type: 'check'
				},
				src: 'lib/checks/**/*.json'
			},
			rule: {
				options: {
					type: 'rule'
				},
				src: 'lib/rules/**/*.json'
			}
		},
		uglify: {
			beautify: {
				files: [{
					src: ['<%= concat.engine.dest %>'],
					dest: '<%= concat.engine.dest %>'
				}],
				options: {
					mangle: false,
					compress: false,
					beautify: {
						beautify: true,
						indent_level: 2,
						bracketize: true,
						quote_style: 1
					},
					preserveComments: 'some'
				}
			},
			lib: {
				files: [{
					src: ['./axe.js'],
					dest: './axe.min.js'
				}],
				options: {
					preserveComments: 'some',
					mangle: {
						except: ['commons', 'utils', 'axe']
					}
				}
			}
		},
		watch: {
			files: ['lib/**/*', 'test/**/*.js', 'Gruntfile.js'],
			tasks: ['build', 'testconfig', 'fixture']
		},
		testconfig: {
			test: {
				src: ['test/integration/rules/**/*.json'],
				dest: 'tmp/integration-tests.js'
			}
		},
		fixture: {
			engine: {
				src: '<%= concat.engine.src %>',
				dest: 'test/core/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/core',
					data: {
						title: 'aXe Core Tests'
					}
				}
			},
			checks: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.dest.auto %>'
				],
				dest: 'test/checks/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/checks',
					data: {
						title: 'aXe Check Tests'
					}
				}
			},
			commons: {
				src: [
					'<%= concat.engine.dest %>',
					'build/test/engine.js',
					'<%= configure.rules.dest.auto %>'
				],
				dest: 'test/commons/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/commons',
					data: {
						title: 'aXe Commons Tests'
					}
				}
			},
			integration: {
				src: ['<%= concat.engine.dest %>'],
				dest: 'test/integration/rules/index.html',
				options: {
					fixture: 'test/runner.tmpl',
					testCwd: 'test/integration/rules',
					tests: ['../../../tmp/integration-tests.js', 'runner.js'],
					data: {
						title: 'aXe Integration Tests'
					}
				}
			}
		},
		mocha: testConfig(grunt),
		'test-webdriver': testConfig(grunt, {
			browser: grunt.option('browser') || 'firefox'
		}),
		connect: {
			test: {
				options: {
					hostname: '0.0.0.0',
					port: grunt.option('port') || 9876,
					base: ['.']
				}
			}
		},
		jshint: {
			axe: {
				options: {
					jshintrc: true,
					reporter: grunt.option('report') ? 'checkstyle' : undefined,
					reporterOutput: grunt.option('report') ? 'tmp/lint.xml' : undefined
				},
				src: ['lib/**/*.js', 'test/**/*.js', 'build/tasks/**/*.js', 'doc/**/*.js', 'Gruntfile.js']
			}
		}
	});

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

	grunt.registerTask('build', ['clean', 'validate', 'concat:commons', 'configure',
		'concat:engine', 'babel', 'uglify']);

	grunt.registerTask('test', ['build', 'testconfig', 'fixture', 'connect',
		'mocha', 'jshint']);

	grunt.registerTask('test-browser', ['build',  'testconfig', 'fixture', 'connect',
		'test-webdriver', 'jshint']);

	grunt.registerTask('dev', ['build', 'testconfig', 'connect', 'watch']);
};
<|endoftext|>


<commit_before>/*
 * grunt-image-resize
 * https://github.com/excellenteasy.com/grunt-image-resize
 *
 * Copyright (c) 2013 David Pfahler
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    jshint: {
      all: [
        'Gruntfile.js',
        'tasks/*.js',
        '<%= nodeunit.tests %>'
      ],
      options: {
        jshintrc: '.jshintrc'
      },
    },

    // Before generating any new files, remove any previously-created files.
    clean: {
      tests: ['tmp/*']
    },

    // Configuration to be run (and then tested).
    image_resize: {
      options: {
        width: 100
      },
      resize: {
        files: [
          {'tmp/gnu.jpg': 'test/fixtures/gnu.jpg'},
          {'tmp/wikipedia.png': 'test/fixtures/wikipedia.png'},
          {'tmp/Rhododendron.jpg': 'test/fixtures/Rhododendron.jpg'},
          {'tmp/TeslaTurbine.png': 'test/fixtures/TeslaTurbine.png'}
        ]
      },
      no_overwrite: {
        options: {
          width: 0,
          height: 50,
          overwrite: false
        },
        files: [
          {'tmp/gnu.jpg': 'test/fixtures/gnu.jpg'},
          {'tmp/wikipedia.png': 'test/fixtures/wikipedia.png'},
          {'tmp/Rhododendron.jpg': 'test/fixtures/Rhododendron.jpg'},
          {'tmp/TeslaTurbine.png': 'test/fixtures/TeslaTurbine.png'}
        ]
      },
      upscale: {
        options: {
          width: 600,
          height: 0,
          upscale: true
        },
        files: [
          {'tmp/upscale.png': 'test/fixtures/upscale.png'}
        ]
      },
      upscale2: {
        options: {
          width: 600,
          height: 600,
          upscale: true
        },
        files: [
          {'tmp/upscale2.png': 'test/fixtures/upscale2.png'}
        ]
      },
      no_upscale: {
        options: {
          width: 600,
          height: 0,
          upscale: false
        },
        files: [
          {'tmp/no_upscale.png': 'test/fixtures/no_upscale.png'}
        ]
      },
      crop: {
        options: {
          width: 400,
          height: 300,
          upscale: false,
          crop: true
        },
        files: [
          {'tmp/crop.png': 'test/fixtures/crop.png'}
      },
      quality: {
        options: {
          width: 600,
          height: 0,
          upscale: false,
          quality: 0.2
        },
        files: [
          {'tmp/quality.jpg': 'test/fixtures/quality.jpg'}
        ]
      }
    },

    // Unit tests.
    nodeunit: {
      tests: ['test/*_test.js']
    },

  });

  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  // Whenever the "test" task is run, first clean the "tmp" dir, then run this
  // plugin's task(s), then test the result.
  grunt.registerTask('test', [
    'clean',
    'image_resize',
    'nodeunit'
  ]);

  // By default, lint and run all tests.
  grunt.registerTask('default', ['jshint', 'test']);

};
<commit_msg>fixed Gruntfile<commit_after>/*
 * grunt-image-resize
 * https://github.com/excellenteasy.com/grunt-image-resize
 *
 * Copyright (c) 2013 David Pfahler
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    jshint: {
      all: [
        'Gruntfile.js',
        'tasks/*.js',
        '<%= nodeunit.tests %>'
      ],
      options: {
        jshintrc: '.jshintrc'
      },
    },

    // Before generating any new files, remove any previously-created files.
    clean: {
      tests: ['tmp/*']
    },

    // Configuration to be run (and then tested).
    image_resize: {
      options: {
        width: 100
      },
      resize: {
        files: [
          {'tmp/gnu.jpg': 'test/fixtures/gnu.jpg'},
          {'tmp/wikipedia.png': 'test/fixtures/wikipedia.png'},
          {'tmp/Rhododendron.jpg': 'test/fixtures/Rhododendron.jpg'},
          {'tmp/TeslaTurbine.png': 'test/fixtures/TeslaTurbine.png'}
        ]
      },
      no_overwrite: {
        options: {
          width: 0,
          height: 50,
          overwrite: false
        },
        files: [
          {'tmp/gnu.jpg': 'test/fixtures/gnu.jpg'},
          {'tmp/wikipedia.png': 'test/fixtures/wikipedia.png'},
          {'tmp/Rhododendron.jpg': 'test/fixtures/Rhododendron.jpg'},
          {'tmp/TeslaTurbine.png': 'test/fixtures/TeslaTurbine.png'}
        ]
      },
      upscale: {
        options: {
          width: 600,
          height: 0,
          upscale: true
        },
        files: [
          {'tmp/upscale.png': 'test/fixtures/upscale.png'}
        ]
      },
      upscale2: {
        options: {
          width: 600,
          height: 600,
          upscale: true
        },
        files: [
          {'tmp/upscale2.png': 'test/fixtures/upscale2.png'}
        ]
      },
      no_upscale: {
        options: {
          width: 600,
          height: 0,
          upscale: false
        },
        files: [
          {'tmp/no_upscale.png': 'test/fixtures/no_upscale.png'}
        ]
      },
      crop: {
        options: {
          width: 400,
          height: 300,
          upscale: false,
          crop: true
        },
        files: [
          {'tmp/crop.png': 'test/fixtures/crop.png'}
        ]
      },
      quality: {
        options: {
          width: 600,
          height: 0,
          upscale: false,
          quality: 0.2
        },
        files: [
          {'tmp/quality.jpg': 'test/fixtures/quality.jpg'}
        ]
      }
    },

    // Unit tests.
    nodeunit: {
      tests: ['test/*_test.js']
    },

  });

  // Actually load this plugin's task(s).
  grunt.loadTasks('tasks');

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

  // Whenever the "test" task is run, first clean the "tmp" dir, then run this
  // plugin's task(s), then test the result.
  grunt.registerTask('test', [
    'clean',
    'image_resize',
    'nodeunit'
  ]);

  // By default, lint and run all tests.
  grunt.registerTask('default', ['jshint', 'test']);

};
<|endoftext|>


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

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

    // Project configuration
    // ---------------------

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

    yuidoc: {
      compile: {
        'name': '<%= pkg.name %>',
        'description': '<%= pkg.description %>',
        'version': '<%= pkg.version %>',
        'url': '<%= pkg.url %>',
        options: {
          paths: '.',
          outdir: 'report/api/'
        }
      }
    },

    nodeunit: {}

  });

  grunt.loadNpmTasks('grunt-contrib-yuidoc');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-nodeunit');

};
<commit_msg>CI goodness<commit_after>module.exports = function(grunt) {
  'use strict';

  grunt.initConfig({

    // load module meta data
    pkg: grunt.file.readJSON('package.json'),

    // define a src set of files for other tasks
    src: {
      lint: ['Gruntfile.js', 'index.js', 'lib/**/*.js', 'test/*.js'],
      complexity: ['index.js', 'lib/**/*.js', 'test/*.js'],
      test: ['test/*.js'],
      src: ['index.js']
    },

    // clean coverage helper file
    clean: ['coverage', 'report', 'report.zip'],

    // linting
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: '<%= src.lint %>'
    },

    // testing
    mochaTest: {
      test: {
        options: {
          reporter: 'spec',
          require: 'coverage/blanket'
        },
        src: '<%= src.test %>'
      },
      coverage: {
        options: {
          reporter: 'html-cov',
          quiet: true
        },
        src: '<%= src.test %>',
        dest: 'report/coverage/index.html'
      }
    },

    // code metrics
    complexity: {
      generic: {
        src: '<%= src.complexity %>',
        options: {
          cyclomatic: 10,
          halstead: 22,
          maintainability: 80
        }
      }
    },
    plato: {
      generic: {
        options : {
          jshint : grunt.file.readJSON('.jshintrc')
        },
        files: {
          'report/complexity': '<%= src.complexity %>',
        }
      }
    },

    // api docs
    yuidoc: {
      compile: {
        name: '<%= pkg.name %>',
        description: '<%= pkg.description %>',
        version: '<%= pkg.version %>',
        url: '<%= pkg.homepage %>',
        options: {
          paths: '.',
          outdir: 'report/api'
        }
      }
    },

    // user docs
    documantix: {
      options: {
        header: 'dalekjs/dalekjs.com/master/assets/header.html',
        footer: 'dalekjs/dalekjs.com/master/assets/footer.html',
        target: 'report/docs'
      },
      src: ['index.js']
    },

    // compress artifacts
    compress: {
      main: {
        options: {
          archive: 'report.zip'
        },
        files: [
          {src: ['report/**'], dest: '/'}
        ]
      }
    }

  });

  // prepare files & folders for grunt:plato & coverage
  grunt.registerTask('prepare', function () {
    var fs = require('fs');

    // generate dirs for docs & reports
    ['coverage', 'report', 'report/coverage',
    'report/complexity', 'report/complexity/files',
    'report/complexity/files/index_js',
    'report/complexity/files/lib_levelbase_js',
    'report/complexity/files/lib_loglevel_level0_js',
    'report/complexity/files/lib_loglevel_level1_js',
    'report/complexity/files/lib_loglevel_level2_js',
    'report/complexity/files/lib_loglevel_level3_js',
    'report/complexity/files/lib_loglevel_level4_js',
    'report/complexity/files/test_index_TEST_js'].forEach(function (path) {
      fs.mkdirSync(__dirname + '/' + path);
    });

    // store some dummy reports, so that grunt plato doesnt complain
    ['report.history.json',
    'files/test_index_TEST_js/report.history.json',
    'files/index_js/report.history.json',
    'files/lib_levelbase_js/report.history.json',
    'files/lib_loglevel_level0_js/report.history.json',
    'files/lib_loglevel_level1_js/report.history.json',
    'files/lib_loglevel_level2_js/report.history.json',
    'files/lib_loglevel_level3_js/report.history.json',
    'files/lib_loglevel_level4_js/report.history.json',
    'files/test_index_TEST_js/report.history.json'].forEach(function (file) {
      fs.writeFileSync(__dirname + '/report/complexity/' + file, '{}');
    });

    // generate code coverage helper file
    var coverageHelper = 'require("blanket")({pattern: require("fs").realpathSync(__dirname + "/../index.js")});';
    fs.writeFileSync(__dirname + '/coverage/blanket.js', coverageHelper);
  });

  // load 3rd party tasks
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-yuidoc');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-complexity');
  grunt.loadNpmTasks('grunt-documantix');
  grunt.loadNpmTasks('grunt-plato');

  // define runner tasks
  grunt.registerTask('lint', 'jshint');
  grunt.registerTask('test', ['clean', 'prepare', 'lint', 'mochaTest', 'complexity']);
  grunt.registerTask('docs', ['clean', 'prepare', 'plato', 'mochaTest', 'documantix', 'yuidoc', 'compress']);
};
<|endoftext|>


<commit_before>var merge = require("deepmerge");
var path = require('path');

module.exports = function(grunt) {

  grunt.initConfig({
    dist: grunt.option('output') || 'dist',
    phpbin: '/Applications/MAMP/bin/php/php5.6.2/bin',
    pkg: grunt.file.readJSON('package.json'),
    clean: {
      'build': "<%= dist %>",
      'tmp': ['tmp']
    },
    copy: {
      'dist': {
        dot: true,
        expand: true,
        cwd: '.',
        src: ['wp/**/*', 'vendor/**/*', 'index.php', '.htaccess'],
        dest: grunt.option('output') || "<%= dist %>"
      },
      'broccoli': {
        dot: true,
        expand: true,
        cwd: 'tmp/broccoli_build',
        src: ['**/*.*'],
        dest: grunt.option('output') || "<%= dist %>/app"
      }
    },
    curl: {
      'wordpress': {
          src: 'http://wordpress.org/latest.zip',
          dest: 'tmp/downloads/wordpress/latest.zip'
      },
      'composer': {
        src: 'https://getcomposer.org/installer',
        dest: 'composer.phar'
      }
    },
    unzip: {
      "wordpress": {
        cwd: 'wordpress',
        src: "tmp/downloads/wordpress/latest.zip",
        dest: "tmp/wordpress"
      }
    },
    template: {
      'dist': {
          options: {
            data: function() {
              return merge(
                grunt.file.readJSON('config/application.json'),
                grunt.file.readJSON('config/environment/' + ( grunt.option("environment")  || 'development' ) + '.json')
              );
            }
          },
          src: 'wp-config.php',
          dest: ( grunt.option('output') || "<%= dist %>" ) + "/wp-config.php"
      }
    },
    php: {
      serve: {
        options: {
          bin: "/Applications/MAMP/bin/php/php5.4.34/bin/php",
          base: 'dist',
          keepalive: true,
          open: true
        }
      }
    },
    broccoli: {
      dist: {
        cwd: 'app',
        env: ( grunt.option('target') || 'development' ),
        dest: 'tmp/broccoli_build',
        config: 'Brocfile.js'
      }
    },
    rsync: {
      options: {
        src: "<%= dist %>/.",
        //args: ["--verbose"],
        recursive: true
      },
      development: {
        options: {
          dest: "/Applications/MAMP/htdocs/kicks-app/",
          delete: true
        }
      },
      test: {
        options: {
          dest: "/var/www/site",
          host: "user@staging-host",
          delete: true // Careful this option could cause data loss, read the docs!
        }
      },
      production: {
        options: {
          dest: "/var/www/site",
          host: "user@live-host",
          delete: true // Careful this option could cause data loss, read the docs!
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-broccoli');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-template');
  grunt.loadNpmTasks('grunt-php');
  grunt.loadNpmTasks('grunt-curl');
  grunt.loadNpmTasks('grunt-zip');
  grunt.loadNpmTasks('grunt-phpdocumentor');
  grunt.loadNpmTasks('grunt-wp-i18n');
  grunt.loadNpmTasks('grunt-rsync');

  /**
   * This task downloads the latest wordpress to dist
   */
  grunt.registerTask('install', [
    'clean:tmp',
    'curl:wordpress',
    'unzip:wordpress',
    'copy:wordpress',
    'clean:tmp'
  ]);

  grunt.registerTask('build', [
    'clean:build',
    'clean:tmp',
    'broccoli:dist:build',
    'copy:dist',
    'copy:broccoli',
    'template:dist',
    //'clean:tmp'
  ]);

  grunt.registerTask('deploy', [
    'build',
    'rsync:' + (grunt.option('target') || 'development')
  ]);

  grunt.registerTask('serve', [
    'php:serve'
  ]);

};<commit_msg>Added pkg to config vars<commit_after>var merge = require("deepmerge");
var path = require('path');

module.exports = function(grunt) {

  var pkg = grunt.file.readJSON('package.json');
  grunt.initConfig({
    dist: grunt.option('output') || 'dist',
    phpbin: '/Applications/MAMP/bin/php/php5.6.2/bin',
    pkg: pkg,
    clean: {
      'build': "<%= dist %>",
      'tmp': ['tmp']
    },
    copy: {
      'dist': {
        dot: true,
        expand: true,
        cwd: '.',
        src: ['wp/**/*', 'vendor/**/*', 'index.php', '.htaccess'],
        dest: grunt.option('output') || "<%= dist %>"
      },
      'broccoli': {
        dot: true,
        expand: true,
        cwd: 'tmp/broccoli_build',
        src: ['**/*.*'],
        dest: grunt.option('output') || "<%= dist %>/app"
      }
    },
    curl: {
      'wordpress': {
          src: 'http://wordpress.org/latest.zip',
          dest: 'tmp/downloads/wordpress/latest.zip'
      },
      'composer': {
        src: 'https://getcomposer.org/installer',
        dest: 'composer.phar'
      }
    },
    unzip: {
      "wordpress": {
        cwd: 'wordpress',
        src: "tmp/downloads/wordpress/latest.zip",
        dest: "tmp/wordpress"
      }
    },
    template: {
      'dist': {
          options: {
            data: function() {
              return {
                pkg: pkg,
                config: merge(
                  grunt.file.readJSON('config/application.json'),
                  grunt.file.readJSON('config/environment/' + ( grunt.option("environment")  || 'development' ) + '.json')
                )
              };
            }
          },
          src: 'wp-config.php',
          dest: ( grunt.option('output') || "<%= dist %>" ) + "/wp-config.php"
      }
    },
    php: {
      serve: {
        options: {
          bin: "/Applications/MAMP/bin/php/php5.4.34/bin/php",
          base: 'dist',
          keepalive: true,
          open: true
        }
      }
    },
    broccoli: {
      dist: {
        cwd: 'app',
        env: ( grunt.option('target') || 'development' ),
        dest: 'tmp/broccoli_build',
        config: 'Brocfile.js'
      }
    },
    rsync: {
      options: {
        src: "<%= dist %>/.",
        //args: ["--verbose"],
        recursive: true
      },
      development: {
        options: {
          dest: "/Applications/MAMP/htdocs/kicks-app/",
          delete: true
        }
      },
      test: {
        options: {
          dest: "/var/www/site",
          host: "user@staging-host",
          delete: true // Careful this option could cause data loss, read the docs!
        }
      },
      production: {
        options: {
          dest: "/var/www/site",
          host: "user@live-host",
          delete: true // Careful this option could cause data loss, read the docs!
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-broccoli');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-template');
  grunt.loadNpmTasks('grunt-php');
  grunt.loadNpmTasks('grunt-curl');
  grunt.loadNpmTasks('grunt-zip');
  grunt.loadNpmTasks('grunt-phpdocumentor');
  grunt.loadNpmTasks('grunt-wp-i18n');
  grunt.loadNpmTasks('grunt-rsync');

  /**
   * This task downloads the latest wordpress to dist
   */
  grunt.registerTask('install', [
    'clean:tmp',
    'curl:wordpress',
    'unzip:wordpress',
    'copy:wordpress',
    'clean:tmp'
  ]);

  grunt.registerTask('build', [
    'clean:build',
    'clean:tmp',
    'broccoli:dist:build',
    'copy:dist',
    'copy:broccoli',
    'template:dist',
    //'clean:tmp'
  ]);

  grunt.registerTask('deploy', [
    'build',
    'rsync:' + (grunt.option('target') || 'development')
  ]);

  grunt.registerTask('serve', [
    'php:serve'
  ]);

};<|endoftext|>


<commit_before>'use strict';

var BROWSERS = [
  'PhantomJS',
  'Opera',
  'Firefox',
  'Chrome',
  'ChromeCanary',
  'Safari'
];

var config = {
  src: 'src/',
  build: 'tmp/'
};

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

  grunt.initConfig({
    config: config,
    pkg: require('./package.json'),
    bower: require('./bower.json'),
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= config.src %>/**/*.js'
      ]
    },
    karma: {
      options: {
        configFile: 'karma.conf.js'
      },
      watch: {
        options: {
          autoWatch: true,
          singleRun: false
        }
      },
      ci: {
        options: {
          reporters: ['junit']
        }
      },
      unit: {
        options: {
          browsers: BROWSERS
        }
      },
      coverage: {
        options: {
          reporters: ['coverage'],
        }
      }
    },
    copy: {
      build: {
        files: [{
          expand: true,
          flatten: true,
          cwd: '<%= config.src %>',
          dest: '<%= config.build %>',
          src: [
            '**/*.js',
            '!**/*spec.js'
          ]
        }]
      }
    },
    concat: {
      options: {
        stripBanners: true,
        banner: '/**\n' +
          ' * @license <%= pkg.name %> v<%= pkg.version %>\n' +
          ' * (c) 2013-<%= grunt.template.today("yyyy") %> GoCardless, Ltd.\n' +
          ' * <%= pkg.repository.url %>\n' +
          ' * License: MIT\n' +
          ' */',
      },
      build: {
        src: ['<%= config.build %>/*.js'],
        dest: '<%= bower.main %>'
      }
    },
    clean: {
      build: {
        files: [{
          dot: true,
          src: [
            '<%= config.build %>'
          ]
        }]
      }
    },
    ngtemplatecache: {
      options: {
        stripPrefix: '<%= config.build %>'
      },
      build: {
        files: [{
          src: ['<%= config.build %>/**/*.html'],
          dest: '<%= config.build %>/directive-template.js'
        }]
      }
    },
    htmlmin: {
      build: {
        options: {
          removeComments: true,
          collapseWhitespace: true
        },
        files: [{
          expand: true,
          flatten: true,
          src: ['<%= config.src %>/**/*.html'],
          dest: '<%= config.build %>'
        }]
      }
    },
    uglify: {
      dist: {
        files: {
          '<%= bower.name %>.min.js': ['<%= bower.main %>']
        }
      }
    },
    'ddescribe-iit': {
      files: [
        'src/**/*.js',
      ]
    }
  });

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

  grunt.registerTask('citest', [
    'jshint',
    'ddescribe-iit',
    'karma:ci'
  ]);

  grunt.registerTask('build', [
    // 'test',
    'htmlmin',
    'ngtemplatecache',
    'copy:build',
    'concat',
    'clean:build',
    'uglify'
  ]);
};
<commit_msg>Fix circle<commit_after>'use strict';

var BROWSERS = [
  'PhantomJS',
  'Opera',
  'Firefox',
  'Chrome',
  'ChromeCanary',
  'Safari'
];

var config = {
  src: 'src/',
  build: 'tmp/'
};

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

  grunt.initConfig({
    config: config,
    pkg: require('./package.json'),
    bower: require('./bower.json'),
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        '<%= config.src %>/**/*.js'
      ]
    },
    karma: {
      options: {
        configFile: 'karma.conf.js'
      },
      watch: {
        options: {
          autoWatch: true,
          singleRun: false
        }
      },
      ci: {
        options: {
          browsers: ['Firefox', 'Chrome']
        }
      },
      unit: {
        options: {
          browsers: BROWSERS
        }
      },
      coverage: {
        options: {
          reporters: ['coverage'],
        }
      }
    },
    copy: {
      build: {
        files: [{
          expand: true,
          flatten: true,
          cwd: '<%= config.src %>',
          dest: '<%= config.build %>',
          src: [
            '**/*.js',
            '!**/*spec.js'
          ]
        }]
      }
    },
    concat: {
      options: {
        stripBanners: true,
        banner: '/**\n' +
          ' * @license <%= pkg.name %> v<%= pkg.version %>\n' +
          ' * (c) 2013-<%= grunt.template.today("yyyy") %> GoCardless, Ltd.\n' +
          ' * <%= pkg.repository.url %>\n' +
          ' * License: MIT\n' +
          ' */',
      },
      build: {
        src: ['<%= config.build %>/*.js'],
        dest: '<%= bower.main %>'
      }
    },
    clean: {
      build: {
        files: [{
          dot: true,
          src: [
            '<%= config.build %>'
          ]
        }]
      }
    },
    ngtemplatecache: {
      options: {
        stripPrefix: '<%= config.build %>'
      },
      build: {
        files: [{
          src: ['<%= config.build %>/**/*.html'],
          dest: '<%= config.build %>/directive-template.js'
        }]
      }
    },
    htmlmin: {
      build: {
        options: {
          removeComments: true,
          collapseWhitespace: true
        },
        files: [{
          expand: true,
          flatten: true,
          src: ['<%= config.src %>/**/*.html'],
          dest: '<%= config.build %>'
        }]
      }
    },
    uglify: {
      dist: {
        files: {
          '<%= bower.name %>.min.js': ['<%= bower.main %>']
        }
      }
    },
    'ddescribe-iit': {
      files: [
        'src/**/*.js',
      ]
    }
  });

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

  grunt.registerTask('citest', [
    'jshint',
    'ddescribe-iit',
    'karma:ci'
  ]);

  grunt.registerTask('build', [
    // 'test',
    'htmlmin',
    'ngtemplatecache',
    'copy:build',
    'concat',
    'clean:build',
    'uglify'
  ]);
};
<|endoftext|>


<commit_before>// Generated on 2013-12-20 using generator-angular 0.6.0
'use strict';

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

module.exports = function (grunt) {

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

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

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

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    shell: {
      options: {
        stdout: true
      },
      protractorInstallUpdate: {
        command: 'node ./node_modules/protractor/bin/webdriver-manager update'
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all']
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma:unit']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      styles: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>',
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35730
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          base: '<%= yeoman.dist %>'
        }
      }
    },

    protractor: {
      options: {
        keepAlive: true,
        configFile: 'protractor.conf.js'
      },
      singlerun: {
        options:{
          args: {
            baseUrl: 'http://localhost:9001'
          }
        }
      }
    },

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

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

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

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    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/*'
          ]
        }
      }
    },

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

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    htmlmin: {
      dist: {
        options: {
          // Optional configurations that you can uncomment to use
          // removeCommentsFromCDATA: 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 %>'
        }]
      }
    },

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

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

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

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server',
        'copy:styles'
      ],
      test: [
        'compass',
        'copy:styles'
      ],
      dist: [
        'compass:dist',
        'copy:styles',
        'imagemin',
        'svgmin',
        'htmlmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

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

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

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

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

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

  grunt.registerTask('test:e2e', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'shell:protractorInstallUpdate',
    'protractor:singlerun'
  ]);

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

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>Let livereload watch more files<commit_after>// Generated on 2013-12-20 using generator-angular 0.6.0
'use strict';

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

module.exports = function (grunt) {

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

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

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

    // Project settings
    yeoman: {
      // configurable paths
      app: require('./bower.json').appPath || 'app',
      dist: 'dist'
    },

    shell: {
      options: {
        stdout: true
      },
      protractorInstallUpdate: {
        command: 'node ./node_modules/protractor/bin/webdriver-manager update'
      }
    },

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      js: {
        files: ['{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all']
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma:unit']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      styles: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>',
        },
        files: [
          '<%= yeoman.app %>/api/**/*',
          '<%= yeoman.app %>/views/**/*.html',
          '<%= yeoman.app %>/index.html',
          '<%= yeoman.app %>/scripts/**/*.js',
          '<%= yeoman.app %>/vendor/**/*.{js,css}',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35730
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            '<%= yeoman.app %>'
          ]
        }
      },
      test: {
        options: {
          port: 9001,
          base: [
            '.tmp',
            'test',
            '<%= yeoman.app %>'
          ]
        }
      },
      dist: {
        options: {
          base: '<%= yeoman.dist %>'
        }
      }
    },

    protractor: {
      options: {
        keepAlive: true,
        configFile: 'protractor.conf.js'
      },
      singlerun: {
        options:{
          args: {
            baseUrl: 'http://localhost:9001'
          }
        }
      }
    },

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

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

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

    // Compiles Sass to CSS and generates necessary files if requested
    compass: {
      options: {
        sassDir: '<%= yeoman.app %>/styles',
        cssDir: '.tmp/styles',
        generatedImagesDir: '.tmp/images/generated',
        imagesDir: '<%= yeoman.app %>/images',
        javascriptsDir: '<%= yeoman.app %>/scripts',
        fontsDir: '<%= yeoman.app %>/styles/fonts',
        importPath: '<%= yeoman.app %>/bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    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/*'
          ]
        }
      }
    },

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

    // Performs rewrites based on rev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>']
      }
    },

    // The following *-min tasks produce minified files in the dist folder
    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },
    htmlmin: {
      dist: {
        options: {
          // Optional configurations that you can uncomment to use
          // removeCommentsFromCDATA: 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 %>'
        }]
      }
    },

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

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

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

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server',
        'copy:styles'
      ],
      test: [
        'compass',
        'copy:styles'
      ],
      dist: [
        'compass:dist',
        'copy:styles',
        'imagemin',
        'svgmin',
        'htmlmin'
      ]
    },

    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css',
    //         '<%= yeoman.app %>/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

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

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

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

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

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

  grunt.registerTask('test:e2e', [
    'clean:server',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'shell:protractorInstallUpdate',
    'protractor:singlerun'
  ]);

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

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


<commit_before>/* jshint node: true */

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

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

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

    // Tasks configuration
    jshint: {
      src: {
        options: {
          jshintrc: true,
          ignores: 'node_modules/**'
        },
        src: ['**/*.js']
      }
    },
    jscs: {
      gruntfile: {
        src: ['Gruntfile.js']
      },
      src: {
        src: ['**/*.js']
      }
    },
    clean: {
      dist: 'dist'
    },
    copy: {
      chrome: {
        src: 'chrome/**',
        dest: 'dist/'
      }
    },
    zip: {
      chrome: {
        src: 'chrome/**',
        dest: 'dist/chrome.crx'
      }
    },
  });

  // Load plugins
  require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});

  // Tests task
  grunt.registerTask('test', ['jshint', 'jscs']);

  // Distribution task
  grunt.registerTask('dist', ['clean', 'copy', 'zip']);

  // Default task
  grunt.registerTask('default', ['test', 'dist']);
};
<commit_msg>Grunt meta fixes<commit_after>/* jshint node: true */

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

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

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

    // Tasks
    jshint: {
      src: {
        options: {
          jshintrc: true,
          ignores: 'node_modules/**'
        },
        src: ['**/*.js']
      }
    },
    jscs: {
      gruntfile: {
        src: ['Gruntfile.js']
      },
      src: {
        src: ['**/*.js']
      }
    },
    clean: {
      dist: 'dist'
    },
    copy: {
      chrome: {
        src: 'chrome/**',
        dest: 'dist/'
      }
    },
    zip: {
      chrome: {
        src: 'chrome/**',
        dest: 'dist/chrome.crx'
      }
    },
  });

  // Load plugins
  require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});

  // Tests task
  grunt.registerTask('test', ['jshint', 'jscs']);

  // Distribution task
  grunt.registerTask('dist', ['clean', 'copy', 'zip']);

  // Default task
  grunt.registerTask('default', ['test', 'dist']);
};
<|endoftext|>


<commit_before>/**
 * The-M-Project Build Script
 * Version: 0.1.0
 */

var _ = require('lodash');

module.exports = function (grunt) {
    // show elapsed time at the end
    require('time-grunt')(grunt);
    // load all grunt tasks
    require('load-grunt-tasks')(grunt);

    var additionalMarkdownFiles = {
        'https://raw.github.com/mwaylabs/The-M-Project-Sample-Apps/master/README.md': 'Sample-Apps.md',
        'https://raw.github.com/mwaylabs/generator-m/master/README.md': 'Generator.md',
        'https://raw.github.com/mwaylabs/The-M-Project-Sample-Apps/master/demoapp/README.md': 'Demo-App.md'
    }

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/*!\n' +
                '* Project:   The M-Project - Mobile HTML5 Application Framework\n' +
                '* Copyright: (c) <%= grunt.template.today("yyyy") %> M-Way Solutions GmbH.\n' +
                '* Version:   <%= pkg.version %>\n' +
                '* Date:      <%= grunt.template.today() %>\n' +
                '* License:   http://github.com/mwaylabs/The-M-Project/blob/absinthe/MIT-LICENSE.txt\n' +
                '*/'
        },
        jsonlint: {
            sample: {
                src: [ 'package.json', 'bower.json' ]
            }
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                ignores: ['src/_*.js', 'src/themproject*.js', 'src/ui/themevars.js']
            },
            src: [ 'src/**/*.js' ]
        },
        preprocess: {
            options: {
                context: {
                    BANNER: '<%= meta.banner %>',
                    VERSION: '<%= pkg.version %>'
                }
            },
            dev: {
                files: {
                    '.tmp/themproject.js': 'src/themproject.js'
                }
            },
            dist: {
                files: {
                    'dist/themproject.js': 'src/themproject.js',
                    'dist/themproject.bd.js': 'src/themproject.bd.js'
                }
            }
        },
        uglify: {
            options: {
                preserveComments: 'some'
            },
            core: {
                src: 'dist/themproject.js',
                dest: 'dist/themproject.min.js',
                options: {
                    sourceMap: 'dist/themproject.map',
                    sourceMappingURL: 'themproject.map',
                    sourceMapPrefix: 1
                }
            },
            bd: {
                src: 'dist/themproject.bd.js',
                dest: 'dist/themproject.bd.min.js',
                options: {
                    sourceMap: 'dist/themproject.bd.map',
                    sourceMappingURL: 'themproject.bd.map',
                    sourceMapPrefix: 1
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'dist/',
                src: ['*.css', '!*.min.css'],
                dest: 'dist/',
                ext: '.min.css'
            }
        },
        watch: {
            js: {
                files: ['src/**/*'],
                tasks: ['build-js'],
                options: {
                    spawn: false
                }
            },
            css: {
                files: ['resources/**/*.{scss,sass,css}'],
                tasks: ['build-css'],
                options: {
                    spawn: false
                }
            },
            test: {
                files: ['test/**/*'],
                tasks: ['test'],
                options: {
                    spawn: false
                }
            }
        },
        sass: {
            dev: {                            // Target
                options: {                       // Target options
                    style: 'expanded',
                    banner: '<%= meta.banner %>',
                    loadPath: ['bower_components']
                },
                files: {
                    'dist/themproject.css':'resources/sass/themproject.scss',
                    'dist/themproject_android_dark.css':'resources/sass/themproject_android_dark.scss',
                    'dist/themproject_android_light.css':'resources/sass/themproject_android_light.scss',
                    'dist/themproject_ios.css':'resources/sass/themproject_ios.scss'
                }
            },
            dist: {                            // Target
                options: {                       // Target options
                    style: 'expanded',
                    banner: '<%= meta.banner %>',
                    loadPath: ['bower_components']
                },
                files: {
                    '.tmp/themproject.css':'resources/sass/themproject.scss',
                    '.tmp/themproject_android_dark.css':'resources/sass/themproject_android_dark.scss',
                    '.tmp/themproject_android_light.css':'resources/sass/themproject_android_light.scss',
                    '.tmp/themproject_ios.css':'resources/sass/themproject_ios.scss'
                }
            }
        },
        mocha: {
            options: {
                bail: true,
                reporter: "Spec"
            },
            all: ['test/test.html']
        },
        extractSassVars: {
            all: {
                files: {
                    'src/ui/themevars.js': [
                        'resources/sass/themes/default/_variables.scss',
                        'resources/sass/themes/android_dark/_variables.scss',
                        'resources/sass/themes/android_light/_variables.scss',
                        'resources/sass/themes/ios/_variables.scss'
                    ]
                }
            }
        },

        jsdoc : {
            dist : {
                src: ['doc-template/.tmp/index.md','src/connection/*.js','src/core/*.js','src/data/*.js','src/data/stores/*.js','src/interfaces/*.js','src/ui/*.js','src/ui/layouts/*.js','src/ui/views/*.js','src/utility/*.js'],
                options:{
                    destination: 'doc',
                    template: "doc-template",
                    configure: "doc-template/jsdoc.conf.json",
                    tutorials: "doc-template/additional",
                    private: false
                }
            }
        },
        'curl-dir': {
            customFilepaths: {
                src: (function() {
                    return Object.keys(additionalMarkdownFiles);
                })(),
                router: function (url) {
                    return additionalMarkdownFiles[url];
                },
                dest: 'doc-template/additional'
            }
        },
        clean: {
            md: {
                src: [
                    'doc-template/additional/Sample-Apps.md',
                    'doc-template/additional/Demo-App.md',
                    'doc-template/additional/Generator.md',
                    'doc-template/.tmp/index.md'
                ]
            }
        }
    });

    grunt.registerMultiTask('extractSassVars', 'Convert sass variables to javascript', function () {
        var collection = [];
        var regExp = /\$([^:]+):[\s]+([^;]+);/g;
        var results;

        // Iterate over all specified file groups.
        this.files.forEach(function (f) {
            // Concat specified files.
            var sassVars = f.src.filter(function (filepath) {
                // Warn on and remove invalid source files (if nonull was set).
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.');
                    return false;
                } else {
                    return true;
                }
            }).map(function (filepath) {
                    // Read file source.
                    var regex = new RegExp('^resources/sass/themes/([^/]*)');
                    var themeName = filepath.match(regex)[1];
                    return {
                        theme: themeName,
                        content: grunt.file.read(filepath)
                    };
                });
            _.each(sassVars, function (item) {
                while ((results = regExp.exec(item.content)) != null) {
                    if (!item.vars) {
                        item.vars = {};
                    }
                    item.vars[results[1]] = results[2];
                }
                delete item.content;
            });
            _.each(sassVars, function (item) {
                var group = item.vars;

                for (var key in group) {
                    for (var key2 in group) {
                        group[key2] = group[key2].replace(new RegExp('\\$' + key, 'gi'), group[key]);
                    }
                }
            });
            var vars = {};
            _.each(sassVars, function (item) {
                vars[item.theme] = item.vars
            });
            var output = grunt.file.read(__dirname + '/utils/themevars.txt');
            output = grunt.template.process(output, {data: {vars: JSON.stringify(vars, null, 4)}});

            // Write the destination file.
            grunt.file.write(f.dest, output);

            // Print a success message.
            grunt.log.writeln('File "' + f.dest + '" created.');
        });
    });

    grunt.registerTask('rewriteMarkdownFiles', function() {
        var content = grunt.file.read('README.md');
        var overviewText = content.slice(content.indexOf('## Overview'), content.indexOf("## What's new"));
        content = content.replace('![The-M-Project Absinthe][logo]', '');
        content = content.replace(overviewText, '');
        grunt.file.write('doc-template/.tmp/index.md', content);
    });

    grunt.registerTask('build-js', ['extractSassVars', 'preprocess:dev']);
    grunt.registerTask('build-css', ['sass:dev']);

    grunt.registerTask('dist-js', ['extractSassVars', 'preprocess:dist']);
    grunt.registerTask('dist-css', ['sass:dist']);

    grunt.registerTask('dev-js', ['default', 'watch:js']);
    grunt.registerTask('dev-css', ['default', 'watch:css']);

    grunt.registerTask('dev', ['default', 'watch']);
    grunt.registerTask('test', ['jshint', 'mocha']);
    grunt.registerTask('dist', ['jshint', 'dist-js', 'dist-css', 'uglify', 'cssmin']);
    grunt.registerTask('precommit', ['travis']);
    grunt.registerTask('travis', ['jsonlint', 'default', 'test']);
    grunt.registerTask('default', ['build-js', 'build-css']);

    grunt.registerTask('build-doc', ['clean:md','curl-dir', 'rewriteMarkdownFiles', 'jsdoc', 'clean:md']);
};
<commit_msg>fixed a bug in sass to css generator<commit_after>/**
 * The-M-Project Build Script
 * Version: 0.1.0
 */

var _ = require('lodash');

module.exports = function (grunt) {
    // show elapsed time at the end
    require('time-grunt')(grunt);
    // load all grunt tasks
    require('load-grunt-tasks')(grunt);

    var additionalMarkdownFiles = {
        'https://raw.github.com/mwaylabs/The-M-Project-Sample-Apps/master/README.md': 'Sample-Apps.md',
        'https://raw.github.com/mwaylabs/generator-m/master/README.md': 'Generator.md',
        'https://raw.github.com/mwaylabs/The-M-Project-Sample-Apps/master/demoapp/README.md': 'Demo-App.md'
    }

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/*!\n' +
                '* Project:   The M-Project - Mobile HTML5 Application Framework\n' +
                '* Copyright: (c) <%= grunt.template.today("yyyy") %> M-Way Solutions GmbH.\n' +
                '* Version:   <%= pkg.version %>\n' +
                '* Date:      <%= grunt.template.today() %>\n' +
                '* License:   http://github.com/mwaylabs/The-M-Project/blob/absinthe/MIT-LICENSE.txt\n' +
                '*/'
        },
        jsonlint: {
            sample: {
                src: [ 'package.json', 'bower.json' ]
            }
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc',
                ignores: ['src/_*.js', 'src/themproject*.js', 'src/ui/themevars.js']
            },
            src: [ 'src/**/*.js' ]
        },
        preprocess: {
            options: {
                context: {
                    BANNER: '<%= meta.banner %>',
                    VERSION: '<%= pkg.version %>'
                }
            },
            dev: {
                files: {
                    '.tmp/themproject.js': 'src/themproject.js'
                }
            },
            dist: {
                files: {
                    'dist/themproject.js': 'src/themproject.js',
                    'dist/themproject.bd.js': 'src/themproject.bd.js'
                }
            }
        },
        uglify: {
            options: {
                preserveComments: 'some'
            },
            core: {
                src: 'dist/themproject.js',
                dest: 'dist/themproject.min.js',
                options: {
                    sourceMap: 'dist/themproject.map',
                    sourceMappingURL: 'themproject.map',
                    sourceMapPrefix: 1
                }
            },
            bd: {
                src: 'dist/themproject.bd.js',
                dest: 'dist/themproject.bd.min.js',
                options: {
                    sourceMap: 'dist/themproject.bd.map',
                    sourceMappingURL: 'themproject.bd.map',
                    sourceMapPrefix: 1
                }
            }
        },
        cssmin: {
            minify: {
                expand: true,
                cwd: 'dist/',
                src: ['*.css', '!*.min.css'],
                dest: 'dist/',
                ext: '.min.css'
            }
        },
        watch: {
            js: {
                files: ['src/**/*'],
                tasks: ['build-js'],
                options: {
                    spawn: false
                }
            },
            css: {
                files: ['resources/**/*.{scss,sass,css}'],
                tasks: ['build-css'],
                options: {
                    spawn: false
                }
            },
            test: {
                files: ['test/**/*'],
                tasks: ['test'],
                options: {
                    spawn: false
                }
            }
        },
        sass: {
            dist: {                            // Target
                options: {                       // Target options
                    style: 'expanded',
                    banner: '<%= meta.banner %>',
                    loadPath: ['bower_components']
                },
                files: {
                    'dist/themproject.css':'resources/sass/themproject.scss',
                    'dist/themproject_android_dark.css':'resources/sass/themproject_android_dark.scss',
                    'dist/themproject_android_light.css':'resources/sass/themproject_android_light.scss',
                    'dist/themproject_ios.css':'resources/sass/themproject_ios.scss'
                }
            },
            dev: {                            // Target
                options: {                       // Target options
                    style: 'expanded',
                    loadPath: ['bower_components']
                },
                files: {
                    '.tmp/themproject.css':'resources/sass/themproject.scss',
                    '.tmp/themproject_android_dark.css':'resources/sass/themproject_android_dark.scss',
                    '.tmp/themproject_android_light.css':'resources/sass/themproject_android_light.scss',
                    '.tmp/themproject_ios.css':'resources/sass/themproject_ios.scss'
                }
            }
        },
        mocha: {
            options: {
                bail: true,
                reporter: "Spec"
            },
            all: ['test/test.html']
        },
        extractSassVars: {
            all: {
                files: {
                    'src/ui/themevars.js': [
                        'resources/sass/themes/default/_variables.scss',
                        'resources/sass/themes/android_dark/_variables.scss',
                        'resources/sass/themes/android_light/_variables.scss',
                        'resources/sass/themes/ios/_variables.scss'
                    ]
                }
            }
        },

        jsdoc : {
            dist : {
                src: ['doc-template/.tmp/index.md','src/connection/*.js','src/core/*.js','src/data/*.js','src/data/stores/*.js','src/interfaces/*.js','src/ui/*.js','src/ui/layouts/*.js','src/ui/views/*.js','src/utility/*.js'],
                options:{
                    destination: 'doc',
                    template: "doc-template",
                    configure: "doc-template/jsdoc.conf.json",
                    tutorials: "doc-template/additional",
                    private: false
                }
            }
        },
        'curl-dir': {
            customFilepaths: {
                src: (function() {
                    return Object.keys(additionalMarkdownFiles);
                })(),
                router: function (url) {
                    return additionalMarkdownFiles[url];
                },
                dest: 'doc-template/additional'
            }
        },
        clean: {
            md: {
                src: [
                    'doc-template/additional/Sample-Apps.md',
                    'doc-template/additional/Demo-App.md',
                    'doc-template/additional/Generator.md',
                    'doc-template/.tmp/index.md'
                ]
            }
        }
    });

    grunt.registerMultiTask('extractSassVars', 'Convert sass variables to javascript', function () {
        var collection = [];
        var regExp = /\$([^:]+):[\s]+([^;]+);/g;
        var results;

        // Iterate over all specified file groups.
        this.files.forEach(function (f) {
            // Concat specified files.
            var sassVars = f.src.filter(function (filepath) {
                // Warn on and remove invalid source files (if nonull was set).
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.');
                    return false;
                } else {
                    return true;
                }
            }).map(function (filepath) {
                    // Read file source.
                    var regex = new RegExp('^resources/sass/themes/([^/]*)');
                    var themeName = filepath.match(regex)[1];
                    return {
                        theme: themeName,
                        content: grunt.file.read(filepath)
                    };
                });
            _.each(sassVars, function (item) {
                while ((results = regExp.exec(item.content)) != null) {
                    if (!item.vars) {
                        item.vars = {};
                    }
                    item.vars[results[1]] = results[2];
                }
                delete item.content;
            });
            _.each(sassVars, function (item) {
                var group = item.vars;

                for (var key in group) {
                    for (var key2 in group) {
                        group[key2] = group[key2].replace(new RegExp('\\$' + key, 'gi'), group[key]);
                    }
                }
            });
            var vars = {};
            _.each(sassVars, function (item) {
                vars[item.theme] = item.vars
            });
            var output = grunt.file.read(__dirname + '/utils/themevars.txt');
            output = grunt.template.process(output, {data: {vars: JSON.stringify(vars, null, 4)}});

            // Write the destination file.
            grunt.file.write(f.dest, output);

            // Print a success message.
            grunt.log.writeln('File "' + f.dest + '" created.');
        });
    });

    grunt.registerTask('rewriteMarkdownFiles', function() {
        var content = grunt.file.read('README.md');
        var overviewText = content.slice(content.indexOf('## Overview'), content.indexOf("## What's new"));
        content = content.replace('![The-M-Project Absinthe][logo]', '');
        content = content.replace(overviewText, '');
        grunt.file.write('doc-template/.tmp/index.md', content);
    });

    grunt.registerTask('build-js', ['extractSassVars', 'preprocess:dev']);
    grunt.registerTask('build-css', ['sass:dev']);

    grunt.registerTask('dist-js', ['extractSassVars', 'preprocess:dist']);
    grunt.registerTask('dist-css', ['sass:dist']);

    grunt.registerTask('dev-js', ['default', 'watch:js']);
    grunt.registerTask('dev-css', ['default', 'watch:css']);

    grunt.registerTask('dev', ['default', 'watch']);
    grunt.registerTask('test', ['jshint', 'mocha']);
    grunt.registerTask('dist', ['jshint', 'dist-js', 'dist-css', 'uglify', 'cssmin']);
    grunt.registerTask('precommit', ['travis']);
    grunt.registerTask('travis', ['jsonlint', 'default', 'test']);
    grunt.registerTask('default', ['build-js', 'build-css']);

    grunt.registerTask('build-doc', ['clean:md','curl-dir', 'rewriteMarkdownFiles', 'jsdoc', 'clean:md']);
};
<|endoftext|>