shkeeper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/.idea/.gitignore +8 -0
  3. data/.idea/bigkeeper.iml +68 -0
  4. data/.idea/modules.xml +8 -0
  5. data/.idea/vcs.xml +6 -0
  6. data/CODE_OF_CONDUCT.md +46 -0
  7. data/CONTRIBUTING.md +70 -0
  8. data/Gemfile +10 -0
  9. data/Gemfile.lock +145 -0
  10. data/LICENSE +21 -0
  11. data/README.md +113 -0
  12. data/big_keeper.gemspec +50 -0
  13. data/bin/big +14 -0
  14. data/bin/koo +14 -0
  15. data/bin/setup +8 -0
  16. data/bin/sh +14 -0
  17. data/docs/en-US/FEATURE.md +0 -0
  18. data/docs/en-US/README.md +54 -0
  19. data/docs/zh-CN/BIGKEEPER_FILE.md +84 -0
  20. data/docs/zh-CN/FEATURE&HOTFIX.md +88 -0
  21. data/docs/zh-CN/IMAGE.md +0 -0
  22. data/docs/zh-CN/PODFILE.md +43 -0
  23. data/docs/zh-CN/README.md +113 -0
  24. data/docs/zh-CN/RECOMMEND.md +22 -0
  25. data/docs/zh-CN/RELEASE.md +60 -0
  26. data/docs/zh-CN/SPEC.md +39 -0
  27. data/lib/big_keeper/command/feature&hotfix/delete.rb +40 -0
  28. data/lib/big_keeper/command/feature&hotfix/finish.rb +57 -0
  29. data/lib/big_keeper/command/feature&hotfix/list.rb +63 -0
  30. data/lib/big_keeper/command/feature&hotfix/publish.rb +56 -0
  31. data/lib/big_keeper/command/feature&hotfix/pull.rb +26 -0
  32. data/lib/big_keeper/command/feature&hotfix/push.rb +27 -0
  33. data/lib/big_keeper/command/feature&hotfix/rebase.rb +32 -0
  34. data/lib/big_keeper/command/feature&hotfix/start.rb +94 -0
  35. data/lib/big_keeper/command/feature&hotfix/switch.rb +48 -0
  36. data/lib/big_keeper/command/feature&hotfix/update.rb +74 -0
  37. data/lib/big_keeper/command/feature&hotfix.rb +169 -0
  38. data/lib/big_keeper/command/image/image.rb +0 -0
  39. data/lib/big_keeper/command/image.rb +28 -0
  40. data/lib/big_keeper/command/pod/podfile.rb +69 -0
  41. data/lib/big_keeper/command/pod.rb +42 -0
  42. data/lib/big_keeper/command/release/home.rb +91 -0
  43. data/lib/big_keeper/command/release/module.rb +61 -0
  44. data/lib/big_keeper/command/release.rb +75 -0
  45. data/lib/big_keeper/command/spec/add.rb +9 -0
  46. data/lib/big_keeper/command/spec/analyze.rb +88 -0
  47. data/lib/big_keeper/command/spec/delete.rb +9 -0
  48. data/lib/big_keeper/command/spec/list.rb +19 -0
  49. data/lib/big_keeper/command/spec/search.rb +9 -0
  50. data/lib/big_keeper/command/spec/sync.rb +12 -0
  51. data/lib/big_keeper/command/spec.rb +78 -0
  52. data/lib/big_keeper/dependency/dep_gradle_operator.rb +56 -0
  53. data/lib/big_keeper/dependency/dep_operator.rb +32 -0
  54. data/lib/big_keeper/dependency/dep_pod_operator.rb +131 -0
  55. data/lib/big_keeper/dependency/dep_service.rb +14 -0
  56. data/lib/big_keeper/dependency/dep_type.rb +33 -0
  57. data/lib/big_keeper/model/gitflow_type.rb +43 -0
  58. data/lib/big_keeper/model/library_model.rb +116 -0
  59. data/lib/big_keeper/model/operate_type.rb +27 -0
  60. data/lib/big_keeper/model/podfile_model.rb +33 -0
  61. data/lib/big_keeper/service/git_service.rb +261 -0
  62. data/lib/big_keeper/service/module_service.rb +161 -0
  63. data/lib/big_keeper/service/stash_service.rb +58 -0
  64. data/lib/big_keeper/util/bigkeeper_parser.rb +244 -0
  65. data/lib/big_keeper/util/cache_operator.rb +149 -0
  66. data/lib/big_keeper/util/code_operator.rb +37 -0
  67. data/lib/big_keeper/util/file_operator.rb +33 -0
  68. data/lib/big_keeper/util/git_operator.rb +226 -0
  69. data/lib/big_keeper/util/gitflow_operator.rb +51 -0
  70. data/lib/big_keeper/util/gradle_operator.rb +209 -0
  71. data/lib/big_keeper/util/info_plist_operator.rb +46 -0
  72. data/lib/big_keeper/util/leancloud_logger.rb +72 -0
  73. data/lib/big_keeper/util/list_generator.rb +101 -0
  74. data/lib/big_keeper/util/logger.rb +46 -0
  75. data/lib/big_keeper/util/pod_operator.rb +71 -0
  76. data/lib/big_keeper/util/podfile_detector.rb +137 -0
  77. data/lib/big_keeper/util/podfile_module.rb +63 -0
  78. data/lib/big_keeper/util/podfile_operator.rb +117 -0
  79. data/lib/big_keeper/util/verify_operator.rb +17 -0
  80. data/lib/big_keeper/util/xcode_operator.rb +15 -0
  81. data/lib/big_keeper/version.rb +3 -0
  82. data/lib/big_keeper.rb +71 -0
  83. data/resources/banner.png +0 -0
  84. data/resources/command.png +0 -0
  85. data/resources/keynote/big-keeper-readme-analyze.key +0 -0
  86. data/resources/keynote/big-keeper-readme-example.key +0 -0
  87. data/resources/keynote/big-keeper-readme-feature.key +0 -0
  88. data/resources/keynote/big-keeper-readme-release.key +0 -0
  89. data/resources/readme/big-keeper-readme.001.png +0 -0
  90. metadata +345 -0
