forked from axemclion/grunt-saucelabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
109 lines (103 loc) · 2.61 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
module.exports = function(grunt) {
var _browsers = [{
browserName: 'firefox'
}, {
browserName: 'googlechrome',
platform: 'linux'
}, {
browserName: 'firefox',
platform: 'Windows 2003',
version: '12'
}, {
browserName: 'firefox',
platform: 'Windows 2003',
version: '13'
}, {
browserName: 'firefox',
platform: 'Windows 2003',
version: '14'
}, {
browserName: 'firefox',
platform: 'Windows 2003',
version: '15'
}, {
browserName: 'internet explorer',
platform: 'Windows 2012',
version: '10'
}, {
browserName: 'opera',
version: '11'
}, {
browserName: 'opera',
version: '12'
}];
var sauceAuth = grunt.file.readJSON('saucelabs_auth.json');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
files: ['grunt.js', 'tasks/**/*.js']
},
connect: {
server: {
options: {
base: 'test',
port: 9999
}
}
},
'saucelabs-qunit': {
all: {
username: sauceAuth.username,
key: sauceAuth.key,
urls: ['http://127.0.0.1:9999/qunit/lists-plugin.html', 'http://127.0.0.1:9999/qunit/twitter-plugin.html'],
tunnelTimeout: 5,
build: process.env.TRAVIS_JOB_ID,
concurrency: 3,
browsers: _browsers
}
},
'saucelabs-jasmine': {
all: {
username: sauceAuth.username,
key: sauceAuth.key,
urls: ['http://127.0.0.1:9999/jasmine/SpecRunner.html', 'http://127.0.0.1:9999/jasmine/SpecRunnerDos.html'],
tunnelTimeout: 5,
build: process.env.TRAVIS_JOB_ID,
concurrency: 3,
browsers: _browsers
}
},
publish: {
npm: {
username: process.env.NPM_USERNAME,
password: process.env.NPM_PASSWORD,
email: process.env.NPM_EMAIL
}
}
});
grunt.registerMultiTask('publish', 'Publish the latest version of this plugin', function() {
var done = this.async(),
me = this,
npm = require('npm');
npm.load({}, function(err) {
npm.registry.adduser(me.data.username, me.data.password, me.data.email, function(err) {
if (err) {
console.log(err);
done(false);
} else {
npm.config.set("email", me.data.email, "user");
npm.commands.publish([], function(err) {
console.log(err || "Published to registry");
done(!err);
});
}
});
});
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('test', ['connect', 'saucelabs-qunit', 'saucelabs-jasmine', 'publish']);
grunt.registerTask('default', ['jshint', 'test', 'publish']);
};