kookeeper 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.idea/.gitignore +8 -0
- data/.idea/bigkeeper.iml +68 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/CONTRIBUTING.md +70 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +145 -0
- data/LICENSE +21 -0
- data/README.md +113 -0
- data/big_keeper.gemspec +50 -0
- data/docs/en-US/FEATURE.md +0 -0
- data/docs/en-US/README.md +54 -0
- data/docs/zh-CN/BIGKEEPER_FILE.md +84 -0
- data/docs/zh-CN/FEATURE&HOTFIX.md +88 -0
- data/docs/zh-CN/IMAGE.md +0 -0
- data/docs/zh-CN/PODFILE.md +43 -0
- data/docs/zh-CN/README.md +113 -0
- data/docs/zh-CN/RECOMMEND.md +22 -0
- data/docs/zh-CN/RELEASE.md +60 -0
- data/docs/zh-CN/SPEC.md +39 -0
- data/lib/big_keeper/command/feature&hotfix/delete.rb +40 -0
- data/lib/big_keeper/command/feature&hotfix/finish.rb +54 -0
- data/lib/big_keeper/command/feature&hotfix/list.rb +63 -0
- data/lib/big_keeper/command/feature&hotfix/publish.rb +56 -0
- data/lib/big_keeper/command/feature&hotfix/pull.rb +26 -0
- data/lib/big_keeper/command/feature&hotfix/push.rb +27 -0
- data/lib/big_keeper/command/feature&hotfix/rebase.rb +32 -0
- data/lib/big_keeper/command/feature&hotfix/start.rb +74 -0
- data/lib/big_keeper/command/feature&hotfix/switch.rb +46 -0
- data/lib/big_keeper/command/feature&hotfix/update.rb +66 -0
- data/lib/big_keeper/command/feature&hotfix.rb +167 -0
- data/lib/big_keeper/command/image/image.rb +0 -0
- data/lib/big_keeper/command/image.rb +28 -0
- data/lib/big_keeper/command/pod/podfile.rb +69 -0
- data/lib/big_keeper/command/pod.rb +42 -0
- data/lib/big_keeper/command/release/home.rb +91 -0
- data/lib/big_keeper/command/release/module.rb +61 -0
- data/lib/big_keeper/command/release.rb +75 -0
- data/lib/big_keeper/command/spec/add.rb +9 -0
- data/lib/big_keeper/command/spec/analyze.rb +88 -0
- data/lib/big_keeper/command/spec/delete.rb +9 -0
- data/lib/big_keeper/command/spec/list.rb +19 -0
- data/lib/big_keeper/command/spec/search.rb +9 -0
- data/lib/big_keeper/command/spec/sync.rb +12 -0
- data/lib/big_keeper/command/spec.rb +78 -0
- data/lib/big_keeper/dependency/dep_gradle_operator.rb +56 -0
- data/lib/big_keeper/dependency/dep_operator.rb +32 -0
- data/lib/big_keeper/dependency/dep_pod_operator.rb +130 -0
- data/lib/big_keeper/dependency/dep_service.rb +14 -0
- data/lib/big_keeper/dependency/dep_type.rb +33 -0
- data/lib/big_keeper/model/gitflow_type.rb +43 -0
- data/lib/big_keeper/model/library_model.rb +116 -0
- data/lib/big_keeper/model/operate_type.rb +27 -0
- data/lib/big_keeper/model/podfile_model.rb +33 -0
- data/lib/big_keeper/service/git_service.rb +210 -0
- data/lib/big_keeper/service/module_service.rb +159 -0
- data/lib/big_keeper/service/stash_service.rb +45 -0
- data/lib/big_keeper/util/bigkeeper_parser.rb +244 -0
- data/lib/big_keeper/util/cache_operator.rb +116 -0
- data/lib/big_keeper/util/code_operator.rb +37 -0
- data/lib/big_keeper/util/file_operator.rb +33 -0
- data/lib/big_keeper/util/git_operator.rb +221 -0
- data/lib/big_keeper/util/gitflow_operator.rb +51 -0
- data/lib/big_keeper/util/gradle_operator.rb +209 -0
- data/lib/big_keeper/util/info_plist_operator.rb +46 -0
- data/lib/big_keeper/util/leancloud_logger.rb +72 -0
- data/lib/big_keeper/util/list_generator.rb +101 -0
- data/lib/big_keeper/util/logger.rb +46 -0
- data/lib/big_keeper/util/pod_operator.rb +70 -0
- data/lib/big_keeper/util/podfile_detector.rb +111 -0
- data/lib/big_keeper/util/podfile_module.rb +63 -0
- data/lib/big_keeper/util/podfile_operator.rb +117 -0
- data/lib/big_keeper/util/verify_operator.rb +17 -0
- data/lib/big_keeper/util/xcode_operator.rb +15 -0
- data/lib/big_keeper/version.rb +3 -0
- data/lib/big_keeper.rb +71 -0
- data/resources/banner.png +0 -0
- data/resources/command.png +0 -0
- data/resources/keynote/big-keeper-readme-analyze.key +0 -0
- data/resources/keynote/big-keeper-readme-example.key +0 -0
- data/resources/keynote/big-keeper-readme-feature.key +0 -0
- data/resources/keynote/big-keeper-readme-release.key +0 -0
- data/resources/readme/big-keeper-readme.001.png +0 -0
- metadata +85 -2
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'big_keeper/util/logger'
|
2
|
+
require 'big_keeper/util/cache_operator'
|
3
|
+
|
4
|
+
require 'big_keeper/dependency/dep_service'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
def self.pull(path, user, type)
|
8
|
+
begin
|
9
|
+
# Parse Bigkeeper file
|
10
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
11
|
+
branch_name = GitOperator.new.current_branch(path)
|
12
|
+
|
13
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
14
|
+
|
15
|
+
modules = ModuleCacheOperator.new(path).current_path_modules
|
16
|
+
|
17
|
+
modules.each do |module_name|
|
18
|
+
ModuleService.new.pull(path, user, module_name, branch_name, type)
|
19
|
+
end
|
20
|
+
|
21
|
+
Logger.highlight("Pull branch '#{branch_name}' for 'Home'...")
|
22
|
+
GitOperator.new.pull(path)
|
23
|
+
ensure
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'big_keeper/util/logger'
|
2
|
+
require 'big_keeper/util/cache_operator'
|
3
|
+
|
4
|
+
require 'big_keeper/dependency/dep_service'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
|
8
|
+
def self.push(path, user, comment, type)
|
9
|
+
begin
|
10
|
+
# Parse Bigkeeper file
|
11
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
12
|
+
branch_name = GitOperator.new.current_branch(path)
|
13
|
+
|
14
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
15
|
+
|
16
|
+
modules = ModuleCacheOperator.new(path).current_path_modules
|
17
|
+
|
18
|
+
modules.each do |module_name|
|
19
|
+
ModuleService.new.push(path, user, module_name, branch_name, type, comment)
|
20
|
+
end
|
21
|
+
|
22
|
+
Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
|
23
|
+
GitService.new.verify_push(path, comment, branch_name, 'Home')
|
24
|
+
ensure
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'big_keeper/util/logger'
|
2
|
+
require 'big_keeper/util/cache_operator'
|
3
|
+
|
4
|
+
require 'big_keeper/dependency/dep_service'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
def self.rebase(path, user, type)
|
8
|
+
begin
|
9
|
+
# Parse Bigkeeper file
|
10
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
11
|
+
branch_name = GitOperator.new.current_branch(path)
|
12
|
+
|
13
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
14
|
+
|
15
|
+
modules = ModuleCacheOperator.new(path).current_path_modules
|
16
|
+
|
17
|
+
modules.each do |module_name|
|
18
|
+
ModuleService.new.rebase(path, user, module_name, branch_name, type)
|
19
|
+
end
|
20
|
+
|
21
|
+
Logger.highlight("Rebase '#{GitflowType.base_branch(type)}' "\
|
22
|
+
"to branch '#{branch_name}' for 'Home'...")
|
23
|
+
|
24
|
+
# Rebase Home
|
25
|
+
Logger.error("You have some changes in branch '#{branch_name}' "\
|
26
|
+
"for 'Home'. Use 'push' first please") if GitOperator.new.has_changes(path)
|
27
|
+
|
28
|
+
GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
|
29
|
+
ensure
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'big_keeper/util/podfile_operator'
|
4
|
+
require 'big_keeper/util/gitflow_operator'
|
5
|
+
require 'big_keeper/util/bigkeeper_parser'
|
6
|
+
require 'big_keeper/util/logger'
|
7
|
+
require 'big_keeper/util/pod_operator'
|
8
|
+
require 'big_keeper/util/xcode_operator'
|
9
|
+
require 'big_keeper/util/cache_operator'
|
10
|
+
|
11
|
+
require 'big_keeper/dependency/dep_service'
|
12
|
+
|
13
|
+
require 'big_keeper/dependency/dep_type'
|
14
|
+
|
15
|
+
require 'big_keeper/service/stash_service'
|
16
|
+
require 'big_keeper/service/module_service'
|
17
|
+
|
18
|
+
|
19
|
+
module BigKeeper
|
20
|
+
def self.start(path, version, user, name, modules, type)
|
21
|
+
begin
|
22
|
+
# Parse Bigkeeper file
|
23
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
24
|
+
|
25
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
26
|
+
full_name = "#{version}_#{user}_#{name}"
|
27
|
+
branch_name = "#{GitflowType.name(type)}/#{full_name}"
|
28
|
+
|
29
|
+
GitService.new.verify_home_branch(path, branch_name, OperateType::START)
|
30
|
+
|
31
|
+
stash_modules = ModuleCacheOperator.new(path).all_path_modules
|
32
|
+
|
33
|
+
# Stash current branch
|
34
|
+
StashService.new.stash_all(path, branch_name, user, stash_modules)
|
35
|
+
|
36
|
+
# Verify input modules
|
37
|
+
modules = BigkeeperParser.verify_modules(modules)
|
38
|
+
|
39
|
+
Logger.highlight("Add branch '#{branch_name}' for 'Home'...")
|
40
|
+
# Start home feature
|
41
|
+
GitService.new.start(path, full_name, type)
|
42
|
+
|
43
|
+
# Clean module cache
|
44
|
+
ModuleCacheOperator.new(path).clean_modules
|
45
|
+
|
46
|
+
# Cache all path modules
|
47
|
+
ModuleCacheOperator.new(path).cache_path_modules(modules, modules, [])
|
48
|
+
modules = ModuleCacheOperator.new(path).remain_path_modules
|
49
|
+
|
50
|
+
# Backup home
|
51
|
+
DepService.dep_operator(path, user).backup
|
52
|
+
|
53
|
+
# Start modules feature and modify module as path
|
54
|
+
modules.each do |module_name|
|
55
|
+
ModuleService.new.add(path, user, module_name, full_name, type)
|
56
|
+
end
|
57
|
+
|
58
|
+
# install
|
59
|
+
DepService.dep_operator(path, user).install(true)
|
60
|
+
|
61
|
+
# Open home workspace
|
62
|
+
DepService.dep_operator(path, user).open
|
63
|
+
|
64
|
+
# Push home changes to remote
|
65
|
+
Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
|
66
|
+
GitService.new.verify_push(
|
67
|
+
path,
|
68
|
+
"init #{GitflowType.name(type)} #{full_name}",
|
69
|
+
branch_name,
|
70
|
+
'Home')
|
71
|
+
ensure
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'big_stash/stash_operator'
|
3
|
+
require 'big_keeper/util/logger'
|
4
|
+
require 'big_keeper/util/pod_operator'
|
5
|
+
require 'big_keeper/util/xcode_operator'
|
6
|
+
|
7
|
+
require 'big_keeper/dependency/dep_service'
|
8
|
+
|
9
|
+
module BigKeeper
|
10
|
+
def self.switch_to(path, version, user, full_name, type)
|
11
|
+
begin
|
12
|
+
# Parse Bigkeeper file
|
13
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
14
|
+
|
15
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
16
|
+
branch_name = "#{GitflowType.name(type)}/#{full_name}"
|
17
|
+
|
18
|
+
GitService.new.verify_home_branch(path, branch_name, OperateType::SWITCH)
|
19
|
+
|
20
|
+
stash_modules = ModuleCacheOperator.new(path).all_path_modules
|
21
|
+
|
22
|
+
# Stash current branch
|
23
|
+
StashService.new.stash_all(path, branch_name, user, stash_modules)
|
24
|
+
|
25
|
+
# Switch to new feature
|
26
|
+
GitOperator.new.checkout(path, branch_name)
|
27
|
+
GitOperator.new.pull(path)
|
28
|
+
|
29
|
+
# Apply home stash
|
30
|
+
StashService.new.pop_stash(path, branch_name, 'Home')
|
31
|
+
|
32
|
+
modules = ModuleCacheOperator.new(path).all_path_modules
|
33
|
+
|
34
|
+
modules.each do |module_name|
|
35
|
+
ModuleService.new.switch_to(path, user, module_name, branch_name, type)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Install
|
39
|
+
DepService.dep_operator(path, user).install(false)
|
40
|
+
|
41
|
+
# Open home workspace
|
42
|
+
DepService.dep_operator(path, user).open
|
43
|
+
ensure
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'big_keeper/util/podfile_operator'
|
4
|
+
require 'big_keeper/util/gitflow_operator'
|
5
|
+
require 'big_keeper/util/bigkeeper_parser'
|
6
|
+
require 'big_keeper/util/logger'
|
7
|
+
require 'big_keeper/util/pod_operator'
|
8
|
+
require 'big_keeper/util/xcode_operator'
|
9
|
+
require 'big_keeper/util/cache_operator'
|
10
|
+
|
11
|
+
require 'big_keeper/dependency/dep_service'
|
12
|
+
|
13
|
+
require 'big_keeper/dependency/dep_type'
|
14
|
+
|
15
|
+
require 'big_keeper/service/stash_service'
|
16
|
+
require 'big_keeper/service/module_service'
|
17
|
+
|
18
|
+
|
19
|
+
module BigKeeper
|
20
|
+
def self.update(path, user, modules, type)
|
21
|
+
begin
|
22
|
+
# Parse Bigkeeper file
|
23
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
24
|
+
branch_name = GitOperator.new.current_branch(path)
|
25
|
+
|
26
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
27
|
+
|
28
|
+
full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
|
29
|
+
|
30
|
+
current_modules = ModuleCacheOperator.new(path).current_path_modules
|
31
|
+
|
32
|
+
# Verify input modules
|
33
|
+
modules = BigkeeperParser.verify_modules(modules)
|
34
|
+
|
35
|
+
Logger.highlight("Start to update modules for branch '#{branch_name}'...")
|
36
|
+
|
37
|
+
add_modules = modules - current_modules
|
38
|
+
del_modules = current_modules - modules
|
39
|
+
|
40
|
+
# Clean module cache
|
41
|
+
ModuleCacheOperator.new(path).clean_modules
|
42
|
+
ModuleCacheOperator.new(path).cache_path_modules(modules, add_modules, del_modules)
|
43
|
+
remain_path_modules = ModuleCacheOperator.new(path).remain_path_modules
|
44
|
+
|
45
|
+
if add_modules.empty? and del_modules.empty?
|
46
|
+
Logger.default("There is nothing changed with modules #{modules}.")
|
47
|
+
else
|
48
|
+
# Modify podfile as path and Start modules feature
|
49
|
+
remain_path_modules.each do |module_name|
|
50
|
+
ModuleService.new.add(path, user, module_name, full_name, type)
|
51
|
+
end
|
52
|
+
|
53
|
+
del_modules.each do |module_name|
|
54
|
+
ModuleService.new.del(path, user, module_name, full_name, type)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Install
|
59
|
+
DepService.dep_operator(path, user).install(false)
|
60
|
+
|
61
|
+
# Open home workspace
|
62
|
+
DepService.dep_operator(path, user).open
|
63
|
+
ensure
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'big_keeper/command/feature&hotfix/start'
|
2
|
+
require 'big_keeper/command/feature&hotfix/finish'
|
3
|
+
require 'big_keeper/command/feature&hotfix/switch'
|
4
|
+
require 'big_keeper/command/feature&hotfix/update'
|
5
|
+
require 'big_keeper/command/feature&hotfix/pull'
|
6
|
+
require 'big_keeper/command/feature&hotfix/push'
|
7
|
+
require 'big_keeper/command/feature&hotfix/rebase'
|
8
|
+
require 'big_keeper/command/feature&hotfix/publish'
|
9
|
+
require 'big_keeper/command/feature&hotfix/delete'
|
10
|
+
require 'big_keeper/command/feature&hotfix/list'
|
11
|
+
require 'big_keeper/util/leancloud_logger'
|
12
|
+
|
13
|
+
module BigKeeper
|
14
|
+
def self.feature_and_hotfix_command(type)
|
15
|
+
desc "Gitflow #{GitflowType.name(type)} operations"
|
16
|
+
command GitflowType.command(type) do |c|
|
17
|
+
c.desc "Start a new #{GitflowType.name(type)} with name for given modules and main project"
|
18
|
+
c.command :start do |start|
|
19
|
+
start.action do |global_options, options, args|
|
20
|
+
path = File.expand_path(global_options[:path])
|
21
|
+
version = global_options[:ver]
|
22
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
23
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/start")
|
24
|
+
|
25
|
+
help_now!('user name is required') if user and user.empty?
|
26
|
+
help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
|
27
|
+
name = args[0]
|
28
|
+
modules = args[(1...args.length)] if args.length > 1
|
29
|
+
start(path, version, user, name, modules, type)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
c.desc "Update modules for the #{GitflowType.name(type)} with name"
|
34
|
+
c.command :update do |update|
|
35
|
+
update.action do |global_options, options, args|
|
36
|
+
path = File.expand_path(global_options[:path])
|
37
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
38
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/update")
|
39
|
+
|
40
|
+
help_now!('user name is required') if user and user.empty?
|
41
|
+
modules = args[(0...args.length)] if args.length > 0
|
42
|
+
update(path, user, modules, type)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
c.desc "Switch to the #{GitflowType.name(type)} with name"
|
47
|
+
c.command :switch do |switch|
|
48
|
+
switch.action do |global_options, options, args|
|
49
|
+
path = File.expand_path(global_options[:path])
|
50
|
+
version = global_options[:ver]
|
51
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
52
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/switch")
|
53
|
+
|
54
|
+
help_now!('user name is required') if user and user.empty?
|
55
|
+
help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
|
56
|
+
name = args[0]
|
57
|
+
switch_to(path, version, user, name, type)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
c.desc "Pull remote changes for current #{GitflowType.name(type)}"
|
62
|
+
c.command :pull do |pull|
|
63
|
+
pull.action do |global_options, options, args|
|
64
|
+
path = File.expand_path(global_options[:path])
|
65
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
66
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/pull")
|
67
|
+
|
68
|
+
help_now!('user name is required') if user and user.empty?
|
69
|
+
pull(path, user, type)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
c.desc "Push local changes to remote for current #{GitflowType.name(type)}"
|
74
|
+
c.command :push do |push|
|
75
|
+
push.action do |global_options, options, args|
|
76
|
+
path = File.expand_path(global_options[:path])
|
77
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
78
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/push")
|
79
|
+
|
80
|
+
help_now!('user name is required') if user and user.empty?
|
81
|
+
help_now!('comment message is required') if args.length < 1
|
82
|
+
help_now!(%Q(comment message should be wrappered with '' or "")) if args.length > 1
|
83
|
+
comment = args[0]
|
84
|
+
push(path, user, comment, type)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
c.desc "Rebase '#{GitflowType.base_branch(type)}' to current #{GitflowType.name(type)}"
|
89
|
+
c.command :rebase do |rebase|
|
90
|
+
rebase.action do |global_options, options, args|
|
91
|
+
path = File.expand_path(global_options[:path])
|
92
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
93
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/rebase")
|
94
|
+
|
95
|
+
help_now!('user name is required') if user and user.empty?
|
96
|
+
rebase(path, user, type)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
c.desc "Finish current #{GitflowType.name(type)}"
|
101
|
+
c.command :finish do |finish|
|
102
|
+
finish.action do |global_options, options, args|
|
103
|
+
path = File.expand_path(global_options[:path])
|
104
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
105
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/finish")
|
106
|
+
|
107
|
+
help_now!('user name is required') if user and user.empty?
|
108
|
+
finish(path, user, type)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
c.desc "Publish current #{GitflowType.name(type)}"
|
113
|
+
c.command :publish do |publish|
|
114
|
+
publish.action do |global_options, options, args|
|
115
|
+
path = File.expand_path(global_options[:path])
|
116
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
117
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/publish")
|
118
|
+
|
119
|
+
help_now!('user name is required') if user and user.empty?
|
120
|
+
publish(path, user, type)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
c.desc "Delete #{GitflowType.name(type)} with name"
|
125
|
+
c.command :delete do |delete|
|
126
|
+
delete.action do |global_options, options, args|
|
127
|
+
path = File.expand_path(global_options[:path])
|
128
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
129
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/delete")
|
130
|
+
|
131
|
+
help_now!('user name is required') if user and user.empty?
|
132
|
+
help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
|
133
|
+
name = args[0]
|
134
|
+
delete(path, user, name, type)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
c.desc "List all the #{GitflowType.name(type)}s"
|
139
|
+
c.command :list do |list|
|
140
|
+
list.flag %i[v version] , default_value: 'all versions'
|
141
|
+
list.desc "Print list of TREE format."
|
142
|
+
list.command :tree do |tree|
|
143
|
+
tree.action do |global_options, options, args|
|
144
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/tree")
|
145
|
+
|
146
|
+
Logger.highlight("Generating #{GitflowType.name(type)} tree of all version...") if args.length < 1
|
147
|
+
path = File.expand_path(global_options[:path])
|
148
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
149
|
+
list(path, user, type, options)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
list.desc "Print list of JSON format."
|
154
|
+
list.command :json do |json|
|
155
|
+
json.action do |global_options, options, args|
|
156
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/json")
|
157
|
+
|
158
|
+
options[:json] = true
|
159
|
+
path = File.expand_path(global_options[:path])
|
160
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
161
|
+
list(path, user, type, options)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'big_resources/util/image/name_analyze_util'
|
2
|
+
require 'big_keeper/util/leancloud_logger'
|
3
|
+
|
4
|
+
module BigKeeper
|
5
|
+
def self.image_command
|
6
|
+
desc 'Image operations'
|
7
|
+
command :image do | c |
|
8
|
+
c.desc "Detect duplicate name images."
|
9
|
+
c.command :name do | name |
|
10
|
+
name.action do | global_options, options, args |
|
11
|
+
LeanCloudLogger.instance.set_command("image/name")
|
12
|
+
|
13
|
+
path = File.expand_path(global_options[:path])
|
14
|
+
BigResources::ImageAnalyzeUtil.get_duplicate_name_file_with_type(path, BigResources::PNG)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
c.desc "Detect duplicate content images."
|
19
|
+
c.command :content do | content |
|
20
|
+
content.action do | global_options, options, args |
|
21
|
+
LeanCloudLogger.instance.set_command("image/content")
|
22
|
+
path = File.expand_path(global_options[:path])
|
23
|
+
BigResources::ImageAnalyzeUtil.get_duplicate_content_file_with_type(path, BigResources::PNG)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'big_keeper/util/podfile_detector'
|
2
|
+
require 'big_keeper/util/podfile_operator'
|
3
|
+
require 'big_keeper/util/podfile_module'
|
4
|
+
require 'big_keeper/util/gitflow_operator'
|
5
|
+
require 'big_keeper/util/bigkeeper_parser'
|
6
|
+
require 'big_keeper/dependency/dep_type'
|
7
|
+
require 'big_keeper/util/logger'
|
8
|
+
|
9
|
+
module BigKeeper
|
10
|
+
|
11
|
+
def self.podfile_detect(path)
|
12
|
+
# Parse Bigkeeper file
|
13
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
14
|
+
# Get modules' name
|
15
|
+
module_list = BigkeeperParser.module_names
|
16
|
+
# initialize PodfileDetector
|
17
|
+
detector = PodfileDetector.new(path, module_list)
|
18
|
+
# Get unlocked third party pods list
|
19
|
+
unlock_pod_list = detector.get_unlock_pod_list
|
20
|
+
# Print out unlock pod list
|
21
|
+
unlock_pod_list.each do |pod_name|
|
22
|
+
Logger.default("#{pod_name} should be locked.")
|
23
|
+
end
|
24
|
+
Logger.separator
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.podfile_lock(path)
|
29
|
+
# Parse Bigkeeper file
|
30
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
31
|
+
# Get modules' name
|
32
|
+
module_list = BigkeeperParser.module_names
|
33
|
+
# initialize PodfileDetector
|
34
|
+
detector = PodfileDetector.new(path, module_list)
|
35
|
+
# Get unlocked third party pods list
|
36
|
+
unlock_pod_list = detector.get_unlock_pod_list
|
37
|
+
# Get Version
|
38
|
+
dictionary = detector.deal_lock_file(path, unlock_pod_list)
|
39
|
+
if dictionary.empty?
|
40
|
+
Logger.warning("There is nothing to be locked.")
|
41
|
+
else
|
42
|
+
PodfileOperator.new.find_and_lock("#{path}/Podfile", dictionary)
|
43
|
+
Logger.highlight("The Podfile has been changed.")
|
44
|
+
Logger.separator
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.podfile_modules_update(path)
|
52
|
+
# Parse Bigkeeper file
|
53
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
54
|
+
# Get modules' name
|
55
|
+
module_list = BigkeeperParser.module_names
|
56
|
+
# initialize PodfileDetector
|
57
|
+
detector = PodfileModuleDetector.new(path)
|
58
|
+
# Get module latest version
|
59
|
+
module_dictionary = detector.check_version_list
|
60
|
+
# Check if anything should be upgrade
|
61
|
+
if module_dictionary.empty?
|
62
|
+
Logger.warning("There is nothing to be upgrade.")
|
63
|
+
else
|
64
|
+
PodfileOperator.new.find_and_upgrade("#{path}/Podfile", module_dictionary)
|
65
|
+
Logger.highlight("The Podfile has been changed.")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'big_keeper/command/pod/podfile'
|
2
|
+
require 'big_keeper/util/leancloud_logger'
|
3
|
+
|
4
|
+
module BigKeeper
|
5
|
+
|
6
|
+
def self.pod_command
|
7
|
+
desc 'Podfile operation'
|
8
|
+
command :podfile do |podfile|
|
9
|
+
podfile.desc 'Podfile'
|
10
|
+
|
11
|
+
podfile.desc 'Detect podname should be locked.'
|
12
|
+
podfile.command :detect do |detect|
|
13
|
+
detect.action do |global_options, options, args|
|
14
|
+
LeanCloudLogger.instance.set_command("podfile/detect")
|
15
|
+
|
16
|
+
path = File.expand_path(global_options[:path])
|
17
|
+
podfile_detect(path)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
podfile.desc 'Lock podname should be locked.'
|
22
|
+
podfile.command :lock do |lock|
|
23
|
+
lock.action do |global_options, options, args|
|
24
|
+
LeanCloudLogger.instance.set_command("podfile/lock")
|
25
|
+
|
26
|
+
path = File.expand_path(global_options[:path])
|
27
|
+
podfile_lock(path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
podfile.desc 'Update modules should be upgrade.'
|
32
|
+
podfile.command :update do |update|
|
33
|
+
update.action do |global_options, options, args|
|
34
|
+
LeanCloudLogger.instance.set_command("podfile/update")
|
35
|
+
|
36
|
+
path = File.expand_path(global_options[:path])
|
37
|
+
podfile_modules_update(path)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'big_keeper/util/podfile_operator'
|
3
|
+
require 'big_keeper/util/gitflow_operator'
|
4
|
+
require 'big_keeper/dependency/dep_type'
|
5
|
+
require 'big_keeper/util/info_plist_operator'
|
6
|
+
require 'big_keeper/util/logger'
|
7
|
+
require 'big_keeper/util/xcode_operator'
|
8
|
+
|
9
|
+
module BigKeeper
|
10
|
+
def self.release_home_start(path, version, user)
|
11
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
12
|
+
|
13
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
14
|
+
modules = BigkeeperParser.module_names
|
15
|
+
|
16
|
+
#stash
|
17
|
+
StashService.new.stash_all(path, GitOperator.new.current_branch(path), user, modules)
|
18
|
+
|
19
|
+
# delete cache
|
20
|
+
CacheOperator.new(path).clean()
|
21
|
+
# cache Podfile
|
22
|
+
CacheOperator.new(path).save('Podfile')
|
23
|
+
|
24
|
+
# check
|
25
|
+
GitOperator.new.check_diff(path, "develop", "master")
|
26
|
+
|
27
|
+
#checkout release branch
|
28
|
+
Logger.highlight(%Q(Start to checkout Branch release/#{version}))
|
29
|
+
if GitOperator.new.current_branch(path) != "release/#{version}"
|
30
|
+
if GitOperator.new.has_branch(path, "release/#{version}")
|
31
|
+
GitOperator.new.checkout(path, "release/#{version}")
|
32
|
+
else
|
33
|
+
GitflowOperator.new.start(path, version, GitflowType::RELEASE)
|
34
|
+
GitOperator.new.push_to_remote(path, "release/#{version}")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Logger.highlight(%Q(Start to release/#{version}))
|
39
|
+
# step 2 replace_modules
|
40
|
+
PodfileOperator.new.replace_all_module_release(path,
|
41
|
+
user,
|
42
|
+
modules,
|
43
|
+
ModuleOperateType::RELEASE)
|
44
|
+
|
45
|
+
# step 3 change Info.plist value
|
46
|
+
InfoPlistOperator.new.change_version_build(path, version)
|
47
|
+
|
48
|
+
GitService.new.verify_push(path, "Change version to #{version}", "release/#{version}", 'Home')
|
49
|
+
DepService.dep_operator(path, user).install(true)
|
50
|
+
XcodeOperator.open_workspace(path)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.release_home_finish(path, version)
|
54
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
55
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
56
|
+
Logger.highlight("Start finish release home for #{version}")
|
57
|
+
|
58
|
+
if GitOperator.new.has_branch(path, "release/#{version}")
|
59
|
+
if GitOperator.new.current_branch(path) != "release/#{version}"
|
60
|
+
GitOperator.new.checkout(path, "release/#{version}")
|
61
|
+
end
|
62
|
+
|
63
|
+
GitService.new.verify_push(path, "finish release branch", "release/#{version}", 'Home')
|
64
|
+
|
65
|
+
# master
|
66
|
+
GitOperator.new.checkout(path, "master")
|
67
|
+
GitOperator.new.merge(path, "release/#{version}")
|
68
|
+
GitService.new.verify_push(path, "release V#{version}", "master", 'Home')
|
69
|
+
|
70
|
+
GitOperator.new.tag(path, version)
|
71
|
+
|
72
|
+
# release branch
|
73
|
+
GitOperator.new.checkout(path, "release/#{version}")
|
74
|
+
CacheOperator.new(path).load('Podfile')
|
75
|
+
CacheOperator.new(path).clean()
|
76
|
+
GitOperator.new.commit(path, "reset #{version} Podfile")
|
77
|
+
GitService.new.verify_push(path, "reset #{version} Podfile", "release/#{version}", 'Home')
|
78
|
+
|
79
|
+
# develop
|
80
|
+
GitOperator.new.checkout(path, "develop")
|
81
|
+
GitOperator.new.merge(path, "release/#{version}")
|
82
|
+
GitService.new.verify_push(path, "merge release/#{version} to develop", "develop", 'Home')
|
83
|
+
GitOperator.new.check_diff(path, "develop", "master")
|
84
|
+
|
85
|
+
Logger.highlight("Finish release home for #{version}")
|
86
|
+
else
|
87
|
+
raise Logger.error("There is no release/#{version} branch, please use release home start first.")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|