bigkeeper 0.9.14 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cae335c4028f88931e908c5e06e46be79e64ff6c18940ddec9be8da644a696c
4
- data.tar.gz: 7afc0960f5701b2119235863982fc9bbc86468c621062df8c2b6af3c1ebe3810
3
+ metadata.gz: 07a6a50bde773caacd8472d77d8eace46a204ed3a221a11b608c76f4a7be8950
4
+ data.tar.gz: 44f47beb30ed88659c9488fd83062936008703beebd36a439931558af4daf1ff
5
5
  SHA512:
6
- metadata.gz: 93726a66acd35be37a9552c3c5b47edb41a67cc354289addd3bd5dc28e3b17c9a8d876e49a01c439b9c0adf44c13d0323294a467e85da55b1470aa3ac9b6b69f
7
- data.tar.gz: f9c36337abf07d8c51289d174010e0faee47e67219d7ee0b1374a2b7da9a48c274011ca11ff1866734c991ca749bab2d308d234aa1e821911115c4264d34e06e
6
+ metadata.gz: fb051c59f2c1a559fc3ed31c17779a4c07e9da11224831e299bc4514be4d1d22ad5eb5e72f3e07543f719a0e85253c4e0a3d9ee0c93cd7dbc2a4f26d5c834c4a
7
+ data.tar.gz: d3cab185ee28e86108fca8ebf0d1a25ef718d157f93295cb64f66a84d1bf982ad7c4d76cde7a2dc4ff4fe2ab3ce4bbc3c74ab4f12c2c4459c893d3fce5ecceea
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bigkeeper (0.9.13)
4
+ bigkeeper (0.9.14)
5
5
  big_resources
6
6
  big_stash (~> 0.1)
7
7
  cocoapods
@@ -1,64 +1,86 @@
1
1
  require 'big_keeper/command/release/home'
2
2
  require 'big_keeper/command/release/module'
3
3
  require 'big_keeper/util/leancloud_logger'
4
- require 'big_keeper/command/release/start'
5
4
  require 'big_keeper/util/command_line_util'
6
5
 
7
6
  module BigKeeper
8
7
  def self.release_command
9
-
10
- desc 'Release home project & module.'
8
+ desc 'Prerelease home project command'
11
9
  command :prerelease do |c|
12
- c.desc 'Prerelease home project.'
13
- c.command :home do |home|
14
- home.action do |global_options, options, args|
15
- LeanCloudLogger.instance.set_command("prerelease/home")
10
+ c.desc 'Prerelease home project start. (for Andriod)'
11
+ c.command :start do |start|
12
+ start.action do |global_options, options, args|
16
13
  path = File.expand_path(global_options[:path])
17
14
  version = global_options[:ver]
18
15
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
16
+ LeanCloudLogger.instance.set_command("prerelease/start")
17
+
18
+ help_now!('user name is required') if user and user.empty?
19
+ raise Logger.error("release version is required") if version == nil
19
20
  modules = args[(0...args.length)] if args.length > 0
20
- prerelease(path, version, user, modules)
21
+ prerelease_start(path, version, user, modules)
21
22
  end
22
23
  end
23
24
 
24
- c.desc 'if ignore warning'
25
- c.switch [:i,:ignore]
26
- c.desc 'Release single module operations'
27
- c.command :module do |m|
28
- m.action do |global_options, options, args|
29
- LeanCloudLogger.instance.set_command("prerelease/module")
25
+ c.desc 'Prerelease home project finish.'
26
+ c.command :finish do |finish|
27
+ finish.action do |global_options, options, args|
30
28
  path = File.expand_path(global_options[:path])
31
29
  version = global_options[:ver]
32
30
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
33
- help_now!('module name is required') if args.length == 0
31
+ LeanCloudLogger.instance.set_command("prerelease/start")
32
+
33
+ help_now!('user name is required') if user and user.empty?
34
34
  raise Logger.error("release version is required") if version == nil
35
35
  modules = args[(0...args.length)] if args.length > 0
36
- prerelease_module(path, version, user, modules, false)
36
+ prerelease_finish(path, version, user, modules)
37
37
  end
