big_keeper 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/big_keeper.rb +13 -12
  4. data/lib/big_keeper/command/{feature_finish.rb → feature&hotfix/feature_finish.rb} +8 -4
  5. data/lib/big_keeper/command/{feature_pull.rb → feature&hotfix/feature_pull.rb} +4 -2
  6. data/lib/big_keeper/command/feature&hotfix/feature_push.rb +29 -0
  7. data/lib/big_keeper/command/{feature_start.rb → feature&hotfix/feature_start.rb} +6 -4
  8. data/lib/big_keeper/command/{feature_switch.rb → feature&hotfix/feature_switch.rb} +6 -4
  9. data/lib/big_keeper/command/{feature_update.rb → feature&hotfix/feature_update.rb} +7 -3
  10. data/lib/big_keeper/command/{podfile_lock.rb → pod/podfile_lock.rb} +6 -6
  11. data/lib/big_keeper/command/{release_home.rb → release/release_home.rb} +10 -8
  12. data/lib/big_keeper/command/release/release_module.rb +86 -0
  13. data/lib/big_keeper/command/{start_module_release.sh → release/release_module.sh} +0 -0
  14. data/lib/big_keeper/service/git_service.rb +32 -16
  15. data/lib/big_keeper/service/module_service.rb +21 -13
  16. data/lib/big_keeper/service/stash_service.rb +22 -19
  17. data/lib/big_keeper/util/git_operator.rb +8 -2
  18. data/lib/big_keeper/util/gitflow_operator.rb +1 -1
  19. data/lib/big_keeper/util/info_plist_operator.rb +1 -1
  20. data/lib/big_keeper/util/{log_util.rb → logger.rb} +1 -1
  21. data/lib/big_keeper/util/pod_operator.rb +14 -0
  22. data/lib/big_keeper/util/podfile_detector.rb +3 -3
  23. data/lib/big_keeper/version.rb +1 -1
  24. metadata +14 -14
  25. data/lib/big_keeper/command/feature_push.rb +0 -37
  26. data/lib/big_keeper/command/hotfix_start.rb +0 -0
  27. data/lib/big_keeper/command/release_module.rb +0 -70
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5d867efbd9a7de9b08c51986d5ca038d4f06eb4
4
- data.tar.gz: 4819f7ac162d5ac8113daf85408c070569cc2a46
3
+ metadata.gz: 6967a93e88df9fe276ccf6226dc5b12a921ef49e
4
+ data.tar.gz: 20939ca9f234ae42500e583ce44b9d09c17a75ad
5
5
  SHA512:
6
- metadata.gz: a146247543a84a9f8fcd77b2af6ce402499d8c4db96e091e8ddade6cb940ce244e84548528fb9c8a87c7142570ff7a04199d5e3dd3c6775ed9359caca9303b42
7
- data.tar.gz: 2a30911fb546424945102ac1969ded37385d456d5434843de2177d3663b837bd05b18cd7f90f4e5608b9891915d271e351f796e2728aca5707b1045ad687f3e9
6
+ metadata.gz: 87d3900605fe6f45777a4fdfc00b5b9006505ec6b14a24c5001c298e02c3bafb4c0206fd29eb11a940882c4912a2ef5895c684ed31adfd09776abac8d2c7fc46
7
+ data.tar.gz: 36c0f7aa3abc80fc0d7ba86e87b1d30b0089294ed41b90243c8cad70cb251c3c549bdeb21bf19d73c5d7269bcc36e35ed4da7082f7cfda389b16c7d7076859d4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- big_keeper (0.5.0)
4
+ big_keeper (0.6.0)
5
5
  big_stash (~> 0.1)
6
6
  cocoapods
7
7
  colorize
@@ -19,7 +19,7 @@ GEM
19
19
  thread_safe (~> 0.3, >= 0.3.4)
20
20
  tzinfo (~> 1.1)
21
21
  ast (2.3.0)
22
- big_stash (0.5.0)
22
+ big_stash (0.6.0)
23
23
  gli (~> 2.16)
24
24
  claide (1.0.1)
25
25
  cocoapods (1.2.1)
data/lib/big_keeper.rb CHANGED
@@ -7,15 +7,15 @@ require 'big_keeper/util/git_operator'
7
7
 
8
8
  require 'big_keeper/model/gitflow_type'
9
9
 
10
- require 'big_keeper/command/feature_start'
11
- require 'big_keeper/command/feature_finish'
12
- require 'big_keeper/command/feature_switch'
13
- require 'big_keeper/command/feature_update'
14
- require 'big_keeper/command/feature_pull'
15
- require 'big_keeper/command/feature_push'
16
- require 'big_keeper/command/release_home'
17
- require 'big_keeper/command/release_module'
18
- require 'big_keeper/command/podfile_lock'
10
+ require 'big_keeper/command/feature&hotfix/feature_start'
11
+ require 'big_keeper/command/feature&hotfix/feature_finish'
12
+ require 'big_keeper/command/feature&hotfix/feature_switch'
13
+ require 'big_keeper/command/feature&hotfix/feature_update'
14
+ require 'big_keeper/command/feature&hotfix/feature_pull'
15
+ require 'big_keeper/command/feature&hotfix/feature_push'
16
+ require 'big_keeper/command/release/release_home'
17
+ require 'big_keeper/command/release/release_module'
18
+ require 'big_keeper/command/pod/podfile_lock'
19
19
 
20
20
  require 'big_keeper/service/git_service'
21
21
 
@@ -92,6 +92,7 @@ module BigKeeper
92
92
  push.action do |global_options, options, args|
93
93
  help_now!('user name is required') if user and user.empty?
94
94
  help_now!('comment message is required') if args.length < 1
95
+ help_now!(%Q(comment message should be wrappered with '' or "")) if args.length > 1
95
96
  comment = args[0]
96
97
  feature_push(path, user, comment)
97
98
  end
@@ -125,7 +126,7 @@ module BigKeeper
125
126
  home.command :start do |start|
126
127
  start.action do |global_options, options, args|
127
128
  help_now!('user name is required') if user and user.empty?
128
- raise BigKeeperLog.error("release version is required") if version == nil
129
+ raise Logger.error("release version is required") if version == nil
129
130
  release_home_start(path, version, user)
130
131
  end
131
132
  end
