kookeeper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE.md +20 -0
  3. data/.gitignore +50 -0
  4. data/.travis.yml +19 -0
  5. data/CODE_OF_CONDUCT.md +46 -0
  6. data/CONTRIBUTING.md +70 -0
  7. data/Gemfile +10 -0
  8. data/Gemfile.lock +125 -0
  9. data/LICENSE +21 -0
  10. data/README.md +113 -0
  11. data/Rakefile +2 -0
  12. data/big_keeper.gemspec +49 -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 +54 -0
  17. data/docs/zh-CN/BIGKEEPER_FILE.md +84 -0
  18. data/docs/zh-CN/FEATURE&HOTFIX.md +88 -0
  19. data/docs/zh-CN/IMAGE.md +0 -0
  20. data/docs/zh-CN/PODFILE.md +43 -0
  21. data/docs/zh-CN/README.md +113 -0
  22. data/docs/zh-CN/RECOMMEND.md +22 -0
  23. data/docs/zh-CN/RELEASE.md +60 -0
  24. data/docs/zh-CN/SPEC.md +39 -0
  25. data/lib/big_keeper/command/client.rb +50 -0
  26. data/lib/big_keeper/command/feature&hotfix/delete.rb +40 -0
  27. data/lib/big_keeper/command/feature&hotfix/finish.rb +54 -0
  28. data/lib/big_keeper/command/feature&hotfix/list.rb +63 -0
  29. data/lib/big_keeper/command/feature&hotfix/publish.rb +56 -0
  30. data/lib/big_keeper/command/feature&hotfix/pull.rb +26 -0
  31. data/lib/big_keeper/command/feature&hotfix/push.rb +27 -0
  32. data/lib/big_keeper/command/feature&hotfix/rebase.rb +32 -0
  33. data/lib/big_keeper/command/feature&hotfix/start.rb +74 -0
  34. data/lib/big_keeper/command/feature&hotfix/switch.rb +46 -0
  35. data/lib/big_keeper/command/feature&hotfix/update.rb +66 -0
  36. data/lib/big_keeper/command/feature&hotfix.rb +167 -0
  37. data/lib/big_keeper/command/image/image.rb +0 -0
  38. data/lib/big_keeper/command/image.rb +28 -0
  39. data/lib/big_keeper/command/init.rb +36 -0
  40. data/lib/big_keeper/command/pod/podfile.rb +72 -0
  41. data/lib/big_keeper/command/pod.rb +55 -0
  42. data/lib/big_keeper/command/release/finish.rb +36 -0
  43. data/lib/big_keeper/command/release/home.rb +92 -0
  44. data/lib/big_keeper/command/release/module.rb +65 -0
  45. data/lib/big_keeper/command/release/publish.rb +4 -0
  46. data/lib/big_keeper/command/release/start.rb +78 -0
  47. data/lib/big_keeper/command/release.rb +100 -0
  48. data/lib/big_keeper/command/spec/add.rb +9 -0
  49. data/lib/big_keeper/command/spec/analyze.rb +88 -0
  50. data/lib/big_keeper/command/spec/delete.rb +9 -0
  51. data/lib/big_keeper/command/spec/list.rb +19 -0
  52. data/lib/big_keeper/command/spec/search.rb +9 -0
  53. data/lib/big_keeper/command/spec/sync.rb +12 -0
  54. data/lib/big_keeper/command/spec.rb +78 -0
  55. data/lib/big_keeper/dependency/dep_gradle_operator.rb +74 -0
  56. data/lib/big_keeper/dependency/dep_operator.rb +48 -0
  57. data/lib/big_keeper/dependency/dep_pod_operator.rb +130 -0
  58. data/lib/big_keeper/dependency/dep_service.rb +14 -0
  59. data/lib/big_keeper/dependency/dep_type.rb +33 -0
  60. data/lib/big_keeper/model/gitflow_type.rb +43 -0
  61. data/lib/big_keeper/model/library_model.rb +116 -0
  62. data/lib/big_keeper/model/operate_type.rb +30 -0
  63. data/lib/big_keeper/model/podfile_model.rb +33 -0
  64. data/lib/big_keeper/service/git_service.rb +211 -0
  65. data/lib/big_keeper/service/module_service.rb +224 -0
  66. data/lib/big_keeper/service/stash_service.rb +45 -0
  67. data/lib/big_keeper/util/bigkeeper_parser.rb +260 -0
  68. data/lib/big_keeper/util/cache_operator.rb +118 -0
  69. data/lib/big_keeper/util/code_operator.rb +37 -0
  70. data/lib/big_keeper/util/command_line_util.rb +9 -0
  71. data/lib/big_keeper/util/file_operator.rb +33 -0
  72. data/lib/big_keeper/util/git_operator.rb +242 -0
  73. data/lib/big_keeper/util/gitflow_operator.rb +51 -0
  74. data/lib/big_keeper/util/gradle_content_generator.rb +26 -0
  75. data/lib/big_keeper/util/gradle_file_operator.rb +339 -0
  76. data/lib/big_keeper/util/gradle_module_operator.rb +70 -0
  77. data/lib/big_keeper/util/info_plist_operator.rb +46 -0
  78. data/lib/big_keeper/util/leancloud_logger.rb +84 -0
  79. data/lib/big_keeper/util/list_generator.rb +101 -0
  80. data/lib/big_keeper/util/lockfile_parser.rb +143 -0
  81. data/lib/big_keeper/util/logger.rb +47 -0
  82. data/lib/big_keeper/util/pod_operator.rb +70 -0
  83. data/lib/big_keeper/util/podfile_detector.rb +102 -0
  84. data/lib/big_keeper/util/podfile_module.rb +63 -0
  85. data/lib/big_keeper/util/podfile_operator.rb +125 -0
  86. data/lib/big_keeper/util/verify_operator.rb +17 -0
  87. data/lib/big_keeper/util/version_config_operator.rb +29 -0
  88. data/lib/big_keeper/util/xcode_operator.rb +15 -0
  89. data/lib/big_keeper/version.rb +3 -0
  90. data/lib/big_keeper.rb +81 -0
  91. data/resources/banner.png +0 -0
  92. data/resources/command.png +0 -0
  93. data/resources/keynote/big-keeper-readme-analyze.key +0 -0
  94. data/resources/keynote/big-keeper-readme-example.key +0 -0
  95. data/resources/keynote/big-keeper-readme-feature.key +0 -0
  96. data/resources/keynote/big-keeper-readme-release.key +0 -0
  97. data/resources/readme/big-keeper-readme.001.png +0 -0
  98. data/resources/template/Bigkeeper +23 -0
  99. metadata +354 -0