38
38
  end
39
39
  end
40
40
 
41
- desc 'Gitflow release operations'
41
+ desc 'Release home project & module.'
42
42
  command :release do |c|
43
- c.action do |global_options, options, args|
44
- LeanCloudLogger.instance.set_command("release")
45
- path = File.expand_path(global_options[:path])
46
- version = global_options[:ver]
47
- user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
48
- modules = args[(0...args.length)] if args.length > 0
49
- release(path, version, user, modules)
43
+ c.desc 'Release home project & module.'
44
+ c.command :home do |home|
45
+ home.desc 'Start release home project'
46
+ home.command :start do |start|
47
+ start.action do |global_options, options, args|
48
+ path = File.expand_path(global_options[:path])
49
+ version = global_options[:ver]
50
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
51
+ LeanCloudLogger.instance.set_command("release/home/start")
52
+
53
+ help_now!('user name is required') if user and user.empty?
54
+ raise Logger.error("release version is required") if version == nil
55
+ modules = args[(0...args.length)] if args.length > 0
56
+ release_home_start(path, version, user, modules)
57
+ end
58
+ end
59
+
60
+ home.desc 'Finish release home project'
61
+ home.command :finish do |finish|
62
+ finish.action do |global_options, options, args|
63
+ path = File.expand_path(global_options[:path])
64
+ version = global_options[:ver]
65
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
66
+ LeanCloudLogger.instance.set_command("release/home/finish")
67
+
68
+ help_now!('user name is required') if user and user.empty?
69
+ raise Logger.error("release version is required") if version == nil
70
+ release_home_finish(path, version, user, modules)
71
+ end
72
+ end
50
73
  end
51
74
 
52
75
  c.desc 'if ignore warning'
53
76
  c.switch [:i,:ignore]
54
- c.desc 'Release single module operations'
77
+ c.desc 'Release single module operations (for iOS)'
55
78
  c.command :module do |m|
56
79
  m.action do |global_options, options, args|
80
+ LeanCloudLogger.instance.set_command("release/module")
57
81
  path = File.expand_path(global_options[:path])
58
82
  version = global_options[:ver]
59
83
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
60
- LeanCloudLogger.instance.set_command("release/module")
61
-
62
84
  help_now!('module name is required') if args.length == 0
63
85
  raise Logger.error("release version is required") if version == nil
64
86
  modules = args[(0...args.length)] if args.length > 0
@@ -8,22 +8,38 @@ require 'big_keeper/util/xcode_operator'
8
8
  require 'big_keeper/model/operate_type'
9
9
 
10
10
  module BigKeeper
11
- def self.prerelease(path, version, user, modules)
12
- DepService.dep_operator(path, user).release_start(path, version, user, modules)
11
+ def self.prerelease_start(path, version, user, modules)
12
+ BigkeeperParser.parse("#{path}/Bigkeeper")
13
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
14
+ modules = BigkeeperParser.module_names
15
+ DepService.dep_operator(path, user).prerelease_start(path, version, user, modules)
13
16
  end
14
17
 
15
- def self.release(path, version, user, modules)
18
+ def self.prerelease_finish(path, version, user, modules)
16
19
  BigkeeperParser.parse("#{path}/Bigkeeper")
17
-
18
20
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
19
21
  modules = BigkeeperParser.module_names
22
+ DepService.dep_operator(path, user).prerelease_finish(path, version, user, modules)
23
+ end
20
24
 
21
- if GitOperator.new.has_branch(path, "release/#{version}")
22
- DepService.dep_operator(path, user).release_finish(path, version, user, modules)
23
- else
24
- DepService.dep_operator(path, user).release_start(path, version, user, modules)
25
- DepService.dep_operator(path, user).release_finish(path, version, user, modules)
25
+ def self.release_home_start(path, version, user, modules)
26
+ DepService.dep_operator(path, user).release_home_start(path, version, user, modules)
27
+ end
28
+
29
+ def self.release_home_finish(path, version, user, modules)
30
+ BigkeeperParser.parse("#{path}/Bigkeeper")
31
+
32
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
33
+ modules = []
34
+ BigkeeperParser.module_names.each do |module_name|
35
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
36
+ if GitOperator.new.has_branch(module_full_path, "release/#{version}")
37
+ Logger.highlight("#{module_name} has release/#{version}")
38
+ modules << module_name
39
+ end
26
40
  end