@@ -133,7 +134,7 @@ module BigKeeper
133
134
  home.desc 'Finish release home project'
134
135
  home.command :finish do |finish|
135
136
  finish.action do |global_options, options, args|
136
- raise BigKeeperLog.error("release version is required") if version == nil
137
+ raise Logger.error("release version is required") if version == nil
137
138
  release_home_finish(path, version)
138
139
  end
139
140
  end
@@ -143,7 +144,7 @@ module BigKeeper
143
144
  c.command :module do |finish|
144
145
  finish.action do |global_options, options, args|
145
146
  help_now!('module name is required') if args.length != 1
146
- raise BigKeeperLog.error("release version is required") if version == nil
147
+ raise Logger.error("release version is required") if version == nil
147
148
  module_name = args[0]
148
149
  start_module_release(path, version, user, module_name)
149
150
  end
@@ -1,10 +1,13 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
3
  require 'big_keeper/util/podfile_operator'
4
+ require 'big_keeper/util/logger'
5
+ require 'big_keeper/util/pod_operator'
4
6
  require 'big_keeper/util/bigkeeper_parser'
5
7
 
6
8
  require 'big_keeper/model/podfile_type'
7
9
 
10
+
8
11
  module BigKeeper
9
12
 
10
13
  def self.feature_finish(path, user)
@@ -16,7 +19,7 @@ module BigKeeper
16
19
  BigkeeperParser.module_names, ModuleType::PATH)
17
20
 
18
21
  branch_name = GitOperator.new.current_branch(path)
19
- raise "Not a feature branch, exit." unless branch_name.include? 'feature'
22
+ Logger.error("Not a feature branch, exit.") unless branch_name.include? 'feature'
20
23
 
21
24
  # Rebase modules and modify podfile as git
22
25
  modules.each do |module_name|
@@ -32,12 +35,13 @@ module BigKeeper
32
35
  end
33
36
 
34
37
  # pod install
35
- p `pod install --project-directory=#{path}`
38
+ PodOperator.pod_install(path)
36
39
 
40
+ Logger.highlight("Finish branch '#{branch_name}' for 'Home'")
37
41
  # Push home changes to remote
38
- GitOperator.new.commit(path, "finish #{GitflowType.name(GitflowType::FEATURE)} #{branch_name}")
39
- GitOperator.new.push(path, branch_name)
42
+ GitService.new.verify_push(path, "finish #{GitflowType.name(GitflowType::FEATURE)} #{branch_name}", branch_name, 'Home')
40
43
 
44
+ # Rebase Home
41
45
  GitService.new.verify_rebase(path, 'develop', 'Home')
42
46
 
43
47
  `open #{BigkeeperParser.home_pulls()}`
@@ -1,3 +1,5 @@
1
+ require 'big_keeper/util/logger'
2
+
1
3
  module BigKeeper
2
4
  def self.feature_pull(path, user)
3
5
  begin
@@ -5,7 +7,7 @@ module BigKeeper
5
7
  BigkeeperParser.parse("#{path}/Bigkeeper")
6
8
 
7
9
  branch_name = GitOperator.new.current_branch(path)
8
- raise 'Not a feature branch, exit.' unless branch_name.include? 'feature'
10
+ Logger.error('Not a feature branch, exit.') unless branch_name.include? 'feature'
9
11
 
10
12
  modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
11
13
  BigkeeperParser.module_names, ModuleType::PATH)
@@ -14,7 +16,7 @@ module BigKeeper
14
16
  ModuleService.new.pull(path, user, module_name, branch_name)
15
17
  end
16
18
 
17
- p "Pull branch #{branch_name} for home..."
19
+ Logger.highlight("Pull branch '#{branch_name}' for 'Home'...")
18
20
  GitOperator.new.pull(path)
19
21
  ensure
20
22
  end
@@ -0,0 +1,29 @@
1
+ require 'big_keeper/util/logger'
2
+
3
+ module BigKeeper
4
+
5
+ def self.feature_push(path, user, comment)
6
+ begin
7
+ # Parse Bigkeeper file
8
+ BigkeeperParser.parse("#{path}/Bigkeeper")
9
+
10
+ branch_name = GitOperator.new.current_branch(path)
11
+ Logger.error("Not a feature branch, exit.") unless branch_name.include? 'feature'
12
+
13
+ modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
14
+ BigkeeperParser.module_names, ModuleType::PATH)
15
+
16
+ modules.each do |module_name|
17
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
18
+ module_branch_name = GitOperator.new.current_branch(module_full_path)
19
+
20
+ Logger.highlight("Push branch '#{branch_name}' for module '#{module_name}'...")
21
+ GitService.new.verify_push(path, comment, module_branch_name, module_name)
22
+ end
23
+
24
+ Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
25
+ GitService.new.verify_push(path, comment, branch_name, 'Home')
26
+ ensure
27
+ end
28
+ end
29
+ end
@@ -3,6 +3,8 @@
3
3
  require 'big_keeper/util/podfile_operator'
4
4
  require 'big_keeper/util/gitflow_operator'
5
5
  require 'big_keeper/util/bigkeeper_parser'
6
+ require 'big_keeper/util/logger'
7
+ require 'big_keeper/util/pod_operator'
6
8
 
7
9
  require 'big_keeper/model/podfile_type'
8
10
 
@@ -26,7 +28,7 @@ module BigKeeper
26
28
  BigkeeperParser.module_names, ModuleType::PATH)
27
29
 
28
30
  # Stash current branch
29
- StashService.new.stash(path, branch_name, user, stash_modules)
31
+ StashService.new.stash_all(path, branch_name, user, stash_modules)
30
32
 
31
33
  # Handle modules
32
34
  if modules
@@ -37,6 +39,7 @@ module BigKeeper
37
39
  modules = BigkeeperParser.module_names
38
40
  end
39
41
 
42
+ Logger.highlight("Add branch '#{branch_name}' for 'Home'...")
40
43
  # Start home feature
41
44
  GitService.new.start(path, feature_name, GitflowType::FEATURE)
42
45
 
@@ -46,11 +49,10 @@ module BigKeeper
46
49
  end
47
50
 
48
51
  # pod install
49
- p `pod install --project-directory=#{path}`
52
+ PodOperator.pod_install(path)
50
53
 
