kookeeper 3.0.1 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  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/docs/en-US/FEATURE.md +0 -0
  17. data/docs/en-US/README.md +54 -0
  18. data/docs/zh-CN/BIGKEEPER_FILE.md +84 -0
  19. data/docs/zh-CN/FEATURE&HOTFIX.md +88 -0
  20. data/docs/zh-CN/IMAGE.md +0 -0
  21. data/docs/zh-CN/PODFILE.md +43 -0
  22. data/docs/zh-CN/README.md +113 -0
  23. data/docs/zh-CN/RECOMMEND.md +22 -0
  24. data/docs/zh-CN/RELEASE.md +60 -0
  25. data/docs/zh-CN/SPEC.md +39 -0
  26. data/lib/big_keeper/command/feature&hotfix/delete.rb +40 -0
  27. data/lib/big_keeper/command/feature&hotfix/finish.rb +54 -0
  28. data/lib/big_keeper/command/feature&hotfix/list.rb +63 -0
  29. data/lib/big_keeper/command/feature&hotfix/publish.rb +56 -0
  30. data/lib/big_keeper/command/feature&hotfix/pull.rb +26 -0
  31. data/lib/big_keeper/command/feature&hotfix/push.rb +27 -0
  32. data/lib/big_keeper/command/feature&hotfix/rebase.rb +32 -0
  33. data/lib/big_keeper/command/feature&hotfix/start.rb +75 -0
  34. data/lib/big_keeper/command/feature&hotfix/switch.rb +46 -0
  35. data/lib/big_keeper/command/feature&hotfix/update.rb +66 -0
  36. data/lib/big_keeper/command/feature&hotfix.rb +167 -0
  37. data/lib/big_keeper/command/image/image.rb +0 -0
  38. data/lib/big_keeper/command/image.rb +28 -0
  39. data/lib/big_keeper/command/pod/podfile.rb +69 -0
  40. data/lib/big_keeper/command/pod.rb +42 -0
  41. data/lib/big_keeper/command/release/home.rb +91 -0
  42. data/lib/big_keeper/command/release/module.rb +61 -0
  43. data/lib/big_keeper/command/release.rb +75 -0
  44. data/lib/big_keeper/command/spec/add.rb +9 -0
  45. data/lib/big_keeper/command/spec/analyze.rb +88 -0
  46. data/lib/big_keeper/command/spec/delete.rb +9 -0
  47. data/lib/big_keeper/command/spec/list.rb +19 -0
  48. data/lib/big_keeper/command/spec/search.rb +9 -0
  49. data/lib/big_keeper/command/spec/sync.rb +12 -0
  50. data/lib/big_keeper/command/spec.rb +78 -0
  51. data/lib/big_keeper/dependency/dep_gradle_operator.rb +56 -0
  52. data/lib/big_keeper/dependency/dep_operator.rb +32 -0
  53. data/lib/big_keeper/dependency/dep_pod_operator.rb +130 -0
  54. data/lib/big_keeper/dependency/dep_service.rb +14 -0
  55. data/lib/big_keeper/dependency/dep_type.rb +33 -0
  56. data/lib/big_keeper/model/gitflow_type.rb +43 -0
  57. data/lib/big_keeper/model/library_model.rb +116 -0
  58. data/lib/big_keeper/model/operate_type.rb +27 -0
  59. data/lib/big_keeper/model/podfile_model.rb +33 -0
  60. data/lib/big_keeper/service/git_service.rb +233 -0
  61. data/lib/big_keeper/service/module_service.rb +159 -0
  62. data/lib/big_keeper/service/stash_service.rb +45 -0
  63. data/lib/big_keeper/util/bigkeeper_parser.rb +244 -0
  64. data/lib/big_keeper/util/cache_operator.rb +116 -0
  65. data/lib/big_keeper/util/code_operator.rb +37 -0
  66. data/lib/big_keeper/util/file_operator.rb +33 -0
  67. data/lib/big_keeper/util/git_operator.rb +221 -0
  68. data/lib/big_keeper/util/gitflow_operator.rb +51 -0
  69. data/lib/big_keeper/util/gradle_operator.rb +209 -0
  70. data/lib/big_keeper/util/info_plist_operator.rb +46 -0
  71. data/lib/big_keeper/util/leancloud_logger.rb +72 -0
  72. data/lib/big_keeper/util/list_generator.rb +101 -0
  73. data/lib/big_keeper/util/logger.rb +46 -0
  74. data/lib/big_keeper/util/pod_operator.rb +70 -0
  75. data/lib/big_keeper/util/podfile_detector.rb +111 -0
  76. data/lib/big_keeper/util/podfile_module.rb +63 -0
  77. data/lib/big_keeper/util/podfile_operator.rb +117 -0
  78. data/lib/big_keeper/util/verify_operator.rb +17 -0
  79. data/lib/big_keeper/util/xcode_operator.rb +15 -0
  80. data/lib/big_keeper/version.rb +3 -0
  81. data/lib/big_keeper.rb +71 -0
  82. data/resources/banner.png +0 -0
  83. data/resources/command.png +0 -0
  84. data/resources/keynote/big-keeper-readme-analyze.key +0 -0
  85. data/resources/keynote/big-keeper-readme-example.key +0 -0
  86. data/resources/keynote/big-keeper-readme-feature.key +0 -0
  87. data/resources/keynote/big-keeper-readme-release.key +0 -0
  88. data/resources/readme/big-keeper-readme.001.png +0 -0
  89. metadata +92 -3
@@ -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,75 @@
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
+ home_branch_name = "release/#{version}"
30
+ GitService.new.verify_home_branch(path, branch_name, OperateType::START)
31
+
32
+ stash_modules = ModuleCacheOperator.new(path).all_path_modules
33
+
34
+ # Stash current branch
35
+ StashService.new.stash_all(path, branch_name, user, stash_modules)
36
+
37
+ # Verify input modules
38
+ modules = BigkeeperParser.verify_modules(modules)
39
+
40
+ Logger.highlight("Add branch release'#{version}' for 'Home'...")
41
+ # Start home feature
42
+ # GitService.new.start(path, full_name, type)
43
+ GitService.new.startHome(path, version, GitflowType::RELEASE)
44
+ # Clean module cache
45
+ ModuleCacheOperator.new(path).clean_modules
46
+
47
+ # Cache all path modules
48
+ ModuleCacheOperator.new(path).cache_path_modules(modules, modules, [])
49
+ modules = ModuleCacheOperator.new(path).remain_path_modules
50
+
51
+ # Backup home
52
+ DepService.dep_operator(path, user).backup
53
+
54
+ # Start modules feature and modify module as path
55
+ modules.each do |module_name|
56
+ ModuleService.new.add(path, user, module_name, full_name, type)
57
+ end
58
+
59
+ # install
60
+ DepService.dep_operator(path, user).install(true)
61
+
62
+ # Open home workspace
63
+ DepService.dep_operator(path, user).open
64
+
65
+ # Push home changes to remote
66
+ Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
67
+ GitService.new.verify_push(
68
+ path,
69
+ "init #{GitflowType.name(type)} #{full_name}",
70
+ branch_name,
71
+ 'Home')
72
+ ensure
73
+ end
74
+ end
75
+ 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