bigkeeper 0.9.12 → 0.9.13

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: 90e19c3d486a57e017de6cb6f711051f540dc2d44ffded09215d22c5275230d0
4
- data.tar.gz: c059a11b0e5b6373d1b8aeeb9cb64d80df9d5f6f9c4fd0677d348aafc47744c7
3
+ metadata.gz: 7e751a206b1442e0848d2b6dfacc760f5d656bfc17b1274841a2091a62e6514b
4
+ data.tar.gz: 22fc192c12e254bf5d449f7681d49bf0b10cf68774b209f2be04c3af95cd55ce
5
5
  SHA512:
6
- metadata.gz: f8b8be1f557c434fc0d85a1ef47a05cf411b826006a314b62d59e7f9e1bf396d740a79157af80bc15ecf7cc677fb081939b6ff6167eae33c62ecc8bebb135274
7
- data.tar.gz: 27cdd35ad095a1d4fb5a767c0c0830fec50f22328016f52168d77f1a59b67f96212a2e8ddad18655fe0e093d57fdbc9a0be424d81c81b0f4500dc398637b1f0a
6
+ metadata.gz: da2b7fdf30d1c5e1f196b9c63b73c393c2816ac9a53c60479333d9168d8adce26406083f10a12788365ff7b6dcec89e23d06bbc9bac9a23662f05917af7801f5
7
+ data.tar.gz: 3f8171e5002173aac2cc02b53eff96d388019f958b8b55d11bd596b490e455df4143eb281c4e65319f0622bfb120987915d5365084631bb0826078414c3b1579
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bigkeeper (0.9.11)
4
+ bigkeeper (0.9.12)
5
5
  big_resources
6
6
  big_stash (~> 0.1)
7
7
  cocoapods
@@ -8,6 +8,7 @@ require 'big_keeper/command/feature&hotfix/rebase'
8
8
  require 'big_keeper/command/feature&hotfix/publish'
9
9
  require 'big_keeper/command/feature&hotfix/delete'
10
10
  require 'big_keeper/command/feature&hotfix/list'
11
+ require 'big_keeper/command/feature&hotfix/module'
11
12
  require 'big_keeper/util/leancloud_logger'
12
13
 
13
14
  module BigKeeper
@@ -43,6 +44,33 @@ module BigKeeper
43
44
  end
44
45
  end
45
46
 
47
+ c.desc "Modules operate for the #{GitflowType.name(type)}"
48
+ c.command :module do |m|
49
+ m.desc "Add modules for the #{GitflowType.name(type)}"
50
+ m.command :add do |add|
51
+ add.action do |global_options, options, args|
52
+ path = File.expand_path(global_options[:path])
53
+ version = global_options[:ver]
54
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
55
+ LeanCloudLogger.instance.set_command("feature/module/add")
56
+ modules = args[(0...args.length)] if args.length > 0
57
+ module_add(path, user, modules, type)
58
+ end
59
+ end
60
+
61
+ m.desc "delete modules for the #{GitflowType.name(type)}"
62
+ m.command :delete do |delete|
63
+ delete.action do |global_options, options, args|
64
+ path = File.expand_path(global_options[:path])
65
+ version = global_options[:ver]
66
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
67
+ LeanCloudLogger.instance.set_command("feature/module/delete")
68
+ modules = args[(0...args.length)] if args.length > 0
69
+ module_del(path, user, modules, type)
70
+ end
71
+ end
72
+ end
73
+
46
74
  c.desc "Switch to the #{GitflowType.name(type)} with name"
47
75
  c.command :switch do |switch|