51
54
  # Push home changes to remote
52
- GitOperator.new.commit(path, "init #{GitflowType.name(GitflowType::FEATURE)} #{feature_name}")
53
- GitOperator.new.push(path, branch_name)
55
+ GitService.new.verify_push(path, "init #{GitflowType.name(GitflowType::FEATURE)} #{feature_name}", branch_name, 'Home')
54
56
 
55
57
  # Open home workspace
56
58
  `open #{path}/*.xcworkspace`
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
  require 'big_stash/stash_operator'
3
+ require 'big_keeper/util/logger'
4
+ require 'big_keeper/util/pod_operator'
3
5
 
4
6
  module BigKeeper
5
7
  def self.feature_switch(path, version, user, name)
@@ -13,18 +15,18 @@ module BigKeeper
13
15
 
14
16
  GitService.new.verify_branch(path, branch_name, OperateType::SWITCH)
15
17
 
16
- stath_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
18
+ stash_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
17
19
  BigkeeperParser.module_names, ModuleType::PATH)
18
20
 
19
21
  # Stash current branch
20
- StashService.new.stash(path, branch_name, user, stath_modules)
22
+ StashService.new.stash_all(path, branch_name, user, stash_modules)
21
23
 
22
24
  # Switch to new feature
23
25
  GitOperator.new.git_checkout(path, branch_name)
24
26
  GitOperator.new.pull(path)
25
27
 
26
28
  # Apply home stash
27
- BigStash::StashOperator.new(path).pop_stash(branch_name)
29
+ StashService.new.pop_stash(path, branch_name, 'Home')
28
30
 
29
31
  modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
30
32
  BigkeeperParser.module_names, ModuleType::PATH)
@@ -34,7 +36,7 @@ module BigKeeper
34
36
  end
35
37
 
36
38
  # pod install
37
- p `pod install --project-directory=#{path}`
39
+ PodOperator.pod_install(path)
38
40
 
39
41
  # Open home workspace
40
42
  `open #{path}/*.xcworkspace`
@@ -3,6 +3,8 @@
3
3
  require 'big_keeper/util/podfile_operator'
4
4
  require 'big_keeper/util/gitflow_operator'
5
5
  require 'big_keeper/util/bigkeeper_parser'
6
+ require 'big_keeper/util/logger'
7
+ require 'big_keeper/util/pod_operator'
6
8
 
7
9
  require 'big_keeper/model/podfile_type'
8
10
 
@@ -17,7 +19,7 @@ module BigKeeper
17
19
  BigkeeperParser.parse("#{path}/Bigkeeper")
18
20
 
19
21
  branch_name = GitOperator.new.current_branch(path)
20
- raise "Not a feature branch, exit." unless branch_name.include? 'feature'
22
+ Logger.error("Not a feature branch, exit.") unless branch_name.include? 'feature'
21
23
 