@@ -0,0 +1,211 @@
1
+ require 'big_keeper/util/git_operator'
2
+ require 'big_keeper/util/gitflow_operator'
3
+ require 'big_keeper/model/gitflow_type'
4
+ require 'big_keeper/model/operate_type'
5
+ require 'big_keeper/util/logger'
6
+
7
+ module BigKeeper
8
+ # Operator for got
9
+ class GitService
10
+ def start(path, name, type)
11
+ git = GitOperator.new
12
+
13
+ branch_name = "#{GitflowType.name(type)}/#{name}"
14
+ if !git.has_remote_branch(path, branch_name) && !git.has_local_branch(path, branch_name)
15
+
16
+ verify_special_branch(path, 'master')
17
+ verify_special_branch(path, 'develop')
18
+
19
+ GitflowOperator.new.verify_git_flow(path)
20
+
21
+ GitflowOperator.new.start(path, name, type)
22
+ git.push_to_remote(path, branch_name)
23
+ else
24
+ verify_checkout(path, branch_name)
25
+
26
+ if !git.has_remote_branch(path, branch_name)
27
+ git.push_to_remote(path, branch_name)
28
+ end
29
+ end
30
+ end
31
+
32
+ def verify_checkout(path, branch_name)
33
+ Dir.chdir(path) do
34
+ cmd = "git checkout -b #{branch_name}"
35
+ if GitOperator.new.has_branch(path, branch_name)
36
+ cmd = "git checkout #{branch_name}"
37
+ end
38
+ IO.popen(cmd) do |io|
39
+ io.each do |line|
40
+ Logger.error("Checkout #{branch_name} failed.") if line.include? 'error'
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ def verify_checkout_pull(path, branch_name)
47
+ GitService.new.verify_checkout(path, branch_name)
48
+ GitService.new.pull(path, branch_name)
49
+ end
50
+
51
+ def verify_special_branch(path, name)
52
+ git = GitOperator.new
53
+
54
+ if git.has_remote_branch(path, name)
55
+ if git.has_local_branch(path, name)
56
+ if git.has_commits(path, name)
57
+ Logger.error(%Q('#{name}' has unpushed commits, you should fix it manually...))
58
+ end
59
+ pull(path, name)
60
+ else
61
+ git.checkout(path, name)
62
+ end
63
+ else
64
+ verify_checkout(path, name)
65
+ git.push_to_remote(path, name)
66
+ end
67
+ end
68
+
69
+ def verify_home_branch(path, branch_name, type)
70
+ Logger.highlight('Sync local branchs from remote, waiting...')
71
+ git = GitOperator.new
72
+
73
+ git.fetch(path)
74
+
75
+ if OperateType::START == type
76
+ if git.current_branch(path) == branch_name
77
+ Logger.error(%(Current branch is '#{branch_name}' already. Use 'update' please))
78
+ end
79
+ if git.has_branch(path, branch_name)
80
+ Logger.error(%(Branch '#{branch_name}' already exists. Use 'switch' please))
81
+ end
82
+ elsif OperateType::SWITCH == type
83
+ if !git.has_branch(path, branch_name)
84
+ Logger.error(%(Can't find a branch named '#{branch_name}'. Use 'start' please))
85
+ end
86
+ if git.current_branch(path) == branch_name
87
+ Logger.error(%(Current branch is '#{branch_name}' already. Use 'update' please))
88
+ end
89
+ elsif OperateType::UPDATE == type
90
+ if !git.has_branch(path, branch_name)
91
+ Logger.error(%(Can't find a branch named '#{branch_name}'. Use 'start' please))
92
+ end
93
+ if git.current_branch(path) != branch_name
94
+ Logger.error(%(Current branch is not '#{branch_name}'. Use 'switch' please))
95
+ end
96
+ else
97
+ Logger.error(%(Not a valid command for '#{branch_name}'.))
98
+ end
99
+ end
100
+
101
+ def current_branch_type(path)
102
+ branch_name = GitOperator.new.current_branch(path)
103
+ if branch_name =~ /^feature\/S*/
104
+ GitflowType::FEATURE
105
+ elsif branch_name =~ /^hotfix\/S*/
106
+ GitflowType::HOTFIX
107
+ elsif branch_name =~ /^release\/S*/
108
+ GitflowType::RELEASE
109
+ else
110
+ GitflowType::FEATURE
111
+ end
112
+ end
113
+
114
+ def branchs_with_type(path, type)
115
+ branchs = []
116
+ Dir.chdir(path) do
117
+ IO.popen('git branch -a') do | io |
118
+ io.each do | line |
119
+ branchs << line.gsub('\n', '') if line.include?('develop')
120
+ branchs << line.gsub(/\s/, '') if line =~ /[\s\S]*#{GitflowType.name(type)}*/
121
+ end
122
+ end
123
+ end
124
+ branchs
125
+ end
126
+
127
+ def pull(path, branch_name)
128
+ git = GitOperator.new
129
+ current_branch_name = git.current_branch(path)
130
+ if current_branch_name == branch_name
131
+ git.pull(path)
132
+ else
133
+ git.checkout(path, branch_name)
134
+ git.pull(path)
135
+ git.checkout(path, current_branch_name)
136
+ end
137
+ end
138
+
139
+ def verify_del(path, branch_name, name, type)
140
+ git = GitOperator.new
141
+
142
+ if git.has_local_branch(path, branch_name)
143
+ Logger.highlight("Delete local branch '#{branch_name}' for '#{name}'...")
144
+
145
+ if git.current_branch(path) == branch_name
146
+ git.discard(path)
147
+ git.checkout(path, GitflowType.base_branch(type))
148
+ end
149
+ git.del_local(path, branch_name)
150
+ end
151
+
152
+ if git.has_remote_branch(path, branch_name)
153
+ Logger.highlight("Delete remote branch '#{branch_name}' for '#{name}'...")
154
+ git.del_remote(path, branch_name)
155
+ end
156
+ end
157
+
158
+ def verify_push(path, comment, branch_name, name)
159
+ git = GitOperator.new
160
+ if git.has_changes(path) || git.has_commits(path, branch_name)
161
+
162
+ git.commit(path, comment) if git.has_changes(path)
163
+
164
+ if git.has_remote_branch(path, branch_name)
165
+ Dir.chdir(path) do
166
+ `git push`
167
+ end
168
+ else
169
+ git.push_to_remote(path, branch_name)
170
+ end
171
+
172
+ GitOperator.new.check_push_success(path, branch_name, "origin/#{branch_name}")
173
+ else
174
+ Logger.default("Nothing to push for '#{name}'.")
175
+ end
176
+ end
177
+
178
+ def verify_rebase(path, branch_name, name)
179
+
180
+ # pull rebased branch
181
+ pull(path, branch_name)
182
+
183
+ Dir.chdir(path) do
184
+ IO.popen("git rebase #{branch_name} --ignore-whitespace") do |io|
185
+ unless io.gets
186
+ Logger.error("#{name} is already in a rebase-apply, Please:\n"\
187
+ " 1.Resolve it;\n"\
188
+ " 2.Commit the changes;\n"\
189
+ " 3.Push to remote;\n"\
190
+ " 4.Create a MR;\n"\
191
+ " 5.Run 'finish' again.")
192
+ end
193
+ io.each do |line|
194
+ next unless line.include? 'Merge conflict'
195
+ Logger.error("Merge conflict in #{name}, Please:\n"\
196
+ " 1.Resolve it;\n"\
197
+ " 2.Commit the changes;\n"\
198
+ " 3.Push to remote;\n"\
199
+ " 4.Create a MR;\n"\
200
+ " 5.Run 'finish' again.")
201
+ end
202
+ end
203
+ if GitOperator.new.current_branch(path) != 'develop' && GitOperator.new.current_branch(path) != 'master'
204
+ `git push -f`
205
+ else
206
+ Logger.error("You should not push 'master' or 'develop'")
207
+ end
208
+ end
209
+ end
210
+ end
211
+ end
@@ -0,0 +1,224 @@
1
+ require 'big_keeper/service/git_service'
2
+
3
+ require 'big_keeper/util/logger'
4
+ require 'big_keeper/util/cache_operator'
5
+
6
+ module BigKeeper
7
+ # Operator for got
8
+ class ModuleService
9
+
10
+ def verify_module(path, user, module_name, home_branch_name, type)
11
+ name = home_branch_name.gsub(/#{GitflowType.name(type)}\//, '')
12
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
13
+
14
+ git = GitOperator.new
15
+ if !File.exist? module_full_path
16
+ Logger.default("No local repository for module '#{module_name}', clone it...")
17
+ module_git = BigkeeperParser.module_git(module_name)
18
+ git.clone(File.expand_path("#{module_full_path}/../"), module_git)
19
+ end
20
+
21
+ current_branch_name = git.current_branch(module_full_path)
22
+ if current_branch_name != home_branch_name
23
+ # stash current branch
24
+ StashService.new.stash(module_full_path, current_branch_name, module_name)
25
+
26
+ GitService.new.start(module_full_path, name, type)
27
+
28
+ StashService.new.pop_stash(module_full_path, home_branch_name, module_name)
29
+ end
30
+ end
31
+
32
+ def push(path, user, module_name, home_branch_name, type, comment)
33
+ Logger.highlight("Push branch '#{home_branch_name}' for module '#{module_name}'...")
34
+
35
+ verify_module(path, user, module_name, home_branch_name, type)
36
+
37
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
38
+ GitService.new.verify_push(module_full_path, comment, home_branch_name, module_name)
39
+ end
40
+
41
+ def rebase(path, user, module_name, home_branch_name, type)
42
+ Logger.highlight("Rebase '#{GitflowType.base_branch(type)}' "\
43
+ "to branch '#{home_branch_name}' for module "\
44
+ "'#{module_name}'...")
45
+
46
+ verify_module(path, user, module_name, home_branch_name, type)
47
+
48
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
49
+
50
+ Logger.error("You have some changes in branch "\
51
+ "'#{home_branch_name}' for module '#{module_name}'. "\
52
+ "Use 'push' first please") if GitOperator.new.has_changes(module_full_path)
53
+
54
+ GitService.new.verify_rebase(module_full_path, GitflowType.base_branch(type), module_name)
55
+ end
56
+
57
+ def pull(path, user, module_name, home_branch_name, type)
58
+ Logger.highlight("Pull branch '#{home_branch_name}' for module '#{module_name}'...")
59
+
60
+ verify_module(path, user, module_name, home_branch_name, type)
61
+
62
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
63
+ GitOperator.new.pull(module_full_path)
64
+ end
65
+
66
+ def switch_to(path, user, module_name, home_branch_name, type)
67
+ Logger.highlight("Switch to branch '#{home_branch_name}' for module '#{module_name}'...")
68
+
69
+ verify_module(path, user, module_name, home_branch_name, type)
70
+ end
71
+
72
+ def pre_publish(path, user, module_name, home_branch_name, type)
73
+ Logger.highlight("Prepare to publish branch '#{home_branch_name}' for module '#{module_name}'...")
74
+
75
+ verify_module(path, user, module_name, home_branch_name, type)
76
+
77
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
78
+ GitService.new.verify_push(module_full_path, "prepare to rebase '#{GitflowType.base_branch(type)}'", home_branch_name, module_name)
79
+ GitService.new.verify_rebase(module_full_path, GitflowType.base_branch(type), module_name)
80
+ end
81
+
82
+ def publish(path, user, module_name, home_branch_name, type)
83
+ Logger.highlight("Publish branch '#{home_branch_name}' for module '#{module_name}'...")
84
+
85
+ DepService.dep_operator(path, user).update_module_config(module_name, ModuleOperateType::PUBLISH)
86
+
87
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
88
+ GitService.new.verify_push(module_full_path, "publish branch #{home_branch_name}", home_branch_name, module_name)
89
+
90
+ `open #{BigkeeperParser.module_pulls(module_name)}`
91
+
92
+ ModuleCacheOperator.new(path).del_git_module(module_name)
93
+ end
94
+
95
+ def finish(path, user, module_name, home_branch_name, type)
96
+ Logger.highlight("Finish branch '#{home_branch_name}' for module '#{module_name}'...")
97
+
98
+ verify_module(path, user, module_name, home_branch_name, type)
99
+
100
+ DepService.dep_operator(path, user).update_module_config(module_name, ModuleOperateType::FINISH)
101
+
102
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
103
+ GitService.new.verify_push(module_full_path, "finish branch #{home_branch_name}", home_branch_name, module_name)
104
+
105
+ ModuleCacheOperator.new(path).add_git_module(module_name)
106
+ ModuleCacheOperator.new(path).del_path_module(module_name)
107
+ end
108
+
109
+ def add(path, user, module_name, name, type)
110
+ home_branch_name = "#{GitflowType.name(type)}/#{name}"
111
+ Logger.highlight("Add branch '#{home_branch_name}' for module '#{module_name}'...")
112
+
113
+ verify_module(path, user, module_name, home_branch_name, type)
114
+
115
+ DepService.dep_operator(path, user).update_module_config(module_name, ModuleOperateType::ADD)
116
+
117
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
118
+ GitService.new.verify_push(module_full_path, "init #{GitflowType.name(type)} #{name}", home_branch_name, module_name)
119
+
120
+ ModuleCacheOperator.new(path).add_path_module(module_name)
121
+ end
122
+
123
+ def del(path, user, module_name, name, type)
124
+ home_branch_name = "#{GitflowType.name(type)}/#{name}"
125
+
126
+ Logger.highlight("Delete branch '#{home_branch_name}' for module '#{module_name}'...")
127
+
128
+ module_git = BigkeeperParser.module_git(module_name)
129
+ DepService.dep_operator(path, user).update_module_config(module_name, ModuleOperateType::DELETE)
130
+
131
+ # Stash module current branch
132
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
133
+ current_branch_name = GitOperator.new.current_branch(module_full_path)
134
+ StashService.new.stash(module_full_path, current_branch_name, module_name)
135
+ GitOperator.new.checkout(module_full_path, GitflowType.base_branch(type))
136
+
137
+ ModuleCacheOperator.new(path).del_path_module(module_name)
138
+ end
139
+
140
+ def module_info(module_path, home_branch_name, user, type, module_name, version)
141
+ result_dic = {}
142
+ matched_branches = []
143
+ branches = GitService.new.branchs_with_type(module_path, type)
144
+ if version == 'all versions'
145
+ matched_branches = branches
146
+ else
147
+ branches.each do | branch |
148
+ matched_branches << branch if branch.include?(version)
149
+ end
150
+ end
151
+ result_dic[:module_name] = module_name
152
+ result_dic[:current_branch] = GitOperator.new.current_branch(module_path)
153
+ result_dic[:branches] = matched_branches
154
+ result_dic
155
+ end
156
+
157
+ def release_check_changed(path, user, module_name)
158
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
159
+
160
+ git = GitOperator.new
161
+ if !File.exist? module_full_path
162
+ Logger.default("No local repository for module '#{module_name}', clone it...")
163
+ module_git = BigkeeperParser.module_git(module_name)
164
+ git.clone(File.expand_path("#{module_full_path}/../"), module_git)
165
+ end
166
+ GitService.new.verify_checkout_pull(module_full_path, 'develop')
167
+ git.check_remote_branch_diff(module_full_path, 'develop', 'master')
168
+ end
169
+
170
+ def release_start(path, user, modules, module_name, version)
171
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
172
+
173
+ git = GitOperator.new
174
+ if !File.exist? module_full_path
175
+ Logger.default("No local repository for module '#{module_name}', clone it...")
176
+ module_git = BigkeeperParser.module_git(module_name)
177
+ git.clone(File.expand_path("#{module_full_path}/../"), module_git)
178
+ end
179
+ #stash module
180
+ StashService.new.stash(module_full_path, GitOperator.new.current_branch(module_full_path), module_name)
181
+ # delete cache
182
+ CacheOperator.new(module_full_path).clean()
183
+ # checkout develop
184
+ GitService.new.verify_checkout_pull(module_full_path, 'develop')
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
+ end
195
+
196
+ def release_finish(path, user, modules, module_name, version)
197
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
198
+
199
+ git = GitOperator.new
200
+ if !File.exist? module_full_path
201
+ Logger.default("No local repository for module '#{module_name}', clone it...")
202
+ module_git = BigkeeperParser.module_git(module_name)
203
+ git.clone(File.expand_path("#{module_full_path}/../"), module_git)
204
+ end
205
+ #stash module
206
+ StashService.new.stash(module_full_path, GitOperator.new.current_branch(module_full_path), module_name)
207
+ # delete cache
208
+ CacheOperator.new(module_full_path).clean()
209
+ # checkout develop
210
+ GitService.new.verify_checkout_pull(module_full_path, 'develop')
211
+ DepService.dep_operator(path, user).release_module_finish(modules, module_name, version)
212
+
213
+ # Push home changes to remote
214
+ Logger.highlight("Push branch 'develop' for #{module_name}...")
215
+ GitService.new.verify_push(
216
+ module_full_path,
217
+ "release finish for #{version}",
218
+ 'develop',
219
+ "#{module_name}")
220
+ end
221
+
222
+ private :verify_module
223
+ end
224
+ end
@@ -0,0 +1,45 @@
1
+ require 'big_stash/stash_operator'
2
+ require 'big_keeper/util/bigkeeper_parser'
3
+ require 'big_keeper/util/git_operator'
4
+ require 'big_keeper/util/logger'
5
+
6
+ module BigKeeper
7
+ # Operator for got
8
+ class StashService
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)
26
+ # Stash modules
27
+ Logger.highlight('Stash for current workspace...')
28
+
29
+ modules.each do |module_name|
30
+ module_path = BigkeeperParser.module_full_path(path, user, module_name)
31
+ branch_name = GitOperator.new.current_branch(module_path)
32
+
33
+ if branch_name != new_branch_name
34
+ stash(module_path, branch_name, module_name)
35
+ end
36
+ end
37
+
38
+ # Stash home
39
+ branch_name = GitOperator.new.current_branch(path)
40
+ if branch_name != new_branch_name
41
+ stash(path, branch_name, 'Home')
42
+ end
43
+ end
44
+ end
45
+ end