forked from WinRb/Viewpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
40 lines (31 loc) · 687 Bytes
/
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
require 'rubygems'
require 'date'
task :default => [:gem]
desc "Build the gem without a version change"
task :gem do
system "gem build viewpoint.gemspec"
end
desc "Clean the build environment"
task :clean do
system "rm -f viewpoint*.gem"
end
desc "Build the gem, but increment the version first"
task :newrelease => [:versionup, :clean, :gem]
desc "Increment the version by 1 minor release"
task :versionup do
ver = up_min_version
puts "New version: #{ver}"
end
def up_min_version
f = File.open('VERSION', 'r+')
ver = f.readline.chomp
v_arr = ver.split(/\./).map do |v|
v.to_i
end
v_arr[2] += 1
ver = v_arr.join('.')
f.rewind
f.write(ver)
f.close
ver
end