kookeeper 3.0.0 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/.gitignore +8 -0
- data/.idea/bigkeeper.iml +68 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/Gemfile.lock +68 -48
- data/big_keeper.gemspec +3 -3
- data/bin/big +1 -1
- data/bin/koo +1 -1
- data/lib/big_keeper/command/feature&hotfix/delete.rb +1 -1
- data/lib/big_keeper/command/feature&hotfix/finish.rb +2 -2
- data/lib/big_keeper/command/feature&hotfix/list.rb +1 -1
- data/lib/big_keeper/command/feature&hotfix/publish.rb +2 -2
- data/lib/big_keeper/command/feature&hotfix/start.rb +2 -2
- data/lib/big_keeper/command/feature&hotfix/switch.rb +2 -2
- data/lib/big_keeper/command/feature&hotfix/update.rb +2 -2
- data/lib/big_keeper/command/pod/podfile.rb +13 -16
- data/lib/big_keeper/command/pod.rb +5 -18
- data/lib/big_keeper/command/release/home.rb +1 -2
- data/lib/big_keeper/command/release/module.rb +0 -4
- data/lib/big_keeper/command/release.rb +0 -25
- data/lib/big_keeper/dependency/dep_gradle_operator.rb +29 -47
- data/lib/big_keeper/dependency/dep_operator.rb +1 -17
- data/lib/big_keeper/dependency/dep_pod_operator.rb +10 -10
- data/lib/big_keeper/model/operate_type.rb +0 -3
- data/lib/big_keeper/service/git_service.rb +2 -3
- data/lib/big_keeper/service/module_service.rb +0 -65
- data/lib/big_keeper/util/bigkeeper_parser.rb +1 -17
- data/lib/big_keeper/util/cache_operator.rb +4 -6
- data/lib/big_keeper/util/file_operator.rb +1 -1
- data/lib/big_keeper/util/git_operator.rb +4 -25
- data/lib/big_keeper/util/gradle_operator.rb +209 -0
- data/lib/big_keeper/util/leancloud_logger.rb +7 -19
- data/lib/big_keeper/util/list_generator.rb +2 -2
- data/lib/big_keeper/util/logger.rb +1 -2
- data/lib/big_keeper/util/podfile_detector.rb +44 -35
- data/lib/big_keeper/util/podfile_module.rb +1 -1
- data/lib/big_keeper/util/podfile_operator.rb +8 -16
- data/lib/big_keeper/version.rb +1 -1
- data/lib/big_keeper.rb +9 -19
- metadata +14 -25
- data/.github/ISSUE_TEMPLATE.md +0 -20
- data/.gitignore +0 -50
- data/.travis.yml +0 -19
- data/Rakefile +0 -2
- data/lib/big_keeper/command/client.rb +0 -50
- data/lib/big_keeper/command/init.rb +0 -36
- data/lib/big_keeper/command/release/finish.rb +0 -36
- data/lib/big_keeper/command/release/publish.rb +0 -4
- data/lib/big_keeper/command/release/start.rb +0 -78
- data/lib/big_keeper/util/command_line_util.rb +0 -9
- data/lib/big_keeper/util/gradle_content_generator.rb +0 -26
- data/lib/big_keeper/util/gradle_file_operator.rb +0 -339
- data/lib/big_keeper/util/gradle_module_operator.rb +0 -70
- data/lib/big_keeper/util/lockfile_parser.rb +0 -143
- data/lib/big_keeper/util/version_config_operator.rb +0 -29
- data/resources/template/Bigkeeper +0 -23
@@ -1,36 +0,0 @@
|
|
1
|
-
module BigKeeper
|
2
|
-
def self.release_finish(path, version, user, modules)
|
3
|
-
BigkeeperParser.parse("#{path}/Bigkeeper")
|
4
|
-
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
5
|
-
modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
|
6
|
-
|
7
|
-
if modules.nil? || modules.empty?
|
8
|
-
Logger.error('no module need to release')
|
9
|
-
end
|
10
|
-
if !CommandLineUtil.double_check("module #{modules} will changed version to #{version}, are you sure?")
|
11
|
-
Logger.error('release finish interrupt')
|
12
|
-
end
|
13
|
-
#stash home
|
14
|
-
StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
|
15
|
-
# delete cache
|
16
|
-
CacheOperator.new(path).clean()
|
17
|
-
# checkout develop
|
18
|
-
GitService.new.verify_checkout_pull(path, 'develop')
|
19
|
-
|
20
|
-
modules.each do |module_name|
|
21
|
-
Logger.highlight("release start module #{module_name}")
|
22
|
-
ModuleService.new.release_finish(path, user, modules, module_name, version)
|
23
|
-
end
|
24
|
-
|
25
|
-
#release home
|
26
|
-
DepService.dep_operator(path, user).release_home_finish(modules, version)
|
27
|
-
|
28
|
-
# Push home changes to remote
|
29
|
-
Logger.highlight("Push branch 'develop' for 'Home'...")
|
30
|
-
GitService.new.verify_push(
|
31
|
-
path,
|
32
|
-
"release finish for #{version}",
|
33
|
-
'develop',
|
34
|
-
'Home')
|
35
|
-
end
|
36
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
module BigKeeper
|
2
|
-
def self.release_start(path, version, user, modules)
|
3
|
-
BigkeeperParser.parse("#{path}/Bigkeeper")
|
4
|
-
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
5
|
-
modules = release_check_changed_modules(path, user) if (modules.nil? || modules.empty?)
|
6
|
-
|
7
|
-
if modules.nil? || modules.empty?
|
8
|
-
Logger.error('no module need to release')
|
9
|
-
end
|
10
|
-
|
11
|
-
if !CommandLineUtil.double_check("module #{modules} will changed version to #{version}-SNAPSHOT, are you sure?")
|
12
|
-
Logger.error('release start interrupt')
|
13
|
-
end
|
14
|
-
|
15
|
-
#stash home
|
16
|
-
StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
|
17
|
-
# delete cache
|
18
|
-
CacheOperator.new(path).clean()
|
19
|
-
# checkout develop
|
20
|
-
GitService.new.verify_checkout_pull(path, 'develop')
|
21
|
-
|
22
|
-
modules.each do |module_name|
|
23
|
-
Logger.highlight("release start module #{module_name}")
|
24
|
-
ModuleService.new.release_start(path, user, modules, module_name, version)
|
25
|
-
end
|
26
|
-
|
27
|
-
#release home
|
28
|
-
DepService.dep_operator(path, user).release_home_start(modules, version)
|
29
|
-
|
30
|
-
# Push home changes to remote
|
31
|
-
Logger.highlight("Push branch 'develop' for 'Home'...")
|
32
|
-
GitService.new.verify_push(
|
33
|
-
path,
|
34
|
-
"release start for #{version}",
|
35
|
-
'develop',
|
36
|
-
'Home')
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.release_finish(path, version, user, modules)
|
40
|
-
BigkeeperParser.parse("#{path}/Bigkeeper")
|
41
|
-
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
42
|
-
|
43
|
-
#stash home
|
44
|
-
StashService.new.stash(path, GitOperator.new.current_branch(path), 'home')
|
45
|
-
# delete cache
|
46
|
-
CacheOperator.new(path).clean()
|
47
|
-
# checkout develop
|
48
|
-
GitService.new.verify_checkout_pull(path, 'develop')
|
49
|
-
|
50
|
-
modules.each do |module_name|
|
51
|
-
Logger.highlight("release start module #{module_name}")
|
52
|
-
ModuleService.new.release_finish(path, user, modules, module_name, version)
|
53
|
-
end
|
54
|
-
|
55
|
-
#release home
|
56
|
-
DepService.dep_operator(path, user).release_home_finish(modules, version)
|
57
|
-
|
58
|
-
# Push home changes to remote
|
59
|
-
Logger.highlight("Push branch 'develop' for 'Home'...")
|
60
|
-
GitService.new.verify_push(
|
61
|
-
path,
|
62
|
-
"release finish for #{version}",
|
63
|
-
'develop',
|
64
|
-
'Home')
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.release_check_changed_modules(path, user)
|
68
|
-
changed_modules = []
|
69
|
-
BigkeeperParser.parse("#{path}/Bigkeeper")
|
70
|
-
allModules = BigkeeperParser.module_names
|
71
|
-
allModules.each do |module_name|
|
72
|
-
if ModuleService.new.release_check_changed(path, user, module_name)
|
73
|
-
changed_modules << module_name
|
74
|
-
end
|
75
|
-
end
|
76
|
-
changed_modules
|
77
|
-
end
|
78
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module BigKeeper
|
2
|
-
class GradleConentGenerator
|
3
|
-
def self.generate_bigkeeper_settings_gradle_content()
|
4
|
-
"
|
5
|
-
//bigkeeper config start
|
6
|
-
Properties properties = new Properties()
|
7
|
-
properties.load(new File('local.properties').newDataInputStream())
|
8
|
-
if (\'true\' == properties.getProperty(\'ENABLE_BIGKEEPER_LOCAL\')) {
|
9
|
-
\tapply from: \'./.bigkeeper/bigkeeper_settings.gradle\'
|
10
|
-
}
|
11
|
-
//bigkeeper config end"
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.generate_bigkeeper_build_gradle_content()
|
15
|
-
"
|
16
|
-
//bigkeeper config start
|
17
|
-
Properties properties = new Properties()
|
18
|
-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
|
19
|
-
if (\'true\' != properties.getProperty(\'ENABLE_BIGKEEPER_LOCAL\')) {
|
20
|
-
\tapply from: \'../.bigkeeper/bigkeeper_build.gradle\'
|
21
|
-
}
|
22
|
-
//bigkeeper config end
|
23
|
-
"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,339 +0,0 @@
|
|
1
|
-
require 'big_keeper/util/logger'
|
2
|
-
require 'big_keeper/util/gradle_content_generator'
|
3
|
-
|
4
|
-
module BigKeeper
|
5
|
-
class GradleFileOperator
|
6
|
-
@path
|
7
|
-
@user
|
8
|
-
def initialize(path, user)
|
9
|
-
@path = path
|
10
|
-
@user = user
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_module_depends(build_file, module_name)
|
14
|
-
Logger.highlight("get module #{module_name} depends ...")
|
15
|
-
depend_modules = []
|
16
|
-
modules = ModuleCacheOperator.new(@path).all_path_modules
|
17
|
-
File.open(build_file, 'r') do |file|
|
18
|
-
file.each_line do |line|
|
19
|
-
modules.each do |name|
|
20
|
-
if line.strip().index('//') != 0 && !line.include?(BigkeeperParser.module_maven(module_name)) && !depend_modules.include?(name) && line.include?(BigkeeperParser.module_maven(name))
|
21
|
-
depend_modules << name
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
print "module #{module_name} depends: "
|
27
|
-
p depend_modules
|
28
|
-
depend_modules
|
29
|
-
end
|
30
|
-
|
31
|
-
def update_module_settings(module_name, settings_file, depend_modules)
|
32
|
-
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
33
|
-
cache_path = File.expand_path("#{module_full_path}/.bigkeeper")
|
34
|
-
big_settings_file = "#{cache_path}/bigkeeper_settings.gradle"
|
35
|
-
|
36
|
-
if depend_modules.empty? && !File.exist?(big_settings_file)
|
37
|
-
return
|
38
|
-
end
|
39
|
-
|
40
|
-
result = ''
|
41
|
-
depend_modules.each do |name|
|
42
|
-
artifact_id = BigkeeperParser.module_maven_artifact(name)
|
43
|
-
source = BigkeeperParser.module_source(name)
|
44
|
-
result << "include \':module:#{artifact_id}\'\nproject(':module:#{artifact_id}').projectDir = new File(rootProject.projectDir, '../#{name}/#{source}')\n"
|
45
|
-
end
|
46
|
-
|
47
|
-
dest_path = File.dirname(big_settings_file)
|
48
|
-
FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path)
|
49
|
-
file = File.new(big_settings_file, 'w', :encoding => 'UTF-8')
|
50
|
-
begin
|
51
|
-
file << result
|
52
|
-
file.close
|
53
|
-
ensure
|
54
|
-
file.close
|
55
|
-
end
|
56
|
-
|
57
|
-
if has_bigkeeper_config(settings_file)
|
58
|
-
return
|
59
|
-
end
|
60
|
-
|
61
|
-
temp_file = Tempfile.new('.settings.gradle.tmp', :encoding => 'UTF-8')
|
62
|
-
begin
|
63
|
-
File.open(settings_file, 'r', :encoding => 'UTF-8') do |file|
|
64
|
-
file.each_line do |line|
|
65
|
-
temp_file.puts(line)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
temp_file.puts(GradleConentGenerator.generate_bigkeeper_settings_gradle_content())
|
69
|
-
temp_file.close
|
70
|
-
FileUtils.mv(temp_file.path, settings_file)
|
71
|
-
ensure
|
72
|
-
temp_file.close
|
73
|
-
temp_file.unlink
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def update_module_build(build_file, module_name, depend_modules, version_name)
|
78
|
-
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
79
|
-
cache_path = File.expand_path("#{module_full_path}/.bigkeeper")
|
80
|
-
big_build_file = "#{cache_path}/bigkeeper_build.gradle"
|
81
|
-
|
82
|
-
if depend_modules.empty? && !File.exist?(big_build_file)
|
83
|
-
return
|
84
|
-
end
|
85
|
-
|
86
|
-
result = "configurations.all {\n\tresolutionStrategy {\n"
|
87
|
-
depend_modules.each do |name|
|
88
|
-
module_maven = BigkeeperParser.module_maven(name)
|
89
|
-
result << "\t\tforce \'#{module_maven}:#{version_name}-SNAPSHOT\'\n"
|
90
|
-
end
|
91
|
-
result << "\t}\n}\n"
|
92
|
-
|
93
|
-
dest_path = File.dirname(big_build_file)
|
94
|
-
FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path)
|
95
|
-
file = File.new(big_build_file, 'w', :encoding => 'UTF-8')
|
96
|
-
begin
|
97
|
-
file << result
|
98
|
-
file.close
|
99
|
-
ensure
|
100
|
-
file.close
|
101
|
-
end
|
102
|
-
|
103
|
-
if has_bigkeeper_config(build_file)
|
104
|
-
return
|
105
|
-
end
|
106
|
-
|
107
|
-
temp_file = Tempfile.new('.build.gradle.tmp')
|
108
|
-
begin
|
109
|
-
File.open(build_file, 'r') do |file|
|
110
|
-
file.each_line do |line|
|
111
|
-
temp_file.puts(line)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
temp_file.puts(GradleConentGenerator.generate_bigkeeper_build_gradle_content())
|
115
|
-
temp_file.close
|
116
|
-
FileUtils.mv(temp_file.path, build_file)
|
117
|
-
ensure
|
118
|
-
temp_file.close
|
119
|
-
temp_file.unlink
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
def get_home_depends()
|
124
|
-
path_modules = ModuleCacheOperator.new(@path).all_path_modules
|
125
|
-
git_modules = ModuleCacheOperator.new(@path).all_git_modules
|
126
|
-
path_modules | git_modules
|
127
|
-
end
|
128
|
-
|
129
|
-
def update_home_settings(settings_file, depend_modules)
|
130
|
-
cache_path = File.expand_path("#{@path}/.bigkeeper")
|
131
|
-
big_settings_file = "#{cache_path}/bigkeeper_settings.gradle"
|
132
|
-
|
133
|
-
if depend_modules.empty? && !File.exist?(big_settings_file)
|
134
|
-
return
|
135
|
-
end
|
136
|
-
|
137
|
-
result = ''
|
138
|
-
depend_modules.each do |name|
|
139
|
-
artifact_id = BigkeeperParser.module_maven(name).split(':')[1]
|
140
|
-
path = BigkeeperParser.module_full_path(@path, @user, name)
|
141
|
-
source = BigkeeperParser.module_source(name)
|
142
|
-
result << "include \':module:#{artifact_id}\'\nproject(':module:#{artifact_id}').projectDir = new File(rootProject.projectDir, '../#{name}/#{source}')\n"
|
143
|
-
end
|
144
|
-
|
145
|
-
dest_path = File.dirname(big_settings_file)
|
146
|
-
FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path)
|
147
|
-
file = File.new(big_settings_file, 'w')
|
148
|
-
begin
|
149
|
-
file << result
|
150
|
-
file.close
|
151
|
-
ensure
|
152
|
-
file.close
|
153
|
-
end
|
154
|
-
|
155
|
-
if has_bigkeeper_config(settings_file)
|
156
|
-
return
|
157
|
-
end
|
158
|
-
|
159
|
-
temp_file = Tempfile.new('.settings.gradle.tmp')
|
160
|
-
begin
|
161
|
-
File.open(settings_file, 'r') do |file|
|
162
|
-
file.each_line do |line|
|
163
|
-
temp_file.puts(line)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
temp_file.puts(GradleConentGenerator.generate_bigkeeper_settings_gradle_content())
|
167
|
-
temp_file.close
|
168
|
-
FileUtils.mv(temp_file.path, settings_file)
|
169
|
-
ensure
|
170
|
-
temp_file.close
|
171
|
-
temp_file.unlink
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
def update_home_build(build_file, depend_modules, version_name)
|
176
|
-
cache_path = File.expand_path("#{@path}/.bigkeeper")
|
177
|
-
big_build_file = "#{cache_path}/bigkeeper_build.gradle"
|
178
|
-
|
179
|
-
if depend_modules.empty? && !File.exist?(big_build_file)
|
180
|
-
return
|
181
|
-
end
|
182
|
-
|
183
|
-
result = "configurations.all {\n\tresolutionStrategy {\n"
|
184
|
-
depend_modules.each do |module_name|
|
185
|
-
module_maven = BigkeeperParser.module_maven(module_name)
|
186
|
-
result << "\t\tforce \'#{module_maven}:#{version_name}-SNAPSHOT\'\n"
|
187
|
-
end
|
188
|
-
result << "\t}\n}\n"
|
189
|
-
|
190
|
-
dest_path = File.dirname(big_build_file)
|
191
|
-
FileUtils.mkdir_p(dest_path) unless File.exist?(dest_path)
|
192
|
-
file = File.new(big_build_file, 'w')
|
193
|
-
begin
|
194
|
-
file << result
|
195
|
-
file.close
|
196
|
-
ensure
|
197
|
-
file.close
|
198
|
-
end
|
199
|
-
|
200
|
-
if has_bigkeeper_config(build_file)
|
201
|
-
return
|
202
|
-
end
|
203
|
-
|
204
|
-
temp_file = Tempfile.new('.build.gradle.tmp')
|
205
|
-
begin
|
206
|
-
File.open(build_file, 'r') do |file|
|
207
|
-
file.each_line do |line|
|
208
|
-
temp_file.puts(line)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
temp_file.puts(GradleConentGenerator.generate_bigkeeper_build_gradle_content())
|
212
|
-
temp_file.close
|
213
|
-
FileUtils.mv(temp_file.path, build_file)
|
214
|
-
ensure
|
215
|
-
temp_file.close
|
216
|
-
temp_file.unlink
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
def update_module_version_name(build_file, version_name)
|
221
|
-
temp_file = Tempfile.new('.build.gradle.tmp')
|
222
|
-
isModifyPom = false
|
223
|
-
isBigkeeperScript = false
|
224
|
-
isBigkeeperBackupScript = false
|
225
|
-
hasBigkeeperBackup = false
|
226
|
-
begin
|
227
|
-
File.open(build_file, 'r') do |file|
|
228
|
-
file.each_line do |line|
|
229
|
-
if line.include?('modifyPom')
|
230
|
-
isModifyPom = true
|
231
|
-
elsif line.include?('bigkeeper config start')
|
232
|
-
isBigkeeperScript = true
|
233
|
-
elsif line.include?('bigkeeper config end')
|
234
|
-
isBigkeeperScript = false
|
235
|
-
elsif line.include?('bigkeeper config backup start')
|
236
|
-
isBigkeeperBackupScript = true
|
237
|
-
hasBigkeeperBackup = true
|
238
|
-
elsif line.include?('bigkeeper config backup end')
|
239
|
-
isBigkeeperBackupScript = false
|
240
|
-
end
|
241
|
-
|
242
|
-
if isModifyPom && !isBigkeeperBackupScript && line.match(/[\s\S]*version[\s\S]*/)
|
243
|
-
if !hasBigkeeperBackup
|
244
|
-
temp_file.puts("\t\t//bigkeeper config backup start")
|
245
|
-
temp_file.puts("\t\t//"+line.strip)
|
246
|
-
temp_file.puts("\t\t//bigkeeper config backup end")
|
247
|
-
end
|
248
|
-
|
249
|
-
if isBigkeeperScript
|
250
|
-
temp_file.puts("\t\tversion \'#{version_name}\'")
|
251
|
-
else
|
252
|
-
temp_file.puts("\t\t//bigkeeper config start")
|
253
|
-
temp_file.puts("\t\tversion \'#{version_name}\'")
|
254
|
-
temp_file.puts("\t\t//bigkeeper config end")
|
255
|
-
end
|
256
|
-
isModifyPom = false
|
257
|
-
else
|
258
|
-
temp_file.puts(line)
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
262
|
-
temp_file.close
|
263
|
-
FileUtils.mv(temp_file.path, build_file)
|
264
|
-
ensure
|
265
|
-
temp_file.close
|
266
|
-
temp_file.unlink
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
def update_module_depends(build_file, settings_file, module_name, version_name)
|
271
|
-
depend_modules = get_module_depends(build_file, module_name)
|
272
|
-
update_module_settings(module_name, settings_file, depend_modules)
|
273
|
-
update_module_build(build_file, module_name, depend_modules, version_name)
|
274
|
-
end
|
275
|
-
|
276
|
-
def update_home_depends(build_file, settings_file, type)
|
277
|
-
depend_modules = get_home_depends()
|
278
|
-
update_home_settings(settings_file, depend_modules)
|
279
|
-
update_home_build(build_file, depend_modules, generate_version_name(type))
|
280
|
-
end
|
281
|
-
|
282
|
-
def generate_version_name(type)
|
283
|
-
branch_name = GitOperator.new.current_branch(@path)
|
284
|
-
version_name = ''
|
285
|
-
if OperateType::FINISH == type
|
286
|
-
version_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){ $2 }
|
287
|
-
else
|
288
|
-
version_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
|
289
|
-
version_name = version_name.gsub('_', '-')
|
290
|
-
end
|
291
|
-
version_name
|
292
|
-
end
|
293
|
-
|
294
|
-
def recover_bigkeeper_config_file(bigkeeper_config_file)
|
295
|
-
if !File.exist?(bigkeeper_config_file)
|
296
|
-
return
|
297
|
-
end
|
298
|
-
temp_file = Tempfile.new('.bigkeeper_config.tmp', :encoding => 'UTF-8')
|
299
|
-
isBigkeeperScript = false
|
300
|
-
isBigkeeperBackupScript = false
|
301
|
-
begin
|
302
|
-
File.open(bigkeeper_config_file, 'r') do |file|
|
303
|
-
file.each_line do |line|
|
304
|
-
if line.include?('bigkeeper config start')
|
305
|
-
isBigkeeperScript = true
|
306
|
-
elsif line.include?('bigkeeper config end')
|
307
|
-
isBigkeeperScript = false
|
308
|
-
elsif line.include?('bigkeeper config backup start')
|
309
|
-
isBigkeeperBackupScript = true
|
310
|
-
elsif line.include?('bigkeeper config backup end')
|
311
|
-
isBigkeeperBackupScript = false
|
312
|
-
elsif isBigkeeperBackupScript
|
313
|
-
temp_file.puts(line.gsub('//',''))
|
314
|
-
elsif !isBigkeeperScript
|
315
|
-
temp_file.puts(line)
|
316
|
-
end
|
317
|
-
end
|
318
|
-
end
|
319
|
-
temp_file.close
|
320
|
-
FileUtils.mv(temp_file.path, bigkeeper_config_file)
|
321
|
-
ensure
|
322
|
-
temp_file.close
|
323
|
-
temp_file.unlink
|
324
|
-
end
|
325
|
-
end
|
326
|
-
|
327
|
-
def has_bigkeeper_config(file)
|
328
|
-
File.open(file, 'r') do |file|
|
329
|
-
file.each_line do |line|
|
330
|
-
if line.include?('bigkeeper config start')
|
331
|
-
return true
|
332
|
-
end
|
333
|
-
end
|
334
|
-
end
|
335
|
-
false
|
336
|
-
end
|
337
|
-
|
338
|
-
end
|
339
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'big_keeper/util/cache_operator'
|
2
|
-
require 'big_keeper/util/gradle_file_operator'
|
3
|
-
require 'big_keeper/util/bigkeeper_parser'
|
4
|
-
|
5
|
-
module BigKeeper
|
6
|
-
# Operator for podfile
|
7
|
-
class GradleModuleOperator
|
8
|
-
@path
|
9
|
-
@user
|
10
|
-
@module_name
|
11
|
-
|
12
|
-
BUILD_GRADLE = "build.gradle"
|
13
|
-
SETTINGS_GRADLE = "settings.gradle"
|
14
|
-
|
15
|
-
def initialize(path, user, module_name)
|
16
|
-
@path = path
|
17
|
-
@user = user
|
18
|
-
@module_name = module_name
|
19
|
-
end
|
20
|
-
|
21
|
-
def backup
|
22
|
-
end
|
23
|
-
|
24
|
-
## TODO
|
25
|
-
def recover()
|
26
|
-
module_full_path = BigkeeperParser.module_full_path(@path, @user, @module_name)
|
27
|
-
source = BigkeeperParser.module_source(@module_name)
|
28
|
-
build_file = "#{module_full_path}/#{source}/#{BUILD_GRADLE}"
|
29
|
-
settings_file = "#{module_full_path}/#{SETTINGS_GRADLE}"
|
30
|
-
GradleFileOperator.new(@path, @user).recover_bigkeeper_config_file(build_file)
|
31
|
-
GradleFileOperator.new(@path, @user).recover_bigkeeper_config_file(settings_file)
|
32
|
-
|
33
|
-
cache_operator = CacheOperator.new(module_full_path)
|
34
|
-
cache_operator.clean
|
35
|
-
end
|
36
|
-
|
37
|
-
def update_module(module_operate_type)
|
38
|
-
update_module_depends(module_operate_type)
|
39
|
-
update_module_version_name(module_operate_type)
|
40
|
-
end
|
41
|
-
|
42
|
-
def update_module_depends(module_operate_type)
|
43
|
-
module_full_path = BigkeeperParser.module_full_path(@path, @user, @module_name)
|
44
|
-
source = BigkeeperParser.module_source(@module_name)
|
45
|
-
version_name = generate_version_name(module_operate_type)
|
46
|
-
build_file = "#{module_full_path}/#{source}/#{BUILD_GRADLE}"
|
47
|
-
settings_file = "#{module_full_path}/#{SETTINGS_GRADLE}"
|
48
|
-
GradleFileOperator.new(@path, @user).update_module_depends(build_file, settings_file, @module_name, version_name)
|
49
|
-
end
|
50
|
-
|
51
|
-
def update_module_version_name(module_operate_type)
|
52
|
-
module_full_path = BigkeeperParser.module_full_path(@path, @user, @module_name)
|
53
|
-
source = BigkeeperParser.module_source(@module_name)
|
54
|
-
GradleFileOperator.new(@path, @user).update_module_version_name("#{module_full_path}/#{source}/#{BUILD_GRADLE}", generate_version_name(module_operate_type))
|
55
|
-
end
|
56
|
-
|
57
|
-
def generate_version_name(module_operate_type)
|
58
|
-
branch_name = GitOperator.new.current_branch(@path)
|
59
|
-
version_name = ''
|
60
|
-
if ModuleOperateType::ADD == module_operate_type
|
61
|
-
version_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
|
62
|
-
version_name = version_name.gsub('_', '-')
|
63
|
-
elsif ModuleOperateType::FINISH == module_operate_type
|
64
|
-
version_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){ $2 }
|
65
|
-
end
|
66
|
-
return version_name
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|