-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
deploy.rb
77 lines (61 loc) · 2.39 KB
/
deploy.rb
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
require 'rubygems'
require 'zlib'
JMASK_FILE = 'src/jquery.mask.js'
JMASK_MIN_FILE = 'dist/jquery.mask.min.js'
GHPAGES_JMASK_MIN_FILE = 'js/jquery.mask.min.js'
JMASK_VERSION = `stepup version --next-release`.delete("\n")
BOWER_MANIFEST_FILE = 'bower.json'
NPM_MANIFEST_FILE = 'package.json'
METEOR_MANIFEST_FILE = 'package.js'
COMPONENT_MANIFEST_FILE = 'component.json'
abort("No notes, do deal.") if JMASK_VERSION.empty?
puts '# PUTTING NEW VERSION INSIDE OF JQUERY MASK FILE'
unversioned_jmask_file = File.open(JMASK_FILE, 'rb') { |file| file.read }
File.open(JMASK_FILE, 'w') do |file|
file.write(unversioned_jmask_file.gsub(/\* @version: (v[0-9.+]+)/, "\* @version: #{JMASK_VERSION}"))
end
puts '# COPYING NEW JMASK FILE TO DIST/'
`yes | cp #{JMASK_FILE} dist/`
[BOWER_MANIFEST_FILE, NPM_MANIFEST_FILE, COMPONENT_MANIFEST_FILE, METEOR_MANIFEST_FILE].each { |manifest_name|
puts "# UPGRADING #{manifest_name} "
manifest_file = File.open(manifest_name, 'rb') { |file| file.read }
File.open(manifest_name, 'w') do |file|
file.write(manifest_file.gsub(/"version": "([0-9.+]+)"/, "\"version\": \"#{JMASK_VERSION.gsub("v", "")}\""))
end
}
puts '# GENERATING MIN FILE'
jquery_mask_min_file = nil
File.open(JMASK_FILE, 'r') do |file|
minFile = File.open(JMASK_MIN_FILE, 'w')
minFile.puts("// jQuery Mask Plugin #{JMASK_VERSION}")
minFile.puts("// github.com/igorescobar/jQuery-Mask-Plugin")
jquery_mask_min_file = `java -jar ../clojure-compiler/compiler.jar --js src/jquery.mask.js --charset UTF-8`
minFile.puts(jquery_mask_min_file)
minFile.close
end
puts '# GENERATING A NEW COMMIT WITH VERSIONED FILEs'
`git commit -am 'generating jquery mask files #{JMASK_VERSION}'`
puts '# PUSHING CHANGES TO REMOTE'
`git pull --rebase && git push`
puts '# CREATING NEW VERSION'
`stepup version create --no-editor`
puts '# UPGRATING CHANGELOG'
`stepup changelog --format=wiki > CHANGELOG.md`
`git commit -am "upgrading changelog"`
`git push`
puts '# UPGRADING gh-pages'
`git checkout gh-pages`
`git pull origin gh-pages`
minFile = File.open(GHPAGES_JMASK_MIN_FILE, 'w')
minFile.puts("// jQuery Mask Plugin #{JMASK_VERSION}")
minFile.puts("// github.com/igorescobar/jQuery-Mask-Plugin")
minFile.puts(jquery_mask_min_file)
minFile.close
`git commit -am "upgrading plugin file"`
`git push`
`git checkout master`
puts '# PUBLISHING NPM PACKAGE'
`npm publish`
puts '# PUBLISHING METEOR PACKAGE'
`meteor publish`
puts '# DONE!'