kookeeper 3.0.4 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 259f22b3c107e156d728a101f2914f362d616030d0db042c713a198f686b059d
4
- data.tar.gz: fc6691bcd56404c79b85c5ab2eefd291ded7bc0ddc591d775e9f6fd139fccbd3
3
+ metadata.gz: 57f6a3e487540db4bdd18bf917a4ae6a6da9a01b5c703cc93ac1ff7fc44ea3c7
4
+ data.tar.gz: e8bf371127fe93b66c29bde4fc4d5dbcb4a19448cdc49706835bba5614929af1
5
5
  SHA512:
6
- metadata.gz: 0301d91098c61cd9fb366bd2995c9db659639bcae0b974d4eb9123cd071daa7ca6b02e4f013a363422d5e289cc328a52a9fb11514cdca0e84b72eff2fb534937
7
- data.tar.gz: 970b8471efa9e3d29671e44a50ea0668705bbccbe2211a72a58f9d25af59c94615ca189b7836237c0003bfae60e718f112e403502418730b142a9c73fb16b192
6
+ metadata.gz: 1b96c0d5aa8e3dca7eb245e11a99c6dc7981ff6d0592f2d2aa003219d259cec3b1e936e44d2e1726601720b4a42314997cf5e8702b82f3dc5c0ec029b44208a4
7
+ data.tar.gz: 0a45a6cd29b64e31a99dfa6e95c5e334111e88c50c2bc6b2e854e19f5d7f2bd13dba5f681b87045a773db8526dcf4c9fa3c28a477c446c810ac2835d2feef3b9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kookeeper (3.0.4)
4
+ kookeeper (3.0.7)
5
5
  big_resources
6
6
  big_stash (~> 0.1)
7
7
  cocoapods
@@ -19,7 +19,8 @@ module BigKeeper
19
19
  # Parse Bigkeeper file
20
20
  BigkeeperParser.parse("#{path}/Bigkeeper")
21
21
 
22
- branch_name = GitOperator.new.current_branch(path)
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 #{branch_name}", branch_name, 'Home')
51
+ GitService.new.verify_push(path, "finish branch #{home_branch_name}", home_branch_name, 'Home')
51
52
  ensure
52
53
  end
53
54
  end
@@ -17,57 +17,76 @@ require 'big_keeper/service/module_service'
17
17
 
18
18
 
19
19
  module BigKeeper
