Gruntfile.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * Gruntfile.js
  3. */
  4. module.exports = function(grunt) {
  5. grunt.initConfig({
  6. pkg: grunt.file.readJSON('package.json'),
  7. php: {
  8. dist: {
  9. options: {
  10. port: 8080,
  11. base: 'web',
  12. open: true,
  13. keepalive: true
  14. }
  15. }
  16. },
  17. phpcs: {
  18. application: {
  19. dir: ['src/']
  20. },
  21. options: {
  22. bin: 'vendor/bin/phpcs',
  23. standard: 'PSR2'
  24. }
  25. },
  26. phplint: {
  27. options: {
  28. swapPath: '/tmp'
  29. },
  30. all: ['src/*.php']
  31. },
  32. phpdocumentor: {
  33. dist: {
  34. options: {
  35. directory: './src/',
  36. bin: 'vendor/bin/phpdoc.php',
  37. target: 'docs/'
  38. }
  39. }
  40. },
  41. clean: {
  42. phpdocumentor: 'docs/'
  43. },
  44. phpunit: {
  45. unit: {
  46. dir: 'tests'
  47. },
  48. options: {
  49. bin: 'vendor/bin/phpunit',
  50. colors: true,
  51. testdox: true
  52. }
  53. },
  54. watch: {
  55. scripts: {
  56. files: ['src/*.php', 'src/**/*.php', 'tests/*.php', 'tests/**/*.php'],
  57. tasks: ['precommit'],
  58. },
  59. },
  60. });
  61. grunt.loadNpmTasks('grunt-phpcs');
  62. grunt.loadNpmTasks('grunt-php');
  63. grunt.loadNpmTasks('grunt-phplint');
  64. grunt.loadNpmTasks('grunt-phpunit');
  65. grunt.loadNpmTasks('grunt-phpdocumentor');
  66. grunt.loadNpmTasks('grunt-contrib-watch');
  67. grunt.loadNpmTasks('grunt-contrib-clean');
  68. grunt.registerTask('phpdocs', [
  69. 'clean:phpdocumentor',
  70. 'phpdocumentor'
  71. ]);
  72. grunt.registerTask('precommit', ['phplint:all', 'phpcs', 'phpunit:unit']);
  73. grunt.registerTask('default', ['phplint:all', 'phpcs', 'phpunit:unit', 'phpdocs']);
  74. grunt.registerTask('server', ['php']);
  75. };