kookeeper 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +11 -111
- data/.github/ISSUE_TEMPLATE.md +0 -20
- data/.gitignore +0 -50
- data/.travis.yml +0 -19
- data/CODE_OF_CONDUCT.md +0 -46
- data/CONTRIBUTING.md +0 -70
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -125
- data/LICENSE +0 -21
- data/README.md +0 -113
- data/Rakefile +0 -2
- data/big_keeper.gemspec +0 -50
- data/bin/big +0 -14
- data/bin/koo +0 -14
- data/bin/setup +0 -8
- data/docs/en-US/FEATURE.md +0 -0
- data/docs/en-US/README.md +0 -54
- data/docs/zh-CN/BIGKEEPER_FILE.md +0 -84
- data/docs/zh-CN/FEATURE&HOTFIX.md +0 -88
- data/docs/zh-CN/IMAGE.md +0 -0
- data/docs/zh-CN/PODFILE.md +0 -43
- data/docs/zh-CN/README.md +0 -113
- data/docs/zh-CN/RECOMMEND.md +0 -22
- data/docs/zh-CN/RELEASE.md +0 -60
- data/docs/zh-CN/SPEC.md +0 -39
- data/lib/big_keeper/command/client.rb +0 -50
- data/lib/big_keeper/command/feature&hotfix/delete.rb +0 -40
- data/lib/big_keeper/command/feature&hotfix/finish.rb +0 -54
- data/lib/big_keeper/command/feature&hotfix/list.rb +0 -63
- data/lib/big_keeper/command/feature&hotfix/publish.rb +0 -56
- data/lib/big_keeper/command/feature&hotfix/pull.rb +0 -26
- data/lib/big_keeper/command/feature&hotfix/push.rb +0 -27
- data/lib/big_keeper/command/feature&hotfix/rebase.rb +0 -32
- data/lib/big_keeper/command/feature&hotfix/start.rb +0 -74
- data/lib/big_keeper/command/feature&hotfix/switch.rb +0 -46
- data/lib/big_keeper/command/feature&hotfix/update.rb +0 -66
- data/lib/big_keeper/command/feature&hotfix.rb +0 -167
- data/lib/big_keeper/command/image/image.rb +0 -0
- data/lib/big_keeper/command/image.rb +0 -28
- data/lib/big_keeper/command/init.rb +0 -36
- data/lib/big_keeper/command/pod/podfile.rb +0 -72
- data/lib/big_keeper/command/pod.rb +0 -55
- data/lib/big_keeper/command/release/finish.rb +0 -36
- data/lib/big_keeper/command/release/home.rb +0 -92
- data/lib/big_keeper/command/release/module.rb +0 -65
- data/lib/big_keeper/command/release/publish.rb +0 -4
- data/lib/big_keeper/command/release/start.rb +0 -78
- data/lib/big_keeper/command/release.rb +0 -100
- data/lib/big_keeper/command/spec/add.rb +0 -9
- data/lib/big_keeper/command/spec/analyze.rb +0 -88
- data/lib/big_keeper/command/spec/delete.rb +0 -9
- data/lib/big_keeper/command/spec/list.rb +0 -19
- data/lib/big_keeper/command/spec/search.rb +0 -9
- data/lib/big_keeper/command/spec/sync.rb +0 -12
- data/lib/big_keeper/command/spec.rb +0 -78
- data/lib/big_keeper/dependency/dep_gradle_operator.rb +0 -74
- data/lib/big_keeper/dependency/dep_operator.rb +0 -48
- data/lib/big_keeper/dependency/dep_pod_operator.rb +0 -130
- data/lib/big_keeper/dependency/dep_service.rb +0 -14
- data/lib/big_keeper/dependency/dep_type.rb +0 -33
- data/lib/big_keeper/model/gitflow_type.rb +0 -43
- data/lib/big_keeper/model/library_model.rb +0 -116
- data/lib/big_keeper/model/operate_type.rb +0 -30
- data/lib/big_keeper/model/podfile_model.rb +0 -33
- data/lib/big_keeper/service/git_service.rb +0 -211
- data/lib/big_keeper/service/module_service.rb +0 -224
- data/lib/big_keeper/service/stash_service.rb +0 -45
- data/lib/big_keeper/util/bigkeeper_parser.rb +0 -260
- data/lib/big_keeper/util/cache_operator.rb +0 -118
- data/lib/big_keeper/util/code_operator.rb +0 -37
- data/lib/big_keeper/util/command_line_util.rb +0 -9
- data/lib/big_keeper/util/file_operator.rb +0 -33
- data/lib/big_keeper/util/git_operator.rb +0 -242
- data/lib/big_keeper/util/gitflow_operator.rb +0 -51
- 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/info_plist_operator.rb +0 -46
- data/lib/big_keeper/util/leancloud_logger.rb +0 -84
- data/lib/big_keeper/util/list_generator.rb +0 -101
- data/lib/big_keeper/util/lockfile_parser.rb +0 -143
- data/lib/big_keeper/util/logger.rb +0 -47
- data/lib/big_keeper/util/pod_operator.rb +0 -70
- data/lib/big_keeper/util/podfile_detector.rb +0 -102
- data/lib/big_keeper/util/podfile_module.rb +0 -63
- data/lib/big_keeper/util/podfile_operator.rb +0 -125
- data/lib/big_keeper/util/verify_operator.rb +0 -17
- data/lib/big_keeper/util/version_config_operator.rb +0 -29
- data/lib/big_keeper/util/xcode_operator.rb +0 -15
- data/lib/big_keeper/version.rb +0 -3
- data/lib/big_keeper.rb +0 -81
- data/resources/banner.png +0 -0
- data/resources/command.png +0 -0
- data/resources/keynote/big-keeper-readme-analyze.key +0 -0
- data/resources/keynote/big-keeper-readme-example.key +0 -0
- data/resources/keynote/big-keeper-readme-feature.key +0 -0
- data/resources/keynote/big-keeper-readme-release.key +0 -0
- data/resources/readme/big-keeper-readme.001.png +0 -0
- data/resources/template/Bigkeeper +0 -23
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'big_keeper/model/gitflow_type'
|
2
|
-
|
3
|
-
module BigKeeper
|
4
|
-
# Operator for gitflow
|
5
|
-
class GitflowOperator
|
6
|
-
def start(path, name, type)
|
7
|
-
Dir.chdir(path) do
|
8
|
-
gitflow_type_name = GitflowType.name(type)
|
9
|
-
`git flow #{gitflow_type_name} start #{name}`
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def verify_git_flow_command
|
14
|
-
has_git_flow_command = false
|
15
|
-
IO.popen('command -v git-flow') do |io|
|
16
|
-
io.each do |line|
|
17
|
-
has_git_flow_command = true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
has_git_flow_command
|
21
|
-
end
|
22
|
-
|
23
|
-
def verify_git_flow(path)
|
24
|
-
has_git_flow = false
|
25
|
-
Dir.chdir(path) do
|
26
|
-
clear_flag = 'Already initialized for gitflow'
|
27
|
-
IO.popen('git flow init -d') do |io|
|
28
|
-
io.each do |line|
|
29
|
-
if line.include? clear_flag
|
30
|
-
has_git_flow = true
|
31
|
-
break
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
has_git_flow
|
37
|
-
end
|
38
|
-
|
39
|
-
def finish_release(path, release_name)
|
40
|
-
Dir.chdir(path) do
|
41
|
-
p `git checkout master`
|
42
|
-
p `git merge release/#{release_name}`
|
43
|
-
p `git push`
|
44
|
-
p `git checkout develop`
|
45
|
-
p `git merge release/#{release_name}`
|
46
|
-
p `git push`
|
47
|
-
p `git branch -d release/#{release_name}`
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
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
|
@@ -1,46 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
require 'plist' # gem install plist
|
3
|
-
require 'big_stash/stash_operator'
|
4
|
-
require 'pathname'
|
5
|
-
|
6
|
-
module BigKeeper
|
7
|
-
# Operator for Info.plist
|
8
|
-
class InfoPlistOperator
|
9
|
-
def change_version_build(path, version)
|
10
|
-
if find_infoPlist_filePath(path) == ''
|
11
|
-
raise %(Not find be Info.plist at #{path})
|
12
|
-
end
|
13
|
-
info_plist_path = find_infoPlist_filePath(path)
|
14
|
-
result = Plist.parse_xml(info_plist_path)
|
15
|
-
result['CFBundleVersion'] = getBuildVersion(version, result['CFBundleShortVersionString'], result['CFBundleVersion']).to_s
|
16
|
-
result['CFBundleShortVersionString'] = version.to_s
|
17
|
-
Plist::Emit.save_plist(result, info_plist_path)
|
18
|
-
puts %Q('Version has changed to #{version}')
|
19
|
-
end
|
20
|
-
|
21
|
-
# Find Info.plist file path
|
22
|
-
# @return [String] pathName of info.plist
|
23
|
-
def find_infoPlist_filePath(path)
|
24
|
-
paths = Pathname.new(path).children.select { |pn| pn.extname == '.xcodeproj' }
|
25
|
-
xcodePath = paths[0].to_s.split('/')[-1]
|
26
|
-
projectName = xcodePath.split('.')[0]
|
27
|
-
projectPath = ''
|
28
|
-
Pathname.new("#{path}/#{projectName}").children.select { |pn|
|
29
|
-
if pn.to_s == "#{path}/#{projectName}/Info.plist"
|
30
|
-
projectPath = "#{path}/#{projectName}/Info.plist"
|
31
|
-
end
|
32
|
-
}
|
33
|
-
projectPath
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def getBuildVersion(build_string, old_build_string, old_build_version)
|
38
|
-
if build_string == old_build_string
|
39
|
-
return old_build_version.to_i + 1
|
40
|
-
else
|
41
|
-
version_arr = build_string.split('.')
|
42
|
-
return version_arr[0].to_i * 1000 + version_arr[1].to_i * 100 + version_arr[2].to_i * 10
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
require 'Singleton'
|
2
|
-
require 'net/http'
|
3
|
-
require 'net/https'
|
4
|
-
require 'big_keeper/util/logger'
|
5
|
-
|
6
|
-
module BigKeeper
|
7
|
-
class LeanCloudLogger
|
8
|
-
include Singleton
|
9
|
-
|
10
|
-
attr_accessor :user, :version, :start_timestamp, :end_timestamp, :command, :parameter, :is_success, :path, :need_log
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@need_log = "true"
|
14
|
-
end
|
15
|
-
|
16
|
-
def set_command(set_command)
|
17
|
-
@command = set_command
|
18
|
-
end
|
19
|
-
|
20
|
-
def is_need_log
|
21
|
-
@need_log == "true"
|
22
|
-
end
|
23
|
-
|
24
|
-
def start_log(global_options, args)
|
25
|
-
@start_timestamp = Time.new.to_i
|
26
|
-
@user = global_options['user'].to_s
|
27
|
-
@parameter = args.join(",")
|
28
|
-
@version = global_options['ver']
|
29
|
-
@path = global_options['path']
|
30
|
-
@need_log = "#{global_options[:log]}"
|
31
|
-
end
|
32
|
-
|
33
|
-
def end_log(is_success, is_show_log)
|
34
|
-
@end_timestamp = Time.new.to_i
|
35
|
-
@is_success = is_success
|
36
|
-
@version = BigkeeperParser.version if @version == 'Version in Bigkeeper file'
|
37
|
-
|
38
|
-
# require
|
39
|
-
parameter = {'start_timestamp' => @start_timestamp, 'end_timestamp' =>@end_timestamp, 'user' =>@user, 'is_success' =>@is_success}
|
40
|
-
|
41
|
-
# optional
|
42
|
-
parameter = parameter.merge('command' => @command) unless @command == nil
|
43
|
-
parameter = parameter.merge('version' => @version) unless @version == nil || @version == ""
|
44
|
-
parameter = parameter.merge('parameter' => @parameter) unless @parameter == nil || @parameter == ""
|
45
|
-
|
46
|
-
if @command
|
47
|
-
leancloud_file = @command.split("/").first
|
48
|
-
send_log_cloud(leancloud_file, parameter, is_show_log)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def send_log_cloud(file_name, parameter, is_show_log)
|
53
|
-
if file_name == nil
|
54
|
-
return
|
55
|
-
end
|
56
|
-
|
57
|
-
if BigkeeperParser.global_configs("LeanCloudId") == nil || BigkeeperParser.global_configs("LeanCloudKey") == nil
|
58
|
-
return
|
59
|
-
end
|
60
|
-
|
61
|
-
header = assemble_request
|
62
|
-
|
63
|
-
uri = URI.parse("https://api.leancloud.cn/1.1/classes/#{file_name}")
|
64
|
-
|
65
|
-
https = Net::HTTP.new(uri.host, 443)
|
66
|
-
https.use_ssl = true
|
67
|
-
https.ssl_version = :TLSv1
|
68
|
-
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
69
|
-
req = Net::HTTP::Post.new(uri.path, header)
|
70
|
-
req.body = parameter.to_json
|
71
|
-
res = https.request(req)
|
72
|
-
|
73
|
-
if is_show_log == true
|
74
|
-
Logger.highlight("Send LeanCloud success, response #{res.body}")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def assemble_request
|
79
|
-
return {'Content-Type' =>'application/json', 'X-LC-Id' =>BigkeeperParser.global_configs("LeanCloudId"), 'X-LC-Key' =>BigkeeperParser.global_configs("LeanCloudKey")}
|
80
|
-
end
|
81
|
-
|
82
|
-
protected :send_log_cloud, :assemble_request
|
83
|
-
end
|
84
|
-
end
|