20
- def self.start(path, version, user, name, modules, type)
20
+ def self.start(path, version, user, 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'
26
- full_name = "#{version}_#{user}_#{name}"
27
+
28
+ p "----------2.version:#{version}"
29
+
30
+ full_name = "#{version}"
31
+ #full_name = "#{version}_#{user}_#{name}"
32
+ p "----------3.full_name:#{full_name}"
27
33
  branch_name = "#{GitflowType.name(type)}/#{full_name}"
34
+ p "----------4.branch_name:#{branch_name}"
28
35
 
36
+ ModuleCacheOperator.new(path).cache_branch_name(branch_name)
29
37
  home_branch_name = "release/#{version}"
30
- GitService.new.verify_home_branch(path, branch_name, OperateType::START)
38
+ p "----------5.home_branch_name:#{home_branch_name}"
39
+ p "----------6.path:#{path}"
40
+ p "----------7.1验证home_branch"
41
+ GitService.new.verify_home_branch(path, home_branch_name, OperateType::START)
42
+ #GitService.new.verify_home_branch(path, branch_name, OperateType::START)
31
43
 
32
44
  stash_modules = ModuleCacheOperator.new(path).all_path_modules
33
-
45
+ p "----------8.stash_modules:#{stash_modules}"
34
46
  # Stash current branch
35
- StashService.new.stash_all(path, branch_name, user, stash_modules)
47
+ #
48
+ p "----------9.stash_all:path:#{path} branch_name:#{branch_name} user:#{user} #{path} stash_modules:#{stash_modules}"
49
+ StashService.new.stash_all(path, branch_name, user, stash_modules,version)
36
50
 
37
51
  # Verify input modules
52
+ p "----------10.验证modules是否包含在Bigkeeper文件中"
38
53
  modules = BigkeeperParser.verify_modules(modules)
39
-
40
- Logger.highlight("Add branch release'#{version}' for 'Home'...")
54
+ p "----------11.home 添加 release/#{version} 分支"
55
+ Logger.highlight("Add branch release/#{version} for 'Home'...")
41
56
  # Start home feature
42
57
  # GitService.new.start(path, full_name, type)
43
58
  GitService.new.startHome(path, version, GitflowType::RELEASE)
44
59
  # Clean module cache
60
+ #
61
+ p "----------11.清空modules缓存"
45
62
  ModuleCacheOperator.new(path).clean_modules
46
63
 
47
64
  # Cache all path modules
65
+ p "----------12.Cache all path modules"
48
66
  ModuleCacheOperator.new(path).cache_path_modules(modules, modules, [])
49
67
  modules = ModuleCacheOperator.new(path).remain_path_modules
50
-
68
+ p "----------13.Backup home"
51
69
  # Backup home
52
70
  DepService.dep_operator(path, user).backup
53
71
 
72
+ p "----------14.为模块建立分支并将podfile中地址切换到本地"
54
73
  # Start modules feature and modify module as path
55
74
  modules.each do |module_name|
56
75
  ModuleService.new.add(path, user, module_name, full_name, type)
57
76
  end
58
-
77
+ p "----------15.pod update"
59
78
  # install
60
- DepService.dep_operator(path, user).install(true)
61
-
79
+ DepService.dep_operator(path, user).install(false )
80
+ p "----------16.打开 workspace"
62
81
  # Open home workspace
63
82
  DepService.dep_operator(path, user).open
64
-
83
+ p "----------17.Push home changes to remote"
65
84
  # Push home changes to remote
66
- Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
85
+ Logger.highlight("Push branch release/#{version} for 'Home'...")
67
86
  GitService.new.verify_push(
68
87
  path,
69
- "init #{GitflowType.name(type)} #{full_name}",
70
- branch_name,
88
+ "start branch #{home_branch_name}",
89
+ home_branch_name,
71
90
  'Home')
72
91
  ensure
73
92
  end
@@ -10,34 +10,35 @@ module BigKeeper
10
10
  def self.switch_to(path, version, user, full_name, type)
11
11
  begin
12
12
  # Parse Bigkeeper file
13
+ p "1.switch_to #{version} 解析Bigkeeper"
13
14
  BigkeeperParser.parse("#{path}/Bigkeeper")
14
15
 
15
16
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
16
17
  branch_name = "#{GitflowType.name(type)}/#{full_name}"
17
-
18
- GitService.new.verify_home_branch(path, branch_name, OperateType::SWITCH)
18
+ home_branch_name = "release/#{full_name}"
19
+ GitService.new.verify_home_branch(path, home_branch_name, OperateType::SWITCH)
19
20
 
20
21
  stash_modules = ModuleCacheOperator.new(path).all_path_modules
21
-
22
+ p "2.switch_to 暂存所有"
22
23
  # Stash current branch
23
- StashService.new.stash_all(path, branch_name, user, stash_modules)
24
-
24
+ StashService.new.stash_all(path, branch_name, user, stash_modules,version)
25
+ p "3.switch_to checkout #{home_branch_name}"
25
26
  # Switch to new feature
26
- GitOperator.new.checkout(path, branch_name)
27
+ GitOperator.new.checkout(path, home_branch_name)
27
28
  GitOperator.new.pull(path)
28
-
29
+ p "4.switch_to"
29
30
  # Apply home stash
30
- StashService.new.pop_stash(path, branch_name, 'Home')
31
+ StashService.new.pop_stash(path, home_branch_name, 'Home')
31
32
 
32
33
  modules = ModuleCacheOperator.new(path).all_path_modules
33
34
 
34
35
  modules.each do |module_name|
35
36
  ModuleService.new.switch_to(path, user, module_name, branch_name, type)
36
37
  end
37
-
38
+ p "5.switch_to"
38
39
  # Install
39
40
  DepService.dep_operator(path, user).install(false)
40
-
41
+ p "6.switch_to"
41
42
  # Open home workspace
42
43
  DepService.dep_operator(path, user).open
43
44
  ensure
@@ -21,9 +21,12 @@ module BigKeeper
21
21
  begin
22
22
  # Parse Bigkeeper file
23
23
  BigkeeperParser.parse("#{path}/Bigkeeper")
24
- branch_name = GitOperator.new.current_branch(path)
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
@@ -24,9 +24,11 @@ module BigKeeper
24
24
 
25
25
  help_now!('user name is required') if user and user.empty?
26
26
  help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
27
- name = args[0]
28
- modules = args[(1...args.length)] if args.length > 1
29
- start(path, version, user, name, modules, type)
27
+ #name = args[0]
28
+ #modules = args[(1...args.length)] if args.length > 1
29
+ modules = args[(0...args.length)] if args.length > 0
30
+ #start(path, version, user, name, modules, type)
31
+ start(path, version, user, modules, type)
30
32
  end
31
33
  end
32
34
 
@@ -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)
@@ -9,21 +9,31 @@ module BigKeeper
9
9
  class GitService
10
10
 
11
11
  def startHome(path, name, type)
12
+ p "--------------------11.1.startHome"
12
13
  git = GitOperator.new
13
14
  branch_name = "#{GitflowType.name(type)}/#{name}"
15
+ p "--------------------11.2branch_name:#{branch_name}"
14
16
  if !git.has_remote_branch(path, branch_name) && !git.has_local_branch(path, branch_name)
