bigkeeper 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/big_keeper.rb +34 -0
- data/lib/big_keeper/command/feature&hotfix/delete.rb +3 -1
- data/lib/big_keeper/command/feature&hotfix/finish.rb +8 -19
- data/lib/big_keeper/command/feature&hotfix/publish.rb +54 -0
- data/lib/big_keeper/command/feature&hotfix/pull.rb +3 -1
- data/lib/big_keeper/command/feature&hotfix/push.rb +3 -1
- data/lib/big_keeper/command/feature&hotfix/rebase.rb +3 -1
- data/lib/big_keeper/command/feature&hotfix/start.rb +10 -4
- data/lib/big_keeper/command/feature&hotfix/switch.rb +6 -4
- data/lib/big_keeper/command/feature&hotfix/update.rb +6 -4
- data/lib/big_keeper/command/pod/podfile.rb +1 -1
- data/lib/big_keeper/command/release/home.rb +5 -5
- data/lib/big_keeper/command/release/module.rb +1 -1
- data/lib/big_keeper/dependency/dep_gradle_operator.rb +163 -0
- data/lib/big_keeper/dependency/dep_operator.rb +38 -0
- data/lib/big_keeper/dependency/dep_pod_operator.rb +116 -0
- data/lib/big_keeper/dependency/dep_service.rb +14 -0
- data/lib/big_keeper/dependency/dep_type.rb +64 -0
- data/lib/big_keeper/service/git_service.rb +6 -1
- data/lib/big_keeper/service/module_service.rb +20 -12
- data/lib/big_keeper/util/bigkeeper_parser.rb +2 -8
- data/lib/big_keeper/util/cache_operator.rb +25 -0
- data/lib/big_keeper/util/file_operator.rb +15 -0
- data/lib/big_keeper/util/git_operator.rb +1 -1
- data/lib/big_keeper/util/podfile_operator.rb +4 -62
- data/lib/big_keeper/util/xcode_operator.rb +0 -3
- data/lib/big_keeper/version.rb +1 -1
- metadata +10 -3
- data/lib/big_keeper/model/podfile_type.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a7d8a654b60f6cc0974fec215e0ec7078dd6b5c
|
4
|
+
data.tar.gz: ad79e973c587663d557bd152854aa477b228b972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69604e25d6176e2f8ae5a006341f3b861cb9b5c640654693cc650fa99e3aabc9067a6dc6eb4e8c0c6121dcf86d0b0545959b64ffc8848b68b6557de72890dee4
|
7
|
+
data.tar.gz: 41fa488126c061453f6a3bb820f85742e4068c09deee4d8142203f906829a7f79224b70c8851dfb0d19db202c220019a05f58798f75d7bee9a4ae02ab0b1bc17
|
data/Gemfile.lock
CHANGED
data/lib/big_keeper.rb
CHANGED
@@ -13,6 +13,8 @@ require 'big_keeper/command/feature&hotfix/switch'
|
|
13
13
|
require 'big_keeper/command/feature&hotfix/update'
|
14
14
|
require 'big_keeper/command/feature&hotfix/pull'
|
15
15
|
require 'big_keeper/command/feature&hotfix/push'
|
16
|
+
require 'big_keeper/command/feature&hotfix/rebase'
|
17
|
+
require 'big_keeper/command/feature&hotfix/publish'
|
16
18
|
require 'big_keeper/command/pod/podfile'
|
17
19
|
require 'big_keeper/command/feature&hotfix/delete'
|
18
20
|
require 'big_keeper/command/release/home'
|
@@ -99,6 +101,14 @@ module BigKeeper
|
|
99
101
|
end
|
100
102
|
end
|
101
103
|
|
104
|
+
c.desc "Rebase 'develop' to current feature"
|
105
|
+
c.command :rebase do |rebase|
|
106
|
+
rebase.action do |global_options, options, args|
|
107
|
+
help_now!('user name is required') if user and user.empty?
|
108
|
+
rebase(path, user, GitflowType::FEATURE)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
102
112
|
c.desc 'Finish current feature'
|
103
113
|
c.command :finish do |finish|
|
104
114
|
finish.action do |global_options, options, args|
|
@@ -107,6 +117,14 @@ module BigKeeper
|
|
107
117
|
end
|
108
118
|
end
|
109
119
|
|
120
|
+
c.desc 'Publish current feature'
|
121
|
+
c.command :publish do |publish|
|
122
|
+
publish.action do |global_options, options, args|
|
123
|
+
help_now!('user name is required') if user and user.empty?
|
124
|
+
publish(path, user, GitflowType::FEATURE)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
110
128
|
c.desc 'Delete feature with name'
|
111
129
|
c.command :delete do |delete|
|
112
130
|
delete.action do |global_options, options, args|
|
@@ -180,6 +198,14 @@ module BigKeeper
|
|
180
198
|
end
|
181
199
|
end
|
182
200
|
|
201
|
+
c.desc "Rebase 'master' to current feature"
|
202
|
+
c.command :rebase do |rebase|
|
203
|
+
rebase.action do |global_options, options, args|
|
204
|
+
help_now!('user name is required') if user and user.empty?
|
205
|
+
rebase(path, user, GitflowType::HOTFIX)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
183
209
|
c.desc 'Finish current hotfix'
|
184
210
|
c.command :finish do |finish|
|
185
211
|
finish.action do |global_options, options, args|
|
@@ -188,6 +214,14 @@ module BigKeeper
|
|
188
214
|
end
|
189
215
|
end
|
190
216
|
|
217
|
+
c.desc 'Publish current feature'
|
218
|
+
c.command :publish do |publish|
|
219
|
+
publish.action do |global_options, options, args|
|
220
|
+
help_now!('user name is required') if user and user.empty?
|
221
|
+
publish(path, user, GitflowType::HOTFIX)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
191
225
|
c.desc 'Delete hotfix with name'
|
192
226
|
c.command :delete do |delete|
|
193
227
|
delete.action do |global_options, options, args|
|
@@ -6,7 +6,9 @@ require 'big_keeper/util/bigkeeper_parser'
|
|
6
6
|
require 'big_keeper/util/logger'
|
7
7
|
require 'big_keeper/util/pod_operator'
|
8
8
|
|
9
|
-
require 'big_keeper/
|
9
|
+
require 'big_keeper/dependency/dep_service'
|
10
|
+
|
11
|
+
require 'big_keeper/dependency/dep_type'
|
10
12
|
|
11
13
|
require 'big_keeper/service/stash_service'
|
12
14
|
require 'big_keeper/service/module_service'
|
@@ -6,7 +6,9 @@ require 'big_keeper/util/pod_operator'
|
|
6
6
|
require 'big_keeper/util/xcode_operator'
|
7
7
|
require 'big_keeper/util/bigkeeper_parser'
|
8
8
|
|
9
|
-
require 'big_keeper/
|
9
|
+
require 'big_keeper/dependency/dep_service'
|
10
|
+
|
11
|
+
require 'big_keeper/dependency/dep_type'
|
10
12
|
|
11
13
|
|
12
14
|
module BigKeeper
|
@@ -16,12 +18,12 @@ module BigKeeper
|
|
16
18
|
# Parse Bigkeeper file
|
17
19
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
18
20
|
|
19
|
-
modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
|
20
|
-
BigkeeperParser.module_names, ModuleType::PATH)
|
21
21
|
branch_name = GitOperator.new.current_branch(path)
|
22
|
-
|
23
22
|
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
24
23
|
|
24
|
+
modules = DepService.dep_operator(path).modules_with_type(BigkeeperParser.module_names,
|
25
|
+
ModuleType::PATH)
|
26
|
+
|
25
27
|
# Rebase modules and modify podfile as git
|
26
28
|
modules.each do |module_name|
|
27
29
|
ModuleService.new.finish(path, user, module_name, branch_name, type)
|
@@ -30,26 +32,13 @@ module BigKeeper
|
|
30
32
|
Logger.highlight("Finish branch '#{branch_name}' for 'Home'")
|
31
33
|
|
32
34
|
# pod install
|
33
|
-
|
34
|
-
|
35
|
-
modules.each do |module_name|
|
36
|
-
module_git = BigkeeperParser.module_git(module_name)
|
37
|
-
PodfileOperator.new.find_and_replace("#{path}/Podfile",
|
38
|
-
module_name,
|
39
|
-
ModuleType::GIT,
|
40
|
-
GitInfo.new(module_git, GitType::BRANCH, GitflowType.base_branch(type)))
|
41
|
-
end
|
35
|
+
DepService.dep_operator(path).install(false)
|
42
36
|
|
43
37
|
# Open home workspace
|
44
|
-
|
38
|
+
DepService.dep_operator(path).open
|
45
39
|
|
46
40
|
# Push home changes to remote
|
47
41
|
GitService.new.verify_push(path, "finish branch #{branch_name}", branch_name, 'Home')
|
48
|
-
|
49
|
-
# Rebase Home
|
50
|
-
GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
|
51
|
-
|
52
|
-
`open #{BigkeeperParser.home_pulls()}`
|
53
42
|
ensure
|
54
43
|
end
|
55
44
|
end
|
@@ -0,0 +1,54 @@
|
|
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/bigkeeper_parser'
|
8
|
+
|
9
|
+
require 'big_keeper/dependency/dep_service'
|
10
|
+
|
11
|
+
require 'big_keeper/dependency/dep_type'
|
12
|
+
|
13
|
+
|
14
|
+
module BigKeeper
|
15
|
+
|
16
|
+
def self.publish(path, user, type)
|
17
|
+
begin
|
18
|
+
# Parse Bigkeeper file
|
19
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
20
|
+
|
21
|
+
branch_name = GitOperator.new.current_branch(path)
|
22
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
23
|
+
|
24
|
+
path_modules = DepService.dep_operator(path).modules_with_type(BigkeeperParser.module_names,
|
25
|
+
ModuleType::PATH)
|
26
|
+
Logger.error("You have unfinished modules #{path_modules}, Use 'finish' first please.") unless path_modules.empty?
|
27
|
+
|
28
|
+
modules = DepService.dep_operator(path).modules_with_branch(BigkeeperParser.module_names,
|
29
|
+
branch_name)
|
30
|
+
|
31
|
+
# Rebase modules and modify podfile as git
|
32
|
+
modules.each do |module_name|
|
33
|
+
ModuleService.new.publish(path, user, module_name, branch_name, type)
|
34
|
+
end
|
35
|
+
|
36
|
+
Logger.highlight("Publish branch '#{branch_name}' for 'Home'")
|
37
|
+
|
38
|
+
# pod install
|
39
|
+
DepService.dep_operator(path).install(false)
|
40
|
+
|
41
|
+
# Recover podfile
|
42
|
+
DepService.dep_operator(path).recover
|
43
|
+
|
44
|
+
# Push home changes to remote
|
45
|
+
GitService.new.verify_push(path, "publish branch #{branch_name}", branch_name, 'Home')
|
46
|
+
|
47
|
+
# Rebase Home
|
48
|
+
GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
|
49
|
+
|
50
|
+
`open #{BigkeeperParser.home_pulls()}`
|
51
|
+
ensure
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'big_keeper/util/logger'
|
2
2
|
|
3
|
+
require 'big_keeper/dependency/dep_service'
|
4
|
+
|
3
5
|
module BigKeeper
|
4
6
|
def self.pull(path, user, type)
|
5
7
|
begin
|
@@ -9,7 +11,7 @@ module BigKeeper
|
|
9
11
|
|
10
12
|
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
11
13
|
|
12
|
-
modules =
|
14
|
+
modules = DepService.dep_operator(path).modules_with_type(
|
13
15
|
BigkeeperParser.module_names, ModuleType::PATH)
|
14
16
|
|
15
17
|
modules.each do |module_name|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'big_keeper/util/logger'
|
2
2
|
|
3
|
+
require 'big_keeper/dependency/dep_service'
|
4
|
+
|
3
5
|
module BigKeeper
|
4
6
|
|
5
7
|
def self.push(path, user, comment, type)
|
@@ -10,7 +12,7 @@ module BigKeeper
|
|
10
12
|
|
11
13
|
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
12
14
|
|
13
|
-
modules =
|
15
|
+
modules = DepService.dep_operator(path).modules_with_type(
|
14
16
|
BigkeeperParser.module_names, ModuleType::PATH)
|
15
17
|
|
16
18
|
modules.each do |module_name|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'big_keeper/util/logger'
|
2
2
|
|
3
|
+
require 'big_keeper/dependency/dep_service'
|
4
|
+
|
3
5
|
module BigKeeper
|
4
6
|
def self.reabse(path, user, type)
|
5
7
|
begin
|
@@ -9,7 +11,7 @@ module BigKeeper
|
|
9
11
|
|
10
12
|
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
11
13
|
|
12
|
-
modules =
|
14
|
+
modules = DepService.dep_operator(path).modules_with_type(
|
13
15
|
BigkeeperParser.module_names, ModuleType::PATH)
|
14
16
|
|
15
17
|
modules.each do |module_name|
|
@@ -7,7 +7,9 @@ require 'big_keeper/util/logger'
|
|
7
7
|
require 'big_keeper/util/pod_operator'
|
8
8
|
require 'big_keeper/util/xcode_operator'
|
9
9
|
|
10
|
-
require 'big_keeper/
|
10
|
+
require 'big_keeper/dependency/dep_service'
|
11
|
+
|
12
|
+
require 'big_keeper/dependency/dep_type'
|
11
13
|
|
12
14
|
require 'big_keeper/service/stash_service'
|
13
15
|
require 'big_keeper/service/module_service'
|
@@ -25,9 +27,10 @@ module BigKeeper
|
|
25
27
|
|
26
28
|
GitService.new.verify_home_branch(path, branch_name, OperateType::START)
|
27
29
|
|
28
|
-
stash_modules =
|
30
|
+
stash_modules = DepService.dep_operator(path).modules_with_type(
|
29
31
|
BigkeeperParser.module_names, ModuleType::PATH)
|
30
32
|
|
33
|
+
p stash_modules
|
31
34
|
# Stash current branch
|
32
35
|
StashService.new.stash_all(path, branch_name, user, stash_modules)
|
33
36
|
|
@@ -48,16 +51,19 @@ module BigKeeper
|
|
48
51
|
# Start home feature
|
49
52
|
GitService.new.start(path, full_name, type)
|
50
53
|
|
54
|
+
# Backup podfile
|
55
|
+
DepService.dep_operator(path).backup
|
56
|
+
|
51
57
|
# Modify podfile as path and Start modules feature
|
52
58
|
modules.each do |module_name|
|
53
59
|
ModuleService.new.add(path, user, module_name, full_name, type)
|
54
60
|
end
|
55
61
|
|
56
62
|
# pod install
|
57
|
-
|
63
|
+
DepService.dep_operator(path).install(true) unless modules.empty?
|
58
64
|
|
59
65
|
# Open home workspace
|
60
|
-
|
66
|
+
DepService.dep_operator(path).open
|
61
67
|
|
62
68
|
# Push home changes to remote
|
63
69
|
GitService.new.verify_push(path, "init #{GitflowType.name(type)} #{full_name}", branch_name, 'Home')
|
@@ -4,6 +4,8 @@ require 'big_keeper/util/logger'
|
|
4
4
|
require 'big_keeper/util/pod_operator'
|
5
5
|
require 'big_keeper/util/xcode_operator'
|
6
6
|
|
7
|
+
require 'big_keeper/dependency/dep_service'
|
8
|
+
|
7
9
|
module BigKeeper
|
8
10
|
def self.switch_to(path, version, user, name, type)
|
9
11
|
begin
|
@@ -16,7 +18,7 @@ module BigKeeper
|
|
16
18
|
|
17
19
|
GitService.new.verify_home_branch(path, branch_name, OperateType::SWITCH)
|
18
20
|
|
19
|
-
stash_modules =
|
21
|
+
stash_modules = DepService.dep_operator(path).modules_with_type(
|
20
22
|
BigkeeperParser.module_names, ModuleType::PATH)
|
21
23
|
|
22
24
|
# Stash current branch
|
@@ -29,7 +31,7 @@ module BigKeeper
|
|
29
31
|
# Apply home stash
|
30
32
|
StashService.new.pop_stash(path, branch_name, 'Home')
|
31
33
|
|
32
|
-
modules =
|
34
|
+
modules = DepService.dep_operator(path).modules_with_type(
|
33
35
|
BigkeeperParser.module_names, ModuleType::PATH)
|
34
36
|
|
35
37
|
modules.each do |module_name|
|
@@ -37,10 +39,10 @@ module BigKeeper
|
|
37
39
|
end
|
38
40
|
|
39
41
|
# pod install
|
40
|
-
|
42
|
+
DepService.dep_operator(path).install(false)
|
41
43
|
|
42
44
|
# Open home workspace
|
43
|
-
|
45
|
+
DepService.dep_operator(path).open
|
44
46
|
ensure
|
45
47
|
end
|
46
48
|
end
|
@@ -7,7 +7,9 @@ require 'big_keeper/util/logger'
|
|
7
7
|
require 'big_keeper/util/pod_operator'
|
8
8
|
require 'big_keeper/util/xcode_operator'
|
9
9
|
|
10
|
-
require 'big_keeper/
|
10
|
+
require 'big_keeper/dependency/dep_service'
|
11
|
+
|
12
|
+
require 'big_keeper/dependency/dep_type'
|
11
13
|
|
12
14
|
require 'big_keeper/service/stash_service'
|
13
15
|
require 'big_keeper/service/module_service'
|
@@ -24,7 +26,7 @@ module BigKeeper
|
|
24
26
|
|
25
27
|
full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
|
26
28
|
|
27
|
-
current_modules =
|
29
|
+
current_modules = DepService.dep_operator(path).modules_with_type(
|
28
30
|
BigkeeperParser.module_names, ModuleType::PATH)
|
29
31
|
|
30
32
|
# Verify input modules
|
@@ -58,10 +60,10 @@ module BigKeeper
|
|
58
60
|
end
|
59
61
|
|
60
62
|
# pod install
|
61
|
-
|
63
|
+
DepService.dep_operator(path).install(false)
|
62
64
|
|
63
65
|
# Open home workspace
|
64
|
-
|
66
|
+
DepService.dep_operator(path).open
|
65
67
|
end
|
66
68
|
ensure
|
67
69
|
end
|
@@ -3,7 +3,7 @@ require 'big_keeper/util/podfile_operator'
|
|
3
3
|
require 'big_keeper/util/podfile_module'
|
4
4
|
require 'big_keeper/util/gitflow_operator'
|
5
5
|
require 'big_keeper/util/bigkeeper_parser'
|
6
|
-
require 'big_keeper/
|
6
|
+
require 'big_keeper/dependency/dep_type'
|
7
7
|
require 'big_keeper/util/logger'
|
8
8
|
|
9
9
|
module BigKeeper
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
require 'big_keeper/util/podfile_operator'
|
3
3
|
require 'big_keeper/util/gitflow_operator'
|
4
|
-
require 'big_keeper/
|
4
|
+
require 'big_keeper/dependency/dep_type'
|
5
5
|
require 'big_keeper/util/info_plist_operator'
|
6
6
|
require 'big_keeper/util/logger'
|
7
7
|
|
@@ -52,14 +52,14 @@ module BigKeeper
|
|
52
52
|
|
53
53
|
Logger.highlight(%Q(Start to release/#{version}))
|
54
54
|
# step 2 replace_modules
|
55
|
-
PodfileOperator.new.replace_all_module_release(
|
56
|
-
|
57
|
-
|
55
|
+
PodfileOperator.new.replace_all_module_release(project_path,
|
56
|
+
modules,
|
57
|
+
version)
|
58
58
|
|
59
59
|
# step 3 change Info.plist value
|
60
60
|
InfoPlistOperator.new.change_version_build(project_path, version)
|
61
61
|
|
62
|
-
|
62
|
+
DepService.dep_operator(project_path).install(true)
|
63
63
|
`open #{project_path}/*.xcworkspace`
|
64
64
|
end
|
65
65
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
require 'big_keeper/util/podfile_operator'
|
3
3
|
require 'big_keeper/util/gitflow_operator'
|
4
|
-
require 'big_keeper/
|
4
|
+
require 'big_keeper/dependency/dep_type'
|
5
5
|
require 'big_keeper/util/info_plist_operator'
|
6
6
|
require 'big_keeper/util/git_operator'
|
7
7
|
require 'big_keeper/util/logger'
|
@@ -0,0 +1,163 @@
|
|
1
|
+
require 'big_keeper/dependency/dep_operator'
|
2
|
+
|
3
|
+
module BigKeeper
|
4
|
+
# Operator for podfile
|
5
|
+
class DepGradleOperator < DepOperator
|
6
|
+
|
7
|
+
def backup
|
8
|
+
cache_operator = CacheOperator.new(@path)
|
9
|
+
cache_operator.save('setting.gradle')
|
10
|
+
Dir.glob("#{@path}/*/build.gradle").each do |build_gradle_file_path|
|
11
|
+
build_gradle_file = build_gradle_file_path.gsub!(/#{@path}/, '')
|
12
|
+
cache_operator.save(build_gradle_file)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def recover
|
17
|
+
cache_operator = CacheOperator.new(@path)
|
18
|
+
|
19
|
+
cache_operator.load('setting.gradle')
|
20
|
+
Dir.glob("#{@path}/*/build.gradle").each do |build_gradle_file_path|
|
21
|
+
build_gradle_file = build_gradle_file_path.gsub!(/#{@path}/, '')
|
22
|
+
cache_operator.load(build_gradle_file)
|
23
|
+
end
|
24
|
+
|
25
|
+
cache_operator.clean
|
26
|
+
end
|
27
|
+
|
28
|
+
def modules_with_branch(modules, branch_name)
|
29
|
+
snapshot_name = "#{branch_name}_SNAPSHOT"
|
30
|
+
file = "#{@path}/app/build.gradle"
|
31
|
+
|
32
|
+
matched_modules = []
|
33
|
+
File.open(file, 'r') do |file|
|
34
|
+
file.each_line do |line|
|
35
|
+
modules.each do |module_name|
|
36
|
+
if line =~ /compile\s*'\S*#{module_name.downcase}:#{snapshot_name}'\S*/
|
37
|
+
matched_modules << module_name
|
38
|
+
break
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
matched_modules
|
44
|
+
end
|
45
|
+
|
46
|
+
def modules_with_type(modules, type)
|
47
|
+
file = "#{@path}/app/build.gradle"
|
48
|
+
|
49
|
+
matched_modules = []
|
50
|
+
File.open(file, 'r') do |file|
|
51
|
+
file.each_line do |line|
|
52
|
+
modules.each do |module_name|
|
53
|
+
if line =~ regex(type, module_name)
|
54
|
+
matched_modules << module_name
|
55
|
+
break
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
matched_modules
|
61
|
+
end
|
62
|
+
|
63
|
+
def regex(type, module_name)
|
64
|
+
if ModuleType::PATH == type
|
65
|
+
/compile\s*project\('\S*#{module_name.downcase}'\)\S*/
|
66
|
+
elsif ModuleType::GIT == type
|
67
|
+
/compile\s*'\S*#{module_name.downcase}\S*'\S*/
|
68
|
+
elsif ModuleType::SPEC == type
|
69
|
+
/compile\s*'\S*#{module_name.downcase}\S*'\S*/
|
70
|
+
else
|
71
|
+
//
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def find_and_replace(module_name, module_type, source)
|
76
|
+
Dir.glob("#{@path}/*/build.gradle").each do |file|
|
77
|
+
temp_file = Tempfile.new('.build.gradle.tmp')
|
78
|
+
begin
|
79
|
+
File.open(file, 'r') do |file|
|
80
|
+
file.each_line do |line|
|
81
|
+
temp_file.puts generate_build_config(line, module_name, module_type, source)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
temp_file.close
|
85
|
+
FileUtils.mv(temp_file.path, file)
|
86
|
+
ensure
|
87
|
+
temp_file.close
|
88
|
+
temp_file.unlink
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def install(addition)
|
94
|
+
modules = modules_with_type(BigkeeperParser.module_names, ModuleType::PATH)
|
95
|
+
|
96
|
+
CacheOperator.new(@path).load('setting.gradle')
|
97
|
+
|
98
|
+
begin
|
99
|
+
File.open("#{@path}/setting.gradle", 'a') do |file|
|
100
|
+
modules.each do |module_name|
|
101
|
+
module_path = BigkeeperParser.module_path(user, module_name)
|
102
|
+
file.puts "include '#{prefix_of_module(module_name)}#{module_name.downcase}'\r\n"
|
103
|
+
file.puts "project('#{prefix_of_module(module_name)}#{module_name.downcase}').projectDir = new File(rootProject.projectDir, '../#{module_name}/#{module_name.downcase}-lib')\r\n"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
ensure
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def prefix_of_module(module_name)
|
111
|
+
file = "#{@path}/app/build.gradle"
|
112
|
+
prefix = ''
|
113
|
+
|
114
|
+
File.open(file, 'r') do |file|
|
115
|
+
file.each_line do |line|
|
116
|
+
if line =~ /(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/
|
117
|
+
prefix = line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
118
|
+
$3
|
119
|
+
}
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
prefix.chop
|
125
|
+
end
|
126
|
+
|
127
|
+
def open
|
128
|
+
end
|
129
|
+
|
130
|
+
def generate_build_config(line, module_name, module_type, source)
|
131
|
+
if ModuleType::PATH == module_type
|
132
|
+
line.sub(/(\s*)compile(\s*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
133
|
+
"#{$1}compile project('#{$3}#{module_name.downcase}')"
|
134
|
+
}
|
135
|
+
elsif ModuleType::GIT == module_type
|
136
|
+
branch_name = GitOperator.new.current_branch(@path)
|
137
|
+
snapshot_name = "SNAPSHOT"
|
138
|
+
|
139
|
+
# Get version part of source.addition
|
140
|
+
if 'develop' == source.addition || 'master' == source.addition
|
141
|
+
snapshot_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){
|
142
|
+
"#{$2}_SNAPSHOT"
|
143
|
+
}
|
144
|
+
else
|
145
|
+
snapshot_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){
|
146
|
+
"#{$2}_SNAPSHOT"
|
147
|
+
}
|
148
|
+
end
|
149
|
+
line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
150
|
+
"#{$1}compile '#{$3}#{module_name.downcase}:#{snapshot_name}'"
|
151
|
+
}
|
152
|
+
elsif ModuleType::SPEC == module_type
|
153
|
+
line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
154
|
+
"#{$1}compile '#{$3}#{module_name.downcase}:#{source}'"
|
155
|
+
}
|
156
|
+
else
|
157
|
+
line
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
private :generate_build_config, :regex
|
162
|
+
end
|
163
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module BigKeeper
|
2
|
+
# Operator for podfile
|
3
|
+
class DepOperator
|
4
|
+
@path
|
5
|
+
|
6
|
+
def initialize(path)
|
7
|
+
@path = path
|
8
|
+
end
|
9
|
+
|
10
|
+
def backup
|
11
|
+
raise "You should override this method in subclass."
|
12
|
+
end
|
13
|
+
|
14
|
+
def recover
|
15
|
+
raise "You should override this method in subclass."
|
16
|
+
end
|
17
|
+
|
18
|
+
def modules_with_branch(modules, branch_name)
|
19
|
+
raise "You should override this method in subclass."
|
20
|
+
end
|
21
|
+
|
22
|
+
def modules_with_type(modules, type)
|
23
|
+
raise "You should override this method in subclass."
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_and_replace(module_name, module_type, source)
|
27
|
+
raise "You should override this method in subclass."
|
28
|
+
end
|
29
|
+
|
30
|
+
def install(addition)
|
31
|
+
raise "You should override this method in subclass."
|
32
|
+
end
|
33
|
+
|
34
|
+
def open
|
35
|
+
raise "You should override this method in subclass."
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'big_keeper/dependency/dep_operator'
|
2
|
+
|
3
|
+
require 'big_keeper/util/pod_operator'
|
4
|
+
require 'big_keeper/util/xcode_operator'
|
5
|
+
require 'big_keeper/util/cache_operator'
|
6
|
+
|
7
|
+
module BigKeeper
|
8
|
+
# Operator for podfile
|
9
|
+
class DepPodOperator < DepOperator
|
10
|
+
def backup
|
11
|
+
CacheOperator.new(@path).save('Podfile')
|
12
|
+
end
|
13
|
+
|
14
|
+
def recover
|
15
|
+
cache_operator = CacheOperator.new(@path)
|
16
|
+
cache_operator.load('Podfile')
|
17
|
+
cache_operator.clean
|
18
|
+
end
|
19
|
+
|
20
|
+
def modules_with_branch(modules, branch_name)
|
21
|
+
file = "#{@path}/Podfile"
|
22
|
+
matched_modules = []
|
23
|
+
File.open(file, 'r') do |file|
|
24
|
+
file.each_line do |line|
|
25
|
+
modules.each do |module_name|
|
26
|
+
if line =~ /pod\s*'#{module_name}'\s*,\s*:git\s*=>\s*\S*\s*,\s*:branch\s*=>\s*'#{branch_name}'\s*/
|
27
|
+
matched_modules << module_name
|
28
|
+
break
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
matched_modules
|
34
|
+
end
|
35
|
+
|
36
|
+
def modules_with_type(modules, type)
|
37
|
+
file = "#{@path}/Podfile"
|
38
|
+
matched_modules = []
|
39
|
+
File.open(file, 'r') do |file|
|
40
|
+
file.each_line do |line|
|
41
|
+
modules.each do |module_name|
|
42
|
+
if line =~ /pod\s*'#{module_name}'\s*,#{regex(type)}/
|
43
|
+
matched_modules << module_name
|
44
|
+
break
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
matched_modules
|
50
|
+
end
|
51
|
+
|
52
|
+
def regex(type)
|
53
|
+
if ModuleType::PATH == type
|
54
|
+
"\s*:path\s*=>\s*"
|
55
|
+
elsif ModuleType::GIT == type
|
56
|
+
"\s*:git\s*=>\s*"
|
57
|
+
elsif ModuleType::SPEC == type
|
58
|
+
"\s*'"
|
59
|
+
else
|
60
|
+
""
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def find_and_replace(module_name, module_type, source)
|
65
|
+
file = "#{@path}/Podfile"
|
66
|
+
temp_file = Tempfile.new('.Podfile.tmp')
|
67
|
+
|
68
|
+
begin
|
69
|
+
File.open(file, 'r') do |file|
|
70
|
+
file.each_line do |line|
|
71
|
+
temp_file.puts generate_module_config(line, module_name, module_type, source)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
temp_file.close
|
75
|
+
FileUtils.mv(temp_file.path, file)
|
76
|
+
ensure
|
77
|
+
temp_file.close
|
78
|
+
temp_file.unlink
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def install(addition)
|
83
|
+
PodOperator.pod_install(@path, addition)
|
84
|
+
end
|
85
|
+
|
86
|
+
def open
|
87
|
+
XcodeOperator.open_workspace(@path)
|
88
|
+
end
|
89
|
+
|
90
|
+
def generate_module_config(line, module_name, module_type, source)
|
91
|
+
line.sub(/(\s*)pod(\s*)'(\S*)#{module_name}(\S*)'([\s\S]*)#([\s\S]*)/){
|
92
|
+
if ModuleType::PATH == module_type
|
93
|
+
"#{$1}pod '#{module_name}', :path => '#{source}' ##{$6}"
|
94
|
+
elsif ModuleType::GIT == module_type
|
95
|
+
# puts source.base
|
96
|
+
# puts source.addition
|
97
|
+
if GitType::BRANCH == source.type
|
98
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}', :branch => '#{source.addition}' ##{$6}"
|
99
|
+
elsif GitType::TAG == source.type
|
100
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}', :tag => '#{source.addition}' ##{$6}"
|
101
|
+
elsif GitType::COMMIT == source.type
|
102
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}', :commit => '#{source.addition}' ##{$6}"
|
103
|
+
else
|
104
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}' ##{$6}"
|
105
|
+
end
|
106
|
+
elsif ModuleType::SPEC == module_type
|
107
|
+
"#{$1}pod '#{module_name}', '#{source}' ##{$6}"
|
108
|
+
else
|
109
|
+
line
|
110
|
+
end
|
111
|
+
}
|
112
|
+
end
|
113
|
+
|
114
|
+
private :generate_module_config, :regex
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'big_keeper/util/git_operator'
|
2
|
+
require 'big_keeper/model/gitflow_type'
|
3
|
+
require 'big_keeper/model/operate_type'
|
4
|
+
require 'big_keeper/util/logger'
|
5
|
+
require 'big_keeper/dependency/dep_type'
|
6
|
+
|
7
|
+
module BigKeeper
|
8
|
+
# Operator for podfile
|
9
|
+
class DepService
|
10
|
+
def self.dep_operator(path)
|
11
|
+
DepType.operator(path)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'big_keeper/dependency/dep_operator'
|
2
|
+
require 'big_keeper/dependency/dep_pod_operator'
|
3
|
+
require 'big_keeper/dependency/dep_gradle_operator'
|
4
|
+
require 'big_keeper/util/file_operator'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
module DepType
|
8
|
+
NONE = 0
|
9
|
+
COCOAPODS = 1
|
10
|
+
GRADLE = 2
|
11
|
+
|
12
|
+
def self.type(path)
|
13
|
+
if FileOperator.definitely_exists?("#{path}/Podfile")
|
14
|
+
COCOAPODS
|
15
|
+
elsif FileOperator.definitely_exists?("#{path}/build.gradle")
|
16
|
+
GRADLE
|
17
|
+
else
|
18
|
+
NONE
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.operator(path)
|
23
|
+
operator_type = type(path)
|
24
|
+
if COCOAPODS == operator_type
|
25
|
+
DepPodOperator.new(path)
|
26
|
+
elsif GRADLE == operator_type
|
27
|
+
DepGradleOperator.new(path)
|
28
|
+
else
|
29
|
+
DepOperator.new(path)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module ModuleType
|
35
|
+
PATH = 1
|
36
|
+
GIT = 2
|
37
|
+
SPEC = 3
|
38
|
+
end
|
39
|
+
|
40
|
+
module GitType
|
41
|
+
MASTER = 1
|
42
|
+
BRANCH = 2
|
43
|
+
TAG = 3
|
44
|
+
COMMIT = 4
|
45
|
+
end
|
46
|
+
|
47
|
+
class GitInfo
|
48
|
+
def initialize(base, type, addition)
|
49
|
+
@base, @type, @addition = base, type, addition
|
50
|
+
end
|
51
|
+
|
52
|
+
def type
|
53
|
+
@type
|
54
|
+
end
|
55
|
+
|
56
|
+
def base
|
57
|
+
@base
|
58
|
+
end
|
59
|
+
|
60
|
+
def addition
|
61
|
+
@addition
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'big_keeper/util/git_operator'
|
2
|
+
require 'big_keeper/util/gitflow_operator'
|
2
3
|
require 'big_keeper/model/gitflow_type'
|
3
4
|
require 'big_keeper/model/operate_type'
|
4
5
|
require 'big_keeper/util/logger'
|
@@ -12,6 +13,8 @@ module BigKeeper
|
|
12
13
|
branch_name = "#{GitflowType.name(type)}/#{name}"
|
13
14
|
if !git.has_remote_branch(path, branch_name) && !git.has_local_branch(path, branch_name)
|
14
15
|
|
16
|
+
GitflowOperator.new.verify_git_flow(path)
|
17
|
+
|
15
18
|
verify_special_branch(path, 'master')
|
16
19
|
verify_special_branch(path, 'develop')
|
17
20
|
|
@@ -121,7 +124,7 @@ module BigKeeper
|
|
121
124
|
Logger.highlight("Delete local branch '#{branch_name}' for '#{name}'...")
|
122
125
|
|
123
126
|
if git.current_branch(path) == branch_name
|
124
|
-
git.
|
127
|
+
git.discard(path)
|
125
128
|
git.checkout(path, GitflowType.base_branch(type))
|
126
129
|
end
|
127
130
|
git.del_local(path, branch_name)
|
@@ -179,6 +182,8 @@ module BigKeeper
|
|
179
182
|
if GitOperator.new.current_branch(path) != 'develop' && GitOperator.new.current_branch(path) != 'master'
|
180
183
|
`git push -f`
|
181
184
|
GitOperator.new.checkout(path, branch_name)
|
185
|
+
else
|
186
|
+
Logger.error("You should not push 'master' or 'develop'")
|
182
187
|
end
|
183
188
|
end
|
184
189
|
end
|
@@ -13,7 +13,7 @@ module BigKeeper
|
|
13
13
|
if !File.exist? module_full_path
|
14
14
|
Logger.default("No local repository for module '#{module_name}', clone it...")
|
15
15
|
module_git = BigkeeperParser.module_git(module_name)
|
16
|
-
git.
|
16
|
+
git.clone(File.expand_path("#{module_full_path}/../"), module_git)
|
17
17
|
end
|
18
18
|
|
19
19
|
current_branch_name = git.current_branch(module_full_path)
|
@@ -67,24 +67,32 @@ module BigKeeper
|
|
67
67
|
verify_module(path, user, module_name, home_branch_name, type)
|
68
68
|
end
|
69
69
|
|
70
|
+
def publish(path, user, module_name, home_branch_name, type)
|
71
|
+
Logger.highlight("Publish branch '#{home_branch_name}' for module '#{module_name}'...")
|
72
|
+
|
73
|
+
verify_module(path, user, module_name, home_branch_name, type)
|
74
|
+
|
75
|
+
GitService.new.verify_push(module_full_path, "publish branch #{home_branch_name}", home_branch_name, module_name)
|
76
|
+
|
77
|
+
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
78
|
+
GitService.new.verify_rebase(module_full_path, GitflowType.base_branch(type), module_name)
|
79
|
+
|
80
|
+
`open #{BigkeeperParser.module_pulls(module_name)}`
|
81
|
+
end
|
82
|
+
|
70
83
|
def finish(path, user, module_name, home_branch_name, type)
|
71
84
|
Logger.highlight("Finish branch '#{home_branch_name}' for module '#{module_name}'...")
|
72
85
|
|
73
86
|
verify_module(path, user, module_name, home_branch_name, type)
|
74
87
|
|
88
|
+
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
89
|
+
GitService.new.verify_push(module_full_path, "finish branch #{home_branch_name}", home_branch_name, module_name)
|
90
|
+
|
75
91
|
module_git = BigkeeperParser.module_git(module_name)
|
76
|
-
|
92
|
+
DepService.dep_operator(path).find_and_replace(
|
77
93
|
module_name,
|
78
94
|
ModuleType::GIT,
|
79
95
|
GitInfo.new(module_git, GitType::BRANCH, home_branch_name))
|
80
|
-
|
81
|
-
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
82
|
-
|
83
|
-
GitService.new.verify_push(module_full_path, "finish branch #{home_branch_name}", home_branch_name, module_name)
|
84
|
-
|
85
|
-
GitService.new.verify_rebase(module_full_path, GitflowType.base_branch(type), module_name)
|
86
|
-
|
87
|
-
`open #{BigkeeperParser.module_pulls(module_name)}`
|
88
96
|
end
|
89
97
|
|
90
98
|
def add(path, user, module_name, name, type)
|
@@ -95,7 +103,7 @@ module BigKeeper
|
|
95
103
|
verify_module(path, user, module_name, home_branch_name, type)
|
96
104
|
|
97
105
|
module_path = BigkeeperParser.module_path(user, module_name)
|
98
|
-
|
106
|
+
DepService.dep_operator(path).find_and_replace(
|
99
107
|
module_name,
|
100
108
|
ModuleType::PATH,
|
101
109
|
module_path)
|
@@ -115,7 +123,7 @@ module BigKeeper
|
|
115
123
|
|
116
124
|
module_git = BigkeeperParser.module_git(module_name)
|
117
125
|
|
118
|
-
|
126
|
+
DepService.dep_operator(path).find_and_replace(
|
119
127
|
module_name,
|
120
128
|
ModuleType::GIT,
|
121
129
|
GitInfo.new(module_git, GitType::BRANCH, GitflowType.base_branch(type)))
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'big_keeper/util/logger'
|
2
|
+
require 'big_keeper/util/file_operator'
|
2
3
|
|
3
4
|
# Bigkeeper module
|
4
5
|
module BigKeeper
|
@@ -36,7 +37,7 @@ module BigKeeper
|
|
36
37
|
def self.parse(bigkeeper)
|
37
38
|
if @@config.empty?
|
38
39
|
|
39
|
-
Logger.error("Can't find a Bigkeeper file in current directory.") if !
|
40
|
+
Logger.error("Can't find a Bigkeeper file in current directory.") if !FileOperator.definitely_exists?(bigkeeper)
|
40
41
|
|
41
42
|
content = File.read bigkeeper
|
42
43
|
content.gsub!(/version\s/, 'BigKeeper::version ')
|
@@ -50,13 +51,6 @@ module BigKeeper
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
|
-
def self.definitely_exists? path
|
54
|
-
folder = File.dirname path
|
55
|
-
filename = File.basename path
|
56
|
-
# Unlike Ruby IO, ls, and find -f, this technique will fail to locate the file if the case is wrong:
|
57
|
-
not %x( find "#{folder}" -name "#{filename}" ).empty?
|
58
|
-
end
|
59
|
-
|
60
54
|
def self.parse_version(name)
|
61
55
|
@@config[:version] = name
|
62
56
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module BigKeeper
|
5
|
+
class CacheOperator
|
6
|
+
def initialize(path)
|
7
|
+
@path = File.expand_path(path)
|
8
|
+
@cache_path = File.expand_path("#{path}/.bigkeeper")
|
9
|
+
end
|
10
|
+
|
11
|
+
def save(file)
|
12
|
+
dest_path = File.dirname("#{@cache_path}/#{file}")
|
13
|
+
FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path)
|
14
|
+
FileUtils.cp("#{@path}/#{file}", "#{@cache_path}/#{file}");
|
15
|
+
end
|
16
|
+
|
17
|
+
def load(file)
|
18
|
+
FileUtils.cp("#{@cache_path}/#{file}", "#{@path}/#{file}");
|
19
|
+
end
|
20
|
+
|
21
|
+
def clean
|
22
|
+
FileUtils.rm_r(@cache_path)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module BigKeeper
|
2
|
+
# Operator for got
|
3
|
+
class FileOperator
|
4
|
+
def self.definitely_exists? path
|
5
|
+
folder = File.dirname path
|
6
|
+
filename = File.basename path
|
7
|
+
# Unlike Ruby IO, ls, and find -f, this technique will fail to locate the file if the case is wrong:
|
8
|
+
not %x( find "#{folder}" -name "#{filename}" ).empty?
|
9
|
+
end
|
10
|
+
|
11
|
+
def find_all(path, name)
|
12
|
+
Dir.glob("#{path}/*/#{name}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require 'fileutils'
|
3
|
-
require 'big_keeper/
|
3
|
+
require 'big_keeper/dependency/dep_type'
|
4
4
|
require 'big_keeper/util/podfile_detector'
|
5
5
|
|
6
6
|
module BigKeeper
|
@@ -17,64 +17,6 @@ module BigKeeper
|
|
17
17
|
false
|
18
18
|
end
|
19
19
|
|
20
|
-
def modules_with_type(podfile, modules, type)
|
21
|
-
matched_modules = []
|
22
|
-
File.open(podfile, 'r') do |file|
|
23
|
-
file.each_line do |line|
|
24
|
-
modules.each do |module_name|
|
25
|
-
if line =~ /pod\s*'#{module_name}',#{ModuleType.regex(type)}/
|
26
|
-
matched_modules << module_name
|
27
|
-
break
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
matched_modules
|
33
|
-
end
|
34
|
-
|
35
|
-
def find_and_replace(podfile, module_name, module_type, source)
|
36
|
-
temp_file = Tempfile.new('.Podfile.tmp')
|
37
|
-
|
38
|
-
begin
|
39
|
-
File.open(podfile, 'r') do |file|
|
40
|
-
file.each_line do |line|
|
41
|
-
if line.include?module_name
|
42
|
-
temp_file.puts generate_module_config(module_name, module_type, source)
|
43
|
-
else
|
44
|
-
temp_file.puts line
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
temp_file.close
|
49
|
-
FileUtils.mv(temp_file.path, podfile)
|
50
|
-
ensure
|
51
|
-
temp_file.close
|
52
|
-
temp_file.unlink
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def generate_module_config(module_name, module_type, source)
|
57
|
-
module_config = ''
|
58
|
-
if ModuleType::PATH == module_type
|
59
|
-
module_config = %Q( pod '#{module_name}', :path => '#{source}')
|
60
|
-
elsif ModuleType::GIT == module_type
|
61
|
-
# puts source.base
|
62
|
-
# puts source.addition
|
63
|
-
if GitType::BRANCH == source.type
|
64
|
-
module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :branch => '#{source.addition}')
|
65
|
-
elsif GitType::TAG == source.type
|
66
|
-
module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :tag => '#{source.addition}')
|
67
|
-
elsif GitType::COMMIT == source.type
|
68
|
-
module_config = %Q( pod '#{module_name}', :git => '#{source.base}', :commit => '#{source.addition}')
|
69
|
-
else
|
70
|
-
module_config = %Q( pod '#{module_name}', :git => '#{source.base}')
|
71
|
-
end
|
72
|
-
else
|
73
|
-
module_config = %Q( pod '#{module_name}', '#{source}')
|
74
|
-
end
|
75
|
-
module_config
|
76
|
-
end
|
77
|
-
|
78
20
|
def generate_pod_config(pod_name, version,comment)
|
79
21
|
module_config = ''
|
80
22
|
if comment != nil
|
@@ -84,9 +26,9 @@ module BigKeeper
|
|
84
26
|
end
|
85
27
|
end
|
86
28
|
|
87
|
-
def replace_all_module_release(
|
29
|
+
def replace_all_module_release(path, module_names, version)
|
88
30
|
module_names.each do |module_name|
|
89
|
-
|
31
|
+
DepService.dep_operator(path).find_and_replace(
|
90
32
|
module_name,
|
91
33
|
ModuleType::GIT,
|
92
34
|
GitInfo.new(BigkeeperParser.module_git(module_name), GitType::TAG, version))
|
@@ -161,6 +103,6 @@ module BigKeeper
|
|
161
103
|
end
|
162
104
|
end
|
163
105
|
|
164
|
-
private :
|
106
|
+
private :generate_pod_config
|
165
107
|
end
|
166
108
|
end
|
data/lib/big_keeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigkeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mmoaay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- lib/big_keeper.rb
|
227
227
|
- lib/big_keeper/command/feature&hotfix/delete.rb
|
228
228
|
- lib/big_keeper/command/feature&hotfix/finish.rb
|
229
|
+
- lib/big_keeper/command/feature&hotfix/publish.rb
|
229
230
|
- lib/big_keeper/command/feature&hotfix/pull.rb
|
230
231
|
- lib/big_keeper/command/feature&hotfix/push.rb
|
231
232
|
- lib/big_keeper/command/feature&hotfix/rebase.rb
|
@@ -235,14 +236,20 @@ files:
|
|
235
236
|
- lib/big_keeper/command/pod/podfile.rb
|
236
237
|
- lib/big_keeper/command/release/home.rb
|
237
238
|
- lib/big_keeper/command/release/module.rb
|
239
|
+
- lib/big_keeper/dependency/dep_gradle_operator.rb
|
240
|
+
- lib/big_keeper/dependency/dep_operator.rb
|
241
|
+
- lib/big_keeper/dependency/dep_pod_operator.rb
|
242
|
+
- lib/big_keeper/dependency/dep_service.rb
|
243
|
+
- lib/big_keeper/dependency/dep_type.rb
|
238
244
|
- lib/big_keeper/model/gitflow_type.rb
|
239
245
|
- lib/big_keeper/model/operate_type.rb
|
240
246
|
- lib/big_keeper/model/podfile_model.rb
|
241
|
-
- lib/big_keeper/model/podfile_type.rb
|
242
247
|
- lib/big_keeper/service/git_service.rb
|
243
248
|
- lib/big_keeper/service/module_service.rb
|
244
249
|
- lib/big_keeper/service/stash_service.rb
|
245
250
|
- lib/big_keeper/util/bigkeeper_parser.rb
|
251
|
+
- lib/big_keeper/util/cache_operator.rb
|
252
|
+
- lib/big_keeper/util/file_operator.rb
|
246
253
|
- lib/big_keeper/util/git_operator.rb
|
247
254
|
- lib/big_keeper/util/gitflow_operator.rb
|
248
255
|
- lib/big_keeper/util/info_plist_operator.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module BigKeeper
|
2
|
-
module ModuleType
|
3
|
-
PATH = 1
|
4
|
-
GIT = 2
|
5
|
-
SPEC = 3
|
6
|
-
|
7
|
-
def self.regex(type)
|
8
|
-
if PATH == type
|
9
|
-
"\s*:path\s*=>\s*"
|
10
|
-
elsif GIT == type
|
11
|
-
"\s*:git\s*=>\s*"
|
12
|
-
elsif SPEC == type
|
13
|
-
"\s*'"
|
14
|
-
else
|
15
|
-
name
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
module GitType
|
21
|
-
MASTER = 1
|
22
|
-
BRANCH = 2
|
23
|
-
TAG = 3
|
24
|
-
COMMIT = 4
|
25
|
-
end
|
26
|
-
|
27
|
-
class GitInfo
|
28
|
-
def initialize(base, type, addition)
|
29
|
-
@base, @type, @addition = base, type, addition
|
30
|
-
end
|
31
|
-
|
32
|
-
def type
|
33
|
-
@type
|
34
|
-
end
|
35
|
-
|
36
|
-
def base
|
37
|
-
@base
|
38
|
-
end
|
39
|
-
|
40
|
-
def addition
|
41
|
-
@addition
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|