bigkeeper 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/big_keeper.gemspec +3 -3
  4. data/docs/en-US/README.md +2 -2
  5. data/docs/zh-CN/BIGKEEPER_FILE.md +2 -2
  6. data/docs/zh-CN/FEATURE&HOTFIX.md +18 -11
  7. data/lib/big_keeper.rb +9 -289
  8. data/lib/big_keeper/command/feature&hotfix.rb +140 -0
  9. data/lib/big_keeper/command/feature&hotfix/finish.rb +7 -4
  10. data/lib/big_keeper/command/feature&hotfix/publish.rb +7 -6
  11. data/lib/big_keeper/command/feature&hotfix/pull.rb +2 -2
  12. data/lib/big_keeper/command/feature&hotfix/push.rb +2 -2
  13. data/lib/big_keeper/command/feature&hotfix/rebase.rb +2 -2
  14. data/lib/big_keeper/command/feature&hotfix/start.rb +16 -6
  15. data/lib/big_keeper/command/feature&hotfix/switch.rb +4 -6
  16. data/lib/big_keeper/command/feature&hotfix/update.rb +6 -4
  17. data/lib/big_keeper/command/pod.rb +36 -0
  18. data/lib/big_keeper/command/release.rb +68 -0
  19. data/lib/big_keeper/command/release/home.rb +2 -1
  20. data/lib/big_keeper/dependency/dep_gradle_operator.rb +26 -130
  21. data/lib/big_keeper/dependency/dep_operator.rb +4 -10
  22. data/lib/big_keeper/dependency/dep_pod_operator.rb +9 -53
  23. data/lib/big_keeper/dependency/dep_service.rb +2 -2
  24. data/lib/big_keeper/dependency/dep_type.rb +4 -4
  25. data/lib/big_keeper/model/gitflow_type.rb +12 -0
  26. data/lib/big_keeper/service/git_service.rb +2 -2
  27. data/lib/big_keeper/service/module_service.rb +15 -6
  28. data/lib/big_keeper/util/cache_operator.rb +69 -0
  29. data/lib/big_keeper/util/gradle_operator.rb +151 -0
  30. data/lib/big_keeper/util/podfile_operator.rb +4 -4
  31. data/lib/big_keeper/version.rb +1 -1
  32. data/resources/keynote/big-keeper-readme-feature.key +0 -0
  33. metadata +10 -6
