kookeeper 3.0.3 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/big_keeper/command/feature&hotfix/finish.rb +4 -3
- data/lib/big_keeper/command/feature&hotfix/start.rb +33 -15
- data/lib/big_keeper/command/feature&hotfix/update.rb +10 -2
- data/lib/big_keeper/dependency/dep_pod_operator.rb +2 -1
- data/lib/big_keeper/service/git_service.rb +54 -4
- data/lib/big_keeper/service/stash_service.rb +17 -4
- data/lib/big_keeper/util/cache_operator.rb +15 -2
- data/lib/big_keeper/util/git_operator.rb +5 -0
- data/lib/big_keeper/util/pod_operator.rb +4 -3
- data/lib/big_keeper/util/xcode_operator.rb +3 -3
- data/lib/big_keeper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33a8bec3932e96c58808fe6b50e205f181c58df2a24172b7cd2191064e973a2c
|
4
|
+
data.tar.gz: cad57a9f7876441d4b3224d7351988a1b7062b9ad34a9e77e9997d92cb799ecb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac32efeef82e52182881b5f160dde2ca17b283f02841bb5c99d0ee535ecf723597edf0ba259d7a1b3f142a77274af628589126f7ff069be749836ef19318669f
|
7
|
+
data.tar.gz: 9e8a021e6439a697e6dc0456d090c0db703973a4f2e1b3e3c4d9986f076cd57334838da2c70ee55e996354c7f74aad3b5d162b0d4310a7e040c62a052e1087d4
|
data/Gemfile.lock
CHANGED
@@ -19,7 +19,8 @@ module BigKeeper
|
|
19
19
|
# Parse Bigkeeper file
|
20
20
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
21
21
|
|
22
|
-
|
22
|
+
home_branch_name = GitOperator.new.current_branch(path)
|
23
|
+
branch_name = ModuleCacheOperator.new(path).branch_name
|
23
24
|
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
24
25
|
|
25
26
|
# Cache git modules
|
@@ -38,7 +39,7 @@ module BigKeeper
|
|
38
39
|
Logger.highlight("Finish branch '#{branch_name}' for 'Home'")
|
39
40
|
|
40
41
|
# Delete all path modules
|
41
|
-
ModuleCacheOperator.new(path).cache_path_modules([], [], [])
|
42
|
+
# ModuleCacheOperator.new(path).cache_path_modules([], [], [])
|
42
43
|
|
43
44
|
# Install
|
44
45
|
DepService.dep_operator(path, user).install(false)
|
@@ -47,7 +48,7 @@ module BigKeeper
|
|
47
48
|
DepService.dep_operator(path, user).open
|
48
49
|
|
49
50
|
# Push home changes to remote
|
50
|
-
GitService.new.verify_push(path, "finish branch #{
|
51
|
+
GitService.new.verify_push(path, "finish branch #{home_branch_name}", home_branch_name, 'Home')
|
51
52
|
ensure
|
52
53
|
end
|
53
54
|
end
|
@@ -20,53 +20,71 @@ module BigKeeper
|
|
20
20
|
def self.start(path, version, user, name, modules, type)
|
21
21
|
begin
|
22
22
|
# Parse Bigkeeper file
|
23
|
+
p "----------1.开始解析#{path}/Bigkeeper"
|
23
24
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
24
25
|
|
25
26
|
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
27
|
+
|
28
|
+
p "----------2.version:#{version}"
|
26
29
|
full_name = "#{version}_#{user}_#{name}"
|
30
|
+
p "----------3.full_name:#{full_name}"
|
27
31
|
branch_name = "#{GitflowType.name(type)}/#{full_name}"
|
32
|
+
p "----------4.branch_name:#{branch_name}"
|
28
33
|
|
29
|
-
|
34
|
+
ModuleCacheOperator.new(path).cache_branch_name(branch_name)
|
35
|
+
home_branch_name = "release/#{version}"
|
36
|
+
p "----------5.home_branch_name:#{home_branch_name}"
|
37
|
+
p "----------6.path:#{path}"
|
38
|
+
p "----------7.1验证home_branch"
|
39
|
+
GitService.new.verify_home_branch(path, home_branch_name, OperateType::START)
|
40
|
+
#GitService.new.verify_home_branch(path, branch_name, OperateType::START)
|
30
41
|
|
31
42
|
stash_modules = ModuleCacheOperator.new(path).all_path_modules
|
32
|
-
|
43
|
+
p "----------8.stash_modules:#{stash_modules}"
|
33
44
|
# Stash current branch
|
34
|
-
|
45
|
+
#
|
46
|
+
p "----------9.stash_all:path:#{path} branch_name:#{branch_name} user:#{user} #{path} stash_modules:#{stash_modules}"
|
47
|
+
StashService.new.stash_all(path, branch_name, user, stash_modules,version)
|
35
48
|
|
36
49
|
# Verify input modules
|
50
|
+
p "----------10.验证modules是否包含在Bigkeeper文件中"
|
37
51
|
modules = BigkeeperParser.verify_modules(modules)
|
38
|
-
|
39
|
-
Logger.highlight("Add branch
|
52
|
+
p "----------11.home 添加 release/#{version} 分支"
|
53
|
+
Logger.highlight("Add branch release/#{version} for 'Home'...")
|
40
54
|
# Start home feature
|
41
|
-
GitService.new.start(path, full_name, type)
|
42
|
-
|
55
|
+
# GitService.new.start(path, full_name, type)
|
56
|
+
GitService.new.startHome(path, version, GitflowType::RELEASE)
|
43
57
|
# Clean module cache
|
58
|
+
#
|
59
|
+
p "----------11.清空modules缓存"
|
44
60
|
ModuleCacheOperator.new(path).clean_modules
|
45
61
|
|
46
62
|
# Cache all path modules
|
63
|
+
p "----------12.Cache all path modules"
|
47
64
|
ModuleCacheOperator.new(path).cache_path_modules(modules, modules, [])
|
48
65
|
modules = ModuleCacheOperator.new(path).remain_path_modules
|
49
|
-
|
66
|
+
p "----------13.Backup home"
|
50
67
|
# Backup home
|
51
68
|
DepService.dep_operator(path, user).backup
|
52
69
|
|
70
|
+
p "----------14.为模块建立分支并将podfile中地址切换到本地"
|
53
71
|
# Start modules feature and modify module as path
|
54
72
|
modules.each do |module_name|
|
55
73
|
ModuleService.new.add(path, user, module_name, full_name, type)
|
56
74
|
end
|
57
|
-
|
75
|
+
p "----------15.pod update"
|
58
76
|
# install
|
59
|
-
DepService.dep_operator(path, user).install(
|
60
|
-
|
77
|
+
DepService.dep_operator(path, user).install(false )
|
78
|
+
p "----------16.打开 workspace"
|
61
79
|
# Open home workspace
|
62
80
|
DepService.dep_operator(path, user).open
|
63
|
-
|
81
|
+
p "----------17.Push home changes to remote"
|
64
82
|
# Push home changes to remote
|
65
|
-
Logger.highlight("Push branch
|
83
|
+
Logger.highlight("Push branch release/#{version} for 'Home'...")
|
66
84
|
GitService.new.verify_push(
|
67
85
|
path,
|
68
|
-
"
|
69
|
-
|
86
|
+
"start branch #{home_branch_name}",
|
87
|
+
home_branch_name,
|
70
88
|
'Home')
|
71
89
|
ensure
|
72
90
|
end
|
@@ -21,9 +21,12 @@ module BigKeeper
|
|
21
21
|
begin
|
22
22
|
# Parse Bigkeeper file
|
23
23
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
24
|
-
|
24
|
+
home_branch_name = GitOperator.new.current_branch(path)
|
25
|
+
branch_name = ModuleCacheOperator.new(path).branch_name
|
26
|
+
# Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
27
|
+
|
28
|
+
# Logger.error("Not a #{GitflowType.name(GitflowType::RELEASE)} branch, exit.") unless branch_name.include? GitflowType.name(GitflowType::RELEASE)
|
25
29
|
|
26
|
-
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
27
30
|
|
28
31
|
full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
|
29
32
|
|
@@ -45,6 +48,8 @@ module BigKeeper
|
|
45
48
|
if add_modules.empty? and del_modules.empty?
|
46
49
|
Logger.default("There is nothing changed with modules #{modules}.")
|
47
50
|
else
|
51
|
+
|
52
|
+
type =
|
48
53
|
# Modify podfile as path and Start modules feature
|
49
54
|
remain_path_modules.each do |module_name|
|
50
55
|
ModuleService.new.add(path, user, module_name, full_name, type)
|
@@ -60,6 +65,9 @@ module BigKeeper
|
|
60
65
|
|
61
66
|
# Open home workspace
|
62
67
|
DepService.dep_operator(path, user).open
|
68
|
+
|
69
|
+
# Push home changes to remote
|
70
|
+
GitService.new.verify_push(path, "update branch #{home_branch_name}", home_branch_name, 'Home')
|
63
71
|
ensure
|
64
72
|
end
|
65
73
|
end
|
@@ -58,7 +58,8 @@ module BigKeeper
|
|
58
58
|
end
|
59
59
|
elsif ModuleOperateType::FINISH == module_operate_type
|
60
60
|
module_git = BigkeeperParser.module_git(module_name)
|
61
|
-
branch_name = GitOperator.new.current_branch(@path)
|
61
|
+
#branch_name = GitOperator.new.current_branch(@path)
|
62
|
+
branch_name = ModuleCacheOperator.new(@path).branch_name
|
62
63
|
"#{$1}pod '#{module_name}', :git => '#{module_git}', :branch => '#{branch_name}'"
|
63
64
|
elsif ModuleOperateType::PUBLISH == module_operate_type
|
64
65
|
module_git = BigkeeperParser.module_git(module_name)
|
@@ -7,6 +7,39 @@ require 'big_keeper/util/logger'
|
|
7
7
|
module BigKeeper
|
8
8
|
# Operator for got
|
9
9
|
class GitService
|
10
|
+
|
11
|
+
def startHome(path, name, type)
|
12
|
+
p "--------------------11.1.startHome"
|
13
|
+
git = GitOperator.new
|
14
|
+
branch_name = "#{GitflowType.name(type)}/#{name}"
|
15
|
+
p "--------------------11.2branch_name:#{branch_name}"
|
16
|
+
if !git.has_remote_branch(path, branch_name) && !git.has_local_branch(path, branch_name)
|
17
|
+
p "------------------------------11.2.1如果远程和本地没有#{branch_name}分支"
|
18
|
+
verify_special_branch(path, 'master')
|
19
|
+
|
20
|
+
|
21
|
+
#verify_special_branch(path, 'develop')
|
22
|
+
|
23
|
+
#GitflowOperator.new.verify_git_flow(path)
|
24
|
+
|
25
|
+
#GitflowOperator.new.start(path, name, type)
|
26
|
+
#
|
27
|
+
Dir.chdir(path) do
|
28
|
+
p "------------------------------11.2.2git checkout -b #{branch_name}"
|
29
|
+
`git checkout -b #{branch_name}`
|
30
|
+
end
|
31
|
+
git.push_to_remote(path, branch_name)
|
32
|
+
else
|
33
|
+
verify_checkout(path, branch_name)
|
34
|
+
|
35
|
+
if !git.has_remote_branch(path, branch_name)
|
36
|
+
p "------------------------------11.3.1如果远程没有 #{branch_name}"
|
37
|
+
git.push_to_remote(path, branch_name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
10
43
|
def start(path, name, type)
|
11
44
|
git = GitOperator.new
|
12
45
|
|
@@ -16,9 +49,11 @@ module BigKeeper
|
|
16
49
|
verify_special_branch(path, 'master')
|
17
50
|
#verify_special_branch(path, 'develop')
|
18
51
|
|
19
|
-
GitflowOperator.new.verify_git_flow(path)
|
52
|
+
#GitflowOperator.new.verify_git_flow(path)
|
53
|
+
|
54
|
+
#GitflowOperator.new.start(path, name, type)
|
20
55
|
|
21
|
-
|
56
|
+
verify_checkout(path, branch_name)
|
22
57
|
git.push_to_remote(path, branch_name)
|
23
58
|
else
|
24
59
|
verify_checkout(path, branch_name)
|
@@ -30,11 +65,15 @@ module BigKeeper
|
|
30
65
|
end
|
31
66
|
|
32
67
|
def verify_checkout(path, branch_name)
|
68
|
+
p "++++++++++verify_checkout:#{path} #{branch_name}"
|
33
69
|
Dir.chdir(path) do
|
70
|
+
p "++++++++++cd:#{path}"
|
34
71
|
cmd = "git checkout -b #{branch_name}"
|
35
72
|
if GitOperator.new.has_branch(path, branch_name)
|
73
|
+
p "++++++++++有#{branch_name}"
|
36
74
|
cmd = "git checkout #{branch_name}"
|
37
75
|
end
|
76
|
+
p "++++++++++cmd:#{cmd}"
|
38
77
|
IO.popen(cmd) do |io|
|
39
78
|
io.each do |line|
|
40
79
|
Logger.error("Checkout #{branch_name} failed.") if line.include? 'error'
|
@@ -50,26 +89,34 @@ module BigKeeper
|
|
50
89
|
|
51
90
|
def verify_special_branch(path, name)
|
52
91
|
git = GitOperator.new
|
53
|
-
|
92
|
+
p "----------检查#{name}分支"
|
54
93
|
if git.has_remote_branch(path, name)
|
94
|
+
p "--------------------有远程#{name}分支"
|
55
95
|
if git.has_local_branch(path, name)
|
96
|
+
p "------------------------------有本地#{name}分支"
|
56
97
|
if git.has_commits(path, name)
|
98
|
+
p "----------------------------------------有commits"
|
57
99
|
Logger.error(%Q('#{name}' has unpushed commits, you should fix it manually...))
|
58
100
|
end
|
101
|
+
p "------------------------------git pull"
|
59
102
|
pull(path, name)
|
60
103
|
else
|
104
|
+
p "------------------------------没有本地#{name}分支"
|
61
105
|
git.checkout(path, name)
|
62
106
|
end
|
63
107
|
else
|
108
|
+
p "--------------------没有远程#{name}分支"
|
64
109
|
verify_checkout(path, name)
|
65
110
|
git.push_to_remote(path, name)
|
66
111
|
end
|
67
112
|
end
|
68
113
|
|
69
114
|
def verify_home_branch(path, branch_name, type)
|
115
|
+
|
116
|
+
p "--------------------7.1.从远程同步本地分支"
|
70
117
|
Logger.highlight('Sync local branchs from remote, waiting...')
|
71
118
|
git = GitOperator.new
|
72
|
-
|
119
|
+
p "--------------------7.2.git fetch origin"
|
73
120
|
git.fetch(path)
|
74
121
|
|
75
122
|
if OperateType::START == type
|
@@ -126,6 +173,9 @@ module BigKeeper
|
|
126
173
|
def pull(path, branch_name)
|
127
174
|
git = GitOperator.new
|
128
175
|
current_branch_name = git.current_branch(path)
|
176
|
+
|
177
|
+
p "----------current_branch_name:#{current_branch_name}"
|
178
|
+
p "----------branch_name:#{branch_name}"
|
129
179
|
if current_branch_name == branch_name
|
130
180
|
git.pull(path)
|
131
181
|
else
|
@@ -22,24 +22,37 @@ module BigKeeper
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def stash_all(path, new_branch_name, user, modules)
|
25
|
+
def stash_all(path, new_branch_name, user, modules,version)
|
26
26
|
# Stash modules
|
27
27
|
Logger.highlight('Stash for current workspace...')
|
28
|
-
|
28
|
+
p "--------------------9.1.Stash modules----------"
|
29
29
|
modules.each do |module_name|
|
30
30
|
module_path = BigkeeperParser.module_full_path(path, user, module_name)
|
31
31
|
branch_name = GitOperator.new.current_branch(module_path)
|
32
32
|
|
33
|
+
p "------------------------------module_path:#{module_path}"
|
34
|
+
p "------------------------------branch_name:#{branch_name}"
|
35
|
+
p "------------------------------new_branch_name:#{new_branch_name}"
|
33
36
|
if branch_name != new_branch_name
|
34
37
|
stash(module_path, branch_name, module_name)
|
35
38
|
end
|
36
39
|
end
|
37
|
-
|
40
|
+
p "--------------------end Stash modules----------"
|
38
41
|
# Stash home
|
39
42
|
branch_name = GitOperator.new.current_branch(path)
|
40
|
-
|
43
|
+
p "--------------------9.2.Stash home----------"
|
44
|
+
|
45
|
+
|
46
|
+
home_branch_name = "release/#{version}"
|
47
|
+
|
48
|
+
p "------------------------------branch_name:#{branch_name}"
|
49
|
+
p "------------------------------home_branch_name:#{home_branch_name}"
|
50
|
+
|
51
|
+
if branch_name != home_branch_name
|
41
52
|
stash(path, branch_name, 'Home')
|
42
53
|
end
|
54
|
+
|
55
|
+
p "--------------------end Stash home----------"
|
43
56
|
end
|
44
57
|
end
|
45
58
|
end
|
@@ -34,10 +34,14 @@ module BigKeeper
|
|
34
34
|
@modules = JSON.load(file.read())
|
35
35
|
file.close
|
36
36
|
else
|
37
|
-
@modules = {"git" => {"all" => [], "current" => []}, "path" => {"all" => [], "add" => [], "del" => [], "current" => []}}
|
37
|
+
@modules = {"git" => {"all" => [], "current" => []}, "path" => {"all" => [], "add" => [], "del" => [], "current" => []},"branch_name" => ""}
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
+
def branch_name
|
42
|
+
@modules["branch_name"]
|
43
|
+
end
|
44
|
+
|
41
45
|
def all_path_modules
|
42
46
|
@modules["path"]["all"]
|
43
47
|
end
|
@@ -70,6 +74,13 @@ module BigKeeper
|
|
70
74
|
@modules["git"]["all"] - @modules["git"]["current"]
|
71
75
|
end
|
72
76
|
|
77
|
+
|
78
|
+
def cache_branch_name(branch_name)
|
79
|
+
@modules["branch_name"] = branch_name
|
80
|
+
cache_modules
|
81
|
+
end
|
82
|
+
|
83
|
+
|
73
84
|
def cache_path_modules(modules, add_modules, del_modules)
|
74
85
|
@modules["path"]["all"] = modules.uniq
|
75
86
|
@modules["path"]["add"] = add_modules.uniq
|
@@ -103,12 +114,14 @@ module BigKeeper
|
|
103
114
|
end
|
104
115
|
|
105
116
|
def clean_modules
|
106
|
-
|
117
|
+
branch_name = @modules["branch_name"]
|
118
|
+
@modules = {"git" => {"all" => [], "current" => []}, "path" => {"all" => [], "add" => [], "del" => [], "current" => []},"branch_name" => branch_name}
|
107
119
|
cache_modules
|
108
120
|
end
|
109
121
|
|
110
122
|
def cache_modules
|
111
123
|
file = File.new("#{@cache_path}/module.cache", 'w')
|
124
|
+
p "module缓存地址:#{@cache_path}/module.cache"
|
112
125
|
file << @modules.to_json
|
113
126
|
file.close
|
114
127
|
end
|
@@ -41,6 +41,8 @@ module BigKeeper
|
|
41
41
|
|
42
42
|
def checkout(path, branch_name)
|
43
43
|
Dir.chdir(path) do
|
44
|
+
p "----------cd:#{path}"
|
45
|
+
p "----------git checkout #{branch_name}"
|
44
46
|
IO.popen("git checkout #{branch_name}") do |io|
|
45
47
|
io.each do |line|
|
46
48
|
Logger.error("Checkout #{branch_name} failed.") if line.include? 'error'
|
@@ -76,6 +78,7 @@ module BigKeeper
|
|
76
78
|
|
77
79
|
def push_to_remote(path, branch_name)
|
78
80
|
Dir.chdir(path) do
|
81
|
+
p "git push -u origin #{branch_name}"
|
79
82
|
`git push -u origin #{branch_name}`
|
80
83
|
end
|
81
84
|
GitOperator.new.check_push_success(path, branch_name, "origin/#{branch_name}")
|
@@ -83,6 +86,8 @@ module BigKeeper
|
|
83
86
|
|
84
87
|
def pull(path)
|
85
88
|
Dir.chdir(path) do
|
89
|
+
p "----------cd:#{path}"
|
90
|
+
p "----------git pull"
|
86
91
|
`git pull`
|
87
92
|
end
|
88
93
|
end
|
@@ -8,14 +8,14 @@ module BigKeeper
|
|
8
8
|
if repo_update
|
9
9
|
PodOperator.pod_update_private_repos(true)
|
10
10
|
end
|
11
|
-
Logger.highlight('Start pod
|
12
|
-
cmd = "pod
|
11
|
+
Logger.highlight('Start pod update, waiting...')
|
12
|
+
cmd = "pod update --project-directory='#{path}'"
|
13
13
|
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
|
14
14
|
while line = stdout.gets
|
15
15
|
p line
|
16
16
|
end
|
17
17
|
end
|
18
|
-
Logger.highlight('Finish pod
|
18
|
+
Logger.highlight('Finish pod update.')
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.pod_repo_push(path, module_name, source, version)
|
@@ -47,6 +47,7 @@ module BigKeeper
|
|
47
47
|
|
48
48
|
def self.pod_update_private_repos(update_private)
|
49
49
|
if update_private
|
50
|
+
p "BigkeeperParser.sources = #{BigkeeperParser.sources}"
|
50
51
|
BigkeeperParser.sources.map { |spec|
|
51
52
|
Logger.highlight('Start pod repo update, waiting...')
|
52
53
|
cmd = "pod repo update #{spec}"
|
@@ -4,12 +4,12 @@ module BigKeeper
|
|
4
4
|
class XcodeOperator
|
5
5
|
def self.open_workspace(path)
|
6
6
|
# Close Xcode
|
7
|
-
|
7
|
+
`pkill Xcode`
|
8
8
|
|
9
|
-
|
9
|
+
sleep 0.5
|
10
10
|
|
11
11
|
# Open home workspace
|
12
|
-
|
12
|
+
`open #{path}/*.xcworkspace`
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/big_keeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kookeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mmoaay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|