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,22 @@
1
+ # 代码管理规范
2
+
3
+ ## 基本原则
4
+
5
+ - master 分支保证是线上最新包的代码。
6
+ - develop 分支保证是下一个发布包的代码,随时支持发布。
7
+
8
+ ### 开发和测试流程
9
+
10
+ feature 分支为 feature 开发和提测分支,提测前需要 rebase/merge develop 的代码,测试完成后,pr 到 develop 分支,确定下个版本发布才 accept pr。
11
+
12
+ ### develop 分支 bug 修复流程
13
+
14
+ 单独开分支,fix 完成后,pr 到 develop 分支。
15
+
16
+ ### 发布流程
17
+
18
+ develop->release->master 瞬间操作,release 不能长期存在。
19
+
20
+ ### hotfix 流程
21
+
22
+ master 拉出 hotfix,fix 完成后分别 pr 到 master、develop 两个分支,完成后新建发布版本。
@@ -0,0 +1,43 @@
1
+ # release - 功能开发流程
2
+
3
+ 直接在命令行执行 `big release --help` 可以查看其提供的所有功能:
4
+ ```
5
+ NAME
6
+ release - Release operations
7
+
8
+ SYNOPSIS
9
+ big [global options] release home
10
+ big [global options] release module
11
+
12
+ COMMANDS
13
+ home - Release home project operations
14
+ module - Start release module
15
+ ```
16
+ 全局参数如下:
17
+
18
+ - -u, --user:用户名,默认是 git global config 的 user.name,会显示在命令提示信息中,比如上述提示信息中的默认用户名是 mmoaay
19
+
20
+ - -p, --path:项目路径名,默认是当前所在的路径
21
+
22
+ - -v, --version:项目版本号,默认是当前所在的路径
23
+
24
+ 功能列表如下:
25
+
26
+ - home: 发布主工程命令
27
+ - start: 开始发布主工程的某个版本
28
+ - finish: 完成发布版本
29
+ - module: 发布模块命令
30
+ - start: 开始发布模块的某个版本
31
+ - finish: 完成发布版本
32
+
33
+ ## release 的工作区
34
+ 同 feature 工作区
35
+
36
+ ## release home start 流程
37
+ ![](../../resources/readme/big-keeper-readme.008.png)
38
+ ## release home finish 流程
39
+ ![](../../resources/readme/big-keeper-readme.009.png)
40
+ ## release module start 流程
41
+ ![](../../resources/readme/big-keeper-readme.010.png)
42
+ ## release module finish 流程
43
+ ![](../../resources/readme/big-keeper-readme.012.png)
@@ -0,0 +1,295 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'big_keeper/version'
4
+
5
+ require 'big_keeper/util/bigkeeper_parser'
6
+ require 'big_keeper/util/git_operator'
7
+
8
+ require 'big_keeper/model/gitflow_type'
9
+
10
+ require 'big_keeper/command/feature&hotfix/start'
11
+ require 'big_keeper/command/feature&hotfix/finish'
12
+ require 'big_keeper/command/feature&hotfix/switch'
13
+ require 'big_keeper/command/feature&hotfix/update'
14
+ require 'big_keeper/command/feature&hotfix/pull'
15
+ require 'big_keeper/command/feature&hotfix/push'
16
+ require 'big_keeper/command/pod/podfile'
17
+ require 'big_keeper/command/feature&hotfix/delete'
18
+ require 'big_keeper/command/release/home'
19
+ require 'big_keeper/command/release/module'
20
+
21
+ require 'big_keeper/service/git_service'
22
+
23
+ require 'gli'
24
+
25
+ include GLI::App
26
+
27
+ module BigKeeper
28
+ # Your code goes here...
29
+ program_desc 'Efficiency improvement for iOS&Android module development, iOSer&Android using this tool can make module development easier.'
30
+
31
+ flag %i[p path], default_value: './'
32
+ flag %i[v ver], default_value: 'Version in Bigkeeper file'
33
+ flag %i[u user], default_value: GitOperator.new.user.gsub(/[^0-9A-Za-z]/, '').downcase
34
+
35
+ path = ''
36
+ version = ''
37
+ user = GitOperator.new.user
38
+
39
+ pre do |global_options, _command, 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
+ end
44
+
45
+ if !GitflowOperator.new.verify_git_flow_command
46
+ p %Q('git-flow' not found, use 'brew install git-flow' to install it)
47
+ exit
48
+ end
49
+
50
+ desc 'Gitflow feature operations'
51
+ command :feature do |c|
52
+
53
+ c.desc 'Start a new feature with name for given modules and main project'
54
+ c.command :start do |start|
55
+ start.action do |global_options, options, args|
56
+ help_now!('user name is required') if user and user.empty?
57
+ help_now!('feature name is required') if args.length < 1
58
+ name = args[0]
59
+ modules = args[(1...args.length)] if args.length > 1
60
+ start(path, version, user, name, modules, GitflowType::FEATURE)
61
+ end
62
+ end
63
+
64
+ c.desc 'Update modules for the feature with name'
65
+ c.command :update do |update|
66
+ update.action do |global_options, options, args|
67
+ help_now!('user name is required') if user and user.empty?
68
+ modules = args[(0...args.length)] if args.length > 0
69
+ update(path, user, modules, GitflowType::FEATURE)
70
+ end
71
+ end
72
+
73
+ c.desc 'Switch to the feature with name'
74
+ c.command :switch do |switch|
75
+ switch.action do |global_options, options, args|
76
+ help_now!('user name is required') if user and user.empty?
77
+ help_now!('feature name is required') if args.length < 1
78
+ name = args[0]
79
+ switch_to(path, version, user, name, GitflowType::FEATURE)
80
+ end
81
+ end
82
+
83
+ c.desc 'Pull remote changes for current feature'
84
+ c.command :pull do |pull|
85
+ pull.action do |global_options, options, args|
86
+ help_now!('user name is required') if user and user.empty?
87
+ pull(path, user, GitflowType::FEATURE)
88
+ end
89
+ end
90
+
91
+ c.desc 'Push local changes to remote for current feature'
92
+ c.command :push do |push|
93
+ push.action do |global_options, options, args|
94
+ help_now!('user name is required') if user and user.empty?
95
+ help_now!('comment message is required') if args.length < 1
96
+ help_now!(%Q(comment message should be wrappered with '' or "")) if args.length > 1
97
+ comment = args[0]
98
+ push(path, user, comment, GitflowType::FEATURE)
99
+ end
100
+ end
101
+
102
+ c.desc 'Finish current feature'
103
+ c.command :finish do |finish|
104
+ finish.action do |global_options, options, args|
105
+ help_now!('user name is required') if user and user.empty?
106
+ finish(path, user, GitflowType::FEATURE)
107
+ end
108
+ end
109
+
110
+ c.desc 'Delete feature with name'
111
+ c.command :delete do |delete|
112
+ delete.action do |global_options, options, args|
113
+ help_now!('user name is required') if user and user.empty?
114
+ help_now!('feature name is required') if args.length < 1
115
+ name = args[0]
116
+ delete(path, user, name, GitflowType::FEATURE)
117
+ end
118
+ end
119
+
120
+ c.desc 'List all the features'
121
+ c.command :list do |list|
122
+ list.action do
123
+ branchs = GitService.new.branchs_with_type(File.expand_path(path), GitflowType::FEATURE)
124
+ branchs.each do |branch|
125
+ p branch
126
+ end
127
+ end
128
+ end
129
+ end
130
+
131
+ desc 'Gitflow hotfix operations'
132
+ command :hotfix do |c|
133
+
134
+ c.desc 'Start a new hotfix with name for given modules and main project'
135
+ c.command :start do |start|
136
+ start.action do |global_options, options, args|
137
+ help_now!('user name is required') if user and user.empty?
138
+ help_now!('hotfix name is required') if args.length < 1
139
+ name = args[0]
140
+ modules = args[(1...args.length)] if args.length > 1
141
+ start(path, version, user, name, modules, GitflowType::HOTFIX)
142
+ end
143
+ end
144
+
145
+ c.desc 'Update modules for the hotfix with name'
146
+ c.command :update do |update|
147
+ update.action do |global_options, options, args|
148
+ help_now!('user name is required') if user and user.empty?
149
+ modules = args[(0...args.length)] if args.length > 0
150
+ update(path, user, modules, GitflowType::HOTFIX)
151
+ end
152
+ end
153
+
154
+ c.desc 'Switch to the hotfix with name'
155
+ c.command :switch do |switch|
156
+ switch.action do |global_options, options, args|
157
+ help_now!('user name is required') if user and user.empty?
158
+ help_now!('hotfix name is required') if args.length < 1
159
+ name = args[0]
160
+ switch_to(path, version, user, name, GitflowType::HOTFIX)
161
+ end
162
+ end
163
+
164
+ c.desc 'Pull remote changes for current hotfix'
165
+ c.command :pull do |pull|
166
+ pull.action do |global_options, options, args|
167
+ help_now!('user name is required') if user and user.empty?
168
+ pull(path, user, GitflowType::HOTFIX)
169
+ end
170
+ end
171
+
172
+ c.desc 'Push local changes to remote for current hotfix'
173
+ c.command :push do |push|
174
+ push.action do |global_options, options, args|
175
+ help_now!('user name is required') if user and user.empty?
176
+ help_now!('comment message is required') if args.length < 1
177
+ help_now!(%Q(comment message should be wrappered with '' or "")) if args.length > 1
178
+ comment = args[0]
179
+ push(path, user, comment, GitflowType::HOTFIX)
180
+ end
181
+ end
182
+
183
+ c.desc 'Finish current hotfix'
184
+ c.command :finish do |finish|
185
+ finish.action do |global_options, options, args|
186
+ help_now!('user name is required') if user and user.empty?
187
+ finish(path, user, GitflowType::HOTFIX)
188
+ end
189
+ end
190
+
191
+ c.desc 'Delete hotfix with name'
192
+ c.command :delete do |delete|
193
+ delete.action do |global_options, options, args|
194
+ help_now!('user name is required') if user and user.empty?
195
+ help_now!('feature name is required') if args.length < 1
196
+ name = args[0]
197
+ delete(path, user, name, GitflowType::HOTFIX)
198
+ end
199
+ end
200
+
201
+ c.desc 'List all the hotfixes'
202
+ c.command :list do |list|
203
+ list.action do
204
+ branchs = GitService.new.branchs_with_type(File.expand_path(path), GitflowType::HOTFIX)
205
+ branchs.each do |branch|
206
+ p branch
207
+ end
208
+ end
209
+ end
210
+ end
211
+
212
+ desc 'Gitflow release operations'
213
+ command :release do |c|
214
+
215
+ c.desc 'Release home project operations'
216
+ c.command :home do |home|
217
+ home.desc 'Start release home project'
218
+ home.command :start do |start|
219
+ start.action do |global_options, options, args|
220
+ help_now!('user name is required') if user and user.empty?
221
+ raise Logger.error("release version is required") if version == nil
222
+ release_home_start(path, version, user)
223
+ end
224
+ end
225
+
226
+ home.desc 'Finish release home project'
227
+ home.command :finish do |finish|
228
+ finish.action do |global_options, options, args|
229
+ raise Logger.error("release version is required") if version == nil
230
+ release_home_finish(path, version)
231
+ end
232
+ end
233
+ end
234
+
235
+ c.desc 'release module'
236
+ c.command :module do |m|
237
+ m.desc 'Start release module project'
238
+ m.command :start do |start|
239
+ start.action do |global_options, options, args|
240
+ help_now!('module name is required') if args.length != 1
241
+ raise Logger.error("release version is required") if version == nil
242
+ module_name = args[0]
243
+ release_module_start(path, version, user, module_name)
244
+ end
245
+ end
246
+
247
+ m.desc 'finish release module project'
248
+ m.command :finish do |finish|
249
+ finish.action do |global_options, options, args|
250
+ help_now!('module name is required') if args.length != 1
251
+ raise Logger.error("release version is required") if version == nil
252
+ module_name = args[0]
253
+ release_module_finish(path, version, user, module_name)
254
+ end
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ desc 'Podfile operation'
261
+ command :podfile do |podfile|
262
+ podfile.flag %i[pod podfile]
263
+ podfile.desc 'Podfile'
264
+ path = ''
265
+
266
+ podfile.desc 'Detect podname should be locked.'
267
+ podfile.command :detect do |detect|
268
+ detect.action do |global_options,options,args|
269
+ podfile_detect(path)
270
+ end
271
+ end
272
+
273
+ podfile.desc 'Lock podname should be locked.'
274
+ podfile.command :lock do |lock|
275
+ lock.action do |global_options, options, args|
276
+ podfile_lock(path)
277
+ end
278
+ end
279
+
280
+ podfile.desc 'Update modules should be upgrade.'
281
+ podfile.command :update do |lock|
282
+ lock.action do |global_options, options, args|
283
+ podfile_modules_update(path)
284
+ end
285
+ end
286
+ end
287
+
288
+ desc 'Show version of bigkeeper'
289
+ command :version do |version|
290
+ version.action do |global_options, options, args|
291
+ p "bigkeeper (#{VERSION})"
292
+ end
293
+ end
294
+ exit run(ARGV)
295
+ end
@@ -0,0 +1,33 @@
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
+
9
+ require 'big_keeper/model/podfile_type'
10
+
11
+ require 'big_keeper/service/stash_service'
12
+ require 'big_keeper/service/module_service'
13
+
14
+
15
+ module BigKeeper
16
+ def self.delete(path, user, name, type)
17
+ begin
18
+ # Parse Bigkeeper file
19
+ BigkeeperParser.parse("#{path}/Bigkeeper")
20
+ branch_name = "#{GitflowType.name(type)}/#{name}"
21
+
22
+ modules = BigkeeperParser.module_names
23
+
24
+ modules.each do |module_name|
25
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
26
+ GitService.new.verify_del(module_full_path, branch_name, module_name, type)
27
+ end
28
+
29
+ GitService.new.verify_del(path, branch_name, 'Home', type)
30
+ ensure
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'big_keeper/util/podfile_operator'
4
+ require 'big_keeper/util/logger'
5
+ require 'big_keeper/util/pod_operator'
6
+ require 'big_keeper/util/xcode_operator'
7
+ require 'big_keeper/util/bigkeeper_parser'
8
+
9
+ require 'big_keeper/model/podfile_type'
10
+
11
+
12
+ module BigKeeper
13
+
14
+ def self.finish(path, user, type)
15
+ begin
16
+ # Parse Bigkeeper file
17
+ BigkeeperParser.parse("#{path}/Bigkeeper")
18
+
19
+ modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
20
+ BigkeeperParser.module_names, ModuleType::PATH)
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
+ # Rebase modules and modify podfile as git
26
+ modules.each do |module_name|
27
+ ModuleService.new.finish(path, user, module_name, branch_name, type)
28
+ end
29
+
30
+ Logger.highlight("Finish branch '#{branch_name}' for 'Home'")
31
+
32
+ # pod install
33
+ PodOperator.pod_install(path, false)
34
+
35
+ modules.each do |module_name|
36
+ module_git = BigkeeperParser.module_git(module_name)
37
+ PodfileOperator.new.find_and_replace("#{path}/Podfile",
38
+ module_name,
39
+ ModuleType::GIT,
40
+ GitInfo.new(module_git, GitType::BRANCH, GitflowType.base_branch(type)))
41
+ end
42
+
43
+ # Open home workspace
44
+ XcodeOperator.open_workspace(path)
45
+
46
+ # Push home changes to remote
47
+ GitService.new.verify_push(path, "finish branch #{branch_name}", branch_name, 'Home')
48
+
49
+ # Rebase Home
50
+ GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
51
+
52
+ `open #{BigkeeperParser.home_pulls()}`
53
+ ensure
54
+ end
55
+ end
56
+ end