-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathGruntfile.coffee
More file actions
107 lines (85 loc) · 3.39 KB
/
Gruntfile.coffee
File metadata and controls
107 lines (85 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"use strict"
module.exports = (grunt) ->
FilesDir = "static"
#
# Grunt configuration:
#
# https://github.com/cowboy/grunt/blob/master/docs/getting_started.md
#
grunt.initConfig
# Project configuration
# ---------------------
# specify an alternate install location for Bower
bower:
dir: "static/components"
# Coffee to JS compilation
coffee:
scripts:
files:
"static/scripts/scripts.compiled.js": "static/scripts/**/*.coffee"
stylus:
do:
options:
compress: true
"include css": true
files:
"static/styles/allstyles.compiled.css": "static/styles/style.styl"
# generate application cache manifest
manifest:
dest: ""
# default watch configuration
watch:
coffee:
files: "static/scripts/**/*.coffee"
tasks: ["coffee"]
options: { livereload: true}
stylus:
files: ["static/styles/**/*.styl","static/styles/**/*.css", "!static/styles/allstyles.compiled.css"]
tasks: ["stylus"]
options: { livereload: true}
grunt.registerTask "phpserver", "Runs php builtin server", ->
require("child_process").spawn "php", ["-S", "33.33.33.100:1234", "index.php"],
stdio: "inherit"
grunt.registerTask "composer", "install composer depenedencies", ->
done = this.async()
require("child_process").exec "composer install -o", (error, stdout, stderr) ->
if error isnt null
grunt.log.error "exec error: " + error + " " + stderr
done false
else
grunt.log.write stdout
done true
grunt.registerTask "cap-deploy", "deploy with capistrano", ->
done = this.async()
require("child_process").exec "cap deploy", (error, stdout, stderr) ->
if error isnt null
grunt.log.error "exec error: " + error + " " + stderr
done false
else
grunt.log.write stdout
done true
grunt.registerTask "test", "runs unit tests", ->
done = this.async()
require("child_process").exec "protected/tests/phpunit -c protected/tests/phpunit.xml.dist", (error, stdout, stderr) ->
if error isnt null
grunt.log.error "exec error: " + error + " " + stderr
done false
else
grunt.log.write stdout
done true
grunt.registerTask "analyze", "run static code analysis on the code", ->
done = this.async()
require("child_process").exec "echo ok..", (error, stdout, stderr) ->
if error isnt null
grunt.log.error "exec error: " + error + " " + stderr
done false
else
grunt.log.write stdout
done true
grunt.loadNpmTasks "grunt-contrib-stylus"
grunt.loadNpmTasks "grunt-contrib-coffee"
grunt.loadNpmTasks "grunt-contrib-watch"
grunt.loadNpmTasks "grunt-simple-watch"
grunt.registerTask "deploy", ["build", "test", "analyze", "cap-deploy"]
grunt.registerTask "build", ['composer', "coffee", "stylus"]
grunt.registerTask "server", ["phpserver", "build", "simple-watch"]