forked from FirebaseExtended/angularfire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
167 lines (149 loc) · 4.24 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/* global module */
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner: '/*!\n' +
' * AngularFire is the officially supported AngularJS binding for Firebase. Firebase\n' +
' * is a full backend so you don\'t need servers to build your Angular app. AngularFire\n' +
' * provides you with the $firebase service which allows you to easily keep your $scope\n' +
' * variables in sync with your Firebase backend.\n' +
' *\n' +
' * AngularFire 0.0.0\n' +
' * https://github.com/firebase/angularfire/\n' +
' * Date: <%= grunt.template.today("mm/dd/yyyy") %>\n' +
' * License: MIT\n' +
' */\n'
},
// merge files from src/ into angularfire.js
concat: {
app: {
options: { banner: '<%= meta.banner %>' },
src: [
'src/module.js',
'src/**/*.js'
],
dest: 'dist/angularfire.js'
}
},
// Run shell commands
shell: {
options: {
stdout: true
},
protractor_install: {
command: 'node ./node_modules/protractor/bin/webdriver-manager update'
},
npm_install: {
command: 'npm install'
},
bower_install: {
command: 'bower install'
}
},
// Create local server
connect: {
testserver: {
options: {
hostname: 'localhost',
port: 3030
}
}
},
// Minify JavaScript
uglify : {
options: {
preserveComments: 'some'
},
app : {
files : {
'dist/angularfire.min.js' : ['dist/angularfire.js']
}
}
},
// Lint JavaScript
jshint : {
options : {
jshintrc: '.jshintrc',
ignores: ['src/lib/polyfills.js']
},
all : ['src/**/*.js']
},
// Auto-run tasks on file changes
watch : {
scripts : {
files : ['src/**/*.js', 'tests/unit/**/*.spec.js', 'tests/lib/**/*.js', 'tests/mocks/**/*.js'],
tasks : ['test:unit', 'notify:watch'],
options : {
interrupt : true,
atBegin: true
}
}
},
// Unit tests
karma: {
options: {
configFile: 'tests/automatic_karma.conf.js'
},
manual: {
configFile: 'tests/manual_karma.conf.js',
},
singlerun: {},
watch: {
autowatch: true,
singleRun: false,
},
saucelabs: {
configFile: 'tests/sauce_karma.conf.js'
}
},
// End to end (e2e) tests
protractor: {
options: {
configFile: "tests/local_protractor.conf.js"
},
singlerun: {},
saucelabs: {
options: {
configFile: "tests/sauce_protractor.conf.js",
args: {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY
}
}
}
},
// Desktop notificaitons
notify: {
watch: {
options: {
title: 'Grunt Watch',
message: 'Build Finished'
}
}
}
});
require('load-grunt-tasks')(grunt);
// Installation
grunt.registerTask('install', ['shell:protractor_install']);
grunt.registerTask('update', ['shell:npm_install', 'shell:bower_install']);
// Single run tests
grunt.registerTask('test', ['test:unit', 'test:e2e']);
grunt.registerTask('test:unit', ['karma:singlerun']);
grunt.registerTask('test:e2e', ['connect:testserver', 'protractor:singlerun']);
grunt.registerTask('test:manual', ['karma:manual']);
// Travis CI testing
//grunt.registerTask('test:travis', ['build', 'test:unit', 'connect:testserver', 'protractor:saucelabs']);
grunt.registerTask('test:travis', ['build', 'test:unit']);
// Sauce tasks
grunt.registerTask('sauce:unit', ['karma:saucelabs']);
grunt.registerTask('sauce:e2e', ['connect:testserver', 'protractor:saucelabs']);
// Watch tests
grunt.registerTask('test:watch', ['karma:watch']);
grunt.registerTask('test:watch:unit', ['karma:watch']);
// Build tasks
grunt.registerTask('build', ['concat', 'jshint', 'uglify']);
// Default task
grunt.registerTask('default', ['build', 'test']);
};