@@ -0,0 +1,140 @@
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
+
11
+ module BigKeeper
12
+ def self.feature_and_hotfix_command(type)
13
+ desc "Gitflow #{GitflowType.name(type)} operations"
14
+ command GitflowType.command(type) do |c|
15
+ c.desc "Start a new #{GitflowType.name(type)} with name for given modules and main project"
16
+ c.command :start do |start|
17
+ start.action do |global_options, options, args|
18
+ path = File.expand_path(global_options[:path])
19
+ version = global_options[:ver]
20
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
21
+
22
+ help_now!('user name is required') if user and user.empty?
23
+ help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
24
+ name = args[0]
25
+ modules = args[(1...args.length)] if args.length > 1
26
+ start(path, version, user, name, modules, type)
27
+ end
28
+ end
29
+
30
+ c.desc "Update modules for the #{GitflowType.name(type)} with name"
31
+ c.command :update do |update|
32
+ update.action do |global_options, options, args|
33
+ path = File.expand_path(global_options[:path])
34
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
35
+
36
+ help_now!('user name is required') if user and user.empty?
37
+ modules = args[(0...args.length)] if args.length > 0
38
+ update(path, user, modules, type)
39
+ end
40
+ end
41
+
42
+ c.desc "Switch to the #{GitflowType.name(type)} with name"
43
+ c.command :switch do |switch|
44
+ switch.action do |global_options, options, args|
45
+ path = File.expand_path(global_options[:path])
46
+ version = global_options[:ver]
47
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
48
+
49
+ help_now!('user name is required') if user and user.empty?
50
+ help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
51
+ name = args[0]
52
+ switch_to(path, version, user, name, type)
53
+ end
54
+ end
55
+
56
+ c.desc "Pull remote changes for current #{GitflowType.name(type)}"
57
+ c.command :pull do |pull|
58
+ pull.action do |global_options, options, args|
59
+ path = File.expand_path(global_options[:path])
60
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
61
+
62
+ help_now!('user name is required') if user and user.empty?
63
+ pull(path, user, type)
64
+ end
65
+ end
66
+
67
+ c.desc "Push local changes to remote for current #{GitflowType.name(type)}"
68
+ c.command :push do |push|
69
+ push.action do |global_options, options, args|
70
+ path = File.expand_path(global_options[:path])
71
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
72
+
73
+ help_now!('user name is required') if user and user.empty?
74
+ help_now!('comment message is required') if args.length < 1
75
+ help_now!(%Q(comment message should be wrappered with '' or "")) if args.length > 1
76
+ comment = args[0]
77
+ push(path, user, comment, type)
78
+ end
79
+ end
80
+
81
+ c.desc "Rebase '#{GitflowType.base_branch(type)}' to current #{GitflowType.name(type)}"
82
+ c.command :rebase do |rebase|
83
+ rebase.action do |global_options, options, args|
84
+ path = File.expand_path(global_options[:path])
85
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
86
+
87
+ help_now!('user name is required') if user and user.empty?
88
+ rebase(path, user, type)
89
+ end
90
+ end
91
+
92
+ c.desc "Finish current #{GitflowType.name(type)}"
93
+ c.command :finish do |finish|
94
+ finish.action do |global_options, options, args|
95
+ path = File.expand_path(global_options[:path])
96
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
97
+
98
+ help_now!('user name is required') if user and user.empty?
99
+ finish(path, user, type)
100
+ end
101
+ end
102
+
103
+ c.desc "Publish current #{GitflowType.name(type)}"
104
+ c.command :publish do |publish|
105
+ publish.action do |global_options, options, args|
106
+ path = File.expand_path(global_options[:path])
107
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
108
+
109
+ help_now!('user name is required') if user and user.empty?
110
+ publish(path, user, type)
111
+ end
112
+ end
113
+
114
+ c.desc "Delete #{GitflowType.name(type)} with name"
115
+ c.command :delete do |delete|
116
+ delete.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
+
120
+ help_now!('user name is required') if user and user.empty?
121
+ help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
122
+ name = args[0]
123
+ delete(path, user, name, type)
124
+ end
125
+ end
126
+
127
+ c.desc "List all the #{GitflowType.name(type)}s"
128
+ c.command :list do |list|
129
+ list.action do |global_options, options, args|
130
+ path = File.expand_path(global_options[:path])
131
+
132
+ branchs = GitService.new.branchs_with_type(File.expand_path(path), type)
133
+ branchs.each do |branch|
134
+ p branch
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
@@ -4,6 +4,7 @@ require 'big_keeper/util/podfile_operator'
4
4
  require 'big_keeper/util/logger'
5
5
  require 'big_keeper/util/pod_operator'
6
6
  require 'big_keeper/util/xcode_operator'
7
+ require 'big_keeper/util/cache_operator'
7
8
  require 'big_keeper/util/bigkeeper_parser'
8
9
 
9
10
  require 'big_keeper/dependency/dep_service'
@@ -21,8 +22,10 @@ module BigKeeper
21
22
  branch_name = GitOperator.new.current_branch(path)
22
23
  Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
23
24
 
24
- modules = DepService.dep_operator(path).modules_with_type(BigkeeperParser.module_names,
25
- ModuleType::PATH)
25
+ ModuleCacheOperator.new(path).cache_path_modules([])
26
+ ModuleCacheOperator.new(path).cache_git_modules(modules)
27
+
28
+ modules = ModuleCacheOperator.new(path).current_path_modules
26
29
 
27
30
  # Rebase modules and modify podfile as git
28
31
  modules.each do |module_name|
@@ -32,10 +35,10 @@ module BigKeeper
32
35
  Logger.highlight("Finish branch '#{branch_name}' for 'Home'")
33
36
 
34
37
  # pod install
35
- DepService.dep_operator(path).install(false)
38
+ DepService.dep_operator(path, user).install(false)
36
39
 
37
40
  # Open home workspace
38
- DepService.dep_operator(path).open
41
+ DepService.dep_operator(path, user).open
39
42
 
40
43
  # Push home changes to remote
