big_keeper 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/big_keeper.rb +9 -2
- data/lib/big_keeper/command/pod/{podfile_lock.rb → podfile.rb} +25 -7
- data/lib/big_keeper/service/git_service.rb +13 -6
- data/lib/big_keeper/util/pod_operator.rb +1 -0
- data/lib/big_keeper/util/podfile_detector.rb +7 -7
- data/lib/big_keeper/util/podfile_module.rb +64 -0
- data/lib/big_keeper/util/podfile_operator.rb +21 -0
- data/lib/big_keeper/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40f56a4994a7408e30ccd119e1ed948d5587a25d
|
4
|
+
data.tar.gz: fd1d292ca83f57e781744567b52c5016cf9bdb5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73b4235927749294cb9ff03db11b459e2c965644256607da69603c212c87c9e74b6786b63e9db9112a3d05560c8b91db2e680cf06598860d0c58dc271815bf8d
|
7
|
+
data.tar.gz: 479f99e2fc93c8bf211382bd7586462936d6e2fe43a1865b66b6ddbe76a715a017da8454f03d8ed0fbefd9dd05681920947173021ec0c48d7f1720b61e565a7c
|
data/lib/big_keeper.rb
CHANGED
@@ -13,10 +13,10 @@ 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/pod/podfile'
|
16
17
|
require 'big_keeper/command/feature&hotfix/delete'
|
17
18
|
require 'big_keeper/command/release/home'
|
18
19
|
require 'big_keeper/command/release/module'
|
19
|
-
require 'big_keeper/command/pod/podfile_lock'
|
20
20
|
|
21
21
|
require 'big_keeper/service/git_service'
|
22
22
|
|
@@ -26,7 +26,7 @@ include GLI::App
|
|
26
26
|
|
27
27
|
module BigKeeper
|
28
28
|
# Your code goes here...
|
29
|
-
program_desc 'Efficiency improvement for iOS&Android
|
29
|
+
program_desc 'Efficiency improvement for iOS&Android module development, iOSer&Android using this tool can make module development easier.'
|
30
30
|
|
31
31
|
flag %i[p path], default_value: './'
|
32
32
|
flag %i[v ver], default_value: 'Version in Bigkeeper file'
|
@@ -276,6 +276,13 @@ module BigKeeper
|
|
276
276
|
podfile_lock(path)
|
277
277
|
end
|
278
278
|
end
|
279
|
+
|
280
|
+
podfile.desc 'Update modules should be upgrade.'
|
281
|
+
podfile.command :update do |lock|
|
282
|
+
lock.action do |global_options, options, args|
|
283
|
+
podfile_modules_update(path)
|
284
|
+
end
|
285
|
+
end
|
279
286
|
end
|
280
287
|
|
281
288
|
desc 'Show version of bigkeeper'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
1
|
require 'big_keeper/util/podfile_detector'
|
3
2
|
require 'big_keeper/util/podfile_operator'
|
3
|
+
require 'big_keeper/util/podfile_module'
|
4
4
|
require 'big_keeper/util/gitflow_operator'
|
5
5
|
require 'big_keeper/util/bigkeeper_parser'
|
6
6
|
require 'big_keeper/model/podfile_type'
|
@@ -11,10 +11,10 @@ module BigKeeper
|
|
11
11
|
def self.podfile_detect(path)
|
12
12
|
# Parse Bigkeeper file
|
13
13
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
14
|
-
# Get
|
15
|
-
|
14
|
+
# Get modules' name
|
15
|
+
module_list = BigkeeperParser.module_names
|
16
16
|
# initialize PodfileDetector
|
17
|
-
detector = PodfileDetector.new(path,
|
17
|
+
detector = PodfileDetector.new(path,module_list)
|
18
18
|
# Get unlocked third party pods list
|
19
19
|
unlock_pod_list = detector.get_unlock_pod_list
|
20
20
|
# Print out unlock pod list
|
@@ -28,10 +28,10 @@ module BigKeeper
|
|
28
28
|
def self.podfile_lock(path)
|
29
29
|
# Parse Bigkeeper file
|
30
30
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
31
|
-
# Get
|
32
|
-
|
31
|
+
# Get modules' name
|
32
|
+
module_list = BigkeeperParser.module_names
|
33
33
|
# initialize PodfileDetector
|
34
|
-
detector = PodfileDetector.new(path,
|
34
|
+
detector = PodfileDetector.new(path,module_list)
|
35
35
|
# Get unlocked third party pods list
|
36
36
|
unlock_pod_list = detector.get_unlock_pod_list
|
37
37
|
# Get Version
|
@@ -48,4 +48,22 @@ module BigKeeper
|
|
48
48
|
|
49
49
|
end
|
50
50
|
|
51
|
+
def self.podfile_modules_update(path)
|
52
|
+
# Parse Bigkeeper file
|
53
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
54
|
+
# Get modules' name
|
55
|
+
module_list = BigkeeperParser.module_names
|
56
|
+
# initialize PodfileDetector
|
57
|
+
detector = PodfileModuleDetector.new(path)
|
58
|
+
# Get module latest version
|
59
|
+
module_dictionary = detector.check_version_list
|
60
|
+
# Check if anything should be upgrade
|
61
|
+
if module_dictionary.empty?
|
62
|
+
Logger.warning("There is nothing to be upgrade.")
|
63
|
+
else
|
64
|
+
PodfileOperator.new.find_and_upgrade("#{path}/Podfile",module_dictionary)
|
65
|
+
Logger.highlight("The Podfile has been changed.")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
51
69
|
end
|
@@ -104,12 +104,13 @@ module BigKeeper
|
|
104
104
|
|
105
105
|
def pull(path, branch_name)
|
106
106
|
git = GitOperator.new
|
107
|
-
|
107
|
+
current_branch_name = git.current_branch(path)
|
108
|
+
if current_branch_name == branch_name
|
108
109
|
git.pull(path)
|
109
110
|
else
|
110
|
-
|
111
|
-
|
112
|
-
|
111
|
+
git.checkout(path, branch_name)
|
112
|
+
git.pull(path)
|
113
|
+
git.checkout(path, current_branch_name)
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
@@ -149,6 +150,10 @@ module BigKeeper
|
|
149
150
|
end
|
150
151
|
|
151
152
|
def verify_rebase(path, branch_name, name)
|
153
|
+
|
154
|
+
# pull rebased branch
|
155
|
+
pull(path, branch_name)
|
156
|
+
|
152
157
|
Dir.chdir(path) do
|
153
158
|
IO.popen("git rebase #{branch_name} --ignore-whitespace") do |io|
|
154
159
|
unless io.gets
|
@@ -169,8 +174,10 @@ module BigKeeper
|
|
169
174
|
5.Run 'finish' again.")
|
170
175
|
end
|
171
176
|
end
|
172
|
-
|
173
|
-
|
177
|
+
if GitOperator.new.current_branch(path) != 'develop' && GitOperator.new.current_branch(path) != 'master'
|
178
|
+
`git push -f`
|
179
|
+
GitOperator.new.checkout(path, branch_name)
|
180
|
+
end
|
174
181
|
end
|
175
182
|
end
|
176
183
|
end
|
@@ -6,12 +6,12 @@ module BigKeeper
|
|
6
6
|
|
7
7
|
class PodfileDetector
|
8
8
|
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :module_list, :main_path
|
10
10
|
$unlock_pod_list = []
|
11
11
|
$modify_pod_list = {}
|
12
12
|
|
13
|
-
def initialize(main_path,
|
14
|
-
@
|
13
|
+
def initialize(main_path,module_list)
|
14
|
+
@module_list = module_list
|
15
15
|
@main_path = main_path
|
16
16
|
end
|
17
17
|
|
@@ -21,7 +21,7 @@ class PodfileDetector
|
|
21
21
|
podfile_lines.collect do |sentence|
|
22
22
|
deal_podfile_line(sentence) unless sentence =~(/(\d+.){1,2}\d+/)
|
23
23
|
end
|
24
|
-
|
24
|
+
$unlock_pod_list
|
25
25
|
# p $unlock_pod_list
|
26
26
|
end
|
27
27
|
|
@@ -29,9 +29,9 @@ class PodfileDetector
|
|
29
29
|
if sentence.include?('pod ')
|
30
30
|
pod_model = Podfile_Modle.new(sentence)
|
31
31
|
if !pod_model.name.empty? && pod_model.configurations != '[\'Debug\']' && pod_model.path == nil && pod_model.tag == nil
|
32
|
-
$unlock_pod_list << pod_model.name unless @
|
32
|
+
$unlock_pod_list << pod_model.name unless @module_list.include?(pod_model.name)
|
33
33
|
end
|
34
|
-
|
34
|
+
pod_model
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -72,7 +72,7 @@ class PodfileDetector
|
|
72
72
|
def get_pod_name(sentence)
|
73
73
|
pod_model = deal_podfile_line(sentence)
|
74
74
|
pod_name = pod_model.name if pod_model != nil && pod_model.configurations.nil
|
75
|
-
@unlock_pod_list << pod_name unless @
|
75
|
+
@unlock_pod_list << pod_name unless @module_list.include pod_name
|
76
76
|
end
|
77
77
|
|
78
78
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'big_keeper/util/bigkeeper_parser'
|
2
|
+
require 'big_keeper/util/podfile_detector'
|
3
|
+
require 'big_keeper/model/podfile_model'
|
4
|
+
require 'big_keeper/util/logger'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
|
8
|
+
class PodfileModuleDetector
|
9
|
+
@module_list = []
|
10
|
+
|
11
|
+
def initialize(main_path)
|
12
|
+
@module_list = BigkeeperParser.module_names
|
13
|
+
@main_path = main_path
|
14
|
+
@update_modules = {}
|
15
|
+
# check_version_list
|
16
|
+
end
|
17
|
+
|
18
|
+
#检查需要更新业务库列表
|
19
|
+
def check_version_list
|
20
|
+
if @module_list.empty?
|
21
|
+
Logger.highlight('There is not any module should to be check.')
|
22
|
+
return
|
23
|
+
else
|
24
|
+
Logger.highlight('Checking..')
|
25
|
+
@module_list.each do |module_name|
|
26
|
+
get_pod_search_result(module_name)
|
27
|
+
end
|
28
|
+
|
29
|
+
#获得pod信息后
|
30
|
+
deal_module_info
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def get_pod_search_result(pod_name)
|
36
|
+
#输入pod Search 结果
|
37
|
+
`pod search #{pod_name} --ios --simple >> #{@main_path}/bigKeeperPodInfo.tmp`
|
38
|
+
end
|
39
|
+
|
40
|
+
def deal_module_info
|
41
|
+
podfile_lines = File.readlines("#{@main_path}/bigKeeperPodInfo.tmp")
|
42
|
+
Logger.highlight("Analyzing modules info...") unless podfile_lines.size.zero?
|
43
|
+
podfile_lines.collect do |sentence|
|
44
|
+
if sentence =~(/pod/)
|
45
|
+
sentence = sentence.sub('pod','')
|
46
|
+
sentence = sentence.delete('\n\'')
|
47
|
+
match_result = sentence.split(',')
|
48
|
+
pod_name = match_result[0].strip
|
49
|
+
latest_version = match_result[1].strip
|
50
|
+
@update_modules[pod_name] = latest_version unless @update_modules.include?(pod_name)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
p @update_modules
|
54
|
+
File.delete("#{@main_path}/bigKeeperPodInfo.tmp")
|
55
|
+
@update_modules
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_module_latest_version(pod_model)
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -115,6 +115,27 @@ module BigKeeper
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
+
def find_and_upgrade(podfile,dictionary)
|
119
|
+
temp_file = Tempfile.new('.Podfile.tmp')
|
120
|
+
begin
|
121
|
+
File.open(podfile, 'r') do |file|
|
122
|
+
file.each_line do |line|
|
123
|
+
pod_model = PodfileDetector.get_pod_model(line)
|
124
|
+
if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil
|
125
|
+
temp_file.puts generate_pod_config(pod_model.name,dictionary[pod_model.name],pod_model.comment)
|
126
|
+
else
|
127
|
+
temp_file.puts line
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
temp_file.close
|
132
|
+
FileUtils.mv(temp_file.path, podfile)
|
133
|
+
ensure
|
134
|
+
temp_file.close
|
135
|
+
temp_file.unlink
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
118
139
|
def podspec_change(podspec_file, version, module_name)
|
119
140
|
temp_file = Tempfile.new(".#{module_name}.podspec")
|
120
141
|
begin
|
data/lib/big_keeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: big_keeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -231,7 +231,7 @@ files:
|
|
231
231
|
- lib/big_keeper/command/feature&hotfix/start.rb
|
232
232
|
- lib/big_keeper/command/feature&hotfix/switch.rb
|
233
233
|
- lib/big_keeper/command/feature&hotfix/update.rb
|
234
|
-
- lib/big_keeper/command/pod/
|
234
|
+
- lib/big_keeper/command/pod/podfile.rb
|
235
235
|
- lib/big_keeper/command/release/home.rb
|
236
236
|
- lib/big_keeper/command/release/module.rb
|
237
237
|
- lib/big_keeper/model/gitflow_type.rb
|
@@ -248,6 +248,7 @@ files:
|
|
248
248
|
- lib/big_keeper/util/logger.rb
|
249
249
|
- lib/big_keeper/util/pod_operator.rb
|
250
250
|
- lib/big_keeper/util/podfile_detector.rb
|
251
|
+
- lib/big_keeper/util/podfile_module.rb
|
251
252
|
- lib/big_keeper/util/podfile_operator.rb
|
252
253
|
- lib/big_keeper/version.rb
|
253
254
|
- resources/banner.png
|