48
76
  switch.action do |global_options, options, args|
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'big_keeper/util/podfile_operator'
4
+ require 'big_keeper/util/gitflow_operator'
5
+ require 'big_keeper/util/bigkeeper_parser'
6
+ require 'big_keeper/util/logger'
7
+ require 'big_keeper/util/pod_operator'
8
+ require 'big_keeper/util/xcode_operator'
9
+ require 'big_keeper/util/cache_operator'
10
+ require 'big_keeper/model/operate_type'
11
+ require 'big_keeper/dependency/dep_service'
12
+
13
+ require 'big_keeper/dependency/dep_type'
14
+
15
+ require 'big_keeper/service/stash_service'
16
+ require 'big_keeper/service/module_service'
17
+
18
+
19
+ module BigKeeper
20
+ def self.module_add(path, user, modules, type)
21
+ BigkeeperParser.parse("#{path}/Bigkeeper")
22
+ branch_name = GitOperator.new.current_branch(path)
23
+
24
+ Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
25
+
26
+ full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
27
+
28
+ current_modules = ModuleCacheOperator.new(path).current_path_modules
29
+
30
+ # Verify input modules
31
+ modules = BigkeeperParser.verify_modules(modules)
32
+
33
+ Logger.highlight("Start to update modules for branch '#{branch_name}'...")
34
+
35
+ add_modules = modules - current_modules
36
+
37
+ if add_modules.empty?
38
+ Logger.default("There is nothing changed with modules #{modules}.")
39
+ else
40
+ # Modify podfile as path and Start modules feature
41
+ add_modules.each do |module_name|
42
+ ModuleCacheOperator.new(path).add_path_module(module_name)
43
+ ModuleService.new.add(path, user, module_name, full_name, type)
44
+ end
45
+ end
46
+
47
+ # Install
48
+ DepService.dep_operator(path, user).install(modules, OperateType::UPDATE, false)
49
+
50
+ # Open home workspace
51
+ DepService.dep_operator(path, user).open
52
+ end
53
+
54
+ def self.module_del(path, user, modules, type)
55
+ BigkeeperParser.parse("#{path}/Bigkeeper")
56
+ branch_name = GitOperator.new.current_branch(path)
57
+
58
+ Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
59
+
60
+ full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
61
+
62
+ current_modules = ModuleCacheOperator.new(path).current_path_modules
63
+
64
+ # Verify input modules
65
+ modules = BigkeeperParser.verify_modules(modules)
66
+
67
+ Logger.highlight("Start to update modules for branch '#{branch_name}'...")
68
+
69
+ if modules.empty?
70
+ Logger.default("There is nothing changed with modules #{modules}.")
71
+ else
72
+ # Modify podfile as path and Start modules feature
73
+ modules.each do |module_name|
74
+ ModuleCacheOperator.new(path).del_path_module(module_name)
75
+ ModuleService.new.del(path, user, module_name, full_name, type)
76
+ end
77
+ end
78
+
79
+ # Install
80
+ DepService.dep_operator(path, user).install(modules, OperateType::UPDATE, false)
81
+
82
+ # Open home workspace
83
+ DepService.dep_operator(path, user).open
84
+ end
85
+ end
@@ -41,8 +41,9 @@ module BigKeeper
41
41
 
42
42
  Logger.highlight("Publish branch '#{branch_name}' for 'Home'")
43
43
 
44
+ # [CHG] try to fix publish bug
44
45
  # Recover home
45
- DepService.dep_operator(path, user).recover
46
+ # DepService.dep_operator(path, user).recover
46
47
 
47
48
  # Push home changes to remote
48
49
  GitService.new.verify_push(path, "publish branch #{branch_name}", branch_name, 'Home')
@@ -2,97 +2,67 @@ require 'big_keeper/command/release/home'
2
2
  require 'big_keeper/command/release/module'
3
3
  require 'big_keeper/util/leancloud_logger'
4
4
  require 'big_keeper/command/release/start'
5
- require 'big_keeper/command/release/finish'
6
5
  require 'big_keeper/util/command_line_util'
7
6
 
8
7
  module BigKeeper
9
8
  def self.release_command
10
- desc 'Gitflow release operations'
11
- command :release do |c|
12
9
 
