big_keeper 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +106 -0
- data/LICENSE.txt +21 -0
- data/README.md +41 -0
- data/Rakefile +2 -0
- data/big_keeper.gemspec +40 -0
- data/bin/big-keeper +14 -0
- data/bin/setup +8 -0
- data/docs/en-US/FEATURE.md +0 -0
- data/docs/zh-CN/BIGKEEPER_FILE.md +62 -0
- data/docs/zh-CN/FEATURE.md +88 -0
- data/docs/zh-CN/README.md +76 -0
- data/lib/big_keeper/command/feature_finish.rb +47 -0
- data/lib/big_keeper/command/feature_pull.rb +23 -0
- data/lib/big_keeper/command/feature_push.rb +39 -0
- data/lib/big_keeper/command/feature_start.rb +60 -0
- data/lib/big_keeper/command/feature_switch.rb +43 -0
- data/lib/big_keeper/command/feature_update.rb +60 -0
- data/lib/big_keeper/command/hotfix_start.rb +0 -0
- data/lib/big_keeper/command/podfile_lock.rb +16 -0
- data/lib/big_keeper/command/release_home.rb +51 -0
- data/lib/big_keeper/command/release_module.rb +27 -0
- data/lib/big_keeper/command/start_module_release.sh +44 -0
- data/lib/big_keeper/model/gitflow_type.rb +19 -0
- data/lib/big_keeper/model/operate_type.rb +19 -0
- data/lib/big_keeper/model/podfile_type.rb +44 -0
- data/lib/big_keeper/service/git_service.rb +75 -0
- data/lib/big_keeper/service/module_service.rb +90 -0
- data/lib/big_keeper/service/stash_service.rb +42 -0
- data/lib/big_keeper/util/bigkeeper_parser.rb +167 -0
- data/lib/big_keeper/util/git_operator.rb +95 -0
- data/lib/big_keeper/util/gitflow_operator.rb +40 -0
- data/lib/big_keeper/util/info_plist_operator.rb +46 -0
- data/lib/big_keeper/util/podfile_detector.rb +140 -0
- data/lib/big_keeper/util/podfile_operator.rb +111 -0
- data/lib/big_keeper/version.rb +3 -0
- data/lib/big_keeper.rb +151 -0
- data/resources/readme/big-keeper-readme.001.png +0 -0
- data/resources/readme/big-keeper-readme.002.png +0 -0
- data/resources/readme/big-keeper-readme.003.png +0 -0
- data/resources/readme/big-keeper-readme.004.png +0 -0
- data/resources/readme/big-keeper-readme.005.png +0 -0
- data/resources/readme/big-keeper-readme.006.png +0 -0
- data/resources/readme/big-keeper-readme.007.png +0 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b396b98833d0bbe44d9345410e70963209fcb7b
|
4
|
+
data.tar.gz: 956e4effcef9a81e3c3e9eb062882f2b12ea0a5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0ed9db1e01734561b65d052fb2fbfab216e2c26753ef3d37374ebf0995da3ffe3bc6b6ed2e2642f94bea25ac0217fdae0d7d873429eae6993af58f0e2e85d536
|
7
|
+
data.tar.gz: 468006350087e7a75dbf23dbb1edd94db6beae239d4a8e62cb031afd9011ec0b2e5fa17b02771aa4018e1e3244b1867cafd24f1f2486b469834f675f94f32418
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
big_keeper (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://ruby.taobao.org/
|
8
|
+
specs:
|
9
|
+
CFPropertyList (2.3.3)
|
10
|
+
activesupport (4.2.7.1)
|
11
|
+
i18n (~> 0.7)
|
12
|
+
json (~> 1.7, >= 1.7.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
ast (2.3.0)
|
17
|
+
big_stash (0.2.0)
|
18
|
+
claide (1.0.1)
|
19
|
+
cocoapods (1.2.1)
|
20
|
+
activesupport (>= 4.0.2, < 5)
|
21
|
+
claide (>= 1.0.1, < 2.0)
|
22
|
+
cocoapods-core (= 1.2.1)
|
23
|
+
cocoapods-deintegrate (>= 1.0.1, < 2.0)
|
24
|
+
cocoapods-downloader (>= 1.1.3, < 2.0)
|
25
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
26
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
27
|
+
cocoapods-stats (>= 1.0.0, < 2.0)
|
28
|
+
cocoapods-trunk (>= 1.2.0, < 2.0)
|
29
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
30
|
+
colored2 (~> 3.1)
|
31
|
+
escape (~> 0.0.4)
|
32
|
+
fourflusher (~> 2.0.1)
|
33
|
+
gh_inspector (~> 1.0)
|
34
|
+
molinillo (~> 0.5.7)
|
35
|
+
nap (~> 1.0)
|
36
|
+
ruby-macho (~> 1.1)
|
37
|
+
xcodeproj (>= 1.4.4, < 2.0)
|
38
|
+
cocoapods-core (1.2.1)
|
39
|
+
activesupport (>= 4.0.2, < 5)
|
40
|
+
fuzzy_match (~> 2.0.4)
|
41
|
+
nap (~> 1.0)
|
42
|
+
cocoapods-deintegrate (1.0.1)
|
43
|
+
cocoapods-downloader (1.1.3)
|
44
|
+
cocoapods-plugins (1.0.0)
|
45
|
+
nap
|
46
|
+
cocoapods-search (1.0.0)
|
47
|
+
cocoapods-stats (1.0.0)
|
48
|
+
cocoapods-trunk (1.2.0)
|
49
|
+
nap (>= 0.8, < 2.0)
|
50
|
+
netrc (= 0.7.8)
|
51
|
+
cocoapods-try (1.1.0)
|
52
|
+
colored2 (3.1.2)
|
53
|
+
escape (0.0.4)
|
54
|
+
fourflusher (2.0.1)
|
55
|
+
fuzzy_match (2.0.4)
|
56
|
+
gh_inspector (1.0.2)
|
57
|
+
gli (2.16.1)
|
58
|
+
i18n (0.7.0)
|
59
|
+
json (1.8.3)
|
60
|
+
minitest (5.8.3)
|
61
|
+
molinillo (0.5.7)
|
62
|
+
nanaimo (0.2.3)
|
63
|
+
nap (1.1.0)
|
64
|
+
netrc (0.7.8)
|
65
|
+
parallel (1.12.0)
|
66
|
+
parser (2.4.0.0)
|
67
|
+
ast (~> 2.2)
|
68
|
+
plist (3.3.0)
|
69
|
+
powerpack (0.1.1)
|
70
|
+
rainbow (2.2.2)
|
71
|
+
rake
|
72
|
+
rake (10.5.0)
|
73
|
+
rubocop (0.50.0)
|
74
|
+
parallel (~> 1.10)
|
75
|
+
parser (>= 2.3.3.1, < 3.0)
|
76
|
+
powerpack (~> 0.1)
|
77
|
+
rainbow (>= 2.2.2, < 3.0)
|
78
|
+
ruby-progressbar (~> 1.7)
|
79
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
80
|
+
ruby-macho (1.1.0)
|
81
|
+
ruby-progressbar (1.9.0)
|
82
|
+
thread_safe (0.3.5)
|
83
|
+
tzinfo (1.2.2)
|
84
|
+
thread_safe (~> 0.1)
|
85
|
+
unicode-display_width (1.3.0)
|
86
|
+
xcodeproj (1.4.4)
|
87
|
+
CFPropertyList (~> 2.3.3)
|
88
|
+
claide (>= 1.0.1, < 2.0)
|
89
|
+
colored2 (~> 3.1)
|
90
|
+
nanaimo (~> 0.2.3)
|
91
|
+
|
92
|
+
PLATFORMS
|
93
|
+
ruby
|
94
|
+
|
95
|
+
DEPENDENCIES
|
96
|
+
big_keeper!
|
97
|
+
big_stash (~> 0.1)
|
98
|
+
bundler (~> 1.15)
|
99
|
+
cocoapods
|
100
|
+
gli (~> 2.16)
|
101
|
+
plist
|
102
|
+
rake (~> 10.0)
|
103
|
+
rubocop (~> 0.50.0)
|
104
|
+
|
105
|
+
BUNDLED WITH
|
106
|
+
1.15.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 mmoaay
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
[中文](docs/zh-CN/README.md)
|
2
|
+
|
3
|
+
---
|
4
|
+
|
5
|
+
# big-keeper - All in home project
|
6
|
+
|
7
|
+
big-keeper is an efficiency improvement for iOS modular development, iOSer using this tool can make modular development easier.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'big_keeper'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install big_keeper
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Run `big-keeper` to learn how to use big-keeper.
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
|
33
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/BigKeeper/big-keeper.
|
38
|
+
|
39
|
+
## License
|
40
|
+
|
41
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/big_keeper.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "big_keeper/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "big_keeper"
|
8
|
+
spec.version = BigKeeper::VERSION
|
9
|
+
spec.authors = ["mmoaay"]
|
10
|
+
spec.email = ["mmoaay@sina.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Efficiency improvement for iOS modular development.}
|
13
|
+
spec.description = %q{Efficiency improvement for iOS modular development, iOSer using this tool can make modular development easier.}
|
14
|
+
spec.homepage = "https://github.com/BigKeeper/big-keeper"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "bin"
|
30
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "gli", "~> 2.16"
|
36
|
+
spec.add_development_dependency "big_stash", "~> 0.1"
|
37
|
+
spec.add_development_dependency "cocoapods"
|
38
|
+
spec.add_development_dependency "plist"
|
39
|
+
spec.add_development_dependency "rubocop", "~> 0.50.0"
|
40
|
+
end
|
data/bin/big-keeper
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "big_keeper"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Bigkeeper 文件
|
2
|
+
|
3
|
+
首先,我们在主项目 Podfile 所在的目录加入 `Bigkeeper` 文件。
|
4
|
+
|
5
|
+
## 配置版本
|
6
|
+
|
7
|
+
```
|
8
|
+
version '2.8.8'
|
9
|
+
```
|
10
|
+
|
11
|
+
版本号的用途有:
|
12
|
+
|
13
|
+
- feature 和 hotfix 流程里面做为分支名前缀的一部分,方便后期通过版本号匹配分支;
|
14
|
+
- release 流程里面做为发布版本号,影响范围包括业务模块和主项目。
|
15
|
+
|
16
|
+
## 配置主项目
|
17
|
+
|
18
|
+
```
|
19
|
+
home 'BigKeeperMain', :git => 'git@github.com:BigKeeper/BigKeeperMain.git', :pulls => 'https://github.com/BigKeeper/BigKeeperMain/pulls'
|
20
|
+
```
|
21
|
+
|
22
|
+
这个配置包含三个部分:
|
23
|
+
|
24
|
+
- 主项目的名字;
|
25
|
+
- 主项目的 git 远程仓库地址;
|
26
|
+
- 主项目的 pull request / merge request 页面地址,完成某个 feature / hotfix 时,会自动打开这个页面,让开发者提交 pull request / merge request。
|
27
|
+
|
28
|
+
## 配置业务模块
|
29
|
+
|
30
|
+
```
|
31
|
+
modules do
|
32
|
+
pod 'BigKeeperModular', :git => 'git@github.com:BigKeeper/BigKeeperModular.git', :pulls => 'https://github.com/BigKeeper/BigKeeperModular/pulls'
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
这个配置包含可以配置多个业务模块,建议是把当前所有非第三方库都加入到这个配置里面:
|
37
|
+
|
38
|
+
- 业务模块在 Podfile 中的名字;
|
39
|
+
- 业务模块的 git 远程仓库地址;
|
40
|
+
- 业务模块的 pull request / merge request 页面地址,完成某个 feature / hotfix 时,会自动打开这个页面,让开发者提交 pull request / merge request。
|
41
|
+
|
42
|
+
## 配置用户自定义信息
|
43
|
+
|
44
|
+
```
|
45
|
+
user 'perry' do
|
46
|
+
pod 'BigKeeperModular', :path => '../BigKeeperModular'
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
如果用户需要配置一些自定义信息,比如业务模块在本地的路径,就可以增加一个这样的配置。
|
51
|
+
|
52
|
+
这个配置同样支持对指定的用户名(上述配置用户名为 perry)配置多个业务模块,目前支持的是:
|
53
|
+
|
54
|
+
- 配置业务模块的本地路径,通过这个路径,我们就可以在主工程直接对业务模块做一些 CocoaPods 和 git 相关的操作。
|
55
|
+
|
56
|
+
> 注:
|
57
|
+
>
|
58
|
+
> 1. 默认用户名是 git global config 的 user.name;
|
59
|
+
>
|
60
|
+
> 2. 默认我们会把本地路径配置成 `../{业务模块在 Podfile 中的名字}` 的形式,因为大部分情况下,我们会把项目都放在同级目录下,这也是我们推荐的;
|
61
|
+
>
|
62
|
+
> 3. 另外,在使用 big-keeper 相关功能时,如果某些业务模块并没有 clone 到本地,big-keeper 会根据之前配置的业务模块远程 git 地址 clone 业务模块仓库到**主项目同级目录下**。
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# feature - 功能开发流程
|
2
|
+
|
3
|
+
直接在命令行执行 `big-keeper feature --help` 可以查看其提供的所有功能:
|
4
|
+
|
5
|
+
```
|
6
|
+
NAME
|
7
|
+
feature - Feature operations
|
8
|
+
|
9
|
+
SYNOPSIS
|
10
|
+
big-keeper [global options] feature [command options] finish
|
11
|
+
big-keeper [global options] feature [command options] list
|
12
|
+
big-keeper [global options] feature [command options] pull
|
13
|
+
big-keeper [global options] feature [command options] push
|
14
|
+
big-keeper [global options] feature [command options] start
|
15
|
+
big-keeper [global options] feature [command options] switch
|
16
|
+
big-keeper [global options] feature [command options] update
|
17
|
+
|
18
|
+
COMMAND OPTIONS
|
19
|
+
-u, --user=arg - (default: mmoaay)
|
20
|
+
|
21
|
+
COMMANDS
|
22
|
+
finish - Finish current feature
|
23
|
+
list - List all the features
|
24
|
+
pull - Pull remote changes for current feature
|
25
|
+
push - Push local changes to remote for current feature
|
26
|
+
start - Start a new feature with name for given modules and main project
|
27
|
+
switch - Switch to the feature with name
|
28
|
+
update - Update moduels for the feature with name
|
29
|
+
```
|
30
|
+
|
31
|
+
全局参数如下:
|
32
|
+
|
33
|
+
- -u, --user:用户名,默认是 git global config 的 user.name,会显示在命令提示信息中,比如上述提示信息中的默认用户名是 mmoaay
|
34
|
+
|
35
|
+
功能列表如下:
|
36
|
+
|
37
|
+
- start:
|
38
|
+
开始一个新的 feature,输入参数依次为:
|
39
|
+
- feature 的名字;
|
40
|
+
- 开发该 feature 需要改动的业务模块名。可以多个,用空格隔开;如果不指定,取 **Bigkeeper 文件中所有的业务模块名**。
|
41
|
+
- finish:结束当前 feature;
|
42
|
+
- switch:切换到一个已经存在的 feature,输入参数为 feature 名;
|
43
|
+
- update:
|
44
|
+
更新一个 feature 需要改动的业务模块,输入参数依次为:
|
45
|
+
- feature 的名字;
|
46
|
+
- 开发该 feature 需要改动的业务模块名。可以多个,用空格隔开;如果不指定,取 **Bigkeeper 文件中所有的业务模块名**。
|
47
|
+
- pull:拉取当前 feature 主项目和业务模块的远程 git 仓库更新;
|
48
|
+
- push:提交并推送当前 feature 主项目和业务模块的本地变更到远程 git 仓库,输入参数为提交信息;
|
49
|
+
- list:显示当前的 feature 列表。
|
50
|
+
|
51
|
+
## feature 的工作区
|
52
|
+
|
53
|
+
![](../../resources/readme/big-keeper-readme.001.png)
|
54
|
+
|
55
|
+
feature 的工作区主要由两部分组成:
|
56
|
+
|
57
|
+
- 主项目;
|
58
|
+
- 相关业务模块,我们把 Podfile 中引用方式为 `:path => {业务模块本地路径}` 的模块做为相关业务模块。
|
59
|
+
|
60
|
+
主项目和每个相关业务模块又有各自的工作区,由三个部分组成:
|
61
|
+
|
62
|
+
- 当前代码区改动;
|
63
|
+
- stash 缓存区,当用户需要切换新的 feature 时,对于用户来不及提交的改动,我们会缓存到各个项目的 stash 中,(PS:所以代码突然不见了不要担心,都在 git 的 stash 里面),而当用户切换回某个 feature 时,我们会把和该 feature 分支同名的 stash 恢复回来,从而使用户可以继续开发之前未完成的部分,因为需要通过 feature 的分支名来匹配 stash,而 git stash 又没有提供给 stash 命名的功能,所以我们实现了 [big-stash](https://github.com/BigKeeper/big-stash) 来完成这个功能;
|
64
|
+
- git。
|
65
|
+
|
66
|
+
## feature start 流程
|
67
|
+
|
68
|
+
![](../../resources/readme/big-keeper-readme.002.png)
|
69
|
+
|
70
|
+
## feature finish 流程
|
71
|
+
|
72
|
+
![](../../resources/readme/big-keeper-readme.003.png)
|
73
|
+
|
74
|
+
## feature switch 流程
|
75
|
+
|
76
|
+
![](../../resources/readme/big-keeper-readme.004.png)
|
77
|
+
|
78
|
+
## feature update 流程
|
79
|
+
|
80
|
+
![](../../resources/readme/big-keeper-readme.005.png)
|
81
|
+
|
82
|
+
## feature pull 流程
|
83
|
+
|
84
|
+
![](../../resources/readme/big-keeper-readme.006.png)
|
85
|
+
|
86
|
+
## feature push 流程
|
87
|
+
|
88
|
+
![](../../resources/readme/big-keeper-readme.007.png)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
[English](../../README.md)
|
2
|
+
|
3
|
+
---
|
4
|
+
|
5
|
+
# big-keeper - 我好像做了一个假的模块化项目
|
6
|
+
|
7
|
+
big-keeper 是一个**iOS模块化项目过渡阶段**的效率提升工具,使用这个工具后,开发者**在主项目内**就可以完成**包括其他业务模块在内**所有代码的编写和管理。
|
8
|
+
|
9
|
+
> 注:目前只支持依赖 CocoaPods 管理的模块化工程。
|
10
|
+
|
11
|
+
我们仿照 CocoaPods 的做法,开发团队只需要在主项目中加入一个 Bigkeeper 文件,然后利用我们提供的 `big-keeper` 工具,即可更便捷的实现**代码分支**和**业务模块**的管理;另外,通过我们提供的工具,也能帮助开发者养成更规范的日常开发习惯,减轻项目管理者的负担。
|
12
|
+
|
13
|
+
## 应用场景
|
14
|
+
|
15
|
+
在模块化项目的过渡阶段,我们往往会碰到业务拆分不是那么彻底的情况(PS:比如主项目中仍然存在业务相关代码),这样就会导致一系列问题:
|
16
|
+
|
17
|
+
- 开发者开发一个 feature 时需要维护多个项目的分支,同时还要频繁修改主项目的 `Podfile`;
|
18
|
+
- 项目管理者需要花很大精力去和团队成员同步项目管理规范流程,尤其对于新人,挑战很大;
|
19
|
+
- 开发过程中如果碰到突发情况需要开新分支处理问题时对当前工作区的保存操作会很繁琐(PS:因为涉及到多个项目);
|
20
|
+
- 日常开发过程中类似 commit、pull、push 等操作比较繁琐(PS:因为涉及到多个项目)。
|
21
|
+
|
22
|
+
big-keeper 的出现就是为了解决这些问题。
|
23
|
+
|
24
|
+
> 注:也有很多人认为直接做一个完整的组件化项目更合理,而不需要采用这样曲折的方案,但是很多时候我们并没有这么多的精力直接去做这些事情,big-keeper 存在的价值也是为了帮助开发团队在**iOS模块化项目过渡阶段**能更轻松的往前走。
|
25
|
+
|
26
|
+
## 安装
|
27
|
+
|
28
|
+
- 当作 Ruby Gem 使用:
|
29
|
+
在项目的 Gemfile 中加入下面这行:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'big_keeper'
|
33
|
+
```
|
34
|
+
|
35
|
+
然后执行:
|
36
|
+
|
37
|
+
$ bundle
|
38
|
+
|
39
|
+
- 直接安装:
|
40
|
+
|
41
|
+
$ gem install big_keeper
|
42
|
+
|
43
|
+
## 使用方法
|
44
|
+
|
45
|
+
- [Bigkeeper 文件配置](BIGKEEPER_FILE.md)
|
46
|
+
- `big-keeper` 工具使用:
|
47
|
+
|
48
|
+
直接在命令行执行 `big-keeper` 可以查看其提供的所有功能:
|
49
|
+
|
50
|
+
```
|
51
|
+
NAME
|
52
|
+
big-keeper - Efficiency improvement for iOS modular development, iOSer using this tool can make modular development easier.
|
53
|
+
|
54
|
+
SYNOPSIS
|
55
|
+
big-keeper [global options] command [command options] [arguments...]
|
56
|
+
|
57
|
+
GLOBAL OPTIONS
|
58
|
+
--help - Show this message
|
59
|
+
-p, --path=arg - (default: ./)
|
60
|
+
-v, --ver=arg - (default: Version in Bigkeeper file)
|
61
|
+
|
62
|
+
COMMANDS
|
63
|
+
feature - Feature operations
|
64
|
+
help - Shows a list of commands or help for one command
|
65
|
+
release - Release operations
|
66
|
+
```
|
67
|
+
|
68
|
+
全局参数如下:
|
69
|
+
|
70
|
+
- -p, --path:主项目所在的目录,默认是执行 big-keeper 命令的当前目录;
|
71
|
+
- -v, --ver:版本号,如果没有指定的话,会以主项目 [Bigkeeper 文件](BIGKEEPER_FILE.md)中指定的版本为准。
|
72
|
+
|
73
|
+
功能列表如下:
|
74
|
+
|
75
|
+
- [feature](FEATURE.md):功能开发流程;
|
76
|
+
- [release](RELEASE.md):版本发布流程。
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'big_keeper/util/podfile_operator'
|
4
|
+
require 'big_keeper/util/bigkeeper_parser'
|
5
|
+
|
6
|
+
require 'big_keeper/model/podfile_type'
|
7
|
+
|
8
|
+
module BigKeeper
|
9
|
+
|
10
|
+
def self.feature_finish(path, user)
|
11
|
+
begin
|
12
|
+
# Parse Bigkeeper file
|
13
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
14
|
+
|
15
|
+
modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
|
16
|
+
BigkeeperParser.module_names, ModuleType::PATH)
|
17
|
+
|
18
|
+
branch_name = GitOperator.new.current_branch(path)
|
19
|
+
raise "Not a feature branch, exit." unless branch_name.include? 'feature'
|
20
|
+
|
21
|
+
# Rebase modules and modify podfile as git
|
22
|
+
modules.each do |module_name|
|
23
|
+
ModuleService.new.finish(path, user, module_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
BigkeeperParser.module_names.each do |module_name|
|
27
|
+
module_git = BigkeeperParser.module_git(module_name)
|
28
|
+
PodfileOperator.new.find_and_replace("#{path}/Podfile",
|
29
|
+
%Q('#{module_name}'),
|
30
|
+
ModuleType::GIT,
|
31
|
+
GitInfo.new(module_git, GitType::BRANCH, 'develop'))
|
32
|
+
end
|
33
|
+
|
34
|
+
# pod install
|
35
|
+
p `pod install --project-directory=#{path}`
|
36
|
+
|
37
|
+
# Push home changes to remote
|
38
|
+
GitOperator.new.commit(path, "finish #{GitflowType.name(GitflowType::FEATURE)} #{branch_name}")
|
39
|
+
GitOperator.new.push(path, branch_name)
|
40
|
+
|
41
|
+
GitService.new.verify_rebase(path, 'develop', 'Home')
|
42
|
+
|
43
|
+
`open #{BigkeeperParser.home_pulls()}`
|
44
|
+
ensure
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BigKeeper
|
2
|
+
def self.feature_pull(path, user)
|
3
|
+
begin
|
4
|
+
# Parse Bigkeeper file
|
5
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
6
|
+
|
7
|
+
branch_name = GitOperator.new.current_branch(path)
|
8
|
+
raise 'Not a feature branch, exit.' unless branch_name.include? 'feature'
|
9
|
+
|
10
|
+
modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
|
11
|
+
BigkeeperParser.module_names, ModuleType::PATH)
|
12
|
+
|
13
|
+
modules.each do |module_name|
|
14
|
+
ModuleService.new.pull(path, user, module_name, branch_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
p 'Start pulling home...'
|
18
|
+
GitOperator.new.pull(path, branch_name)
|
19
|
+
p 'Finish pulling home...'
|
20
|
+
ensure
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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 "Start pushing #{module_name}..."
|
20
|
+
GitOperator.new.commit(module_full_path, comment)
|
21
|
+
GitOperator.new.push(module_full_path, module_branch_name)
|
22
|
+
p "Finish pushing #{module_name}..."
|
23
|
+
else
|
24
|
+
p "Nothing to push for #{module_name}."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if GitOperator.new.has_changes(path)
|
29
|
+
p "Start pushing home..."
|
30
|
+
GitOperator.new.commit(path, comment)
|
31
|
+
GitOperator.new.push(path, branch_name)
|
32
|
+
p "Finish pushing home..."
|
33
|
+
else
|
34
|
+
p "Nothing to push for home."
|
35
|
+
end
|
36
|
+
ensure
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|