-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
132 lines (129 loc) · 5.45 KB
/
Gruntfile.js
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: [
'application/javascripts/vendor/modernizr.js',
'application/javascripts/vendor/jquery-*.js',
'application/javascripts/vendor/bootstrap.min.js',
'application/javascripts/vendor/handlebars-*.js',
'application/javascripts/vendor/ember-*.js',
'application/javascripts/vendor/lodash.js',
'application/javascripts/vendor/jquery.migrate.js',
'application/javascripts/vendor/jquery.couch.js',
'application/javascripts/app.js',
'application/javascripts/router.js',
'application/javascripts/components/*.js',
'application/javascripts/controllers/*.js',
'application/javascripts/helpers/*.js',
'application/javascripts/models/*.js',
'application/javascripts/routes/*.js',
'application/javascripts/templates/*.js',
'application/javascripts/views/*.js',
],
dest: 'application/<%= pkg.name %>.js'
}
},
ember_handlebars: {
compile: {
options: {
namespace: 'Ember.TEMPLATES',
processName: function(filePath) {
return filePath.match(/application\/javascripts\/templates\/(.+)\.hbs/)[1];
}
},
files: {
'application/javascripts/templates/templates.js': ['application/javascripts/templates/**/*.hbs',]
},
}
},
watch: {
files: [
'Gruntfile.js',
'couch.js',
'application/index.html',
'application/javascripts/templates/**/*.hbs',
'application/javascripts/**/*.js',
'application/stylesheets/**/*.css'
],
tasks: ['ember_handlebars', 'concat']
},
jshint: {
couch: {
src: ['Gruntfile.js', 'couch.js'],
options: {
"node": true,
"couch": true,
"devel": true,
"trailing": true,
"eqeqeq": true
}
},
ember: {
src: ['Gruntfile.js', 'application/javascripts/**/*.js', '!application/javascripts/templates/*.js', '!application/javascripts/vendor/*.js'],
options: {
"jquery": true,
"eqeqeq": true,
"trailing": true
}
}
},
exec: {
push: {
command: './node_modules/couchapp/bin.js push <%= pkg.main %> "http://$COUCHDB_USERNAME:$COUCHDB_PASSWORD@localhost:5984/portfolio"',
stdout: true
},
remotePush: {
command: './node_modules/couchapp/bin.js push <%= pkg.main %> "http://$COUCHDB_USERNAME:[email protected]:5984/portfolio"',
stdout: true
},
cloudantPush: {
command: './node_modules/couchapp/bin.js push <%= pkg.main %> "http://$CLOUDANT_USERNAME:[email protected]/portfolio"'
},
serve: {
command: './node_modules/couchapp/bin.js serve <%= pkg.main %> http://$COUCHDB_USERNAME:$COUCHDB_PASSWORD@localhost:5984/portfolio -d application',
stdout: true
},
loginLocal: {
command: "curl -vX POST http://localhost:5984/_session -H 'Content-Type: application/x-www-form-urlencoded' -d \"name=$COUCHDB_USERNAME&password=$COUCHDB_PASSWORD\"",
stdout: true
},
loginRemote: {
command: "curl -vX POST http://stevekinney.iriscouch.com:5984/_session -H 'Content-Type: application/x-www-form-urlencoded' -d \"name=$COUCHDB_USERNAME&password=$COUCHDB_PASSWORD\"",
stdout: true
},
loginCloudant: {
command: "curl -vX POST https://councilforeconed.cloudant.com/_session -H 'Content-Type: application/x-www-form-urlencoded' -d \"name=$CLOUDANT_USERNAME&password=$CLOUDANT_PASSWORD\"",
stdout: true
},
replicateToRemote: {
command: 'curl -X POST http://localhost:5984/_replicate -d \'{"source":"http://localhost:5984/portfolio", "target":"http://stevekinney.iriscouch.com/portfolio"}\' -H "Content-Type: application/json"',
stdout: true
},
replicateToCloudant: {
command: "curl -X POST http://localhost:5984/_replicate -d '{\"source\":\"http://localhost:5984/portfolio\", \"target\":\"http://$CLOUDANT_USERNAME:[email protected]/portfolio\"}' -H \"Content-Type: application/json\"",
stdout: true
},
replicateToLocal: {
command: 'curl -X POST http://localhost:5984/_replicate -d \'{"source":"http://$CLOUDANT_USERNAME:[email protected]/portfolio", "target":"http://localhost:5984/portfolio"}\' -H "Content-Type: application/json"',
stdout: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-ember-handlebars');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('default', ['jshint:ember', 'jshint:concat']);
grunt.registerTask('push', ['exec:push']);
grunt.registerTask('serve', ['exec:serve']);
grunt.registerTask('cloud', ['exec:loginLocal', 'exec:loginRemote', 'exec:replicateToRemote']);
grunt.registerTask('ground', ['exec:loginLocal', 'exec:loginCloudant', 'exec:replicateToLocal']);
grunt.registerTask('cpush', ['exec:loginLocal', 'exec:loginRemote', 'exec:remotePush']);
grunt.registerTask('cloudant-push', ['exec:push', 'exec:cloudantPush']);
};