13
- c.desc 'release project start'
14
- c.command :start do |start|
15
- start.action do |global_options, options, args|
10
+ desc 'Release home project & module.'
11
+ 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")
16
16
  path = File.expand_path(global_options[:path])
17
17
  version = global_options[:ver]
18
18
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
19
19
  modules = args[(0...args.length)] if args.length > 0
20
- release_start(path, version, user, modules)
20
+ prerelease(path, version, user, modules)
21
21
  end
22
22
  end
23
23
 
24
- c.desc 'release project finish'
25
- c.command :finish do |finish|
26
- finish.action do |global_options, options, args|
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")
27
30
  path = File.expand_path(global_options[:path])
28
31
  version = global_options[:ver]
29
32
  user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
33
+ help_now!('module name is required') if args.length == 0
34
+ raise Logger.error("release version is required") if version == nil
30
35
  modules = args[(0...args.length)] if args.length > 0
31
- release_finish(path, version, user, modules)
36
+ prerelease_module(path, version, user, modules, false)
32
37
  end
33
38
  end
39
+ end
34
40
 
35
- c.desc 'Release home project operations'
36
- c.command :home do |home|
37
- home.desc 'Start release home project'
38
- home.command :start do |start|
39
- start.action do |global_options, options, args|
40
- path = File.expand_path(global_options[:path])
41
- version = global_options[:ver]
42
- user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
43
- LeanCloudLogger.instance.set_command("release/home/start")
44
-
45
- help_now!('user name is required') if user and user.empty?
46
- raise Logger.error("release version is required") if version == nil
47
- release_home_start(path, version, user)
48
- end
49
- end
50
-
51
- home.desc 'Finish release home project'
52
- home.command :finish do |finish|
53
- finish.action do |global_options, options, args|
54
- path = File.expand_path(global_options[:path])
55
- version = global_options[:ver]
56
- LeanCloudLogger.instance.set_command("release/home/finish")
57
-
58
- raise Logger.error("release version is required") if version == nil
59
- release_home_finish(path, version)
60
- end
61
- end
41
+ desc 'Gitflow release operations'
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)
62
50
  end
63
51
 
64
- c.desc 'release module'
52
+ c.desc 'if ignore warning'
65
53
  c.switch [:i,:ignore]
54
+ c.desc 'Release single module operations'
66
55
  c.command :module do |m|
67
- m.desc 'Start release module project'
68
- m.command :start do |start|
69
- start.action do |global_options, options, args|
70
- path = File.expand_path(global_options[:path])
71
- version = global_options[:ver]
72
- user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
73
- LeanCloudLogger.instance.set_command("release/module/start")
74
-
75
- help_now!('module name is required') if args.length != 1
76
- raise Logger.error("release version is required") if version == nil
77
- module_name = args[0]
78
- release_module_start(path, version, user, module_name, options[:ignore])
79
- end
80
- end
81
-
82
- m.desc 'finish release module project'
83
- m.switch [:s,:spec]
84
- m.command :finish do |finish|
85
- finish.action do |global_options, options, args|
86
- path = File.expand_path(global_options[:path])
87
- version = global_options[:ver]
88
- user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
89
- LeanCloudLogger.instance.set_command("release/module/finish")
56
+ m.action do |global_options, options, args|
57
+ path = File.expand_path(global_options[:path])
58
+ version = global_options[:ver]
59
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
60
+ LeanCloudLogger.instance.set_command("release/module")
90
61
 
91
- help_now!('module name is required') if args.length != 1
92
- raise Logger.error("release version is required") if version == nil
93
- module_name = args[0]
94
- release_module_finish(path, version, user, module_name, options[:spec])
95
- end
62
+ help_now!('module name is required') if args.length == 0
63
+ raise Logger.error("release version is required") if version == nil
64
+ modules = args[(0...args.length)] if args.length > 0
65
+ release_module(path, version, user, modules, options[:spec])
96
66
  end
97
67
  end
98
68
  end
@@ -8,84 +8,21 @@ require 'big_keeper/util/xcode_operator'
8
8
  require 'big_keeper/model/operate_type'
9
9
 
10
10
  module BigKeeper
11
- def self.release_home_start(path, version, user)
12
- BigkeeperParser.parse("#{path}/Bigkeeper")
13
-
14
- version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
15
- modules = BigkeeperParser.module_names
16
-
17
- #stash
18
- StashService.new.stash_all(path, GitOperator.new.current_branch(path), user, modules)
19
-
20
- # delete cache
21
- CacheOperator.new(path).clean()
22
- # cache Podfile
23
- CacheOperator.new(path).save('Podfile')
24
-
25
- # check
26
- GitOperator.new.check_diff(path, "develop", "master")
27
-
28
- #checkout release branch
29
- Logger.highlight(%Q(Start to checkout Branch release/#{version}))
30
- if GitOperator.new.current_branch(path) != "release/#{version}"
31
- if GitOperator.new.has_branch(path, "release/#{version}")
32
- GitOperator.new.checkout(path, "release/#{version}")
33
- else
34
- GitflowOperator.new.start(path, version, GitflowType::RELEASE)
35
- GitOperator.new.push_to_remote(path, "release/#{version}")
36
- end
37
- end
38
-
39
- Logger.highlight(%Q(Start to release/#{version}))
40
- # step 2 replace_modules
41
- PodfileOperator.new.replace_all_module_release(path,
42
- user,
43
- modules,
44
- ModuleOperateType::RELEASE)
45
-
46
- # step 3 change Info.plist value
47
- InfoPlistOperator.new.change_version_build(path, version)
48
-
49
- GitService.new.verify_push(path, "Change version to #{version}", "release/#{version}", 'Home')
50
- DepService.dep_operator(path, user).install(modules, OperateType::RELEASE, true)
51
- XcodeOperator.open_workspace(path)
11
+ def self.prerelease(path, version, user, modules)
12
+ DepService.dep_operator(path, user).release_start(path, version, user, modules)
52
13
  end
53
14
 
54
- def self.release_home_finish(path, version)
15
+ def self.release(path, version, user, modules)
55
16
  BigkeeperParser.parse("#{path}/Bigkeeper")
17
+
56
18
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
57
- Logger.highlight("Start finish release home for #{version}")
19
+ modules = BigkeeperParser.module_names
58
20
 
59
21
  if GitOperator.new.has_branch(path, "release/#{version}")
60
- if GitOperator.new.current_branch(path) != "release/#{version}"
61
- GitOperator.new.checkout(path, "release/#{version}")
62
- end
63
-
64
- GitService.new.verify_push(path, "finish release branch", "release/#{version}", 'Home')
65
-
66
- # master
67
- GitOperator.new.checkout(path, "master")
68
- GitOperator.new.merge(path, "release/#{version}")
69
- GitService.new.verify_push(path, "release V#{version}", "master", 'Home')
70
-
71
- GitOperator.new.tag(path, version)
72
-
73
- # release branch
74
- GitOperator.new.checkout(path, "release/#{version}")
75
- CacheOperator.new(path).load('Podfile')
76
- CacheOperator.new(path).clean()
77
- GitOperator.new.commit(path, "reset #{version} Podfile")
78
- GitService.new.verify_push(path, "reset #{version} Podfile", "release/#{version}", 'Home')
79
-
80
- # develop
81
- GitOperator.new.checkout(path, "develop")
82
- GitOperator.new.merge(path, "release/#{version}")
83
- GitService.new.verify_push(path, "merge release/#{version} to develop", "develop", 'Home')
84
- GitOperator.new.check_diff(path, "develop", "master")
85
-
86
- Logger.highlight("Finish release home for #{version}")
22
+ DepService.dep_operator(path, user).release_finish(path, version, user, modules)
87
23
  else
88
- raise Logger.error("There is no release/#{version} branch, please use release home start first.")
24
+ DepService.dep_operator(path, user).release_start(path, version, user, modules)
25
+ DepService.dep_operator(path, user).release_finish(path, version, user, modules)
89
26
  end
90
27
  end
91
28
 
@@ -8,9 +8,15 @@ 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
+
11
17
  def self.release_module_start(path, version, user, module_name, ignore)
18
+ p module_name
12
19
  BigkeeperParser.parse("#{path}/Bigkeeper")
13
-
14
20
  version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
15
21
  module_path = BigkeeperParser.module_full_path(path, user, module_name)
16
22
 
@@ -28,37 +34,44 @@ module BigKeeper
28
34
  Logger.highlight(%Q(Start checkout #{module_name} to Branch develop))
29
35
  GitService.new.verify_checkout_pull(module_path, "develop")
30
36
 
31
- Logger.highlight(%Q(#{module_name} release start finish))
37
+ Logger.highlight(%Q(#{module_name} prerelease finish))
32
38
  end
33
39
 
34
- ## release finish
35
- def self.release_module_finish(path, version, user, module_name, spec)
40
+ def self.release_module(path, version, user, modules, spec)
36
41
  BigkeeperParser.parse("#{path}/Bigkeeper")
37
42
 
38
- version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
39
- module_path = BigkeeperParser.module_full_path(path, user, module_name)
43
+ if !CommandLineUtil.double_check("modules #{modules} will publish version #{version}, are you sure?")
44
+ Logger.error('module prerelease interrupt')
45
+ end
46
+
47
+ for module_name in modules
48
+ release_module_start(path, version, user, module_name, true)
49
+
50
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
51
+ module_path = BigkeeperParser.module_full_path(path, user, module_name)
40
52
 
41
- # check commit
42
- Logger.error("current branch has unpush files") if GitOperator.new.has_changes(module_path)
53
+ # check commit
54
+ Logger.error("current branch has unpush files") if GitOperator.new.has_changes(module_path)
43
55
 
44
- #修改 podspec 文件
45
- # TO DO: - advanced to use Regular Expression
46
- has_change = PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
47
- GitService.new.verify_push(module_path, "Change version number", "develop", "#{module_name}") if has_change == true
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
48
60
 
49
- # check out master
50
- Logger.highlight("'#{module_name}' checkout branch to master...")
51
- GitService.new.verify_checkout_pull(module_path, "master")
61
+ # check out master
62
+ Logger.highlight("'#{module_name}' checkout branch to master...")
63
+ GitService.new.verify_checkout_pull(module_path, "master")
52
64
 
53
- Logger.highlight(%Q(Merge develop to master))
54
- # merge develop to master
55
- GitOperator.new.merge(module_path, "develop")
56
- GitOperator.new.push_to_remote(module_path, "master")
65
+ Logger.highlight(%Q(Merge develop to master))
66
+ # merge develop to master
67
+ GitOperator.new.merge(module_path, "develop")
68
+ GitOperator.new.push_to_remote(module_path, "master")
57
69
 
58
- GitOperator.new.tag(module_path, version)
59
- # pod repo push
60
- if spec == true
61
- PodOperator.pod_repo_push(module_path, module_name, BigkeeperParser.source_spec_path(module_name), version)
70
+ GitOperator.new.tag(module_path, version)
71
+ # pod repo push
72
+ if spec == true
73
+ PodOperator.pod_repo_push(module_path, module_name, BigkeeperParser.source_spec_path(module_name), version)
74
+ end
62
75
  end
63
76
  end
64
77
 
@@ -1,69 +1,4 @@
1
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
2
  def self.release_check_changed_modules(path, user)
68
3
  changed_modules = []
69
4
  BigkeeperParser.parse("#{path}/Bigkeeper")
@@ -75,4 +10,5 @@ module BigKeeper
75
10
  end
76
11
  changed_modules
77
12
  end
13
+
78
14
  end
@@ -70,5 +70,87 @@ module BigKeeper
70
70
 
71
71
  def open
72
72
  end
73
+
74
+ def release_start(path, version, user, modules)
75
+ BigkeeperParser.parse("#{path}/Bigkeeper")
76
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
77
+ modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
78
+
79
+ if modules.nil? || modules.empty?
80
+ Logger.error('no module need to release')
81
+ end
82
+
83
+ if !CommandLineUtil.double_check("module #{modules} will changed version to #{version}-SNAPSHOT, are you sure?")
84
+ Logger.error('release start interrupt')
85
+ end
86
+
87
+ #stash home
88
+ StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
89
+ # delete cache
90
+ CacheOperator.new(path).clean()
91
+ # checkout develop
92
+ GitService.new.verify_checkout_pull(path, 'develop')
93
+
94
+ modules.each do |module_name|
95
+ 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
+ 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}")
106
+ end
107
+
108
+ #release home
109
+ DepService.dep_operator(path, user).release_home_start(modules, version)
110
+
111
+ # Push home changes to remote
112
+ Logger.highlight("Push branch 'develop' for 'Home'...")
113
+ GitService.new.verify_push(
114
+ path,
115
+ "release start for #{version}",
116
+ 'develop',
117
+ 'Home')
118
+ end
119
+
120
+ def self.release_finish(path, version, user, modules)
121
+ BigkeeperParser.parse("#{path}/Bigkeeper")
122
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
123
+ modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
124
+
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
+ #stash home
132
+ StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
133
+ # delete cache
134
+ CacheOperator.new(path).clean()
135
+ # checkout develop
136
+ GitService.new.verify_checkout_pull(path, 'develop')
137
+
138
+ modules.each do |module_name|
139
+ Logger.highlight("release start module #{module_name}")
140
+ ModuleService.new.release_finish(path, user, modules, module_name, version)
141
+ end
142
+
143
+ #release home
144
+ DepService.dep_operator(path, user).release_home_finish(modules, version)
145
+
146
+ # Push home changes to remote
147
+ Logger.highlight("Push branch 'develop' for 'Home'...")
148
+ GitService.new.verify_push(
149
+ path,
150
+ "release finish for #{version}",
151
+ 'develop',
152
+ 'Home')
153
+ end
154
+
73
155
  end
74
156
  end
@@ -75,6 +75,10 @@ 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}'"
78
82
  else
79
83
  line
80
84
  end
@@ -86,7 +90,7 @@ module BigKeeper
86
90
 
87
91
  File.open("#{@path}/.bigkeeper/Podfile", 'r', :encoding => 'UTF-8') do |file|
88
92
  file.each_line do |line|
89
- if line =~ /(\s*)pod(\s*)('|")#{module_name}('|")([\s\S]*)/
93
+ if line =~ /(\s*)pod(\s*)('|")#{module_name}((\/[_a-zA-Z0-9]+)?)('|")([\s\S]*)/
90
94
  origin_config = line
91
95
  break
92
96
  end
@@ -102,7 +106,7 @@ module BigKeeper
102
106
  tags_spec_list = Array.new
103
107
  tags_module_list = Array.new
104
108
 
105
- IO.popen("find /Users/#{username}/.cocoapods/repos -type d -name #{module_name}") do |io|
109
+ IO.popen("find /Users/#{username}/.cocoapods/repos/#{BigkeeperParser.source_spec_name(module_name)} -type d -name #{module_name}") do |io|
106
110
  io.each do |line|
107
111
  tags_repos_pwd.push(line) if line.include? "#{module_name}"
108
112
  end
@@ -125,6 +129,106 @@ module BigKeeper
125
129
  end
126
130
  end
127
131
 
132
+ def release_start(path, version, user, modules)
133
+ BigkeeperParser.parse("#{path}/Bigkeeper")
134
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
135
+ modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
136
+
137
+ if modules.nil? || modules.empty?
138
+ Logger.default('no module need to release')
139
+ end
140
+
141
+ #stash home
142
+ StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
143
+ # delete cache
144
+ CacheOperator.new(path).clean()
145
+ # cache Podfile
146
+ CacheOperator.new(path).save('Podfile')
147
+ # checkout develop
148
+ GitService.new.verify_checkout_pull(path, 'develop')
149
+ # check
150
+ GitOperator.new.check_diff(path, "develop", "master")
151
+
152
+ #checkout release branch
153
+ Logger.highlight(%Q(Start to checkout Branch release/#{version}))
154
+
155
+ GitService.new.verify_checkout(path, "release/#{version}")
156
+
157
+ raise Logger.error("Chechout release/#{version} failed.") unless GitOperator.new.current_branch(path) == "release/#{version}"
158
+
159
+ Logger.highlight(%Q(Finish to release/#{version} for home project))
160
+
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)
164
+ ModuleService.new.release_start(path, user, modules, module_name, version)
165
+
166
+ if GitOperator.new.has_branch(module_full_path, "release/#{version}")
167
+ GitOperator.new.checkout(module_full_path, "release/#{version}")
168
+ else
169
+ GitflowOperator.new.start(path, version, GitflowType::RELEASE)
170
+ GitOperator.new.push_to_remote(path, "release/#{version}")
171
+
172
+ Logger.highlight("Push branch release/'#{version}' for #{module_name}...")
173
+ GitOperator.new.push_to_remote(module_full_path, "release/#{version}")
174
+ end
175
+
176
+ DepService.dep_operator(path, user).update_module_config(
177
+ module_name,
178
+ ModuleOperateType::RELEASE_START)
179
+ end
180
+
181
+ # step 3 change Info.plist value
182
+ InfoPlistOperator.new.change_version_build(path, version)
183
+
184
+ GitService.new.verify_push(path, "Change version to #{version}", "release/#{version}", 'Home')
185
+ # DepService.dep_operator(path, user).install(modules, OperateType::RELEASE, true)
186
+ XcodeOperator.open_workspace(path)
187
+ end
188
+
189
+ def release_module_start(modules, module_name, version)
190
+ module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
191
+ GitService.new.verify_checkout(module_full_path, "release/#{version}")
192
+ end
193
+
194
+ def release_finish(path, version, user, modules)
195
+ BigkeeperParser.parse("#{path}/Bigkeeper")
196
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
197
+ modules = BigkeeperParser.module_names
198
+
199
+ if GitOperator.new.has_branch(path, "release/#{version}")
200
+ GitService.new.verify_checkout(path, "release/#{version}")
201
+
202
+ PodfileOperator.new.replace_all_module_release(path, user, modules, ModuleOperateType::RELEASE)
203
+
204
+ GitService.new.verify_push(path, "finish release branch", "release/#{version}", 'Home')
205
+
206
+ # master
207
+ GitOperator.new.checkout(path, "master")
208
+ GitOperator.new.merge(path, "release/#{version}")
209
+ GitService.new.verify_push(path, "release V#{version}", "master", 'Home')
210
+
211
+ GitOperator.new.tag(path, version)
212
+
213
+ # release branch
214
+ GitOperator.new.checkout(path, "release/#{version}")
215
+ CacheOperator.new(path).load('Podfile')
216
+ CacheOperator.new(path).clean()
217
+ GitOperator.new.commit(path, "reset #{version} Podfile")
218
+ GitService.new.verify_push(path, "reset #{version} Podfile", "release/#{version}", 'Home')
219
+
220
+ # develop
221
+ GitOperator.new.checkout(path, "develop")
222
+ GitOperator.new.merge(path, "release/#{version}")
223
+ GitService.new.verify_push(path, "merge release/#{version} to develop", "develop", 'Home')
224
+ GitOperator.new.check_diff(path, "develop", "master")
225
+
226
+ Logger.highlight("Finish release home for #{version}")
227
+ else
228
+ raise Logger.error("There is no release/#{version} branch, please use release home start first.")
229
+ end
230
+ end
231
+
128
232
  private :generate_module_config, :origin_config_of_module, :find_lastest_tag
129
233
  end
130
234
  end
@@ -26,5 +26,6 @@ module BigKeeper
26
26
  FINISH = 3
27
27
  PUBLISH = 4
28
28
  RELEASE = 5
29
+ RELEASE_START = 6
29
30
  end
30
31
  end
@@ -183,14 +183,6 @@ module BigKeeper
183
183
  # checkout develop
184
184
  GitService.new.verify_checkout_pull(module_full_path, 'develop')
185
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
186
  end
195
187
 
196
188
  def release_finish(path, user, modules, module_name, version)
@@ -183,6 +183,8 @@ module BigKeeper
183
183
  end
184
184
 
185
185
  def self.module_full_path(home_path, user_name, module_name)
186
+ Logger.error("Can't find a Pod named #{module_name} in current directory.") unless @@config[:modules].invert.has_value?(module_name)
187
+
186
188
  if @@config[:users] \
187
189
  && @@config[:users][user_name] \
188
190
  && @@config[:users][user_name][:mods] \
@@ -206,7 +208,6 @@ module BigKeeper
206
208
  && @@config[:users][user_name][:mods][module_name][:path]
207
209
  File.expand_path(@@config[:users][user_name][:mods][module_name][:path])
208
210
  else
209
- p @@config[:modules][module_name]
210
211
  if @@config[:modules][module_name][:alias]
211
212
  "#{home_modules_workspace}#{@@config[:modules][module_name][:alias]}"
212
213
  else
@@ -15,7 +15,9 @@ module BigKeeper
15
15
  end
16
16
 
17
17
  def load(file)
18
- FileUtils.cp("#{@cache_path}/#{file}", "#{@path}/#{file}");
18
+ if File.exist?(@cache_path)
19
+ FileUtils.cp("#{@cache_path}/#{file}", "#{@path}/#{file}");
20
+ end
19
21
  end
20
22
 
21
23
  def clean
@@ -1,3 +1,3 @@
1
1
  module BigKeeper
2
- VERSION = "0.9.12"
2
+ VERSION = "0.9.13"
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.12
4
+ version: 0.9.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmoaay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -259,6 +259,7 @@ files:
259
259
  - lib/big_keeper/command/feature&hotfix/delete.rb
260
260
  - lib/big_keeper/command/feature&hotfix/finish.rb
261
261
  - lib/big_keeper/command/feature&hotfix/list.rb
262
+ - lib/big_keeper/command/feature&hotfix/module.rb
262
263
  - lib/big_keeper/command/feature&hotfix/publish.rb
263
264
  - lib/big_keeper/command/feature&hotfix/pull.rb
264
265
  - lib/big_keeper/command/feature&hotfix/push.rb
@@ -272,7 +273,6 @@ files:
272
273
  - lib/big_keeper/command/pod.rb
273
274
  - lib/big_keeper/command/pod/podfile.rb
274
275
  - lib/big_keeper/command/release.rb
275
- - lib/big_keeper/command/release/finish.rb
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
@@ -347,7 +347,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
347
347
  - !ruby/object:Gem::Version
348
348
  version: '0'
349
349
  requirements: []
350
- rubygems_version: 3.0.1
350
+ rubyforge_project:
351
+ rubygems_version: 2.7.6
351
352
  signing_key:
352
353
  specification_version: 4
353
354
  summary: Efficiency improvement for iOS&Android modular development.
@@ -1,36 +0,0 @@
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