41
44
  GitService.new.verify_push(path, "finish branch #{branch_name}", branch_name, 'Home')
@@ -4,6 +4,7 @@ require 'big_keeper/util/podfile_operator'
4
4
  require 'big_keeper/util/logger'
5
5
  require 'big_keeper/util/pod_operator'
6
6
  require 'big_keeper/util/xcode_operator'
7
+ require 'big_keeper/util/cache_operator'
7
8
  require 'big_keeper/util/bigkeeper_parser'
8
9
 
9
10
  require 'big_keeper/dependency/dep_service'
@@ -21,12 +22,12 @@ module BigKeeper
21
22
  branch_name = GitOperator.new.current_branch(path)
22
23
  Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
23
24
 
24
- path_modules = DepService.dep_operator(path).modules_with_type(BigkeeperParser.module_names,
25
- ModuleType::PATH)
25
+ path_modules = ModuleCacheOperator.new(path).current_path_modules
26
26
  Logger.error("You have unfinished modules #{path_modules}, Use 'finish' first please.") unless path_modules.empty?
27
27
 
28
- modules = DepService.dep_operator(path).modules_with_branch(BigkeeperParser.module_names,
29
- branch_name)
28
+ ModuleCacheOperator.new(path).cache_git_modules([])
29
+
30
+ modules = ModuleCacheOperator.new(path).current_git_modules
30
31
 
31
32
  # Rebase modules and modify podfile as git
32
33
  modules.each do |module_name|
@@ -36,10 +37,10 @@ module BigKeeper
36
37
  Logger.highlight("Publish branch '#{branch_name}' for 'Home'")
37
38
 
38
39
  # pod install
39
- DepService.dep_operator(path).install(false, user)
40
+ DepService.dep_operator(path, user).install(false)
40
41
 
41
42
  # Recover podfile
42
- DepService.dep_operator(path).recover
43
+ DepService.dep_operator(path, user).recover
43
44
 
44
45
  # Push home changes to remote
45
46
  GitService.new.verify_push(path, "publish branch #{branch_name}", branch_name, 'Home')
@@ -1,4 +1,5 @@
1
1
  require 'big_keeper/util/logger'
2
+ require 'big_keeper/util/cache_operator'
2
3
 
3
4
  require 'big_keeper/dependency/dep_service'
4
5
 
@@ -11,8 +12,7 @@ module BigKeeper
11
12
 
12
13
  Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
13
14
 
14
- modules = DepService.dep_operator(path).modules_with_type(
15
- BigkeeperParser.module_names, ModuleType::PATH)
15
+ modules = ModuleCacheOperator.new(path).current_path_modules
16
16
 
17
17
  modules.each do |module_name|
18
18
  ModuleService.new.pull(path, user, module_name, branch_name, type)
@@ -1,4 +1,5 @@
1
1
  require 'big_keeper/util/logger'
2
+ require 'big_keeper/util/cache_operator'
2
3
 
3
4
  require 'big_keeper/dependency/dep_service'
4
5
 
@@ -12,8 +13,7 @@ module BigKeeper
12
13
 
13
14
  Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
14
15
 
15
- modules = DepService.dep_operator(path).modules_with_type(
16
- BigkeeperParser.module_names, ModuleType::PATH)
16
+ modules = ModuleCacheOperator.new(path).current_path_modules
17
17
 
18
18
  modules.each do |module_name|
19
19
  ModuleService.new.push(path, user, module_name, branch_name, type, comment)
@@ -1,4 +1,5 @@
1
1
  require 'big_keeper/util/logger'
2
+ require 'big_keeper/util/cache_operator'
2
3
 
3
4
  require 'big_keeper/dependency/dep_service'
4
5
 
@@ -11,8 +12,7 @@ module BigKeeper
11
12
 
12
13
  Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
13
14
 
14
- modules = DepService.dep_operator(path).modules_with_type(
15
- BigkeeperParser.module_names, ModuleType::PATH)
15
+ modules = ModuleCacheOperator.new(path).current_path_modules
16
16
 
17
17
  modules.each do |module_name|
18
18
  ModuleService.new.rebase(path, user, module_name, branch_name, type)
@@ -6,6 +6,7 @@ require 'big_keeper/util/bigkeeper_parser'
6
6
  require 'big_keeper/util/logger'
