Skip to content

Commit 461efdd

Browse files
author
Tom Hanoldt
committed
more automation
1 parent 7bd017e commit 461efdd

File tree

5 files changed

+260
-38
lines changed

5 files changed

+260
-38
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
bower_components
22
node_modules
33
.DS_Store
4-
tmp
4+
build
55
.grunt/
6+
_SpecRunner.html

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ before_script:
66
- npm install -g grunt-cli bower
77
- bower install
88

9-
script: grunt test-all-jquery-versions --verbose
9+
script: grunt build --verbose

Gruntfile.coffee

Lines changed: 83 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,119 @@
33
module.exports = (grunt) ->
44
grunt.initConfig
55
pkg: grunt.file.readJSON 'package.json'
6+
7+
git:
8+
add:
9+
options:
10+
simple:
11+
args: ['./dist']
12+
13+
commit:
14+
options:
15+
message: 'dist v<%= pkg.version %>'
16+
17+
push:
18+
options:
19+
simple:
20+
args: ['master']
21+
22+
tag:
23+
options:
24+
simple:
25+
args: ['<%= pkg.version %>']
26+
27+
replace:
28+
dist:
29+
options:
30+
patterns: [{
31+
match: /__VERSION__/
32+
replacement: '<%= pkg.version %>'
33+
}]
34+
files: [{
35+
expand: true
36+
flatten: true
37+
src: [
38+
'dist/**/*'
39+
]
40+
dest: 'dist/'
41+
}]
42+
bower:
43+
options:
44+
patterns: [{
45+
match: /"version": "([^"]*)"/
46+
replacement: '"version": "<%= pkg.version %>"'
47+
}]
48+
files: [{
49+
expand: true
50+
flatten: true
51+
src: [
52+
'bower.json'
53+
]
54+
dest: './'
55+
}]
56+
657
includes:
758
files:
859
src: ['src/jquery.input.validator.coffee']
9-
dest: 'tmp'
60+
dest: 'build'
1061
flatten: true
1162
cwd: '.'
1263
options:
1364
includeRegexp: /^(\s*)#=\s*include\s+(\S+)\s*$/
1465
silent: true
1566
banner: '# <% includes.files.dest %>'
67+
1668
coffee:
1769
compile:
1870
files:
19-
'dist/jquery.input.validator.js': 'tmp/jquery.input.validator.coffee'
20-
'tmp/spec/rules.spec.js': 'spec/rules.spec.coffee'
21-
'tmp/spec/controller.spec.js': 'spec/controller.spec.coffee'
22-
'tmp/spec/reset.spec.js': 'spec/reset.spec.coffee'
23-
'tmp/spec/hint.spec.js': 'spec/hint.spec.coffee'
71+
'dist/jquery.input.validator.js': 'build/jquery.input.validator.coffee'
72+
'build/spec/rules.spec.js': 'spec/rules.spec.coffee'
73+
'build/spec/controller.spec.js': 'spec/controller.spec.coffee'
74+
'build/spec/reset.spec.js': 'spec/reset.spec.coffee'
75+
'build/spec/hint.spec.js': 'spec/hint.spec.coffee'
76+
2477
coffeelint:
2578
app:
2679
[ 'src/*.coffee' ]
80+
2781
uglify:
2882
options:
2983
banner: '/*! <%= pkg.name %> v<%= pkg.version %> | <%= pkg.license %> */\n'
3084
build:
3185
files: 'dist/jquery.input.validator.min.js': 'dist/jquery.input.validator.js'
86+
87+
exec:
88+
npm_publish: 'npm publish'
89+
3290
jasmine:
3391
jquery1:
3492
src: 'dist/jquery.input.validator.js'
3593
options:
36-
specs: 'tmp/spec/*spec.js'
94+
specs: 'build/spec/*spec.js'
3795
vendor: [
3896
"bower_components/jquery-1/jquery.min.js"
3997
"bower_components/jasmine-jquery-legacy/lib/jasmine-jquery.js"
4098
]
4199
jquery2:
42100
src: 'dist/jquery.input.validator.js'
43101
options:
44-
specs: 'tmp/spec/*spec.js'
102+
specs: 'build/spec/*spec.js'
45103
vendor: [
46104
"bower_components/jquery-2/dist/jquery.min.js"
47105
"bower_components/jasmine-jquery/lib/jasmine-jquery.js"
48106
]
49107
jquery3:
50108
src: 'dist/jquery.input.validator.js'
51109
options:
52-
specs: 'tmp/spec/*spec.js'
110+
specs: 'build/spec/*spec.js'
53111
vendor: [
54112
"bower_components/jquery-3/dist/jquery.min.js"
55113
"bower_components/jasmine-jquery/lib/jasmine-jquery.js"
56114
]
57115
jquery3Slim:
58116
src: 'dist/jquery.input.validator.js'
59117
options:
60-
specs: 'tmp/spec/*spec.js'
118+
specs: 'build/spec/*spec.js'
61119
vendor: [
62120
"bower_components/jquery-3/dist/jquery.slim.min.js"
63121
"bower_components/jasmine-jquery/lib/jasmine-jquery.js"
@@ -72,27 +130,18 @@ module.exports = (grunt) ->
72130
if key != 'grunt' and key.indexOf('grunt') == 0
73131
grunt.loadNpmTasks key
74132

75-
grunt.registerTask 'default', [
76-
'includes'
77-
'coffeelint'
78-
'coffee'
79-
'jasmine'
80-
'uglify'
81-
]
82-
83-
grunt.registerTask 'lint', [
84-
'includes'
85-
'coffeelint'
86-
]
87-
88-
grunt.registerTask 'test', [
89-
'includes'
90-
'coffee'
91-
'jasmine:jquery3'
92-
]
93-
94-
grunt.registerTask 'test_all', [
95-
'includes'
96-
'coffee'
97-
'jasmine'
98-
]
133+
grunt.registerTask 'code', [ 'includes', 'coffee', 'replace:dist', 'replace:bower' ]
134+
135+
grunt.registerTask 'lint', [ 'includes', 'coffeelint' ]
136+
137+
grunt.registerTask 'test', [ 'code', 'jasmine:jquery3' ]
138+
grunt.registerTask 'test-all', [ 'code', 'jasmine' ]
139+
140+
grunt.registerTask 'build', [ 'code', 'lint', 'test-all', 'uglify' ]
141+
142+
grunt.registerTask 'git-push-dist', [ 'git:add', 'git:commit', 'git:tag', 'git:push' ]
143+
144+
# the version is comes from package.json:version
145+
grunt.registerTask 'release', [ 'build', 'git-push-dist', 'exec:npm_publish' ]
146+
147+
grunt.registerTask 'default', [ 'build' ]

0 commit comments

Comments
 (0)