22
24
  feature_name = branch_name.gsub(/feature\//, '')
23
25
 
@@ -33,11 +35,13 @@ module BigKeeper
33
35
  modules = BigkeeperParser.module_names
34
36
  end
35
37
 
38
+ Logger.highlight("Start to update modules for branch '#{branch_name}'...")
39
+
36
40
  add_modules = modules - current_modules
37
41
  del_modules = current_modules - modules
38
42
 
39
43
  if add_modules.empty? and del_modules.empty?
40
- p "There is nothing changed with modules #{modules}."
44
+ Logger.info("There is nothing changed with modules #{modules}.")
41
45
  else
42
46
  # Modify podfile as path and Start modules feature
43
47
  add_modules.each do |module_name|
@@ -49,7 +53,7 @@ module BigKeeper
49
53
  end
50
54
 
51
55
  # pod install
52
- p `pod install --project-directory=#{path}`
56
+ PodOperator.pod_install(path)
53
57
 
54
58
  # Open home workspace
55
59
  `open #{path}/*.xcworkspace`
@@ -4,7 +4,7 @@ require 'big_keeper/util/podfile_operator'
4
4
  require 'big_keeper/util/gitflow_operator'
5
5
  require 'big_keeper/util/bigkeeper_parser'
6
6
  require 'big_keeper/model/podfile_type'
7
- require 'big_keeper/util/log_util'
7
+ require 'big_keeper/util/logger'
8
8
 
9
9
  module BigKeeper
10
10
 
@@ -19,9 +19,9 @@ module BigKeeper
19
19
  unlock_pod_list = detector.get_unlock_pod_list
20
20
  # Print out unlock pod list
21
21
  unlock_pod_list.each do |pod_name|
22
- BigKeeperLog.default("#{pod_name} should be locked.")
22
+ Logger.default("#{pod_name} should be locked.")
23
23
  end
24
- BigKeeperLog.separator
24
+ Logger.separator
25
25
 
26
26
  end
27
27
 
@@ -37,11 +37,11 @@ module BigKeeper
37
37
  # Get Version
38
38
  dictionary = detector.deal_lock_file(path,unlock_pod_list)
39
39
  if dictionary.empty?
40
- BigKeeperLog.warning("There is nothing to be locked.")
40
+ Logger.warning("There is nothing to be locked.")
41
41
  else
42
42
  PodfileOperator.new.find_and_lock("#{path}/Podfile",dictionary)
43
- BigKeeperLog.highlight("The Podfile has been changed.")
44
- BigKeeperLog.separator
43
+ Logger.highlight("The Podfile has been changed.")
44
+ Logger.separator
45
45
  end
46
46
 
47
47
 
@@ -3,7 +3,7 @@ require 'big_keeper/util/podfile_operator'
3
3
  require 'big_keeper/util/gitflow_operator'
4
4
  require 'big_keeper/model/podfile_type'
5
5
  require 'big_keeper/util/info_plist_operator'
6
- require 'big_keeper/util/log_util'
6
+ require 'big_keeper/util/logger'
7
7
 
8
8
  module BigKeeper
9
9
  def self.release_home_start(path, version, user)
@@ -16,7 +16,7 @@ module BigKeeper
16
16
  if GitOperator.new.has_branch(path, "release/#{version}")
17
17
  if GitOperator.new.current_branch(path) == "release/#{version}"
18
18
  GitOperator.new.commit(path, "release: V #{version}")
19
- GitOperator.new.push(path, "release/#{version}")
19
+ GitOperator.new.first_push(path, "release/#{version}")
20
20
  GitflowOperator.new.finish_release(path, version)
21
21
  if GitOperator.new.current_branch(path) == "master"
22
22
  GitOperator.new.tag(path, version)
@@ -25,10 +25,10 @@ module BigKeeper
25
25
  GitOperator.new.tag(path, version)
26
26
  end
27
27
  else
28
- raise BigKeeperLog.error("Not in release branch, please check your branches.")
28
+ raise Logger.error("Not in release branch, please check your branches.")
29
29
  end
30
30
  else
31
- raise BigKeeperLog.error("Not has release branch, please use release start first.")
31
+ raise Logger.error("Not has release branch, please use release start first.")
32
32
  end
33
33
  end
34
34
  end
@@ -37,18 +37,20 @@ module BigKeeper
37
37
  def self.start_release(project_path, version, modules, user)
38
38
  Dir.chdir(project_path) do
39
39
  # step 0 Stash current branch
40
- StashService.new.stash(project_path, GitOperator.new.current_branch(project_path), user, modules)
40
+ StashService.new.stash_all(project_path, GitOperator.new.current_branch(project_path), user, modules)
41
41
 
42
+ Logger.highlight(%Q(Start to checkout Branch release/#{version}))
42
43
  # step 1 checkout release
43
44
  if GitOperator.new.current_branch(project_path) != "release/#{version}"
44
45
  if GitOperator.new.has_branch(project_path, "release/#{version}")
45
46
  GitOperator.new.git_checkout(project_path, "release/#{version}")
46
47
  else
47
48
  GitflowOperator.new.start(project_path, version, GitflowType::RELEASE)
48
- GitOperator.new.push(project_path, "release/#{version}")
49
+ GitOperator.new.first_push(project_path, "release/#{version}")
49
50
  end
50
51
  end
51
52
 
53
+ Logger.highlight(%Q(Start to release/#{version}))
52
54
  # step 2 replace_modules
53
55
  PodfileOperator.new.replace_all_module_release(%Q(#{project_path}/Podfile),
54
56
  modules,
@@ -57,8 +59,8 @@ module BigKeeper
57
59
  # step 3 change Info.plist value
58
60
  InfoPlistOperator.new.change_version_build(project_path, version)
59
61
 
60
- p `pod install --project-directory=#{project_path}`
61
- p `open #{project_path}/*.xcworkspace`
62
+ PodOperator.pod_install(project_path)
63
+ `open #{project_path}/*.xcworkspace`
62
64
  end
63
65
  end
64
66
  end
@@ -0,0 +1,86 @@
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.start_module_release(path, version, user, module_name)
11
+ BigkeeperParser.parse("#{path}/Bigkeeper")
12
+ Dir.chdir(path) do
13
+ module_release(BigkeeperParser::module_path(user, module_name),
14
+ version,
15
+ module_name,
16
+ GitInfo.new(BigkeeperParser::home_git, GitType::TAG, version),
17
+ user)
18
+ end
19
+ end
20
+
21
+ private
22
+ def self.module_release(module_path, version, module_name, source, user)
23
+ Dir.chdir(module_path) do
24
+ if GitOperator.new.has_changes(module_path)
25
+ StashService.new.stash_all(module_path, GitOperator.new.current_branch(module_path), user, module_name.split())
26
+ end
27
+
28
+ # step 1 checkout release
29
+ Logger.highlight(%Q(Start checkout #{module_name} to Branch release/#{version}))
30
+ if GitOperator.new.current_branch(module_path) != "release/#{version}"
31
+ if GitOperator.new.has_branch(module_path, "release/#{version}")
32
+ GitOperator.new.git_checkout(module_path, "release/#{version}")
33
+ else
34
+ GitflowOperator.new.start(module_path, version, GitflowType::RELEASE)
35
+ GitOperator.new.first_push(module_path, "release/#{version}")
36
+ end
37
+ end
38
+
39
+ #修改 podspec 文件
40
+ # TO DO: - advanced to use Regular Expression
41
+ PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
42
+ GitOperator.new.commit(module_path, "update podspec")
43
+ GitOperator.new.first_push(module_path, GitOperator.new.current_branch(module_path))
44
+
45
+ # Pod lib lint in release/#{tag} branch
46
+ Logger.highlight(%Q(Start Pod lib lint #{module_name}))
47
+ has_error = false
48
+ IO.popen("pod lib lint --allow-warnings --verbose --use-libraries --sources=#{BigkeeperParser::sourcemodule_path}") do |io|
49
+ io.each do |line|
50
+ has_error = true if line.include? "ERROR"
51
+ end
52
+ end
53
+ if has_error
54
+ Logger.error("Pod lib error in '#{module_name}'")
55
+ return
56
+ end
57
+
58
+ # check out master
59
+ if GitOperator.new.current_branch(module_path) != "master"
60
+ current_name = GitOperator.new.current_branch(module_path)
61
+ GitOperator.new.git_checkout(module_path, "master")
62
+ Logger.highlight("Push branch '#{branch_name}' for '#{module_name}'...")
63
+ GitService.new.verify_push(module_path, "finish #{GitflowType.name(GitflowType::RELEASE)} #{branch_name}", "master", "#{module_name}")
64
+ end
65
+
66
+ # to do rebase release to master
67
+ Logger.highlight(%Q(Rebase develop to master))
68
+ GitService.new.verify_rebase(module_path, 'develop', "#{module_name}")
69
+
70
+ Logger.highlight(%Q(Start Pod repo push #{module_name}))
71
+ IO.popen("pod repo push #{module_name} #{module_name}.podspec --allow-warnings --sources=#{BigkeeperParser::sourcemodule_path}") do |io|
72
+ io.each do |line|
73
+ has_error = true if line.include? "ERROR"
74
+ end
75
+ end
76
+ if has_error
77
+ Logger.error("Pod repo push in '#{module_name}'")
78
+ return
79
+ end
80
+
81
+ GitOperator.new.tag(module_path, version)
82
+
83
+ Logger.highlight(%Q(Success release #{module_name}))
84
+ end
85
+ end
86
+ end
@@ -1,6 +1,7 @@
1
1
  require 'big_keeper/util/git_operator'
2
2
  require 'big_keeper/model/gitflow_type'
3
3
  require 'big_keeper/model/operate_type'
4
+ require 'big_keeper/util/logger'
4
5
 
5
6
  module BigKeeper
6
7
  # Operator for got
@@ -9,7 +10,7 @@ module BigKeeper
9
10
  if GitOperator.new.has_remote_branch(path, 'master')
10
11
  if GitOperator.new.has_local_branch(path, 'master')
11
12
  if GitOperator.new.has_commits(path, 'master')
12
- raise %Q('master' has unpushed commits, you should fix it)
13
+ Logger.error(%Q('master' has unpushed commits, you should fix it))
13
14
  else
14
15
  GitOperator.new.git_checkout(path, 'master')
15
16
  GitOperator.new.pull(path)
@@ -22,7 +23,7 @@ module BigKeeper
22
23
  if GitOperator.new.has_remote_branch(path, 'develop')
23
24
  if GitOperator.new.has_local_branch(path, 'develop')
24
25
  if GitOperator.new.has_commits(path, 'develop')
25
- raise %Q('develop' has unpushed commits, you should fix it)
26
+ Logger.error(%Q('develop' has unpushed commits, you should fix it))
26
27
  else
27
28
  GitOperator.new.git_checkout(path, 'develop')
28
29
  GitOperator.new.pull(path)
@@ -33,8 +34,8 @@ module BigKeeper
33
34
  end
34
35
 
35
36
  if !GitflowOperator.new.verify_git_flow(path)
36
- GitOperator.new.push(path, 'develop') if !GitOperator.new.has_remote_branch(path, 'develop')
37
- GitOperator.new.push(path, 'master') if !GitOperator.new.has_remote_branch(path, 'master')
37
+ GitOperator.new.first_push(path, 'develop') if !GitOperator.new.has_remote_branch(path, 'develop')
38
+ GitOperator.new.first_push(path, 'master') if !GitOperator.new.has_remote_branch(path, 'master')
38
39
  end
39
40
 
40
41
  branch_name = "#{GitflowType.name(type)}/#{name}"
@@ -43,36 +44,37 @@ module BigKeeper
43
44
  GitOperator.new.pull(path)
44
45
  else
45
46
  GitflowOperator.new.start(path, name, type)
46
- GitOperator.new.push(path, branch_name)
47
+ GitOperator.new.first_push(path, branch_name)
47
48
  end
48
49
  end
49
50
 
50
51
  def verify_branch(path, branch_name, type)
52
+ Logger.highlight('Sync local branchs from remote, waiting...')
51
53
  GitOperator.new.git_fetch(path)
52
54
 
53
55
  if OperateType::START == type
54
56
  if GitOperator.new.current_branch(path) == branch_name
55
- raise %(Current branch is '#{branch_name}' already. Use 'update' please)
57
+ Logger.error(%(Current branch is '#{branch_name}' already. Use 'update' please))
56
58
  end
57
59
  if GitOperator.new.has_branch(path, branch_name)
58
- raise %(Branch '#{branch_name}' already exists. Use 'switch' please)
60
+ Logger.error(%(Branch '#{branch_name}' already exists. Use 'switch' please))
59
61
  end
60
62
  elsif OperateType::SWITCH == type
61
63
  if !GitOperator.new.has_branch(path, branch_name)
62
- raise %(Can't find a branch named '#{branch_name}'. Use 'start' please)
64
+ Logger.error(%(Can't find a branch named '#{branch_name}'. Use 'start' please))
63
65
  end
64
66
  if GitOperator.new.current_branch(path) == branch_name
65
- raise %(Current branch is '#{branch_name}' already. Use 'update' please)
67
+ Logger.error(%(Current branch is '#{branch_name}' already. Use 'update' please))
66
68
  end
67
69
  elsif OperateType::UPDATE == type
68
70
  if !GitOperator.new.has_branch(path, branch_name)
69
- raise %(Can't find a branch named '#{branch_name}'. Use 'start' please)
71
+ Logger.error(%(Can't find a branch named '#{branch_name}'. Use 'start' please))
70
72
  end
71
73
  if GitOperator.new.current_branch(path) != branch_name
72
- raise %(Current branch is not '#{branch_name}'. Use 'switch' please)
74
+ Logger.error(%(Current branch is not '#{branch_name}'. Use 'switch' please))
73
75
  end
74
76
  else
75
- raise %(Not a valid command for '#{branch_name}'.)
77
+ Logger.error(%(Not a valid command for '#{branch_name}'.))
76
78
  end
77
79
  end
78
80
 
@@ -88,25 +90,39 @@ module BigKeeper
88
90
  branchs
89
91
  end
90
92
 
93
+ def verify_push(path, comment, branch_name, name)
94
+ git = GitOperator.new
95
+ if git.has_changes(path)
96
+ git.commit(path, comment)
97
+ if git.has_remote_branch(path, branch_name)
98
+ git.push(path)
99
+ else
100
+ git.first_push(path, branch_name)
101
+ end
102
+ else
103
+ Logger.default("Nothing to push for '#{name}'.")
104
+ end
105
+ end
106
+
91
107
  def verify_rebase(path, branch_name, name)
92
108
  Dir.chdir(path) do
93
109
  IO.popen("git rebase #{branch_name} --ignore-whitespace") do |io|
94
110
  unless io.gets
95
- raise "#{name} is already in a rebase-apply, Please:\n\
111
+ Logger.error("#{name} is already in a rebase-apply, Please:\n\
96
112
  1.Resolve it;\n\
97
113
  2.Commit the changes;\n\
98
114
  3.Push to remote;\n\
99
115
  4.Create a MR;\n\
100
- 5.Run 'finish' again."
116
+ 5.Run 'finish' again.")
101
117
  end
102
118
  io.each do |line|
103
119
  next unless line.include? 'Merge conflict'
104
- raise "Merge conflict in #{name}, Please:\n\
120
+ Logger.error("Merge conflict in #{name}, Please:\n\
105
121
  1.Resolve it;\n\
106
122
  2.Commit the changes;\n\
107
123
  3.Push to remote;\n\
108
124
  4.Create a MR;\n\
109
- 5.Run 'finish' again."
125
+ 5.Run 'finish' again.")
110
126
  end
111
127
  end
112
128
  `git push -f origin #{branch_name}`
@@ -1,4 +1,5 @@
1
1
  require 'big_keeper/service/git_service'
2
+ require 'big_keeper/util/logger'
2
3
 
3
4
  module BigKeeper
4
5
  # Operator for got
@@ -6,19 +7,23 @@ module BigKeeper
6
7
  def pull(path, user, module_name, branch_name)
7
8
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
8
9
 
10
+ Logger.highlight("Pull branch '#{branch_name}' for module '#{module_name}'...")
11
+
9
12
  if !File.exist? module_full_path
13
+ Logger.default("No local repository for module '#{module_name}', clone it...")
10
14
  module_git = BigkeeperParser.module_git(module_name)
11
15
  GitOperator.new.clone(File.expand_path("#{module_full_path}/../"), module_git)
12
16
  GitOperator.new.git_checkout(module_full_path, branch_name)
13
17
  else
14
18
  current_branch_name = GitOperator.new.current_branch(module_full_path)
15
19
  if current_branch_name != branch_name
16
- p "Current branch of #{module_name} is #{current_branch_name},\
17
- stash it and checkout #{branch_name}..."
18
- BigStash::StashOperator.new(module_full_path).stash(current_branch_name)
20
+ Logger.default("Current branch of '#{module_name}' is '#{current_branch_name}',\
21
+ stash it and checkout '#{branch_name}'...")
22
+
23
+ StashService.new.stash(module_full_path, current_branch_name, module_name)
24
+
19
25
  GitOperator.new.git_checkout(module_full_path, branch_name)
20
26
  end
21
- p "Pull branch #{branch_name} for module #{module_name}..."
22
27
  GitOperator.new.pull(module_full_path)
23
28
  end
24
29
  end
@@ -26,9 +31,10 @@ module BigKeeper
26
31
  def switch(path, user, module_name, branch_name)
27
32
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
28
33
 
29
- p "Switch to branch #{branch_name} for module #{module_name}..."
34
+ Logger.highlight("Switch to branch '#{branch_name}' for module '#{module_name}'...")
30
35
 
31
36
  if !File.exist? module_full_path
37
+ Logger.default("No local repository for module '#{module_name}', clone it...")
32
38
  module_git = BigkeeperParser.module_git(module_name)
33
39
  GitOperator.new.clone(File.expand_path("#{module_full_path}/../"), module_git)
34
40
  GitOperator.new.git_checkout(module_full_path, branch_name)
@@ -37,7 +43,7 @@ module BigKeeper
37
43
  GitOperator.new.pull(module_full_path)
38
44
  end
39
45
 
40
- BigStash::StashOperator.new(module_full_path).pop_stash(branch_name)
46
+ StashService.new.pop_stash(module_full_path, branch_name, module_name)
41
47
  end
42
48
 
43
49
  def finish(path, user, module_name)
@@ -45,7 +51,7 @@ module BigKeeper
45
51
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
46
52
  branch_name = GitOperator.new.current_branch(module_full_path)
47
53
 
48
- p "Finish branch #{branch_name} for module #{module_name}..."
54
+ Logger.highlight("Finish branch '#{branch_name}' for module '#{module_name}'...")
49
55
 
50
56
  PodfileOperator.new.find_and_replace("#{path}/Podfile",
51
57
  module_name,
@@ -60,27 +66,29 @@ module BigKeeper
60
66
  def add(path, user, module_name, name, type)
61
67
  branch_name = "#{GitflowType.name(type)}/#{name}"
62
68
 
63
- p "Add branch #{branch_name} for module #{module_name}..."
69
+ Logger.highlight("Add branch '#{branch_name}' for module '#{module_name}'...")
64
70
 
65
71
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
66
72
 
67
73
  # clone module if not exist
68
74
  if !File.exist? module_full_path
75
+ Logger.default("No local repository for module #{module_name}, clone it...")
69
76
  module_git = BigkeeperParser.module_git(module_name)
70
77
  GitOperator.new.clone(File.expand_path("#{module_full_path}/../"), module_git)
71
78
  end
72
79
 
73
80
  # stash current branch
74
81
  current_branch_name = GitOperator.new.current_branch(module_full_path)
75
- BigStash::StashOperator.new(module_full_path).stash(current_branch_name)
82
+
83
+ StashService.new.stash(module_full_path, current_branch_name, module_name)
76
84
 
77
85
  # start new feature/hotfix
78
86
  GitService.new.start(module_full_path, name, type)
79
87
 
80
- # apply stash
81
- BigStash::StashOperator.new(module_full_path).pop_stash(branch_name)
88
+ StashService.new.pop_stash(module_full_path, branch_name, module_name)
82
89
 
83
90
  module_path = BigkeeperParser.module_path(user, module_name)
91
+
84
92
  PodfileOperator.new.find_and_replace("#{path}/Podfile",
85
93
  module_name,
86
94
  ModuleType::PATH,
@@ -90,11 +98,11 @@ module BigKeeper
90
98
  def del(path, user, module_name, name, type)
91
99
  branch_name = "#{GitflowType.name(type)}/#{name}"
92
100
 
93
- p "del branch #{branch_name} for module #{module_name}..."
101
+ Logger.highlight("Delete branch '#{branch_name}' for module '#{module_name}'...")
94
102
 
95
103
  module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
96
104
 
97
- BigStash::StashOperator.new(module_full_path).stash(branch_name)
105
+ StashService.new.stash(module_full_path, branch_name, module_name)
98
106
 
99
107
  GitOperator.new.git_checkout(module_full_path, 'develop')
100
108
  GitOperator.new.del(module_full_path, branch_name)
@@ -1,42 +1,45 @@
1
1
  require 'big_stash/stash_operator'
2
2
  require 'big_keeper/util/bigkeeper_parser'
3
3
  require 'big_keeper/util/git_operator'
4
+ require 'big_keeper/util/logger'
4
5
 
5
6
  module BigKeeper
6
7
  # Operator for got
7
8
  class StashService
8
- def stash(path, new_branch_name, user, modules)
9
+ def pop_stash(path, branch_name, name)
10
+ # pop stash
11
+ if BigStash::StashOperator.new(path).stash_for_name(branch_name)
12
+ Logger.highlight(%Q(Branch '#{branch_name}' of '#{name}' has stash , start to pop...))
13
+ BigStash::StashOperator.new(path).pop_stash(branch_name)
14
+ end
15
+ end
16
+
17
+ def stash(path, branch_name, name)
18
+ # stash
19
+ if GitOperator.new.has_changes(path)
20
+ Logger.highlight(%Q(Branch '#{branch_name}' of '#{name}' needs stash , start to stash...))
21
+ BigStash::StashOperator.new(path).stash(branch_name)
22
+ end
23
+ end
24
+
25
+ def stash_all(path, new_branch_name, user, modules)
9
26
  # Stash modules
27
+ Logger.highlight('Stash for current workspace...')
28
+
10
29
  modules.each do |module_name|
11
30
  module_path = BigkeeperParser.module_full_path(path, user, module_name)
12
31
  branch_name = GitOperator.new.current_branch(module_path)
13
32
 
14
33
  if branch_name != new_branch_name
15
- p %Q(Current branch of '#{module_name}' is '#{branch_name}', start to stash...)
16
- BigStash::StashOperator.new(module_path).stash(branch_name)
17
- else
18
- p %Q(Current branch name of '#{module_name}' is the same with new branch, continue...)
34
+ stash(module_path, branch_name, module_name)
19
35
  end
20
36
  end
21
37
 
22
38
  # Stash home
23
39
  branch_name = GitOperator.new.current_branch(path)
24
40
  if branch_name != new_branch_name
25
- p %Q(Current branch of home is '#{branch_name}', start to stash...)
26
- BigStash::StashOperator.new(path).stash(branch_name)
27
- else
28
- p "Current branch name of home is the same with new branch, continue..."
29
- end
30
- end
31
-
32
- def pop_stash(path, user, branch_name, modules)
33
- # Stash modules
34
- modules.each do |module_name|
35
- module_path = BigkeeperParser.module_full_path(path, user, module_name)
36
- BigStash::StashOperator.new(module_path).pop_stash(branch_name)
41
+ stash(path, branch_name, 'Home')
37
42
  end
38
- # Stash home
39
- BigStash::StashOperator.new(path).pop_stash(branch_name)
40
43
  end
41
44
  end
42
45
  end
@@ -72,9 +72,15 @@ module BigKeeper
72
72
  end
73
73
  end
74
74
 
75
- def push(path, branch_name)
75
+ def first_push(path, branch_name)
76
76
  Dir.chdir(path) do
77
- p `git push -u origin #{branch_name}`
77
+ `git push -u origin #{branch_name}`
78
+ end
79
+ end
80
+
81
+ def push(path)
82
+ Dir.chdir(path) do
83
+ p `git push`
78
84
  end
79
85
  end
80
86
 
@@ -6,7 +6,7 @@ module BigKeeper
6
6
  def start(path, name, type)
7
7
  Dir.chdir(path) do
8
8
  gitflow_type_name = GitflowType.name(type)
9
- p `git flow #{gitflow_type_name} start #{name}`
9
+ `git flow #{gitflow_type_name} start #{name}`
10
10
  end
11
11
  end
12
12
 
@@ -12,8 +12,8 @@ module BigKeeper
12
12
  end
13
13
  info_plist_path = find_infoPlist_filePath(path)
14
14
  result = Plist.parse_xml(info_plist_path)
15
+ result['CFBundleVersion'] = getBuildVersion(version, result['CFBundleShortVersionString'], result['CFBundleVersion']).to_s
15
16
  result['CFBundleShortVersionString'] = version.to_s
16
- result['CFBundleVersion'] = getBuildVersion(version, result['CFBundleShortVersionString'], result['CFBundleVersion'])
17
17
  Plist::Emit.save_plist(result, info_plist_path)
18
18
  puts %Q('Version has changed to #{version}')
19
19
  end
@@ -6,7 +6,7 @@ module BigKeeper
6
6
  ERROR_LOG = 3
7
7
  WARNING_LOG = 4
8
8
 
9
- class BigKeeperLog
9
+ class Logger
10
10
 
11
11
  def self.log_with_type(sentence,type)
12
12
  case type
@@ -0,0 +1,14 @@
1
+ require 'big_keeper/util/logger'
2
+
3
+ module BigKeeper
4
+ class PodOperator
5
+ def self.pod_install(path)
6
+ Logger.highlight('Start pod install, waiting...')
7
+
8
+ # pod install
9
+ `pod install --project-directory=#{path}`
10
+
11
+ Logger.highlight('Finish pod install.')
12
+ end
13
+ end
14
+ end
@@ -1,6 +1,6 @@
1
1
  require 'big_keeper/util/bigkeeper_parser'
2
2
  require 'big_keeper/model/podfile_model'
3
- require 'big_keeper/util/log_util'
3
+ require 'big_keeper/util/logger'
4
4
 
5
5
  module BigKeeper
6
6
 
@@ -17,7 +17,7 @@ class PodfileDetector
17
17
 
18
18
  def get_unlock_pod_list
19
19
  podfile_lines = File.readlines("#{@main_path}/Podfile")
20
- BigKeeperLog.highlight("Analyzing Podfile...") unless podfile_lines.size.zero?
20
+ Logger.highlight("Analyzing Podfile...") unless podfile_lines.size.zero?
21
21
  podfile_lines.collect do |sentence|
22
22
  deal_podfile_line(sentence) unless sentence =~(/(\d+.){1,2}\d+/)
23
23
  end
@@ -39,7 +39,7 @@ class PodfileDetector
39
39
  def deal_lock_file(main_path,deal_list)
40
40
  $result = {}
41
41
  podfile_lock_lines = File.readlines("#{main_path}/Podfile.lock")
42
- BigKeeperLog.highlight("Analyzing Podfile.lock...") unless podfile_lock_lines.size.zero?
42
+ Logger.highlight("Analyzing Podfile.lock...") unless podfile_lock_lines.size.zero?
43
43
  podfile_lock_lines.select do |sentence|
44
44
  if sentence.include?('DEPENDENCIES') #指定范围解析 Dependencies 之前
45
45
  break
@@ -1,3 +1,3 @@
1
1
  module BigKeeper
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: big_keeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mmoaay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-07 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -221,17 +221,16 @@ files:
221
221
  - docs/zh-CN/README.md
222
222
  - docs/zh-CN/RELEASE.md
223
223
  - lib/big_keeper.rb
224
- - lib/big_keeper/command/feature_finish.rb
225
- - lib/big_keeper/command/feature_pull.rb
226
- - lib/big_keeper/command/feature_push.rb
227
- - lib/big_keeper/command/feature_start.rb
228
- - lib/big_keeper/command/feature_switch.rb
229
- - lib/big_keeper/command/feature_update.rb
230
- - lib/big_keeper/command/hotfix_start.rb
231
- - lib/big_keeper/command/podfile_lock.rb
232
- - lib/big_keeper/command/release_home.rb
233
- - lib/big_keeper/command/release_module.rb
234
- - lib/big_keeper/command/start_module_release.sh
224
+ - lib/big_keeper/command/feature&hotfix/feature_finish.rb
225
+ - lib/big_keeper/command/feature&hotfix/feature_pull.rb
226
+ - lib/big_keeper/command/feature&hotfix/feature_push.rb
227
+ - lib/big_keeper/command/feature&hotfix/feature_start.rb
228
+ - lib/big_keeper/command/feature&hotfix/feature_switch.rb
229
+ - lib/big_keeper/command/feature&hotfix/feature_update.rb
230
+ - lib/big_keeper/command/pod/podfile_lock.rb
231
+ - lib/big_keeper/command/release/release_home.rb
232
+ - lib/big_keeper/command/release/release_module.rb
233
+ - lib/big_keeper/command/release/release_module.sh
235
234
  - lib/big_keeper/model/gitflow_type.rb
236
235
  - lib/big_keeper/model/operate_type.rb
237
236
  - lib/big_keeper/model/podfile_model.rb
@@ -243,7 +242,8 @@ files:
243
242
  - lib/big_keeper/util/git_operator.rb
244
243
  - lib/big_keeper/util/gitflow_operator.rb
245
244
  - lib/big_keeper/util/info_plist_operator.rb
246
- - lib/big_keeper/util/log_util.rb
245
+ - lib/big_keeper/util/logger.rb
246
+ - lib/big_keeper/util/pod_operator.rb
247
247
  - lib/big_keeper/util/podfile_detector.rb
248
248
  - lib/big_keeper/util/podfile_operator.rb
249
249
  - lib/big_keeper/version.rb
@@ -1,37 +0,0 @@
1
- module BigKeeper
2
-
3
- def self.feature_push(path, user, comment)
4
- begin
5
- # Parse Bigkeeper file
6
- BigkeeperParser.parse("#{path}/Bigkeeper")
7
-
8
- branch_name = GitOperator.new.current_branch(path)
9
- raise "Not a feature branch, exit." unless branch_name.include? 'feature'
10
-
11
- modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
12
- BigkeeperParser.module_names, ModuleType::PATH)
13
-
14
- modules.each do |module_name|
15
- module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
16
- module_branch_name = GitOperator.new.current_branch(module_full_path)
17
-
18
- if GitOperator.new.has_changes(module_full_path)
19
- p "Push branch #{branch_name} for module #{module_name}..."
20
- GitOperator.new.commit(module_full_path, comment)
21
- GitOperator.new.push(module_full_path, module_branch_name)
22
- else
23
- p "Nothing to push for #{module_name}."
24
- end
25
- end
26
-
27
- if GitOperator.new.has_changes(path)
28
- p "Push branch #{branch_name} for home..."
29
- GitOperator.new.commit(path, comment)
30
- GitOperator.new.push(path, branch_name)
31
- else
32
- p "Nothing to push for home."
33
- end
34
- ensure
35
- end
36
- end
37
- end
File without changes
@@ -1,70 +0,0 @@
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/log_util'
8
-
9
- module BigKeeper
10
- def self.start_module_release(path, version, user, module_name)
11
- BigkeeperParser.parse("#{path}/Bigkeeper")
12
- Dir.chdir(path) do
13
- module_release(BigkeeperParser::module_path(user, module_name),
14
- version,
15
- module_name,
16
- GitInfo.new(BigkeeperParser::home_git, GitType::TAG, version),
17
- user)
18
- end
19
- end
20
-
21
- private
22
- def self.module_release(module_path, version, module_name, source, user)
23
- Dir.chdir(module_path) do
24
- if GitOperator.new.has_changes(module_path)
25
- StashService.new.stash(module_path, GitOperator.new.current_branch(module_path), user, module_name.split())
26
- end
27
-
28
- # step 1 checkout release
29
- if GitOperator.new.current_branch(module_path) != "release/#{version}"
30
- if GitOperator.new.has_branch(module_path, "release/#{version}")
31
- GitOperator.new.git_checkout(module_path, "release/#{version}")
32
- else
33
- GitflowOperator.new.start(module_path, version, GitflowType::RELEASE)
34
- GitOperator.new.push(module_path, "release/#{version}")
35
- end
36
- end
37
- p "path----"
38
- puts GitOperator.new.current_branch(module_path)
39
- #修改 podspec 文件
40
- # TO DO: - advanced to use Regular Expression
41
- has_error = false
42
- IO.popen("pod lib lint --allow-warnings --verbose --use-libraries --sources=#{BigkeeperParser::sourcemodule_path}") do |io|
43
- io.each do |line|
44
- has_error = true if line.include? "ERROR"
45
- end
46
- end
47
- if has_error
48
- puts "error"
49
- return
50
- end
51
-
52
- puts "error------"
53
- # PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
54
- # p `pod lib lint --allow-warnings --verbose --use-libraries --sources=#{BigkeeperParser::sourcemodule_path}`
55
-
56
- # GitOperator.new.commit(module_path, "update podspec")
57
- # GitOperator.new.push(module_path, GitOperator.new.current_branch(module_path))
58
- # if GitOperator.new.current_branch(module_path) != "master"
59
- # current_name = GitOperator.new.current_branch(module_path)
60
- # p `git checkout master`
61
- # p `git merge #{current_name}`
62
- # p `git push`
63
- # end
64
- # GitOperator.new.tag(module_path, version)
65
-
66
- # p `pod repo push #{module_name} #{module_name}.podspec --allow-warnings --sources=#{BigkeeperParser::sourcemodule_path}`
67
-
68
- end
69
- end
70
- end