7
7
  require 'big_keeper/util/pod_operator'
8
8
  require 'big_keeper/util/xcode_operator'
9
+ require 'big_keeper/util/cache_operator'
9
10
 
10
11
  require 'big_keeper/dependency/dep_service'
11
12
 
@@ -27,10 +28,8 @@ module BigKeeper
27
28
 
28
29
  GitService.new.verify_home_branch(path, branch_name, OperateType::START)
29
30
 
30
- stash_modules = DepService.dep_operator(path).modules_with_type(
31
- BigkeeperParser.module_names, ModuleType::PATH)
31
+ stash_modules = ModuleCacheOperator.new(path).current_path_modules
32
32
 
33
- p stash_modules
34
33
  # Stash current branch
35
34
  StashService.new.stash_all(path, branch_name, user, stash_modules)
36
35
 
@@ -51,8 +50,10 @@ module BigKeeper
51
50
  # Start home feature
52
51
  GitService.new.start(path, full_name, type)
53
52
 
53
+ ModuleCacheOperator.new(path).cache_path_modules(modules)
54
+
54
55
  # Backup podfile
55
- DepService.dep_operator(path).backup
56
+ DepService.dep_operator(path, user).backup
56
57
 
57
58
  # Modify podfile as path and Start modules feature
58
59
  modules.each do |module_name|
@@ -60,16 +61,25 @@ module BigKeeper
60
61
  end
61
62
 
62
63
  # pod install
63
- DepService.dep_operator(path).install(true, user)
64
+ DepService.dep_operator(path, user).install(true)
64
65
 
65
66
  # Open home workspace
66
- DepService.dep_operator(path).open
67
+ DepService.dep_operator(path, user).open
67
68
 
68
69
  # Push home changes to remote
69
70
  GitService.new.verify_push(path,
70
71
  "init #{GitflowType.name(type)} #{full_name}",
71
72
  branch_name,
72
73
  'Home')
74
+
75
+ modules.each do |module_name|
76
+ module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
77
+ # Push home changes to remote
78
+ GitService.new.verify_push(module_full_path,
79
+ "init #{GitflowType.name(type)} #{full_name}",
80
+ branch_name,
81
+ module_name)
82
+ end
73
83
  ensure
74
84
  end
75
85
  end
@@ -18,8 +18,7 @@ module BigKeeper
18
18
 
19
19
  GitService.new.verify_home_branch(path, branch_name, OperateType::SWITCH)
20
20
 
21
- stash_modules = DepService.dep_operator(path).modules_with_type(
22
- BigkeeperParser.module_names, ModuleType::PATH)
21
+ stash_modules = ModuleCacheOperator.new(path).current_path_modules
23
22
 
24
23
  # Stash current branch
25
24
  StashService.new.stash_all(path, branch_name, user, stash_modules)
@@ -31,18 +30,17 @@ module BigKeeper
31
30
  # Apply home stash
32
31
  StashService.new.pop_stash(path, branch_name, 'Home')
33
32
 
34
- modules = DepService.dep_operator(path).modules_with_type(
35
- BigkeeperParser.module_names, ModuleType::PATH)
33
+ modules = ModuleCacheOperator.new(path).current_path_modules
36
34
 
37
35
  modules.each do |module_name|
38
36
  ModuleService.new.switch_to(path, user, module_name, branch_name, type)
39
37
  end
40
38
 
41
39
  # pod install
42
- DepService.dep_operator(path).install(false, user)
40
+ DepService.dep_operator(path, user).install(false)
43
41
 
44
42
  # Open home workspace
45
- DepService.dep_operator(path).open
43
+ DepService.dep_operator(path, user).open
46
44
  ensure
47
45
  end
48
46
  end
@@ -6,6 +6,7 @@ require 'big_keeper/util/bigkeeper_parser'
6
6
  require 'big_keeper/util/logger'
7
7
  require 'big_keeper/util/pod_operator'
8
8
  require 'big_keeper/util/xcode_operator'
9
+ require 'big_keeper/util/cache_operator'
9
10
 
10
11
  require 'big_keeper/dependency/dep_service'
11
12
 
@@ -26,8 +27,7 @@ module BigKeeper
26
27
 
27
28
  full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
28
29
 
29
- current_modules = DepService.dep_operator(path).modules_with_type(
30
- BigkeeperParser.module_names, ModuleType::PATH)
30
+ current_modules = ModuleCacheOperator.new(path).current_path_modules
31
31
 
32
32
  # Verify input modules
33
33
  modules = [] unless modules
@@ -47,6 +47,8 @@ module BigKeeper
47
47
  add_modules = modules - current_modules
48
48
  del_modules = current_modules - modules
49
49
 
50
+ ModuleCacheOperator.new(path).cache_path_modules(modules)
51
+
50
52
  if add_modules.empty? and del_modules.empty?
51
53
  Logger.default("There is nothing changed with modules #{modules}.")
52
54
  else
@@ -60,10 +62,10 @@ module BigKeeper
60
62
  end
61
63
 
62
64
  # pod install
63
- DepService.dep_operator(path).install(false, user)
65
+ DepService.dep_operator(path, user).install(false)
64
66
 
65
67
  # Open home workspace
66
- DepService.dep_operator(path).open
68
+ DepService.dep_operator(path, user).open
67
69
  end
68
70
  ensure
69
71
  end
@@ -0,0 +1,36 @@
1
+ require 'big_keeper/command/pod/podfile'
2
+
3
+ module BigKeeper
4
+
5
+ def self.pod_command
6
+ desc 'Podfile operation'
7
+ command :podfile do |podfile|
8
+ podfile.flag %i[pod 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
+ path = File.expand_path(global_options[:path])
15
+ podfile_detect(path)
16
+ end
17
+ end
18
+
19
+ podfile.desc 'Lock podname should be locked.'
20
+ podfile.command :lock do |lock|
21
+ lock.action do |global_options, options, args|
22
+ path = File.expand_path(global_options[:path])
23
+ podfile_lock(path)
24
+ end
25
+ end
26
+
27
+ podfile.desc 'Update modules should be upgrade.'
28
+ podfile.command :update do |lock|
29
+ lock.action do |global_options, options, args|
30
+ path = File.expand_path(global_options[:path])
31
+ podfile_modules_update(path)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,68 @@
1
+ require 'big_keeper/command/release/home'
2
+ require 'big_keeper/command/release/module'
3
+
4
+ module BigKeeper
5
+ def self.release_command
6
+ desc 'Gitflow release operations'
7
+ command :release do |c|
8
+
9
+ c.desc 'Release home project operations'
10
+ c.command :home do |home|
11
+ home.desc 'Start release home project'
12
+ home.command :start do |start|
13
+ start.action do |global_options, options, args|
14
+ path = File.expand_path(global_options[:path])
15
+ version = global_options[:ver]
16
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
17
+
18
+ help_now!('user name is required') if user and user.empty?
19
+ raise Logger.error("release version is required") if version == nil
20
+ release_home_start(path, version, user)
21
+ end
22
+ end
23
+
24
+ home.desc 'Finish release home project'
25
+ home.command :finish do |finish|
26
+ finish.action do |global_options, options, args|
27
+ path = File.expand_path(global_options[:path])
28
+ version = global_options[:ver]
29
+
30
+ raise Logger.error("release version is required") if version == nil
31
+ release_home_finish(path, version)
32
+ end
33
+ end
34
+ end
35
+
36
+ c.desc 'release module'
37
+ c.command :module do |m|
38
+ m.desc 'Start release module project'
39
+ m.command :start do |start|
40
+ start.action do |global_options, options, args|
41
+ path = File.expand_path(global_options[:path])
42
+ version = global_options[:ver]
43
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
44
+
45
+ help_now!('module name is required') if args.length != 1
46
+ raise Logger.error("release version is required") if version == nil
47
+ module_name = args[0]
48
+ release_module_start(path, version, user, module_name)
49
+ end
50
+ end
51
+
52
+ m.desc 'finish release module project'
53
+ m.command :finish do |finish|
54
+ finish.action do |global_options, options, args|
55
+ path = File.expand_path(global_options[:path])
56
+ version = global_options[:ver]
57
+ user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
58
+
59
+ help_now!('module name is required') if args.length != 1
60
+ raise Logger.error("release version is required") if version == nil
61
+ module_name = args[0]
62
+ release_module_finish(path, version, user, module_name)
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end