kookeeper 1.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 -110
- 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 -49
- data/bin/big +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,101 +0,0 @@
|
|
1
|
-
require 'big_keeper/util/logger'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module BigKeeper
|
5
|
-
class ListGenerator
|
6
|
-
#generate tree print throught console
|
7
|
-
def self.generate_tree(file_path, home_branches, version)
|
8
|
-
module_branches_dic = {}
|
9
|
-
json_data = File.read(file_path, :encoding => 'UTF-8')
|
10
|
-
module_branches_dic = JSON.parse(json_data)
|
11
|
-
to_tree(module_branches_dic, home_branches, version)
|
12
|
-
File.delete(file_path)
|
13
|
-
end
|
14
|
-
|
15
|
-
#generate json print throught console
|
16
|
-
def self.generate_json(file_path, home_branches, version)
|
17
|
-
module_branches_dic = {}
|
18
|
-
json_data = File.read(file_path, :encoding => 'UTF-8')
|
19
|
-
module_branches_dic = JSON.parse(json_data)
|
20
|
-
json = to_json(home_branches, module_branches_dic, version)
|
21
|
-
puts JSON.pretty_generate(json)
|
22
|
-
File.delete(file_path)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.to_json(home_branches, module_info_list, version)
|
26
|
-
json_array = []
|
27
|
-
print_all = version == "all versions"
|
28
|
-
home_branches = home_branches.uniq
|
29
|
-
home_branches.each do | home_branch_name |
|
30
|
-
next unless home_branch_name.include?(version) || print_all
|
31
|
-
branch_dic = {}
|
32
|
-
involve_modules = []
|
33
|
-
module_info_list.collect do | module_info_dic |
|
34
|
-
next unless module_info_dic["branches"] != nil
|
35
|
-
module_name = module_info_dic["module_name"]
|
36
|
-
module_info_dic["branches"].each do | module_branch |
|
37
|
-
if module_branch.strip.delete("*") == home_branch_name.strip.delete("*")
|
38
|
-
module_current_info = {}
|
39
|
-
module_current_info["module_name"] = module_name
|
40
|
-
module_current_info["current_branch"] = module_info_dic["current_branch"]
|
41
|
-
involve_modules << module_current_info
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
branch_dic["is_remote"] = false
|
47
|
-
branch_dic["is_current"] = false
|
48
|
-
|
49
|
-
if home_branch_name =~ /^remotes\//
|
50
|
-
home_branch_name = $~.post_match
|
51
|
-
branch_dic["is_remote"] = true
|
52
|
-
end
|
53
|
-
|
54
|
-
if home_branch_name =~ /^origin\//
|
55
|
-
home_branch_name = $~.post_match
|
56
|
-
end
|
57
|
-
|
58
|
-
if home_branch_name.include?("*")
|
59
|
-
home_branch_name = home_branch_name.delete("*")
|
60
|
-
branch_dic["is_current"] = true
|
61
|
-
end
|
62
|
-
|
63
|
-
if home_branch_name =~ /^feature\//
|
64
|
-
home_branch_name = $~.post_match
|
65
|
-
end
|
66
|
-
|
67
|
-
if home_branch_name =~ /^hotfix\//
|
68
|
-
home_branch_name = $~.post_match
|
69
|
-
end
|
70
|
-
|
71
|
-
branch_dic["home_branch_name"] = home_branch_name
|
72
|
-
branch_dic["involve_modules"] = involve_modules
|
73
|
-
json_array << branch_dic
|
74
|
-
end
|
75
|
-
json_array
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.to_tree(module_branches_dic, branches_name, version)
|
79
|
-
home_name = BigkeeperParser.home_name
|
80
|
-
print_all = version == "all versions"
|
81
|
-
branches_name.each do | home_branch_name |
|
82
|
-
next unless home_branch_name.include?(version) || print_all
|
83
|
-
Logger.highlight(home_branch_name.strip)
|
84
|
-
module_branches_dic.each do | module_info_dic |
|
85
|
-
module_name = module_info_dic["module_name"]
|
86
|
-
next if module_info_dic["branches"] == nil
|
87
|
-
module_info_dic["branches"].each do | module_branch |
|
88
|
-
if module_branch.include?(home_branch_name.strip.delete('*'))
|
89
|
-
if !module_branch.include?("*") && home_branch_name.include?("*")
|
90
|
-
Logger.warning(" ├── #{module_name} (current branch :#{module_info_dic["current_branch"]})")
|
91
|
-
else
|
92
|
-
Logger.default(" ├── #{module_name}")
|
93
|
-
end
|
94
|
-
break
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
require 'big_keeper/util/bigkeeper_parser'
|
2
|
-
require 'big_keeper/util/logger'
|
3
|
-
require 'big_keeper/util/podfile_detector'
|
4
|
-
require 'Singleton'
|
5
|
-
|
6
|
-
module BigKeeper
|
7
|
-
class LockfileParser
|
8
|
-
include Singleton
|
9
|
-
attr_accessor :main_path, :dependencies, :pods, :podfile_hash
|
10
|
-
$mode = 'PODS'
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
self.pods = {}
|
14
|
-
self.dependencies = []
|
15
|
-
end
|
16
|
-
|
17
|
-
def parse(main_path)
|
18
|
-
self.main_path = main_path
|
19
|
-
$mode = 'PODS'
|
20
|
-
podfile_lock_lines = File.readlines("#{main_path}/Podfile.lock", :encoding => 'UTF-8')
|
21
|
-
Logger.highlight("Analyzing Podfile.lock...")
|
22
|
-
podfile_lock_lines.each do |sentence|
|
23
|
-
if sentence.include?('PODS')
|
24
|
-
$mode = 'PODS'
|
25
|
-
elsif sentence.include?('DEPENDENCIES')
|
26
|
-
$mode = 'DEPENDENCIES'
|
27
|
-
elsif sentence.include?('SPEC REPOS')
|
28
|
-
$mode = 'SPEC REPOS'
|
29
|
-
elsif sentence.include?('SPEC CHECKSUMS')
|
30
|
-
$mode = 'SPEC CHECKSUMS'
|
31
|
-
elsif sentence.include?('CHECKOUT OPTIONS')
|
32
|
-
$mode = 'CHECKOUT OPTIONS'
|
33
|
-
elsif sentence.include?('EXTERNAL SOURCES')
|
34
|
-
$mode = 'EXTERNAL SOURCES'
|
35
|
-
elsif sentence.include?('PODFILE CHECKSUM')
|
36
|
-
$mode = 'PODFILE CHECKSUM'
|
37
|
-
else
|
38
|
-
if $mode == 'PODS'
|
39
|
-
deal_pod(sentence.strip.delete('\n'))
|
40
|
-
end
|
41
|
-
if $mode == 'SPEC CHECKSUMS'
|
42
|
-
deal_spec(sentence.strip.delete('\n'))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def get_unlock_pod_list(is_all)
|
49
|
-
result = {}
|
50
|
-
pod_parser = PodfileParser.instance
|
51
|
-
#podfile 中 unlock pods
|
52
|
-
unlock_pods = pod_parser.get_unlock_pod_list
|
53
|
-
# @unlock_pod_list << pod_name unless @module_list.include pod_name
|
54
|
-
if is_all
|
55
|
-
self.dependencies.each do |pod_name|
|
56
|
-
if pod_parser.pod_list.include?(pod_name)
|
57
|
-
next
|
58
|
-
end
|
59
|
-
if self.pods[pod_name] != nil
|
60
|
-
result[pod_name] = self.pods[pod_name]
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
unlock_pods.each do |pod_name|
|
65
|
-
if self.pods[pod_name] != nil
|
66
|
-
result[pod_name] = self.pods[pod_name]
|
67
|
-
end
|
68
|
-
end
|
69
|
-
return result
|
70
|
-
else
|
71
|
-
unlock_pods.each do |pod_name|
|
72
|
-
if self.pods[pod_name] != nil
|
73
|
-
result[pod_name] = self.pods[pod_name]
|
74
|
-
end
|
75
|
-
end
|
76
|
-
return result
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
#处理PODS
|
81
|
-
# TODO 去除重复
|
82
|
-
def deal_pod(s)
|
83
|
-
pod_name = get_lock_podname(s)
|
84
|
-
return if pod_name == nil
|
85
|
-
pod_version = get_lock_version(s)
|
86
|
-
if self.pods.keys.include?(pod_name)
|
87
|
-
current_version = self.pods[pod_name]
|
88
|
-
if pod_version != nil && current_version != nil
|
89
|
-
self.pods[pod_name] = chose_version(current_version, pod_version)
|
90
|
-
else
|
91
|
-
self.pods[pod_name] = pod_version unless pod_version == nil
|
92
|
-
end
|
93
|
-
end
|
94
|
-
self.pods[pod_name] = pod_version unless pod_version == nil
|
95
|
-
end
|
96
|
-
#
|
97
|
-
# #处理EXTERNAL SOURCES
|
98
|
-
# def deal_sources(s)
|
99
|
-
#
|
100
|
-
# end
|
101
|
-
# #处理CHECKOUT OPTIONS
|
102
|
-
# def deal_checkout(s)
|
103
|
-
#
|
104
|
-
# end
|
105
|
-
|
106
|
-
#处理SPEC CHECKSUMS
|
107
|
-
def deal_spec(s)
|
108
|
-
if /: +/ =~ s
|
109
|
-
dependency = $~.pre_match.strip
|
110
|
-
self.dependencies << dependency unless self.dependencies.include?(dependency)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def get_lock_podname(sentence) #获得lock pod名称
|
115
|
-
match_result = /(\d+.){1,2}\d+/.match(sentence.delete('- :~>='))
|
116
|
-
pod_name = match_result.pre_match unless match_result == nil
|
117
|
-
return pod_name.delete('()') unless pod_name == nil
|
118
|
-
end
|
119
|
-
|
120
|
-
def get_lock_version(sentence)#获得lock pod版本号
|
121
|
-
match_result = /(\d+.){1,2}\d+/.match(sentence)
|
122
|
-
return match_result[0].strip unless match_result == nil
|
123
|
-
end
|
124
|
-
|
125
|
-
def chose_version(cur_version,temp_version)
|
126
|
-
# p "cur:#{cur_version},temp:#{temp_version}"
|
127
|
-
cur_list = cur_version.split('.')
|
128
|
-
temp_list = temp_version.split('.')
|
129
|
-
cur_list << 0.to_s if cur_list.size == 2
|
130
|
-
temp_list << 0.to_s if temp_list.size == 2
|
131
|
-
if cur_list[0] >= temp_list[0]
|
132
|
-
if cur_list[1] >= temp_list[1]
|
133
|
-
if cur_list[2] > temp_list[2]
|
134
|
-
return cur_version
|
135
|
-
end
|
136
|
-
return temp_version
|
137
|
-
end
|
138
|
-
return temp_version
|
139
|
-
end
|
140
|
-
return temp_version
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'colorize'
|
2
|
-
require 'big_keeper/util/leancloud_logger'
|
3
|
-
|
4
|
-
module BigKeeper
|
5
|
-
DEFAULT_LOG = 1
|
6
|
-
HIGHLIGHT_LOG = 2
|
7
|
-
ERROR_LOG = 3
|
8
|
-
WARNING_LOG = 4
|
9
|
-
|
10
|
-
class Logger
|
11
|
-
|
12
|
-
def self.log_with_type(sentence,type)
|
13
|
-
case type
|
14
|
-
when DEFAULT_LOG then puts sentence.to_s.colorize(:default)
|
15
|
-
when HIGHLIGHT_LOG then puts sentence.to_s.colorize(:green)
|
16
|
-
when ERROR_LOG then raise sentence.to_s.colorize(:red)
|
17
|
-
when WARNING_LOG then puts sentence.to_s.colorize(:yellow)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.default(sentence)
|
22
|
-
puts formatter_output(sentence).colorize(:default)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.highlight(sentence)
|
26
|
-
puts formatter_output(sentence).colorize(:green)
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.error(sentence)
|
30
|
-
is_need_log = LeanCloudLogger.instance.is_need_log
|
31
|
-
LeanCloudLogger.instance.end_log(false, is_need_log)
|
32
|
-
raise formatter_output(sentence).colorize(:red)
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.warning(sentence)
|
36
|
-
puts formatter_output(sentence).colorize(:yellow)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.separator
|
40
|
-
puts "- - - - - - - - - - - - - - - - - - - - - - - - - - -".colorize(:light_blue)
|
41
|
-
end
|
42
|
-
|
43
|
-
def self.formatter_output(sentence)
|
44
|
-
"[big] ".concat(sentence.to_s).to_s
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'big_keeper/util/logger'
|
2
|
-
require 'open3'
|
3
|
-
|
4
|
-
module BigKeeper
|
5
|
-
class PodOperator
|
6
|
-
def self.pod_install(path, repo_update)
|
7
|
-
# pod install
|
8
|
-
if repo_update
|
9
|
-
PodOperator.pod_update_private_repos(true)
|
10
|
-
end
|
11
|
-
Logger.highlight('Start pod install, waiting...')
|
12
|
-
cmd = "pod install --project-directory='#{path}'"
|
13
|
-
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
|
14
|
-
while line = stdout.gets
|
15
|
-
p line
|
16
|
-
end
|
17
|
-
end
|
18
|
-
Logger.highlight('Finish pod install.')
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.pod_repo_push(path, module_name, source, version)
|
22
|
-
Logger.highlight(%Q(Start Pod repo push #{module_name}))
|
23
|
-
Dir.chdir(path) do
|
24
|
-
command = ""
|
25
|
-
p BigkeeperParser.source_spec_name(module_name)
|
26
|
-
if source.length > 0
|
27
|
-
command = "pod repo push #{BigkeeperParser.source_spec_name(module_name)} #{module_name}.podspec --allow-warnings --sources=#{source} --verbose --use-libraries"
|
28
|
-
else
|
29
|
-
command = "pod repo push #{BigkeeperParser.source_spec_name(module_name)} #{module_name}.podspec --allow-warnings --verbose --use-libraries"
|
30
|
-
end
|
31
|
-
|
32
|
-
IO.popen(command) do |io|
|
33
|
-
is_success = false
|
34
|
-
error_info = Array.new
|
35
|
-
io.each do |line|
|
36
|
-
error_info.push(line)
|
37
|
-
is_success = true if line.include? "Updating spec repo"
|
38
|
-
end
|
39
|
-
unless is_success
|
40
|
-
puts error_info
|
41
|
-
Logger.error("Fail: '#{module_name}' Pod repo fail")
|
42
|
-
end
|
43
|
-
Logger.highlight(%Q(Success release #{module_name} V#{version}))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.pod_update_private_repos(update_private)
|
49
|
-
if update_private
|
50
|
-
BigkeeperParser.sources.map { |spec|
|
51
|
-
Logger.highlight('Start pod repo update, waiting...')
|
52
|
-
cmd = "pod repo update #{spec}"
|
53
|
-
cmd(cmd)
|
54
|
-
}
|
55
|
-
else
|
56
|
-
cmd = "pod repo update"
|
57
|
-
cmd(cmd)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.cmd(cmd)
|
62
|
-
Open3.popen3(cmd) do |stdin , stdout , stderr, wait_thr|
|
63
|
-
while line = stdout.gets
|
64
|
-
puts line
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
require 'big_keeper/util/bigkeeper_parser'
|
2
|
-
require 'big_keeper/model/podfile_model'
|
3
|
-
require 'big_keeper/util/logger'
|
4
|
-
require 'Singleton'
|
5
|
-
module BigKeeper
|
6
|
-
|
7
|
-
class PodfileParser
|
8
|
-
include Singleton
|
9
|
-
attr_accessor :module_list, :main_path, :pod_list
|
10
|
-
$unlock_pod_list = []
|
11
|
-
$modify_pod_list = {}
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
@module_list = BigkeeperParser.module_names
|
15
|
-
@pod_list = []
|
16
|
-
end
|
17
|
-
|
18
|
-
def parse(path)
|
19
|
-
@main_path = path
|
20
|
-
podfile_lines = File.readlines("#{@main_path}/Podfile", :encoding => 'UTF-8')
|
21
|
-
Logger.highlight("Analyzing Podfile...") unless podfile_lines.size.zero?
|
22
|
-
podfile_lines.collect do |sentence|
|
23
|
-
if /pod / =~ sentence
|
24
|
-
pod_name = get_pod_name(sentence)
|
25
|
-
@pod_list << pod_name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def get_unlock_pod_list
|
31
|
-
podfile_lines = File.readlines("#{@main_path}/Podfile", :encoding => 'UTF-8')
|
32
|
-
#Logger.highlight("Analyzing Podfile...") unless podfile_lines.size.zero?
|
33
|
-
podfile_lines.collect do |sentence|
|
34
|
-
deal_podfile_line(sentence) unless sentence =~(/'(\d+.){1,2}\d+'/)
|
35
|
-
end
|
36
|
-
$unlock_pod_list
|
37
|
-
end
|
38
|
-
|
39
|
-
def deal_podfile_line(sentence)
|
40
|
-
return unless !sentence.strip.start_with?("#")
|
41
|
-
if sentence.strip.include?('pod ')
|
42
|
-
pod_model = PodfileModel.new(sentence)
|
43
|
-
if !pod_model.name.empty? &&
|
44
|
-
pod_model.configurations != '[\'Debug\']' &&
|
45
|
-
pod_model.path == nil &&
|
46
|
-
pod_model.tag == nil
|
47
|
-
pod_names = pod_model.name.split('/')
|
48
|
-
if pod_names.size > 1
|
49
|
-
pod_name = pod_names[0]
|
50
|
-
else
|
51
|
-
pod_name = pod_model.name
|
52
|
-
end
|
53
|
-
$unlock_pod_list << pod_name unless @module_list.include?(pod_name)
|
54
|
-
end
|
55
|
-
pod_model
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def get_pod_name(sentence)
|
60
|
-
|
61
|
-
pod_model = deal_podfile_line(sentence)
|
62
|
-
if pod_model != nil
|
63
|
-
return pod_model.name
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.get_pod_model(sentence)
|
68
|
-
if sentence.include?('pod ')
|
69
|
-
pod_model = PodfileModel.new(sentence)
|
70
|
-
return pod_model
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def get_lock_podname(sentence) #获得pod名称
|
75
|
-
match_result = /(\d+.){1,2}\d+/.match(sentence.delete('- :~>='))
|
76
|
-
pod_name = match_result.pre_match unless match_result == nil
|
77
|
-
return pod_name.delete('()') unless pod_name == nil
|
78
|
-
end
|
79
|
-
|
80
|
-
def get_lock_version(sentence)#获得pod版本号
|
81
|
-
match_result = /(\d+.){1,2}\d+/.match(sentence)
|
82
|
-
return match_result[0] unless match_result == nil
|
83
|
-
end
|
84
|
-
|
85
|
-
def chose_version(cur_version,temp_version)
|
86
|
-
# p "cur:#{cur_version},temp:#{temp_version}"
|
87
|
-
cur_list = cur_version.split('.')
|
88
|
-
temp_list = temp_version.split('.')
|
89
|
-
temp_list << 0.to_s if temp_list.size == 2
|
90
|
-
if cur_list[0] >= temp_list[0]
|
91
|
-
if cur_list[1] >= temp_list[1]
|
92
|
-
if cur_list[2] > temp_list[2]
|
93
|
-
return cur_version
|
94
|
-
end
|
95
|
-
return temp_version
|
96
|
-
end
|
97
|
-
return temp_version
|
98
|
-
end
|
99
|
-
return temp_version
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
@@ -1,63 +0,0 @@
|
|
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
|
-
def get_pod_search_result(pod_name)
|
35
|
-
#输入pod Search 结果
|
36
|
-
`pod search #{pod_name} --ios --simple >> #{@main_path}/bigKeeperPodInfo.tmp`
|
37
|
-
end
|
38
|
-
|
39
|
-
def deal_module_info
|
40
|
-
podfile_lines = File.readlines("#{@main_path}/bigKeeperPodInfo.tmp", :encoding => 'UTF-8')
|
41
|
-
Logger.highlight("Analyzing modules info...") unless podfile_lines.size.zero?
|
42
|
-
podfile_lines.collect do |sentence|
|
43
|
-
if sentence =~(/pod/)
|
44
|
-
sentence = sentence.sub('pod', '')
|
45
|
-
sentence = sentence.delete('\n\'')
|
46
|
-
match_result = sentence.split(',')
|
47
|
-
pod_name = match_result[0].strip
|
48
|
-
latest_version = match_result[1].strip
|
49
|
-
@update_modules[pod_name] = latest_version unless @update_modules.include?(pod_name)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
p @update_modules
|
53
|
-
File.delete("#{@main_path}/bigKeeperPodInfo.tmp")
|
54
|
-
@update_modules
|
55
|
-
end
|
56
|
-
|
57
|
-
def get_module_latest_version(pod_model)
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
@@ -1,125 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'big_keeper/dependency/dep_type'
|
4
|
-
require 'big_keeper/util/podfile_detector'
|
5
|
-
|
6
|
-
module BigKeeper
|
7
|
-
# Operator for podfile
|
8
|
-
class PodfileOperator
|
9
|
-
def has(podfile, module_name)
|
10
|
-
File.open(podfile, 'r') do |file|
|
11
|
-
file.each_line do |line|
|
12
|
-
if line.include?module_name
|
13
|
-
return true
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
false
|
18
|
-
end
|
19
|
-
|
20
|
-
def generate_pod_config(pod_name, version, comment)
|
21
|
-
module_config = ''
|
22
|
-
if comment != nil
|
23
|
-
module_config = " pod '#{pod_name}' , '#{version}' # #{comment}"
|
24
|
-
else
|
25
|
-
module_config = " pod '#{pod_name}' , '#{version}'"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def replace_all_module_release(path, user, module_names, version)
|
30
|
-
module_names.each do |module_name|
|
31
|
-
DepService.dep_operator(path, user).update_module_config(
|
32
|
-
module_name,
|
33
|
-
ModuleOperateType::RELEASE)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
def find_and_lock(podfile, dictionary)
|
39
|
-
temp_file = Tempfile.new('.Podfile.tmp', :encoding => 'UTF-8')
|
40
|
-
begin
|
41
|
-
File.open(podfile, 'r') do |file|
|
42
|
-
file.each_line do |line|
|
43
|
-
pod_model = PodfileParser.get_pod_model(line)
|
44
|
-
if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil
|
45
|
-
temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment)
|
46
|
-
dictionary.delete(pod_model.name)
|
47
|
-
else
|
48
|
-
temp_file.puts line
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
if !dictionary.empty?
|
53
|
-
temp_file.puts 'def sub_dependency'
|
54
|
-
dictionary.keys.each do |sub_pod|
|
55
|
-
temp_file.puts generate_pod_config(sub_pod, dictionary[sub_pod], 'bigkeeper')
|
56
|
-
end
|
57
|
-
temp_file.puts 'end'
|
58
|
-
end
|
59
|
-
temp_file.close
|
60
|
-
FileUtils.mv(temp_file.path, podfile)
|
61
|
-
ensure
|
62
|
-
temp_file.close
|
63
|
-
temp_file.unlink
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def find_and_upgrade(podfile, dictionary)
|
68
|
-
temp_file = Tempfile.new('.Podfile.tmp', :encoding => 'UTF-8')
|
69
|
-
begin
|
70
|
-
File.open(podfile, 'r', :encoding => 'UTF-8') do |file|
|
71
|
-
file.each_line do |line|
|
72
|
-
pod_model = PodfileParser.get_pod_model(line)
|
73
|
-
if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil
|
74
|
-
#替换
|
75
|
-
temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment)
|
76
|
-
else
|
77
|
-
temp_file.puts line
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
temp_file.close
|
82
|
-
FileUtils.mv(temp_file.path, podfile)
|
83
|
-
ensure
|
84
|
-
temp_file.close
|
85
|
-
temp_file.unlink
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def podspec_change(podspec_file, version, module_name)
|
90
|
-
temp_file = Tempfile.new(".#{module_name}.podspec", :encoding => 'UTF-8')
|
91
|
-
has_change = false
|
92
|
-
begin
|
93
|
-
File.open(podspec_file, 'r', :encoding => 'UTF-8') do |file|
|
94
|
-
file.each_line do |line|
|
95
|
-
if line.include?("s.version")
|
96
|
-
temp_line = line
|
97
|
-
temp_line_arr = temp_line.split("=")
|
98
|
-
if temp_line_arr[0].delete(" ") == "s.version"
|
99
|
-
unless temp_line_arr[temp_line_arr.length - 1].include? "#{version}"
|
100
|
-
temp_file.puts "s.version = '#{version}'"
|
101
|
-
has_change = true
|
102
|
-
else
|
103
|
-
temp_file.puts line
|
104
|
-
Logger.highlight("The version in PodSpec is equal your input version")
|
105
|
-
end
|
106
|
-
else
|
107
|
-
temp_file.puts line
|
108
|
-
end
|
109
|
-
else
|
110
|
-
temp_file.puts line
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
temp_file.close
|
115
|
-
FileUtils.mv(temp_file.path, podspec_file)
|
116
|
-
ensure
|
117
|
-
temp_file.close
|
118
|
-
temp_file.unlink
|
119
|
-
end
|
120
|
-
has_change
|
121
|
-
end
|
122
|
-
|
123
|
-
private :generate_pod_config
|
124
|
-
end
|
125
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module BigKeeper
|
2
|
-
# Operator for got
|
3
|
-
class VerifyOperator
|
4
|
-
def self.already_in_process?
|
5
|
-
already_in_process = false
|
6
|
-
Open3.popen3('ps aux | grep \<big\> -c') do |stdin , stdout , stderr, wait_thr|
|
7
|
-
while line = stdout.gets
|
8
|
-
if line.rstrip.to_i > 2
|
9
|
-
already_in_process = true
|
10
|
-
break
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
already_in_process
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module BigKeeper
|
2
|
-
class VersionConfigOperator
|
3
|
-
def self.change_version(version_config_file, modules, version)
|
4
|
-
temp_file = Tempfile.new('.version-config.gradle.tmp')
|
5
|
-
begin
|
6
|
-
File.open(version_config_file, 'r') do |file|
|
7
|
-
file.each_line do |line|
|
8
|
-
temp_file.puts(replace_module_version(line, modules, version))
|
9
|
-
end
|
10
|
-
end
|
11
|
-
temp_file.close
|
12
|
-
FileUtils.mv(temp_file.path, version_config_file)
|
13
|
-
ensure
|
14
|
-
temp_file.close
|
15
|
-
temp_file.unlink
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.replace_module_version(line, modules, version)
|
20
|
-
modules.each do |module_name|
|
21
|
-
version_alias = BigkeeperParser.module_version_alias(module_name)
|
22
|
-
if !version_alias.nil? && !version_alias.empty? && line.match(/\s*#{version_alias}\s*=\s*('|")([\s\S]*)('|")\s*/)
|
23
|
-
return line.sub(/(\s*#{version_alias}\s*=\s*)('|")([\s\S]*)('|")\s*/){"#{$1}\'#{version}\'"}
|
24
|
-
end
|
25
|
-
end
|
26
|
-
line
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|