@@ -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/cache_operator'
8
+ require 'big_keeper/util/bigkeeper_parser'
9
+
10
+ require 'big_keeper/dependency/dep_service'
11
+
12
+ require 'big_keeper/dependency/dep_type'
13
+
14
+
15
+ module BigKeeper
16
+
17
+ def self.publish(path, user, type)
18
+ begin
19
+ # Parse Bigkeeper file
20
+ BigkeeperParser.parse("#{path}/Bigkeeper")
21
+
22
+ branch_name = GitOperator.new.current_branch(path)
23
+ Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
24
+
25
+ path_modules = ModuleCacheOperator.new(path).current_path_modules
26
+ Logger.error("You have unfinished modules #{path_modules}, Use 'finish' first please.") unless path_modules.empty?
27
+
28
+ # Push modules changes to remote then rebase
29
+ modules = ModuleCacheOperator.new(path).current_git_modules
30
+ modules.each do |module_name|
31
+ ModuleService.new.pre_publish(path, user, module_name, branch_name, type)
32
+ end
33
+
34
+ # Install
35
+ DepService.dep_operator(path, user).install(false)
36
+
37
+ # Modify module as git
38
+ modules.each do |module_name|
39
+ ModuleService.new.publish(path, user, module_name, branch_name, type)
40
+ end
41
+
42
+ Logger.highlight("Publish branch '#{branch_name}' for 'Home'")
43
+
44
+ # Recover home
45
+ DepService.dep_operator(path, user).recover
46
+
47
+ # Push home changes to remote
48
+ GitService.new.verify_push(path, "publish branch #{branch_name}", branch_name, 'Home')
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
@@ -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,94 @@
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, modules, type)
21
+ begin
22
+ # Parse Bigkeeper file
23
+ p "----------1.开始解析#{path}/Bigkeeper"
24
+ BigkeeperParser.parse("#{path}/Bigkeeper")
25
+
26
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
27
+
28
+ p "----------2.version:#{version}"
29
+
30
+ full_name = "#{version}"
31
+ #full_name = "#{version}_#{user}_#{name}"
32
+ p "----------3.full_name:#{full_name}"
33
+ branch_name = "#{GitflowType.name(type)}/#{full_name}"
34
+ p "----------4.branch_name:#{branch_name}"
35
+
36
+ ModuleCacheOperator.new(path).cache_branch_name(branch_name)
37
+ home_branch_name = "release/#{version}"
38
+ p "----------5.home_branch_name:#{home_branch_name}"
39
+ p "----------6.path:#{path}"
40
+ p "----------7.1验证home_branch"
41
+ GitService.new.verify_home_branch(path, home_branch_name, OperateType::START)
42
+ #GitService.new.verify_home_branch(path, branch_name, OperateType::START)
43
+
44
+ stash_modules = ModuleCacheOperator.new(path).all_path_modules
45
+ p "----------8.stash_modules:#{stash_modules}"
46
+ # Stash current branch
47
+ #
48
+ p "----------9.stash_all:path:#{path} branch_name:#{branch_name} user:#{user} #{path} stash_modules:#{stash_modules}"
49
+ StashService.new.stash_all(path, branch_name, user, stash_modules,version)
50
+
51
+ # Verify input modules
52
+ p "----------10.验证modules是否包含在Bigkeeper文件中"
53
+ modules = BigkeeperParser.verify_modules(modules)
54
+ p "----------11.home 添加 release/#{version} 分支"
55
+ Logger.highlight("Add branch release/#{version} for 'Home'...")
56
+ # Start home feature
57
+ # GitService.new.start(path, full_name, type)
58
+ GitService.new.startHome(path, version, GitflowType::RELEASE)
59
+ # Clean module cache
60
+ #
61
+ p "----------11.清空modules缓存"
62
+ ModuleCacheOperator.new(path).clean_modules
63
+
64
+ # Cache all path modules
65
+ p "----------12.Cache all path modules"
66
+ ModuleCacheOperator.new(path).cache_path_modules(modules, modules, [])
67
+ modules = ModuleCacheOperator.new(path).remain_path_modules
68
+ p "----------13.Backup home"
69
+ # Backup home
70
+ DepService.dep_operator(path, user).backup
71
+
72
+ p "----------14.为模块建立分支并将podfile中地址切换到本地"
73
+ # Start modules feature and modify module as path
74
+ modules.each do |module_name|
75
+ ModuleService.new.add(path, user, module_name, full_name, type)
76
+ end
77
+ p "----------15.pod update"
78
+ # install
79
+ DepService.dep_operator(path, user).install(false )
80
+ p "----------16.打开 workspace"
81
+ # Open home workspace
82
+ DepService.dep_operator(path, user).open
83
+ p "----------17.Push home changes to remote"
84
+ # Push home changes to remote
85
+ Logger.highlight("Push branch release/#{version} for 'Home'...")
86
+ GitService.new.verify_push(
87
+ path,
88
+ "start branch #{home_branch_name}",
89
+ home_branch_name,
90
+ 'Home')
91
+ ensure
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,48 @@
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
+ p "1.switch_to #{version} 解析Bigkeeper"
14
+ BigkeeperParser.parse("#{path}/Bigkeeper")
15
+
16
+ version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
17
+ branch_name = "#{GitflowType.name(type)}/#{full_name}"
18
+ ModuleCacheOperator.new(path).cache_branch_name(branch_name)
19
+ home_branch_name = "release/#{full_name}"
20
+ GitService.new.verify_home_branch(path, home_branch_name, OperateType::SWITCH)
21
+
22
+ stash_modules = ModuleCacheOperator.new(path).all_path_modules
23
+ p "2.switch_to 暂存所有"
24
+ # Stash current branch
25
+ StashService.new.stash_all(path, branch_name, user, stash_modules,full_name)
26
+ p "3.switch_to checkout #{home_branch_name}"
27
+ # Switch to new feature
28
+ GitOperator.new.checkout(path, home_branch_name)
29
+ GitOperator.new.pull(path)
30
+ p "4.switch_to"
31
+ # Apply home stash
32
+ StashService.new.pop_stash(path, home_branch_name, 'Home')
33
+
34
+ #modules = ModuleCacheOperator.new(path).all_path_modules
35
+ modules = ModuleCacheOperator.new(path).current_path_modules_path(path)
36
+ modules.each do |module_name|
37
+ ModuleService.new.switch_to(path, user, module_name, branch_name, type)
38
+ end
39
+ p "5.switch_to"
40
+ # Install
41
+ DepService.dep_operator(path, user).install(false)
42
+ p "6.switch_to"
43
+ # Open home workspace
44
+ DepService.dep_operator(path, user).open
45
+ ensure
46
+ end
47
+ end
48
+ 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.update(path, user, modules, type)
21
+ begin
22
+ # Parse Bigkeeper file
23
+ BigkeeperParser.parse("#{path}/Bigkeeper")
24
+ home_branch_name = GitOperator.new.current_branch(path)
25
+ branch_name = ModuleCacheOperator.new(path).branch_name
26
+ # Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
27
+
28
+ # Logger.error("Not a #{GitflowType.name(GitflowType::RELEASE)} branch, exit.") unless branch_name.include? GitflowType.name(GitflowType::RELEASE)
29
+
30
+
31
+ full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
32
+
33
+ current_modules = ModuleCacheOperator.new(path).current_path_modules_path(path)
34
+
35
+ # Verify input modules
36
+ modules = BigkeeperParser.verify_modules(modules)
37
+
38
+ Logger.highlight("Start to update modules for branch '#{branch_name}'...")
39
+
40
+ add_modules = modules - current_modules
41
+ del_modules = current_modules - modules
42
+
43
+ # Clean module cache
44
+ ModuleCacheOperator.new(path).clean_modules
45
+ ModuleCacheOperator.new(path).cache_path_modules(modules, add_modules, del_modules)
46
+ remain_path_modules = ModuleCacheOperator.new(path).remain_path_modules
47
+
48
+ if add_modules.empty? and del_modules.empty?
49
+ Logger.default("There is nothing changed with modules #{modules}.")
50
+ else
51
+
52
+ type =
53
+ # Modify podfile as path and Start modules feature
54
+ remain_path_modules.each do |module_name|
55
+ ModuleService.new.add(path, user, module_name, full_name, type)
56
+ end
57
+
58
+ del_modules.each do |module_name|
59
+ ModuleService.new.del(path, user, module_name, full_name, type)
60
+ end
61
+ end
62
+
63
+ # Install
64
+ DepService.dep_operator(path, user).install(false)
65
+
66
+ # Open home workspace
67
+ DepService.dep_operator(path, user).open
68
+
69
+ # Push home changes to remote
70
+ GitService.new.verify_push(path, "update branch #{home_branch_name}", home_branch_name, 'Home')
71
+ ensure
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,169 @@
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
+ modules = args[(0...args.length)] if args.length > 0
30
+ #start(path, version, user, name, modules, type)
31
+ start(path, version, user, modules, type)
32
+ end
33
+ end
34
+
35
+ c.desc "Update modules for the #{GitflowType.name(type)} with name"
36
+ c.command :update do |update|
37
+ update.action do |global_options, options, args|
38
+ path = File.expand_path(global_options[:path])
39
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
40
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/update")
41
+
42
+ help_now!('user name is required') if user and user.empty?
43
+ modules = args[(0...args.length)] if args.length > 0
44
+ update(path, user, modules, type)
45
+ end
46
+ end
47
+
48
+ c.desc "Switch to the #{GitflowType.name(type)} with name"
49
+ c.command :switch do |switch|
50
+ switch.action do |global_options, options, args|
51
+ path = File.expand_path(global_options[:path])
52
+ version = global_options[:ver]
53
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
54
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/switch")
55
+
56
+ help_now!('user name is required') if user and user.empty?
57
+ help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
58
+ name = args[0]
59
+ switch_to(path, version, user, name, type)
60
+ end
61
+ end
62
+
63
+ c.desc "Pull remote changes for current #{GitflowType.name(type)}"
64
+ c.command :pull do |pull|
65
+ pull.action do |global_options, options, args|
66
+ path = File.expand_path(global_options[:path])
67
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
68
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/pull")
69
+
70
+ help_now!('user name is required') if user and user.empty?
71
+ pull(path, user, type)
72
+ end
73
+ end
74
+
75
+ c.desc "Push local changes to remote for current #{GitflowType.name(type)}"
76
+ c.command :push do |push|
77
+ push.action do |global_options, options, args|
78
+ path = File.expand_path(global_options[:path])
79
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
80
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/push")
81
+
82
+ help_now!('user name is required') if user and user.empty?
83
+ help_now!('comment message is required') if args.length < 1
84
+ help_now!(%Q(comment message should be wrappered with '' or "")) if args.length > 1
85
+ comment = args[0]
86
+ push(path, user, comment, type)
87
+ end
88
+ end
89
+
90
+ c.desc "Rebase '#{GitflowType.base_branch(type)}' to current #{GitflowType.name(type)}"
91
+ c.command :rebase do |rebase|
92
+ rebase.action do |global_options, options, args|
93
+ path = File.expand_path(global_options[:path])
94
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
95
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/rebase")
96
+
97
+ help_now!('user name is required') if user and user.empty?
98
+ rebase(path, user, type)
99
+ end
100
+ end
101
+
102
+ c.desc "Finish current #{GitflowType.name(type)}"
103
+ c.command :finish do |finish|
104
+ finish.action do |global_options, options, args|
105
+ path = File.expand_path(global_options[:path])
106
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
107
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/finish")
108
+
109
+ help_now!('user name is required') if user and user.empty?
110
+ finish(path, user, type)
111
+ end
112
+ end
113
+
114
+ c.desc "Publish current #{GitflowType.name(type)}"
115
+ c.command :publish do |publish|
116
+ publish.action do |global_options, options, args|
117
+ path = File.expand_path(global_options[:path])
118
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
119
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/publish")
120
+
121
+ help_now!('user name is required') if user and user.empty?
122
+ publish(path, user, type)
123
+ end
124
+ end
125
+
126
+ c.desc "Delete #{GitflowType.name(type)} with name"
127
+ c.command :delete do |delete|
128
+ delete.action do |global_options, options, args|
129
+ path = File.expand_path(global_options[:path])
130
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
131
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/delete")
132
+
133
+ help_now!('user name is required') if user and user.empty?
134
+ help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
135
+ name = args[0]
136
+ delete(path, user, name, type)
137
+ end
138
+ end
139
+
140
+ c.desc "List all the #{GitflowType.name(type)}s"
141
+ c.command :list do |list|
142
+ list.flag %i[v version] , default_value: 'all versions'
143
+ list.desc "Print list of TREE format."
144
+ list.command :tree do |tree|
145
+ tree.action do |global_options, options, args|
146
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/tree")
147
+
148
+ Logger.highlight("Generating #{GitflowType.name(type)} tree of all version...") if args.length < 1
149
+ path = File.expand_path(global_options[:path])
150
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
151
+ list(path, user, type, options)
152
+ end
153
+ end
154
+
155
+ list.desc "Print list of JSON format."
156
+ list.command :json do |json|
157
+ json.action do |global_options, options, args|
158
+ LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/json")
159
+
160
+ options[:json] = true
161
+ path = File.expand_path(global_options[:path])
162
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
163
+ list(path, user, type, options)
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
169
+ 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