bigkeeper 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/big +1 -1
- data/lib/big_keeper/command/release.rb +25 -0
- data/lib/big_keeper/command/release/finish.rb +36 -0
- data/lib/big_keeper/command/release/publish.rb +4 -0
- data/lib/big_keeper/command/release/start.rb +78 -0
- data/lib/big_keeper/dependency/dep_gradle_operator.rb +25 -0
- data/lib/big_keeper/dependency/dep_operator.rb +16 -0
- data/lib/big_keeper/service/module_service.rb +65 -0
- data/lib/big_keeper/util/bigkeeper_parser.rb +4 -0
- data/lib/big_keeper/util/command_line_util.rb +9 -0
- data/lib/big_keeper/util/git_operator.rb +16 -0
- data/lib/big_keeper/util/gradle_file_operator.rb +1 -0
- data/lib/big_keeper/util/gradle_module_operator.rb +1 -0
- data/lib/big_keeper/util/version_config_operator.rb +29 -0
- data/lib/big_keeper/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cf22bc9b9d70faf0f43bd27e47961d18dad8355a
|
4
|
+
data.tar.gz: 173dbc4a58a0a68bb6acd7347356e7c3ecac30a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1190f2647d435bd6e079d0b7b24ff9a97136f2f96dd93e690d513b6de7273c8602c2331a9370c9d11585a1ca8bd831414541ca52c78cc7962aea1fe5df732f94
|
7
|
+
data.tar.gz: 4ec0c705ac99fe65082ca443eda32beb12d7d704c1d272323e0af8b4a45a691f61d52ac6ad22e26778cb253fefd89f0fd433c6beb89d29b565d113b9d063dc43
|
data/bin/big
CHANGED
@@ -1,12 +1,37 @@
|
|
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
|
+
require 'big_keeper/command/release/finish'
|
6
|
+
require 'big_keeper/util/command_line_util'
|
4
7
|
|
5
8
|
module BigKeeper
|
6
9
|
def self.release_command
|
7
10
|
desc 'Gitflow release operations'
|
8
11
|
command :release do |c|
|
9
12
|
|
13
|
+
c.desc 'release project start'
|
14
|
+
c.command :start do |start|
|
15
|
+
start.action do |global_options, options, args|
|
16
|
+
path = File.expand_path(global_options[:path])
|
17
|
+
version = global_options[:ver]
|
18
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
19
|
+
modules = args[(0...args.length)] if args.length > 0
|
20
|
+
release_start(path, version, user, modules)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
c.desc 'release project finish'
|
25
|
+
c.command :finish do |finish|
|
26
|
+
finish.action do |global_options, options, args|
|
27
|
+
path = File.expand_path(global_options[:path])
|
28
|
+
version = global_options[:ver]
|
29
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
30
|
+
modules = args[(0...args.length)] if args.length > 0
|
31
|
+
release_finish(path, version, user, modules)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
10
35
|
c.desc 'Release home project operations'
|
11
36
|
c.command :home do |home|
|
12
37
|
home.desc 'Start release home project'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module BigKeeper
|
2
|
+
def self.release_finish(path, version, user, modules)
|
3
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
4
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
5
|
+
modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
|
6
|
+
|
7
|
+
if modules.nil? || modules.empty?
|
8
|
+
Logger.error('no module need to release')
|
9
|
+
end
|
10
|
+
if !CommandLineUtil.double_check("module #{modules} will changed version to #{version}, are you sure?")
|
11
|
+
Logger.error('release finish interrupt')
|
12
|
+
end
|
13
|
+
#stash home
|
14
|
+
StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
|
15
|
+
# delete cache
|
16
|
+
CacheOperator.new(path).clean()
|
17
|
+
# checkout develop
|
18
|
+
GitService.new.verify_checkout_pull(path, 'develop')
|
19
|
+
|
20
|
+
modules.each do |module_name|
|
21
|
+
Logger.highlight("release start module #{module_name}")
|
22
|
+
ModuleService.new.release_finish(path, user, modules, module_name, version)
|
23
|
+
end
|
24
|
+
|
25
|
+
#release home
|
26
|
+
DepService.dep_operator(path, user).release_home_finish(modules, version)
|
27
|
+
|
28
|
+
# Push home changes to remote
|
29
|
+
Logger.highlight("Push branch 'develop' for 'Home'...")
|
30
|
+
GitService.new.verify_push(
|
31
|
+
path,
|
32
|
+
"release finish for #{version}",
|
33
|
+
'develop',
|
34
|
+
'Home')
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module BigKeeper
|
2
|
+
def self.release_start(path, version, user, modules)
|
3
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
4
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
5
|
+
modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
|
6
|
+
|
7
|
+
if modules.nil? || modules.empty?
|
8
|
+
Logger.error('no module need to release')
|
9
|
+
end
|
10
|
+
|
11
|
+
if !CommandLineUtil.double_check("module #{modules} will changed version to #{version}-SNAPSHOT, are you sure?")
|
12
|
+
Logger.error('release start interrupt')
|
13
|
+
end
|
14
|
+
|
15
|
+
#stash home
|
16
|
+
StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
|
17
|
+
# delete cache
|
18
|
+
CacheOperator.new(path).clean()
|
19
|
+
# checkout develop
|
20
|
+
GitService.new.verify_checkout_pull(path, 'develop')
|
21
|
+
|
22
|
+
modules.each do |module_name|
|
23
|
+
Logger.highlight("release start module #{module_name}")
|
24
|
+
ModuleService.new.release_start(path, user, modules, module_name, version)
|
25
|
+
end
|
26
|
+
|
27
|
+
#release home
|
28
|
+
DepService.dep_operator(path, user).release_home_start(modules, version)
|
29
|
+
|
30
|
+
# Push home changes to remote
|
31
|
+
Logger.highlight("Push branch 'develop' for 'Home'...")
|
32
|
+
GitService.new.verify_push(
|
33
|
+
path,
|
34
|
+
"release start for #{version}",
|
35
|
+
'develop',
|
36
|
+
'Home')
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.release_finish(path, version, user, modules)
|
40
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
41
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
42
|
+
|
43
|
+
#stash home
|
44
|
+
StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
|
45
|
+
# delete cache
|
46
|
+
CacheOperator.new(path).clean()
|
47
|
+
# checkout develop
|
48
|
+
GitService.new.verify_checkout_pull(path, 'develop')
|
49
|
+
|
50
|
+
modules.each do |module_name|
|
51
|
+
Logger.highlight("release start module #{module_name}")
|
52
|
+
ModuleService.new.release_finish(path, user, modules, module_name, version)
|
53
|
+
end
|
54
|
+
|
55
|
+
#release home
|
56
|
+
DepService.dep_operator(path, user).release_home_finish(modules, version)
|
57
|
+
|
58
|
+
# Push home changes to remote
|
59
|
+
Logger.highlight("Push branch 'develop' for 'Home'...")
|
60
|
+
GitService.new.verify_push(
|
61
|
+
path,
|
62
|
+
"release finish for #{version}",
|
63
|
+
'develop',
|
64
|
+
'Home')
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.release_check_changed_modules(path, user)
|
68
|
+
changed_modules = []
|
69
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
70
|
+
allModules = BigkeeperParser.module_names
|
71
|
+
allModules.each do |module_name|
|
72
|
+
if ModuleService.new.release_check_changed(path, user, module_name)
|
73
|
+
changed_modules << module_name
|
74
|
+
end
|
75
|
+
end
|
76
|
+
changed_modules
|
77
|
+
end
|
78
|
+
end
|
@@ -2,6 +2,7 @@ require 'big_keeper/dependency/dep_operator'
|
|
2
2
|
require 'big_keeper/util/gradle_module_operator'
|
3
3
|
require 'big_keeper/util/gradle_file_operator'
|
4
4
|
require 'big_keeper/model/operate_type'
|
5
|
+
require 'big_keeper/util/version_config_operator'
|
5
6
|
|
6
7
|
module BigKeeper
|
7
8
|
# Operator for podfile
|
@@ -43,6 +44,30 @@ module BigKeeper
|
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
47
|
+
def release_module_start(modules, module_name, version)
|
48
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
49
|
+
version_config_file = "#{module_full_path}/doc/config/version-config.gradle"
|
50
|
+
version = "#{version}-SNAPSHOT" unless version.include?'SNAPSHOT'
|
51
|
+
VersionConfigOperator.change_version(version_config_file, modules, version)
|
52
|
+
end
|
53
|
+
|
54
|
+
def release_module_finish(modules, module_name, version)
|
55
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
56
|
+
version_config_file = "#{module_full_path}/doc/config/version-config.gradle"
|
57
|
+
VersionConfigOperator.change_version(version_config_file, modules, version)
|
58
|
+
end
|
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)
|
64
|
+
end
|
65
|
+
|
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)
|
69
|
+
end
|
70
|
+
|
46
71
|
def open
|
47
72
|
end
|
48
73
|
end
|
@@ -21,6 +21,22 @@ module BigKeeper
|
|
21
21
|
raise "You should override this method in subclass."
|
22
22
|
end
|
23
23
|
|
24
|
+
def release_module_start(modules, module_name, version)
|
25
|
+
raise "You should override this method in subclass."
|
26
|
+
end
|
27
|
+
|
28
|
+
def release_module_finish(modules, module_name, version)
|
29
|
+
raise "You should override this method in subclass."
|
30
|
+
end
|
31
|
+
|
32
|
+
def release_home_start(modules, version)
|
33
|
+
raise "You should override this method in subclass."
|
34
|
+
end
|
35
|
+
|
36
|
+
def release_home_finish(modules, version)
|
37
|
+
raise "You should override this method in subclass."
|
38
|
+
end
|
39
|
+
|
24
40
|
def install(modules, type, should_update)
|
25
41
|
raise "You should override this method in subclass."
|
26
42
|
end
|
@@ -154,6 +154,71 @@ module BigKeeper
|
|
154
154
|
result_dic
|
155
155
|
end
|
156
156
|
|
157
|
+
def release_check_changed(path, user, module_name)
|
158
|
+
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
159
|
+
|
160
|
+
git = GitOperator.new
|
161
|
+
if !File.exist? module_full_path
|
162
|
+
Logger.default("No local repository for module '#{module_name}', clone it...")
|
163
|
+
module_git = BigkeeperParser.module_git(module_name)
|
164
|
+
git.clone(File.expand_path("#{module_full_path}/../"), module_git)
|
165
|
+
end
|
166
|
+
GitService.new.verify_checkout_pull(module_full_path, 'develop')
|
167
|
+
git.check_remote_branch_diff(module_full_path, 'develop', 'master')
|
168
|
+
end
|
169
|
+
|
170
|
+
def release_start(path, user, modules, module_name, version)
|
171
|
+
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
172
|
+
|
173
|
+
git = GitOperator.new
|
174
|
+
if !File.exist? module_full_path
|
175
|
+
Logger.default("No local repository for module '#{module_name}', clone it...")
|
176
|
+
module_git = BigkeeperParser.module_git(module_name)
|
177
|
+
git.clone(File.expand_path("#{module_full_path}/../"), module_git)
|
178
|
+
end
|
179
|
+
#stash module
|
180
|
+
StashService.new.stash(module_full_path, GitOperator.new.current_branch(module_full_path), module_name)
|
181
|
+
# delete cache
|
182
|
+
CacheOperator.new(module_full_path).clean()
|
183
|
+
# checkout develop
|
184
|
+
GitService.new.verify_checkout_pull(module_full_path, 'develop')
|
185
|
+
DepService.dep_operator(path, user).release_module_start(modules, module_name, version)
|
186
|
+
|
187
|
+
# Push home changes to remote
|
188
|
+
Logger.highlight("Push branch 'develop' for #{module_name}...")
|
189
|
+
GitService.new.verify_push(
|
190
|
+
module_full_path,
|
191
|
+
"release start for #{version}",
|
192
|
+
'develop',
|
193
|
+
"#{module_name}")
|
194
|
+
end
|
195
|
+
|
196
|
+
def release_finish(path, user, modules, module_name, version)
|
197
|
+
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
198
|
+
|
199
|
+
git = GitOperator.new
|
200
|
+
if !File.exist? module_full_path
|
201
|
+
Logger.default("No local repository for module '#{module_name}', clone it...")
|
202
|
+
module_git = BigkeeperParser.module_git(module_name)
|
203
|
+
git.clone(File.expand_path("#{module_full_path}/../"), module_git)
|
204
|
+
end
|
205
|
+
#stash module
|
206
|
+
StashService.new.stash(module_full_path, GitOperator.new.current_branch(module_full_path), module_name)
|
207
|
+
# delete cache
|
208
|
+
CacheOperator.new(module_full_path).clean()
|
209
|
+
# checkout develop
|
210
|
+
GitService.new.verify_checkout_pull(module_full_path, 'develop')
|
211
|
+
DepService.dep_operator(path, user).release_module_finish(modules, module_name, version)
|
212
|
+
|
213
|
+
# Push home changes to remote
|
214
|
+
Logger.highlight("Push branch 'develop' for #{module_name}...")
|
215
|
+
GitService.new.verify_push(
|
216
|
+
module_full_path,
|
217
|
+
"release finish for #{version}",
|
218
|
+
'develop',
|
219
|
+
"#{module_name}")
|
220
|
+
end
|
221
|
+
|
157
222
|
private :verify_module
|
158
223
|
end
|
159
224
|
end
|
@@ -231,6 +231,10 @@ module BigKeeper
|
|
231
231
|
@@config[:modules][module_name][:maven_artifact]
|
232
232
|
end
|
233
233
|
|
234
|
+
def self.module_version_alias(module_name)
|
235
|
+
@@config[:modules][module_name][:version_alias]
|
236
|
+
end
|
237
|
+
|
234
238
|
def self.module_pulls(module_name)
|
235
239
|
@@config[:modules][module_name][:pulls]
|
236
240
|
end
|
@@ -181,6 +181,22 @@ module BigKeeper
|
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
184
|
+
def check_remote_branch_diff(path, branch, compare_branch)
|
185
|
+
fetch(path)
|
186
|
+
compare_branch_commits = Array.new
|
187
|
+
IO.popen("cd '#{path}';git log --left-right #{branch}...origin/#{compare_branch} --pretty=oneline") do |io|
|
188
|
+
io.each do |line|
|
189
|
+
compare_branch_commits.push(line) unless (line.include? '>') && (line.include? "Merge branch \'#{branch}\' into \'#{compare_branch}\'")
|
190
|
+
end
|
191
|
+
end
|
192
|
+
if compare_branch_commits.size > 0
|
193
|
+
return true
|
194
|
+
else
|
195
|
+
return false
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
# TODO: 需要改造,util方法不应该有业务逻辑
|
184
200
|
def check_diff(path, branch, compare_branch)
|
185
201
|
compare_branch_commits = Array.new
|
186
202
|
IO.popen("cd '#{path}'; git log --left-right #{branch}...#{compare_branch} --pretty=oneline") do |io|
|
@@ -59,6 +59,7 @@ module BigKeeper
|
|
59
59
|
version_name = ''
|
60
60
|
if ModuleOperateType::ADD == module_operate_type
|
61
61
|
version_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
|
62
|
+
version_name = version_name.gsub('_', '-')
|
62
63
|
elsif ModuleOperateType::FINISH == module_operate_type
|
63
64
|
version_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){ $2 }
|
64
65
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module BigKeeper
|
2
|
+
class VersionConfigOperator
|
3
|
+
def self.change_version(version_config_file, modules, version)
|
4
|
+
temp_file = Tempfile.new('.version-config.gradle.tmp')
|
5
|
+
begin
|
6
|
+
File.open(version_config_file, 'r') do |file|
|
7
|
+
file.each_line do |line|
|
8
|
+
temp_file.puts(replace_module_version(line, modules, version))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
temp_file.close
|
12
|
+
FileUtils.mv(temp_file.path, version_config_file)
|
13
|
+
ensure
|
14
|
+
temp_file.close
|
15
|
+
temp_file.unlink
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.replace_module_version(line, modules, version)
|
20
|
+
modules.each do |module_name|
|
21
|
+
version_alias = BigkeeperParser.module_version_alias(module_name)
|
22
|
+
if !version_alias.nil? && !version_alias.empty? && line.match(/\s*#{version_alias}\s*=\s*('|")([\s\S]*)('|")\s*/)
|
23
|
+
return line.sub(/(\s*#{version_alias}\s*=\s*)('|")([\s\S]*)('|")\s*/){"#{$1}\'#{version}\'"}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
line
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/big_keeper/version.rb
CHANGED
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.
|
4
|
+
version: 0.9.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mmoaay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -271,8 +271,11 @@ files:
|
|
271
271
|
- lib/big_keeper/command/pod.rb
|
272
272
|
- lib/big_keeper/command/pod/podfile.rb
|
273
273
|
- lib/big_keeper/command/release.rb
|
274
|
+
- lib/big_keeper/command/release/finish.rb
|
274
275
|
- lib/big_keeper/command/release/home.rb
|
275
276
|
- lib/big_keeper/command/release/module.rb
|
277
|
+
- lib/big_keeper/command/release/publish.rb
|
278
|
+
- lib/big_keeper/command/release/start.rb
|
276
279
|
- lib/big_keeper/command/spec.rb
|
277
280
|
- lib/big_keeper/command/spec/add.rb
|
278
281
|
- lib/big_keeper/command/spec/analyze.rb
|
@@ -295,6 +298,7 @@ files:
|
|
295
298
|
- lib/big_keeper/util/bigkeeper_parser.rb
|
296
299
|
- lib/big_keeper/util/cache_operator.rb
|
297
300
|
- lib/big_keeper/util/code_operator.rb
|
301
|
+
- lib/big_keeper/util/command_line_util.rb
|
298
302
|
- lib/big_keeper/util/file_operator.rb
|
299
303
|
- lib/big_keeper/util/git_operator.rb
|
300
304
|
- lib/big_keeper/util/gitflow_operator.rb
|
@@ -311,6 +315,7 @@ files:
|
|
311
315
|
- lib/big_keeper/util/podfile_module.rb
|
312
316
|
- lib/big_keeper/util/podfile_operator.rb
|
313
317
|
- lib/big_keeper/util/verify_operator.rb
|
318
|
+
- lib/big_keeper/util/version_config_operator.rb
|
314
319
|
- lib/big_keeper/util/xcode_operator.rb
|
315
320
|
- lib/big_keeper/version.rb
|
316
321
|
- resources/banner.png
|
@@ -342,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
347
|
version: '0'
|
343
348
|
requirements: []
|
344
349
|
rubyforge_project:
|
345
|
-
rubygems_version: 2.
|
350
|
+
rubygems_version: 2.5.2.3
|
346
351
|
signing_key:
|
347
352
|
specification_version: 4
|
348
353
|
summary: Efficiency improvement for iOS&Android modular development.
|