Skip to content

Instantly share code, notes, and snippets.

@seanhagen
Last active December 28, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanhagen/7440505 to your computer and use it in GitHub Desktop.
Save seanhagen/7440505 to your computer and use it in GitHub Desktop.
Example Gruntfile.js
module.exports = function(grunt){
require('load-grunt-tasks')(grunt);
var join = require("path").join;
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
env: {
options: {},
env: 'config.json'
},
php: {
dist: {
options: {
port: 9000,
base: 'code/web',
open: true,
keepalive: true
}
}
},
phpcs: {
application: {
dir: '<path/to/your/project/src>',
options: {
bin: "bin/phpcs",
standard: "PSR2",
extensions: "php",
report: "xml",
reportFile: "tmp/app-psr2.xml",
verbose: true
}
}
},
phplint: {
options: {
},
all: [ '<path/to/your/project/src>/**/*.php' ]
},
phpunit: {
unit: {
dir: 'tests/src'
},
options: {
bin: 'bin/phpunit',
bootstrap: 'tests/phpunit.bootstrap.php',
configuration: 'tests/phpunit.xml',
colors: true,
testdox: true,
logJunit: 'tmp/phpunit.xml',
coverageClover: 'tmp/coverage.xml',
coverageHTML: 'tmp/coverage-html'
}
},
phpmd: {
application: {
dir: '<path/to/your/project/src>',
options: {
rulesets: 'cleancode,codesize,design,naming,unusedcode',
bin: 'bin/phpmd',
reportFile: 'tmp/app-phpmd.xml'
}
}
},
phpcpd: {
application: {
dir: '<path/to/your/project/src>',
options: {
bin: 'bin/phpcpd',
reportFile: 'tmp/app-phpcpd.xml'
}
}
},
bumpup: {
file: 'package.json',
options: {
dateformat: 'YYYY-MM-DD HH:mm'
}
}
});
grunt.registerTask('default', []);
grunt.registerTask( 'cs', ['phpcs:app-psr1','phpcs:app-psr2']);
grunt.registerTask( 'lint', ['phplint'] );
grunt.registerTask( 'md', ['phpmd:application'] );
grunt.registerTask( 'cpd', ['phpcpd:application'] );
grunt.registerTask( 'unit', ['phpunit:unit'] );
grunt.registerTask( 'precommit', ['phplint:all', 'phpunit:unit'] );
grunt.registerTask( 'all', ['phpcs:application','phplint','phpmd:application','phpcpd:application','phpunit:unit'] );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment