bigkeeper 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE.md +20 -0
  3. data/.gitignore +50 -0
  4. data/.travis.yml +17 -0
  5. data/CODE_OF_CONDUCT.md +46 -0
  6. data/CONTRIBUTING.md +70 -0
  7. data/Gemfile +10 -0
  8. data/Gemfile.lock +114 -0
  9. data/LICENSE +21 -0
  10. data/README.md +109 -0
  11. data/Rakefile +2 -0
  12. data/big_keeper.gemspec +47 -0
  13. data/bin/big +14 -0
  14. data/bin/setup +8 -0
  15. data/docs/en-US/FEATURE.md +0 -0
  16. data/docs/en-US/README.md +50 -0
  17. data/docs/zh-CN/BIGKEEPER_FILE.md +62 -0
  18. data/docs/zh-CN/FEATURE&HOTFIX.md +121 -0
  19. data/docs/zh-CN/PODFILE.md +43 -0
  20. data/docs/zh-CN/README.md +107 -0
  21. data/docs/zh-CN/RECOMMEND.md +22 -0
  22. data/docs/zh-CN/RELEASE.md +43 -0
  23. data/lib/big_keeper.rb +295 -0
  24. data/lib/big_keeper/command/feature&hotfix/delete.rb +33 -0
  25. data/lib/big_keeper/command/feature&hotfix/finish.rb +56 -0
  26. data/lib/big_keeper/command/feature&hotfix/pull.rb +24 -0
  27. data/lib/big_keeper/command/feature&hotfix/push.rb +25 -0
  28. data/lib/big_keeper/command/feature&hotfix/rebase.rb +27 -0
  29. data/lib/big_keeper/command/feature&hotfix/start.rb +67 -0
  30. data/lib/big_keeper/command/feature&hotfix/switch.rb +47 -0
  31. data/lib/big_keeper/command/feature&hotfix/update.rb +69 -0
  32. data/lib/big_keeper/command/pod/podfile.rb +69 -0
  33. data/lib/big_keeper/command/release/home.rb +66 -0
  34. data/lib/big_keeper/command/release/module.rb +106 -0
  35. data/lib/big_keeper/model/gitflow_type.rb +31 -0
  36. data/lib/big_keeper/model/operate_type.rb +19 -0
  37. data/lib/big_keeper/model/podfile_model.rb +33 -0
  38. data/lib/big_keeper/model/podfile_type.rb +44 -0
  39. data/lib/big_keeper/service/git_service.rb +186 -0
  40. data/lib/big_keeper/service/module_service.rb +124 -0
  41. data/lib/big_keeper/service/stash_service.rb +45 -0
  42. data/lib/big_keeper/util/bigkeeper_parser.rb +198 -0
  43. data/lib/big_keeper/util/git_operator.rb +142 -0
  44. data/lib/big_keeper/util/gitflow_operator.rb +51 -0
  45. data/lib/big_keeper/util/info_plist_operator.rb +46 -0
  46. data/lib/big_keeper/util/logger.rb +40 -0
  47. data/lib/big_keeper/util/pod_operator.rb +15 -0
  48. data/lib/big_keeper/util/podfile_detector.rb +108 -0
  49. data/lib/big_keeper/util/podfile_module.rb +64 -0
  50. data/lib/big_keeper/util/podfile_operator.rb +166 -0
  51. data/lib/big_keeper/util/xcode_operator.rb +13 -0
  52. data/lib/big_keeper/version.rb +3 -0
  53. data/resources/banner.png +0 -0
  54. data/resources/keynote/big-keeper-readme-example.key +0 -0
  55. data/resources/keynote/big-keeper-readme-feature.key +0 -0
  56. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.001.jpeg +0 -0
  57. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.002.jpeg +0 -0
  58. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.003.jpeg +0 -0
  59. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.004.jpeg +0 -0
  60. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.005.jpeg +0 -0
  61. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.006.jpeg +0 -0
  62. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.007.jpeg +0 -0
  63. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.008.jpeg +0 -0
  64. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.009.jpeg +0 -0
  65. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.010.jpeg +0 -0
  66. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.011.jpeg +0 -0
  67. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.012.jpeg +0 -0
  68. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.013.jpeg +0 -0
  69. data/resources/keynote/big-keeper-readme-feature/big-keeper-readme-feature.014.jpeg +0 -0
  70. data/resources/keynote/big-keeper-readme-release.key +0 -0
  71. data/resources/readme/big-keeper-readme.001.png +0 -0
  72. data/resources/readme/big-keeper-readme.002.png +0 -0
  73. data/resources/readme/big-keeper-readme.003.png +0 -0
  74. data/resources/readme/big-keeper-readme.004.png +0 -0
  75. data/resources/readme/big-keeper-readme.005.png +0 -0
  76. data/resources/readme/big-keeper-readme.006.png +0 -0
  77. data/resources/readme/big-keeper-readme.007.png +0 -0
  78. data/resources/readme/big-keeper-readme.008.png +0 -0
  79. data/resources/readme/big-keeper-readme.009.png +0 -0
  80. data/resources/readme/big-keeper-readme.010.png +0 -0
  81. data/resources/readme/big-keeper-readme.011.png +0 -0
  82. data/resources/readme/big-keeper-readme.012.png +0 -0
  83. metadata +311 -0
@@ -0,0 +1,24 @@
1
+ require 'big_keeper/util/logger'
2
+
3
+ module BigKeeper
4
+ def self.pull(path, user, type)
5
+ begin
6
+ # Parse Bigkeeper file
7
+ BigkeeperParser.parse("#{path}/Bigkeeper")
8
+ branch_name = GitOperator.new.current_branch(path)
9
+
10
+ Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
11
+
12
+ modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
13
+ BigkeeperParser.module_names, ModuleType::PATH)
14
+
15
+ modules.each do |module_name|
16
+ ModuleService.new.pull(path, user, module_name, branch_name, type)
17
+ end
18
+
19
+ Logger.highlight("Pull branch '#{branch_name}' for 'Home'...")
20
+ GitOperator.new.pull(path)
21
+ ensure
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ require 'big_keeper/util/logger'
2
+
3
+ module BigKeeper
4
+
5
+ def self.push(path, user, comment, type)
6
+ begin
7
+ # Parse Bigkeeper file
8
+ BigkeeperParser.parse("#{path}/Bigkeeper")
9
+ branch_name = GitOperator.new.current_branch(path)
10
+
11
+ Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
12
+
13
+ modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
14
+ BigkeeperParser.module_names, ModuleType::PATH)
15
+
16
+ modules.each do |module_name|
17
+ ModuleService.new.push(path, user, module_name, branch_name, type, comment)
18
+ end
19
+
20
+ Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
21
+ GitService.new.verify_push(path, comment, branch_name, 'Home')
22
+ ensure
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ require 'big_keeper/util/logger'
2
+
3
+ module BigKeeper
4
+ def self.reabse(path, user, type)
5
+ begin
6
+ # Parse Bigkeeper file
7
+ BigkeeperParser.parse("#{path}/Bigkeeper")
8
+ branch_name = GitOperator.new.current_branch(path)
9
+
10
+ Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
11
+
12
+ modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
13
+ BigkeeperParser.module_names, ModuleType::PATH)
14
+
15
+ modules.each do |module_name|
16
+ ModuleService.new.rebase(path, user, module_name, branch_name, type)
17
+ end
18
+
19
+ # Rebase Home
20
+ Logger.error("You have some changes in branch '#{home_branch_name}' \
21
+ for 'Home'. Use 'push' first please") if GitOperator.new.has_changes(path)
22
+
23
+ GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
24
+ ensure
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,67 @@
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
+
10
+ require 'big_keeper/model/podfile_type'
11
+
12
+ require 'big_keeper/service/stash_service'
13
+ require 'big_keeper/service/module_service'
14
+
15
+
16
+ module BigKeeper
17
+ def self.start(path, version, user, name, modules, type)
18
+ begin
19
+ # Parse Bigkeeper file
20
+ BigkeeperParser.parse("#{path}/Bigkeeper")
21
+
22
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
23
+ full_name = "#{version}_#{user}_#{name}"
24
+ branch_name = "#{GitflowType.name(type)}/#{full_name}"
25
+
26
+ GitService.new.verify_home_branch(path, branch_name, OperateType::START)
27
+
28
+ stash_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
29
+ BigkeeperParser.module_names, ModuleType::PATH)
30
+
31
+ # Stash current branch
32
+ StashService.new.stash_all(path, branch_name, user, stash_modules)
33
+
34
+ # Verify input modules
35
+ modules = [] unless modules
36
+ BigkeeperParser.verify_modules(modules)
37
+
38
+ # # Handle modules
39
+ # if modules
40
+ # # Verify input modules
41
+ # BigkeeperParser.verify_modules(modules)
42
+ # else
43
+ # # Get all modules if not specified
44
+ # modules = BigkeeperParser.module_names
45
+ # end
46
+
47
+ Logger.highlight("Add branch '#{branch_name}' for 'Home'...")
48
+ # Start home feature
49
+ GitService.new.start(path, full_name, type)
50
+
51
+ # Modify podfile as path and Start modules feature
52
+ modules.each do |module_name|
53
+ ModuleService.new.add(path, user, module_name, full_name, type)
54
+ end
55
+
56
+ # pod install
57
+ PodOperator.pod_install(path, true) unless modules.empty?
58
+
59
+ # Open home workspace
60
+ XcodeOperator.open_workspace(path)
61
+
62
+ # Push home changes to remote
63
+ GitService.new.verify_push(path, "init #{GitflowType.name(type)} #{full_name}", branch_name, 'Home')
64
+ ensure
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/ruby
2
+ require 'big_stash/stash_operator'
3
+ require 'big_keeper/util/logger'
4
+ require 'big_keeper/util/pod_operator'
5
+ require 'big_keeper/util/xcode_operator'
6
+
7
+ module BigKeeper
8
+ def self.switch_to(path, version, user, name, type)
9
+ begin
10
+ # Parse Bigkeeper file
11
+ BigkeeperParser.parse("#{path}/Bigkeeper")
12
+
13
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
14
+ full_name = "#{version}_#{user}_#{name}"
15
+ branch_name = "#{GitflowType.name(type)}/#{full_name}"
16
+
17
+ GitService.new.verify_home_branch(path, branch_name, OperateType::SWITCH)
18
+
19
+ stash_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
20
+ BigkeeperParser.module_names, ModuleType::PATH)
21
+
22
+ # Stash current branch
23
+ StashService.new.stash_all(path, branch_name, user, stash_modules)
24
+
25
+ # Switch to new feature
26
+ GitOperator.new.checkout(path, branch_name)
27
+ GitOperator.new.pull(path)
28
+
29
+ # Apply home stash
30
+ StashService.new.pop_stash(path, branch_name, 'Home')
31
+
32
+ modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
33
+ BigkeeperParser.module_names, ModuleType::PATH)
34
+
35
+ modules.each do |module_name|
36
+ ModuleService.new.switch_to(path, user, module_name, branch_name, type)
37
+ end
38
+
39
+ # pod install
40
+ PodOperator.pod_install(path, false)
41
+
42
+ # Open home workspace
43
+ XcodeOperator.open_workspace(path)
44
+ ensure
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,69 @@
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
+
10
+ require 'big_keeper/model/podfile_type'
11
+
12
+ require 'big_keeper/service/stash_service'
13
+ require 'big_keeper/service/module_service'
14
+
15
+
16
+ module BigKeeper
17
+ def self.update(path, user, modules, type)
18
+ begin
19
+ # Parse Bigkeeper file
20
+ BigkeeperParser.parse("#{path}/Bigkeeper")
21
+ branch_name = GitOperator.new.current_branch(path)
22
+
23
+ Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
24
+
25
+ full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
26
+
27
+ current_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
28
+ BigkeeperParser.module_names, ModuleType::PATH)
29
+
30
+ # Verify input modules
31
+ modules = [] unless modules
32
+ BigkeeperParser.verify_modules(modules)
33
+
34
+ # # Handle modules
35
+ # if modules
36
+ # # Verify input modules
37
+ # BigkeeperParser.verify_modules(modules)
38
+ # else
39
+ # # Get all modules if not specified
40
+ # modules = BigkeeperParser.module_names
41
+ # end
42
+
43
+ Logger.highlight("Start to update modules for branch '#{branch_name}'...")
44
+
45
+ add_modules = modules - current_modules
46
+ del_modules = current_modules - modules
47
+
48
+ if add_modules.empty? and del_modules.empty?
49
+ Logger.default("There is nothing changed with modules #{modules}.")
50
+ else
51
+ # Modify podfile as path and Start modules feature
52
+ add_modules.each do |module_name|
53
+ ModuleService.new.add(path, user, module_name, full_name, type)
54
+ end
55
+
56
+ del_modules.each do |module_name|
57
+ ModuleService.new.del(path, user, module_name, full_name, type)
58
+ end
59
+
60
+ # pod install
61
+ PodOperator.pod_install(path, false)
62
+
63
+ # Open home workspace
64
+ XcodeOperator.open_workspace(path)
65
+ end
66
+ ensure
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,69 @@
1
+ require 'big_keeper/util/podfile_detector'
2
+ require 'big_keeper/util/podfile_operator'
3
+ require 'big_keeper/util/podfile_module'
4
+ require 'big_keeper/util/gitflow_operator'
5
+ require 'big_keeper/util/bigkeeper_parser'
6
+ require 'big_keeper/model/podfile_type'
7
+ require 'big_keeper/util/logger'
8
+
9
+ module BigKeeper
10
+
11
+ def self.podfile_detect(path)
12
+ # Parse Bigkeeper file
13
+ BigkeeperParser.parse("#{path}/Bigkeeper")
14
+ # Get modules' name
15
+ module_list = BigkeeperParser.module_names
16
+ # initialize PodfileDetector
17
+ detector = PodfileDetector.new(path,module_list)
18
+ # Get unlocked third party pods list
19
+ unlock_pod_list = detector.get_unlock_pod_list
20
+ # Print out unlock pod list
21
+ unlock_pod_list.each do |pod_name|
22
+ Logger.default("#{pod_name} should be locked.")
23
+ end
24
+ Logger.separator
25
+
26
+ end
27
+
28
+ def self.podfile_lock(path)
29
+ # Parse Bigkeeper file
30
+ BigkeeperParser.parse("#{path}/Bigkeeper")
31
+ # Get modules' name
32
+ module_list = BigkeeperParser.module_names
33
+ # initialize PodfileDetector
34
+ detector = PodfileDetector.new(path,module_list)
35
+ # Get unlocked third party pods list
36
+ unlock_pod_list = detector.get_unlock_pod_list
37
+ # Get Version
38
+ dictionary = detector.deal_lock_file(path,unlock_pod_list)
39
+ if dictionary.empty?
40
+ Logger.warning("There is nothing to be locked.")
41
+ else
42
+ PodfileOperator.new.find_and_lock("#{path}/Podfile",dictionary)
43
+ Logger.highlight("The Podfile has been changed.")
44
+ Logger.separator
45
+ end
46
+
47
+
48
+
49
+ end
50
+
51
+ def self.podfile_modules_update(path)
52
+ # Parse Bigkeeper file
53
+ BigkeeperParser.parse("#{path}/Bigkeeper")
54
+ # Get modules' name
55
+ module_list = BigkeeperParser.module_names
56
+ # initialize PodfileDetector
57
+ detector = PodfileModuleDetector.new(path)
58
+ # Get module latest version
59
+ module_dictionary = detector.check_version_list
60
+ # Check if anything should be upgrade
61
+ if module_dictionary.empty?
62
+ Logger.warning("There is nothing to be upgrade.")
63
+ else
64
+ PodfileOperator.new.find_and_upgrade("#{path}/Podfile",module_dictionary)
65
+ Logger.highlight("The Podfile has been changed.")
66
+ end
67
+ end
68
+
69
+ end
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/ruby
2
+ require 'big_keeper/util/podfile_operator'
3
+ require 'big_keeper/util/gitflow_operator'
4
+ require 'big_keeper/model/podfile_type'
5
+ require 'big_keeper/util/info_plist_operator'
6
+ require 'big_keeper/util/logger'
7
+
8
+ module BigKeeper
9
+ def self.release_home_start(path, version, user)
10
+ BigkeeperParser.parse("#{path}/Bigkeeper")
11
+ start_release(path, version, BigkeeperParser::module_names, user)
12
+ end
13
+
14
+ def self.release_home_finish(path, version)
15
+ Dir.chdir(path) do
16
+ if GitOperator.new.has_branch(path, "release/#{version}")
17
+ if GitOperator.new.current_branch(path) == "release/#{version}"
18
+ GitOperator.new.commit(path, "release: V #{version}")
19
+ GitOperator.new.push_to_remote(path, "release/#{version}")
20
+ GitflowOperator.new.finish_release(path, version)
21
+ if GitOperator.new.current_branch(path) == "master"
22
+ GitOperator.new.tag(path, version)
23
+ else
24
+ GitOperator.new.checkout(path, "master")
25
+ GitOperator.new.tag(path, version)
26
+ end
27
+ else
28
+ raise Logger.error("Not in release branch, please check your branches.")
29
+ end
30
+ else
31
+ raise Logger.error("Not has release branch, please use release start first.")
32
+ end
33
+ end
34
+ end
35
+
36
+ private
37
+ def self.start_release(project_path, version, modules, user)
38
+ Dir.chdir(project_path) do
39
+ # step 0 Stash current branch
40
+ StashService.new.stash_all(project_path, GitOperator.new.current_branch(project_path), user, modules)
41
+
42
+ Logger.highlight(%Q(Start to checkout Branch release/#{version}))
43
+ # step 1 checkout release
44
+ if GitOperator.new.current_branch(project_path) != "release/#{version}"
45
+ if GitOperator.new.has_branch(project_path, "release/#{version}")
46
+ GitOperator.new.checkout(project_path, "release/#{version}")
47
+ else
48
+ GitflowOperator.new.start(project_path, version, GitflowType::RELEASE)
49
+ GitOperator.new.push_to_remote(project_path, "release/#{version}")
50
+ end
51
+ end
52
+
53
+ Logger.highlight(%Q(Start to release/#{version}))
54
+ # step 2 replace_modules
55
+ PodfileOperator.new.replace_all_module_release(%Q(#{project_path}/Podfile),
56
+ modules,
57
+ version)
58
+
59
+ # step 3 change Info.plist value
60
+ InfoPlistOperator.new.change_version_build(project_path, version)
61
+
62
+ PodOperator.pod_install(project_path, true)
63
+ `open #{project_path}/*.xcworkspace`
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/ruby
2
+ require 'big_keeper/util/podfile_operator'
3
+ require 'big_keeper/util/gitflow_operator'
4
+ require 'big_keeper/model/podfile_type'
5
+ require 'big_keeper/util/info_plist_operator'
6
+ require 'big_keeper/util/git_operator'
7
+ require 'big_keeper/util/logger'
8
+
9
+ module BigKeeper
10
+ def self.release_module_start(path, version, user, module_name)
11
+ BigkeeperParser.parse("#{path}/Bigkeeper")
12
+
13
+ Dir.chdir(path) do
14
+ git_info = GitInfo.new(BigkeeperParser::home_git, GitType::TAG, version)
15
+ module_path = self.get_module_path_default(path, user, module_name)
16
+ start_module_release(module_path, version, module_name, git_info, user)
17
+ end
18
+ end
19
+
20
+ def self.release_module_finish(path, version, user, module_name)
21
+ BigkeeperParser.parse("#{path}/Bigkeeper")
22
+ module_path = self.get_module_path_default(path, user, module_name)
23
+
24
+ Logger.error("current branch has changed") unless GitOperator.new.has_changes(module_path)
25
+ # check out master
26
+ if GitOperator.new.current_branch(module_path) != "master"
27
+ current_name = GitOperator.new.current_branch(module_path)
28
+ GitOperator.new.checkout(module_path, "master")
29
+ Logger.highlight("Push branch '#{current_name}' for '#{module_name}'...")
30
+ GitService.new.verify_push(module_path, "finish #{GitflowType.name(GitflowType::RELEASE)} #{current_name}", "master", "#{module_name}")
31
+ end
32
+ return
33
+
34
+ Dir.chdir(module_path) do
35
+ # rebase develop to master
36
+ Logger.highlight(%Q(Rebase develop to master))
37
+
38
+ #修改 podspec 文件
39
+ # TO DO: - advanced to use Regular Expression
40
+ PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
41
+
42
+ GitService.new.verify_rebase(module_path, 'develop', "#{module_name}")
43
+ GitOperator.new.verify_push(module_path, "finish rebase develop to master", "master", "#{module_name}")
44
+ GitOperator.new.tag(module_path, version)
45
+
46
+ Logger.highlight(%Q(Start Pod repo push #{module_name}))
47
+ IO.popen("pod repo push #{module_name} #{module_name}.podspec --allow-warnings --sources=#{BigkeeperParser::sourcemodule_path}") do |io|
48
+ io.each do |line|
49
+ has_error = true if line.include? "ERROR"
50
+ end
51
+ end
52
+ if has_error
53
+ Logger.error("Pod repo push in '#{module_name}'")
54
+ return
55
+ end
56
+
57
+ Logger.highlight(%Q(Success release #{module_name} V#{version}))
58
+ end
59
+ end
60
+
61
+ private
62
+ def self.start_module_release(module_path, version, module_name, source, user)
63
+ if GitOperator.new.has_changes(module_path)
64
+ StashService.new.stash_all(module_path, GitOperator.new.current_branch(module_path), user, module_name.split())
65
+ end
66
+
67
+ # step 1 checkout to develop branch
68
+ Logger.highlight(%Q(Start checkout #{module_name} to Branch develop))
69
+ if GitOperator.new.current_branch(module_path) != "develop"
70
+ if GitOperator.new.has_branch(module_path, "develop")
71
+ GitOperator.new.checkout(module_path, "develop")
72
+ else
73
+ Logger.error("Cann't find develop branch, please check.")
74
+ end
75
+ end
76
+
77
+ Dir.chdir(module_path) do
78
+ # Pod lib lint
79
+ Logger.highlight(%Q(Start Pod lib lint #{module_name}))
80
+ has_error = false
81
+ IO.popen("pod lib lint --allow-warnings --verbose --use-libraries --sources=#{BigkeeperParser::sourcemodule_path}") do |io|
82
+ io.each do |line|
83
+ has_error = true if line.include? "ERROR"
84
+ end
85
+ end
86
+ if has_error
87
+ Logger.error("Pod lib error in '#{module_name}'")
88
+ return
89
+ end
90
+ end
91
+
92
+ GitOperator.new.commit(module_path, "update podspec")
93
+ GitOperator.new.first_push(module_path, GitOperator.new.current_branch(module_path))
94
+ Logger.highlight(%Q(Pod lib lint success))
95
+ end
96
+
97
+ def self.get_module_path_default(path, user, module_name)
98
+ module_path = BigkeeperParser::module_path(user, module_name)
99
+ if module_path == "../#{module_name}"
100
+ path_array = path.split('/')
101
+ path_array.pop()
102
+ module_path = path_array.join('/') + "/#{module_name}"
103
+ end
104
+ module_path
105
+ end
106
+ end