forked from sroze/ngInfiniteScroll
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.coffee
110 lines (104 loc) · 3.2 KB
/
Gruntfile.coffee
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
module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-contrib-concat'
grunt.loadNpmTasks 'grunt-contrib-connect'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-protractor-runner'
sauceUser = 'pomerantsevp'
sauceKey = '497ab04e-f31b-4a7b-9b18-ae3fbe023222'
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
meta:
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n'
coffeelint:
src: 'src/**/*.coffee'
options:
max_line_length:
level: 'ignore'
line_endings:
value: 'unix'
level: 'error'
no_stand_alone_at:
level: 'error'
clean:
options:
force: true
build: ["compile/**", "build/**"]
coffee:
compile:
files: [
{
expand: true
cwd: 'src/'
src: '**/*.coffee'
dest: 'compile/'
ext: '.js'
}
],
options:
bare: true
concat:
options:
banner: '<%= meta.banner %>'
dist:
src: 'compile/**/*.js'
dest: 'build/ng-infinite-scroll.js'
uglify:
options:
banner: '<%= meta.banner %>'
dist:
src: ['build/ng-infinite-scroll.js']
dest: 'build/ng-infinite-scroll.min.js'
connect:
testserver:
options:
port: 8000
hostname: '0.0.0.0'
middleware: (connect, options) ->
base = if Array.isArray(options.base) then options.base[options.base.length - 1] else options.base
[connect.static(base)]
protractor:
local:
options:
configFile: 'test/protractor-local.conf.js'
args:
params:
testThrottleValue: 500
travis:
options:
configFile: 'test/protractor-travis.conf.js'
args:
params:
# When using Sauce Connect, we should use a large timeout
# since everything is generally much slower than when testing locally.
testThrottleValue: 10000
sauceUser: sauceUser
sauceKey: sauceKey
grunt.registerTask 'webdriver', () ->
done = this.async()
p = require('child_process').spawn('node', ['node_modules/protractor/bin/webdriver-manager', 'update'])
p.stdout.pipe(process.stdout)
p.stderr.pipe(process.stderr)
p.on 'exit', (code) ->
if code isnt 0 then grunt.fail.warn('Webdriver failed to update')
done()
grunt.registerTask 'sauce-connect', () ->
done = this.async()
require('sauce-connect-launcher')({username: sauceUser, accessKey: sauceKey}, (err, sauceConnectProcess) ->
if err then console.error(err.message)
else done()
)
grunt.registerTask 'default', ['coffeelint', 'clean', 'coffee', 'concat', 'uglify']
grunt.registerTask 'test:protractor-local', [
'default',
'webdriver',
'connect:testserver',
'protractor:local'
]
grunt.registerTask 'test:protractor-travis', [
'connect:testserver',
'sauce-connect',
'protractor:travis'
]