-
Notifications
You must be signed in to change notification settings - Fork 13
/
Rakefile
41 lines (34 loc) · 1.09 KB
/
Rakefile
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
task :default => [:test]
desc "Run the tests"
task :test do
ruby "test/test_fat_fingers.rb"
end
desc "Move, Increment, Build, Push"
task :gem do
require 'fileutils'
gems = Dir["./*.gem"]
gems.each{|g| FileUtils.mv(g, 'old_gems')}
lines = []
file = File.open("./fat_fingers.gemspec", "r")
file.each_line do |line|
if line.include?("s.version")
version_array = line.split('"')[1].split(".")
version_array[2] = (version_array[2].to_i + 1).to_s
@new_version = version_array.join(".")
line = ' s.version = "'+@new_version+'"'+"\n"
puts "Upgrading gem to version "+@new_version
end
if line.include?("s.date")
line = ' s.date = "'+Time.now.to_s[0..9]+'"'+"\n"
puts "Upgrading date to "+Time.now.to_s[0..9]
end
lines << line
end
file.close
File.open("./fat_fingers.gemspec", "w") {|file| file.write(lines.join) }
system "gem build fat_fingers.gemspec"
system "gem push fat_fingers-#{@new_version}.gem"
system "git add ."
system "git commit -am 'Bump to version #{@new_version}'."
system "git push"
end