41
+ 54322
42
+ DepService.dep_operator(path, user).release_home_finish(path, version, user, modules)
27
43
  end
28
44
 
29
45
  end
@@ -8,35 +8,6 @@ require 'big_keeper/util/logger'
8
8
  require 'big_keeper/util/pod_operator'
9
9
 
10
10
  module BigKeeper
11
- def self.prerelease_module(path, version, user, modules, ignore)
12
- for module_name in modules
13
- release_module_start(path, version, user, module_name, ignore)
14
- end
15
- end
16
-
17
- def self.release_module_start(path, version, user, module_name, ignore)
18
- p module_name
19
- BigkeeperParser.parse("#{path}/Bigkeeper")
20
- version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
21
- module_path = BigkeeperParser.module_full_path(path, user, module_name)
22
-
23
- # stash
24
- StashService.new.stash(module_path, GitOperator.new.current_branch(module_path), module_name)
25
-
26
- #check
27
- if ignore != true
28
- GitOperator.new.check_merge(module_path, "feature/#{version}")
29
- GitOperator.new.check_diff(module_path, "develop", "master")
30
- Logger.highlight(%Q(#{module_name} release check finish))
31
- end
32
-
33
- # checkout to develop branch
34
- Logger.highlight(%Q(Start checkout #{module_name} to Branch develop))
35
- GitService.new.verify_checkout_pull(module_path, "develop")
36
-
37
- Logger.highlight(%Q(#{module_name} prerelease finish))
38
- end
39
-
40
11
  def self.release_module(path, version, user, modules, spec)
41
12
  BigkeeperParser.parse("#{path}/Bigkeeper")
42
13
 
@@ -44,29 +15,47 @@ module BigKeeper
44
15
  Logger.error('module prerelease interrupt')
45
16
  end
46
17
 
47
- for module_name in modules
48
- release_module_start(path, version, user, module_name, true)
18
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
49
19
 
50
- version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
20
+ for module_name in modules
51
21
  module_path = BigkeeperParser.module_full_path(path, user, module_name)
52
22
 
23
+ StashService.new.stash(module_path, GitOperator.new.current_branch(module_path), module_name)
24
+ GitService.new.verify_checkout_pull(module_path, "release/#{version}")
25
+ GitService.new.verify_checkout_pull(module_path, "develop")
26
+
27
+ has_diff = release_module_pre_check(module_path, module_name, version)
28
+
29
+ if has_diff
30
+ # merge release to develop
31
+ branch_name = GitOperator.new.current_branch(module_path)
32
+ if branch_name == "develop"
33
+ GitOperator.new.merge_no_ff(module_path, "release/#{version}")
34
+ GitOperator.new.push_to_remote(module_path, "develop")
35
+ else
36
+ Logger.error("current branch is not develop branch")
37
+ end
38
+ end
39
+
53
40
  # check commit
54
41
  Logger.error("current branch has unpush files") if GitOperator.new.has_changes(module_path)
55
42
 
56
- #修改 podspec 文件
57
- # TO DO: - advanced to use Regular Expression
58
- has_change = PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
59
- GitService.new.verify_push(module_path, "Change version number", "develop", "#{module_name}") if has_change == true
60
-
61
43
  # check out master
62
44
  Logger.highlight("'#{module_name}' checkout branch to master...")
63
45
  GitService.new.verify_checkout_pull(module_path, "master")
64
46
 
65
- Logger.highlight(%Q(Merge develop to master))
66
- # merge develop to master
67
- GitOperator.new.merge(module_path, "develop")
47
+ # merge release to master
48
+ GitOperator.new.merge_no_ff(module_path, "release/#{version}")
49
+
50
+ Logger.highlight(%Q(Merge "release/#{version}" to master))
51
+
68
52
  GitOperator.new.push_to_remote(module_path, "master")
69
53
 
54
+ #修改 podspec 文件
55
+ # TO DO: - advanced to use Regular Expression
56
+ # has_change = PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
57
+ # GitService.new.verify_push(module_path, "Change version number", "master", "#{module_name}") if has_change == true
58
+
70
59
  GitOperator.new.tag(module_path, version)
71
60
  # pod repo push
72
61
  if spec == true
@@ -75,4 +64,11 @@ module BigKeeper
75
64
  end
76
65
  end
77
66
 
67
+ def self.release_module_pre_check(module_path, module_name, version)
68
+ #check
69
+ #GitOperator.new.check_merge(module_path, "feature/#{version}")
70
+ Logger.highlight(%Q(#{module_name} release pre-check finish))
71
+ return GitOperator.new.check_diff(module_path, "develop", "release/#{version}")
72
+ end
73
+
78
74
  end
@@ -57,22 +57,149 @@ module BigKeeper
57
57
  VersionConfigOperator.change_version(version_config_file, modules, version)
58
58
  end
59
59
 
60
- def release_home_start(modules, version)
61
- version_config_file = "#{@path}/doc/config/version-config.gradle"
62
- version = "#{version}-SNAPSHOT" unless version.include?'SNAPSHOT'
63
- VersionConfigOperator.change_version(version_config_file, modules, version)
60
+ def open
64
61
  end
65
62
 
66
- def release_home_finish(modules, version)
67
- version_config_file = "#{@path}/doc/config/version-config.gradle"
68
- VersionConfigOperator.change_version(version_config_file, modules, version)
63
+ def release_check_changed_modules(path, user)
64
+ changed_modules = []
65
+ BigkeeperParser.parse("#{path}/Bigkeeper")
66
+ allModules = BigkeeperParser.module_names
67
+ allModules.each do |module_name|
68
+ if ModuleService.new.release_check_changed(path, user, module_name)
69
+ changed_modules << module_name
70
+ end
71
+ end
72
+ changed_modules
69
73
  end
70
74
 
71
- def open
75
+ ## release cmd
76
+ def release_home_start(path, version, user, modules)
77
+ BigkeeperParser.parse("#{path}/Bigkeeper")
78
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
79
+ modules = BigkeeperParser.module_names
80
+
81
+ if modules.nil? || modules.empty?
82
+ Logger.default('no module need to release')
83
+ end
84
+
85
+ #stash home
86
+ StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
87
+ # delete cache
88
+ CacheOperator.new(path).clean()
89
+ # check
90
+ GitOperator.new.check_diff(path, "develop", "master")
91
+
92
+ #checkout release branch
93
+ Logger.highlight(%Q(Start to checkout Home Branch release/#{version}))
94
+
95
+ GitService.new.verify_checkout(path, "release/#{version}")
96
+
97
+ raise Logger.error("Chechout release/#{version} failed.") unless GitOperator.new.current_branch(path) == "release/#{version}"
98
+
99
+ Logger.highlight(%Q(Finish to release/#{version} for home project))
100
+
101
+ if !modules.nil? && !modules.empty?
102
+ modules.each do |module_name|
103
+ Logger.highlight("release checkout release/#{version} for #{module_name}")
104
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
105
+
106
+ if GitOperator.new.has_branch(module_full_path, "release/#{version}")
107
+ Logger.highlight("#{module_name} has release/#{version}")
108
+ GitService.new.verify_checkout_pull(module_full_path, "release/#{version}")
109
+ else
110
+ Logger.highlight("#{module_name} dont have release/#{version}")
111
+ GitService.new.verify_checkout(module_full_path, "release/#{version}")
112
+ Logger.highlight("Push branch release/'#{version}' for #{module_name}...")
113
+ GitOperator.new.push_to_remote(module_full_path, "release/#{version}")
114
+ end
115
+ end
116
+ end
117
+
118
+ Logger.highlight("Home project release home start finished")
72
119
  end
73
120
 
74
- def release_start(path, version, user, modules)
121
+ def release_home_finish(path, version, user, modules)
75
122
  BigkeeperParser.parse("#{path}/Bigkeeper")
123
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
124
+
125
+ if modules.nil? || modules.empty?
126
+ Logger.default('no module need to release')
127
+ end
128
+
129
+ #stash home
130
+ StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
131
+ # delete cache
132
+ CacheOperator.new(path).clean()
133
+ # check
134
+ GitOperator.new.check_diff(path, "develop", "master")
135
+
136
+ for module_name in modules
137
+ module_path = BigkeeperParser.module_full_path(path, user, module_name)
138
+
139
+ StashService.new.stash(module_path, GitOperator.new.current_branch(module_path), module_name)
140
+ GitService.new.verify_checkout_pull(module_path, "release/#{version}")
141
+ GitService.new.verify_checkout_pull(module_path, "develop")
142
+
143
+ has_diff = GitOperator.new.check_diff(module_path, "develop", "release/#{version}")
144
+ if has_diff
145
+ branch_name = GitOperator.new.current_branch(module_path)
146
+ if branch_name == "develop"
147
+ GitOperator.new.merge_no_ff(module_path, "release/#{version}")
148
+ GitOperator.new.push_to_remote(module_path, "develop")
149
+ else
150
+ Logger.error("current branch is not develop branch")
151
+ end
152
+ end
153
+
154
+ # check out master
155
+ Logger.highlight("'#{module_name}' checkout branch to master...")
156
+ GitService.new.verify_checkout_pull(module_path, "master")
157
+
158
+ # merge release to master
159
+ GitOperator.new.merge_no_ff(module_path, "release/#{version}")
160
+ Logger.highlight(%Q(Merge "release/#{version}" to master))
161
+ GitOperator.new.push_to_remote(module_path, "master")
162
+ end
163
+
164
+ if GitOperator.new.has_branch(path, "release/#{version}")
165
+
166
+ GitService.new.verify_checkout_pull(path, "release/#{version}")
167
+
168
+ PodfileOperator.new.replace_all_module_release(path, user, modules, ModuleOperateType::RELEASE)
169
+
170
+ GitService.new.verify_push(path, "finish release branch", "release/#{version}", 'Home')
171
+
172
+ # master
173
+ GitService.new.verify_checkout(path, "master")
174
+ GitOperator.new.merge(path, "release/#{version}")
175
+ GitService.new.verify_push(path, "release V#{version}", "master", 'Home')
176
+
177
+ GitOperator.new.tag(path, version)
178
+
179
+ # release branch
180
+ GitOperator.new.checkout(path, "release/#{version}")
181
+ CacheOperator.new(path).load('Podfile')
182
+ CacheOperator.new(path).clean()
183
+ GitOperator.new.commit(path, "reset #{version} Podfile")
184
+ GitService.new.verify_push(path, "reset #{version} Podfile", "release/#{version}", 'Home')
185
+
186
+ # develop
187
+ GitOperator.new.checkout(path, "develop")
188
+ GitOperator.new.merge(path, "release/#{version}")
189
+ GitService.new.verify_push(path, "merge release/#{version} to develop", "develop", 'Home')
190
+ GitOperator.new.check_diff(path, "develop", "master")
191
+
192
+ Logger.highlight("Finish release home for #{version}")
193
+ else
194
+ raise Logger.error("There is no release/#{version} branch, please use release home start first.")
195
+ end
196
+
197
+ end
198
+
199
+ ## prerelease cmd
200
+ def prerelease_start(path, version, user, modules)
201
+ BigkeeperParser.parse("#{path}/Bigkeeper")
202
+
76
203
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
77
204
  modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
78
205
 
@@ -93,20 +220,13 @@ module BigKeeper
93
220
 
94
221
  modules.each do |module_name|
95
222
  Logger.highlight("release start module #{module_name}")
96
- ModuleService.new.release_start(path, user, modules, module_name, version)
97
-
98
- # Push home changes to remote
99
223
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
100
- Logger.highlight("Push branch 'develop' for #{module_name}...")
101
- GitService.new.verify_push(
102
- module_full_path,
103
- "release start for #{version}",
104
- 'develop',
105
- "#{module_name}")
224
+ ModuleService.new.release_start(path, user, modules, module_name, version)
225
+ GitService.new.verify_push(module_full_path, "Change version to #{version}-SNAPSHOT", "develop", module_name)
106
226
  end
107
227
 
108
228
  #release home
109
- DepService.dep_operator(path, user).release_home_start(modules, version)
229
+ DepService.dep_operator(path, user).prerelease_home_start(path, version, user, modules)
110
230
 
111
231
  # Push home changes to remote
112
232
  Logger.highlight("Push branch 'develop' for 'Home'...")
@@ -117,17 +237,10 @@ module BigKeeper
117
237
  'Home')
118
238
  end
119
239
 
120
- def self.release_finish(path, version, user, modules)
240
+ def prerelease_finish(path, version, user, modules)
121
241
  BigkeeperParser.parse("#{path}/Bigkeeper")
122
242
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
123
- modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
124
243
 
125
- if modules.nil? || modules.empty?
126
- Logger.error('no module need to release')
127
- end
128
- if !CommandLineUtil.double_check("module #{modules} will changed version to #{version}, are you sure?")
129
- Logger.error('release finish interrupt')
130
- end
131
244
  #stash home
132
245
  StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
133
246
  # delete cache
@@ -136,20 +249,31 @@ module BigKeeper
136
249
  GitService.new.verify_checkout_pull(path, 'develop')
137
250
 
138
251
  modules.each do |module_name|
139
- Logger.highlight("release start module #{module_name}")
140
- ModuleService.new.release_finish(path, user, modules, module_name, version)
252
+ Logger.highlight("release start module #{module_name}")
253
+ ModuleService.new.release_finish(path, user, modules, module_name, version)
141
254
  end
142
255
 
143
- #release home
144
- DepService.dep_operator(path, user).release_home_finish(modules, version)
256
+ # release home
257
+ DepService.dep_operator(path, user).prerelease_home_finish(path, version, user, modules)
145
258
 
146
259
  # Push home changes to remote
147
260
  Logger.highlight("Push branch 'develop' for 'Home'...")
148
261
  GitService.new.verify_push(
149
- path,
150
- "release finish for #{version}",
151
- 'develop',
152
- 'Home')
262
+ path,
263
+ "release finish for #{version}",
264
+ 'develop',
265
+ 'Home')
266
+ end
267
+
268
+ def prerelease_home_start(path, version, user, modules)
269
+ version_config_file = "#{path}/doc/config/version-config.gradle"
270
+ version = "#{version}-SNAPSHOT" unless version.include?'SNAPSHOT'
271
+ VersionConfigOperator.change_version(version_config_file, modules, version)
272
+ end
273
+
274
+ def prerelease_home_finish(path, version, user, modules)
275
+ version_config_file = "#{@path}/doc/config/version-config.gradle"
276
+ VersionConfigOperator.change_version(version_config_file, modules, version)
153
277
  end
154
278
 
155
279
  end
@@ -21,6 +21,22 @@ module BigKeeper
21
21
  raise "You should override this method in subclass."
22
22
  end
23
23
 
24
+ def prerelease_start(path, version, user, modules)
25
+ raise "You should override this method in subclass."
26
+ end
27
+
28
+ def prerelease_finish(path, version, user, modules)
29
+ raise "You should override this method in subclass."
30
+ end
31
+
32
+ def prerelease_home_start(path, version, user, modules)
33
+ raise "You should override this method in subclass."
34
+ end
35
+
36
+ def prerelease_home_finish(path, version, user, modules)
37
+ raise "You should override this method in subclass."
38
+ end
39
+
24
40
  def release_module_start(modules, module_name, version)
25
41
  raise "You should override this method in subclass."
26
42
  end
@@ -29,11 +45,11 @@ module BigKeeper
29
45
  raise "You should override this method in subclass."
30
46
  end
31
47
 
32
- def release_home_start(modules, version)
48
+ def release_home_start(path, version, user, modules)
33
49
  raise "You should override this method in subclass."
34
50
  end
35
51
 
36
- def release_home_finish(modules, version)
52
+ def release_home_finish(path, version, user, modules)
37
53
  raise "You should override this method in subclass."
38
54
  end
39
55
 
@@ -75,10 +75,6 @@ module BigKeeper
75
75
  Logger.default("#{module_name} lastest tag is #{lastest_tag}, this tag not publish.")
76
76
  "#{$1}pod '#{module_name}#{$4}', :git => '#{module_git}', :tag => '#{lastest_tag}'"
77
77
  end
78
- elsif ModuleOperateType::RELEASE_START == module_operate_type
79
- module_git = BigkeeperParser.module_git(module_name)
80
- branch_name = GitOperator.new.current_branch(@path)
81
- "#{$1}pod '#{module_name}#{$4}', :git => '#{module_git}', :branch => '#{branch_name}'"
82
78
  else
83
79
  line
84
80
  end
@@ -129,10 +125,9 @@ module BigKeeper
129
125
  end
130
126
  end
131
127
 
132
- def release_start(path, version, user, modules)
128
+ def release_home_start(path, version, user, modules)
133
129
  BigkeeperParser.parse("#{path}/Bigkeeper")
134
130
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
135
- modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
136
131
 
137
132
  if modules.nil? || modules.empty?
138
133
  Logger.default('no module need to release')
@@ -158,30 +153,32 @@ module BigKeeper
158
153
 
159
154
  Logger.highlight(%Q(Finish to release/#{version} for home project))
160
155
 
161
- modules.each do |module_name|
162
- Logger.highlight("release checkout release/#{version} for #{module_name}")
163
- module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
156
+ if !modules.nil? && !modules.empty?
157
+ modules.each do |module_name|
158
+ Logger.highlight("release checkout release/#{version} for #{module_name}")
159
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
164
160
 
165
- if GitOperator.new.has_branch(module_full_path, "release/#{version}")
166
- Logger.highlight("#{module_name} has release/#{version}")
167
- GitOperator.new.checkout(module_full_path, "release/#{version}")
168
- else
169
- Logger.highlight("#{module_name} dont have release/#{version}")
170
- ModuleService.new.release_start(path, user, modules, module_name, version)
171
- Logger.highlight("Push branch release/'#{version}' for #{module_name}...")
172
- GitOperator.new.push_to_remote(module_full_path, "release/#{version}")
173
- end
161
+ if GitOperator.new.has_branch(module_full_path, "release/#{version}")
162
+ Logger.highlight("#{module_name} has release/#{version}")
163
+ GitService.new.verify_checkout_pull(module_full_path, "release/#{version}")
164
+ else
165
+ Logger.highlight("#{module_name} dont have release/#{version}")
166
+ ModuleService.new.release_start(path, user, modules, module_name, version)
167
+ Logger.highlight("Push branch release/'#{version}' for #{module_name}...")
168
+ GitOperator.new.push_to_remote(module_full_path, "release/#{version}")
169
+ end
174
170
 
175
- DepService.dep_operator(path, user).update_module_config(
176
- module_name,
177
- ModuleOperateType::RELEASE_START)
171
+ DepService.dep_operator(path, user).update_module_config(
172
+ module_name,
173
+ ModuleOperateType::RELEASE_START)
174
+ end
178
175
  end
179
176
 
180
177
  # step 3 change Info.plist value
181
178
  InfoPlistOperator.new.change_version_build(path, version)
182
179
 
183
180
  GitService.new.verify_push(path, "Change version to #{version}", "release/#{version}", 'Home')
184
- # DepService.dep_operator(path, user).install(modules, OperateType::RELEASE, true)
181
+ DepService.dep_operator(path, user).install(modules, OperateType::RELEASE, true)
185
182
  XcodeOperator.open_workspace(path)
186
183
  end
187
184
 
@@ -190,20 +187,20 @@ module BigKeeper
190
187
  GitService.new.verify_checkout(module_full_path, "release/#{version}")
191
188
  end
192
189
 
193
- def release_finish(path, version, user, modules)
190
+ def release_home_finish(path, version, user, modules)
194
191
  BigkeeperParser.parse("#{path}/Bigkeeper")
195
192
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
196
- modules = BigkeeperParser.module_names
197
193
 
198
194
  if GitOperator.new.has_branch(path, "release/#{version}")
199
- GitService.new.verify_checkout(path, "release/#{version}")
195
+
196
+ GitService.new.verify_checkout_pull(path, "release/#{version}")
200
197
 
201
198
  PodfileOperator.new.replace_all_module_release(path, user, modules, ModuleOperateType::RELEASE)
202
199
 
203
200
  GitService.new.verify_push(path, "finish release branch", "release/#{version}", 'Home')
204
201
 
205
202
  # master
206
- GitOperator.new.checkout(path, "master")
203
+ GitService.new.verify_checkout(path, "master")
207
204
  GitOperator.new.merge(path, "release/#{version}")
208
205
  GitService.new.verify_push(path, "release V#{version}", "master", 'Home')
209
206
 
@@ -46,8 +46,8 @@ module BigKeeper
46
46
  @@current_user = ''
47
47
 
48
48
  def self.parse(bigkeeper)
49
+ @@config = {}
49
50
  if @@config.empty?
50
-
51
51
  Logger.error("Can't find a Bigkeeper file in current directory.") if !FileOperator.definitely_exists?(bigkeeper)
52
52
 
53
53
  content = File.read(bigkeeper, :encoding => 'UTF-8')
@@ -83,7 +83,8 @@ module BigKeeper
83
83
 
84
84
  def pull(path)
85
85
  Dir.chdir(path) do
86
- `git pull`
86
+ # git pull <remote> <branch>
87
+ `git pull #{GitOperator.remote_local_name(path)} #{GitOperator.new.current_branch(path)}`
87
88
  end
88
89
  end
89
90
 
@@ -219,15 +220,27 @@ module BigKeeper
219
220
  compare_branch_commits.map { |item|
220
221
  Logger.default(item)
221
222
  }
222
- Logger.error("#{compare_branch} branch has commit doesn't committed in #{branch}, please check")
223
+ Logger.highlight("#{compare_branch} branch has commit doesn't committed in #{branch}, please check")
224
+ return false
223
225
  else
224
226
  Logger.highlight("#{compare_branch} branch doesn't have commit before #{branch}")
227
+ return true
225
228
  end
226
229
  end
227
230
 
228
231
  def merge(path, branch_name)
229
- IO.popen("cd '#{path}'; git merge #{branch_name}") do |line|
230
- Logger.error("Merge conflict in #{branch_name}") if line.include? 'Merge conflict'
232
+ IO.popen("cd '#{path}'; git merge #{branch_name}") do |io|
233
+ io.each do |line|
234
+ Logger.error("Merge conflict in #{line}") if line.include? 'Merge conflict'
235
+ end
236
+ end
237
+ end
238
+
239
+ def merge_no_ff(path, branch_name)
240
+ IO.popen("cd '#{path}'; git merge #{branch_name} --no-ff") do |io|
241
+ io.each do |line|
242
+ Logger.error("Merge conflict in #{line}") if line.include? 'Merge conflict'
243
+ end
231
244
  end
232
245
  end
233
246
 
@@ -1,3 +1,3 @@
1
1
  module BigKeeper
2
- VERSION = "0.9.14"
2
+ VERSION = "0.9.15"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmoaay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2019-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -276,7 +276,6 @@ files:
276
276
  - lib/big_keeper/command/release/home.rb
277
277
  - lib/big_keeper/command/release/module.rb
278
278
  - lib/big_keeper/command/release/publish.rb
279
- - lib/big_keeper/command/release/start.rb
280
279
  - lib/big_keeper/command/spec.rb
281
280
  - lib/big_keeper/command/spec/add.rb
282
281
  - lib/big_keeper/command/spec/analyze.rb
@@ -1,14 +0,0 @@
1
- module BigKeeper
2
- def self.release_check_changed_modules(path, user)
3
- changed_modules = []
4
- BigkeeperParser.parse("#{path}/Bigkeeper")
5
- allModules = BigkeeperParser.module_names
6
- allModules.each do |module_name|
7
- if ModuleService.new.release_check_changed(path, user, module_name)
8
- changed_modules << module_name
9
- end
10
- end
11
- changed_modules
12
- end
13
-
14
- end