15
-
17
+ p "------------------------------11.2.1如果远程和本地没有#{branch_name}分支"
16
18
  verify_special_branch(path, 'master')
19
+
20
+
17
21
  #verify_special_branch(path, 'develop')
18
22
 
19
- GitflowOperator.new.verify_git_flow(path)
23
+ #GitflowOperator.new.verify_git_flow(path)
20
24
 
21
- GitflowOperator.new.start(path, name, type)
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
22
31
  git.push_to_remote(path, branch_name)
23
32
  else
24
33
  verify_checkout(path, branch_name)
25
34
 
26
35
  if !git.has_remote_branch(path, branch_name)
36
+ p "------------------------------11.3.1如果远程没有 #{branch_name}"
27
37
  git.push_to_remote(path, branch_name)
28
38
  end
29
39
  end
@@ -39,9 +49,11 @@ module BigKeeper
39
49
  verify_special_branch(path, 'master')
40
50
  #verify_special_branch(path, 'develop')
41
51
 
42
- GitflowOperator.new.verify_git_flow(path)
52
+ #GitflowOperator.new.verify_git_flow(path)
53
+
54
+ #GitflowOperator.new.start(path, name, type)
43
55
 
44
- GitflowOperator.new.start(path, name, type)
56
+ verify_checkout(path, branch_name)
45
57
  git.push_to_remote(path, branch_name)
46
58
  else
47
59
  verify_checkout(path, branch_name)
@@ -53,11 +65,15 @@ module BigKeeper
53
65
  end
54
66
 
55
67
  def verify_checkout(path, branch_name)
68
+ p "++++++++++verify_checkout:#{path} #{branch_name}"
56
69
  Dir.chdir(path) do
70
+ p "++++++++++cd:#{path}"
57
71
  cmd = "git checkout -b #{branch_name}"
58
72
  if GitOperator.new.has_branch(path, branch_name)
73
+ p "++++++++++有#{branch_name}"
59
74
  cmd = "git checkout #{branch_name}"
60
75
  end
76
+ p "++++++++++cmd:#{cmd}"
61
77
  IO.popen(cmd) do |io|
62
78
  io.each do |line|
63
79
  Logger.error("Checkout #{branch_name} failed.") if line.include? 'error'
@@ -73,26 +89,34 @@ module BigKeeper
73
89
 
74
90
  def verify_special_branch(path, name)
75
91
  git = GitOperator.new
76
-
92
+ p "----------检查#{name}分支"
77
93
  if git.has_remote_branch(path, name)
94
+ p "--------------------有远程#{name}分支"
78
95
  if git.has_local_branch(path, name)
96
+ p "------------------------------有本地#{name}分支"
79
97
  if git.has_commits(path, name)
98
+ p "----------------------------------------有commits"
80
99
  Logger.error(%Q('#{name}' has unpushed commits, you should fix it manually...))
81
100
  end
101
+ p "------------------------------git pull"
82
102
  pull(path, name)
83
103
  else
104
+ p "------------------------------没有本地#{name}分支"
84
105
  git.checkout(path, name)
85
106
  end
86
107
  else
108
+ p "--------------------没有远程#{name}分支"
87
109
  verify_checkout(path, name)
88
110
  git.push_to_remote(path, name)
89
111
  end
90
112
  end
91
113
 
92
114
  def verify_home_branch(path, branch_name, type)
115
+
116
+ p "--------------------7.1.从远程同步本地分支"
93
117
  Logger.highlight('Sync local branchs from remote, waiting...')
94
118
  git = GitOperator.new
95
-
119
+ p "--------------------7.2.git fetch origin"
96
120
  git.fetch(path)
97
121
 
98
122
  if OperateType::START == type
@@ -149,6 +173,9 @@ module BigKeeper
149
173
  def pull(path, branch_name)
150
174
  git = GitOperator.new
151
175
  current_branch_name = git.current_branch(path)
176
+
177
+ p "----------current_branch_name:#{current_branch_name}"
178
+ p "----------branch_name:#{branch_name}"
152
179
  if current_branch_name == branch_name
153
180
  git.pull(path)
154
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
- if branch_name != new_branch_name
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
- @modules = {"git" => {"all" => [], "current" => []}, "path" => {"all" => [], "add" => [], "del" => [], "current" => []}}
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 install, waiting...')
12
- cmd = "pod install --project-directory='#{path}'"
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 install.')
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
- # `pkill Xcode`
7
+ `pkill Xcode`
8
8
 
9
- # sleep 0.5
9
+ sleep 0.5
10
10
 
11
11
  # Open home workspace
12
- # `open #{path}/*.xcworkspace`
12
+ `open #{path}/*.xcworkspace`
13
13
  end
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module BigKeeper
2
- VERSION = "3.0.4"
2
+ VERSION = "3.0.7"
3
3
  end
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
4
+ version: 3.0.7
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 00:00:00.000000000 Z
11
+ date: 2022-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli