@@ -8,17 +8,17 @@ require 'posix/spawn'
8
8
def repo_name ; 'appium_lib' end # ruby_lib published as appium_lib
9
9
def gh_name ; 'ruby_lib' end # the name as used on github.com
10
10
def version_file ; "lib/#{ repo_name } /common/version.rb" end
11
- def version_rgx ; /VERSION = '([^']+)'/m end
11
+ def version_rgx ; /\s * VERSION\s *= \s * '([^']+)'/m end
12
12
13
13
def version
14
14
@version = @version || File . read ( version_file ) . match ( version_rgx ) [ 1 ]
15
15
end
16
16
17
- def bump major = false
17
+ def bump value
18
18
data = File . read version_file
19
19
20
20
v_line = data . match version_rgx
21
- d_line = data . match /DATE = '([^']+)'/m
21
+ d_line = data . match /\s * DATE\s *= \s * '([^']+)'/m
22
22
23
23
old_v = v_line [ 0 ]
24
24
old_d = d_line [ 0 ]
@@ -27,7 +27,7 @@ def bump major=false
27
27
new_num = old_num . split ( '.' )
28
28
new_num [ -1 ] = new_num [ -1 ] . to_i + 1
29
29
30
- if major
30
+ if value == :y
31
31
new_num [ -1 ] = 0 # x.y.Z -> x.y.0
32
32
new_num [ -2 ] = new_num [ -2 ] . to_i + 1 # x.Y -> x.Y+1
33
33
end
@@ -48,16 +48,22 @@ def bump major=false
48
48
File . write version_file , data
49
49
end
50
50
51
- desc 'Bump the version number and update the date.'
51
+ desc 'Bump the z version number and update the date.'
52
52
task :bump do
53
- bump
53
+ bump :z
54
54
end
55
55
56
56
desc 'Bump the y version number, set z to zero, update the date.'
57
57
task :bumpy do
58
- bump true
58
+ bump :y
59
59
end
60
60
61
+ desc 'Bump the x version number, set y & z to zero, update the date.'
62
+ task :bumpx do
63
+ bump :x
64
+ end
65
+
66
+
61
67
desc 'Install gems required for release task'
62
68
task :dev do
63
69
sh 'gem install --no-rdoc --no-ri yard'
0 commit comments