lg_pod_plugin 1.1.3 → 1.1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/lg +2 -2
- data/lib/command/command.rb +1 -2
- data/lib/command/install.rb +7 -2
- data/lib/command/update.rb +4 -1
- data/lib/lg_pod_plugin/config/l_config.rb +59 -0
- data/lib/lg_pod_plugin/config/lockfile_model.rb +59 -0
- data/lib/lg_pod_plugin/config/podspec.rb +266 -0
- data/lib/lg_pod_plugin/config/target.rb +33 -0
- data/lib/lg_pod_plugin/{database.rb → db/database.rb} +76 -16
- data/lib/lg_pod_plugin/downloader/downloader.rb +156 -0
- data/lib/lg_pod_plugin/{l_cache.rb → downloader/l_cache.rb} +42 -23
- data/lib/lg_pod_plugin/downloader/request.rb +239 -0
- data/lib/lg_pod_plugin/git/git_clone.rb +85 -0
- data/lib/lg_pod_plugin/git/git_download.rb +53 -0
- data/lib/lg_pod_plugin/git/github_api.rb +137 -0
- data/lib/lg_pod_plugin/git/github_archive.rb +165 -0
- data/lib/lg_pod_plugin/git/gitlab_api.rb +266 -0
- data/lib/lg_pod_plugin/git/gitlab_archive.rb +180 -0
- data/lib/lg_pod_plugin/git/http_download.rb +39 -0
- data/lib/lg_pod_plugin/installer/PodDownload +0 -0
- data/lib/lg_pod_plugin/installer/concurrency.rb +21 -0
- data/lib/lg_pod_plugin/installer/install.rb +111 -0
- data/lib/lg_pod_plugin/installer/main.rb +63 -0
- data/lib/lg_pod_plugin/installer/project.rb +47 -0
- data/lib/lg_pod_plugin/net/l_uri.rb +87 -0
- data/lib/lg_pod_plugin/net/net-ping.rb +27 -0
- data/lib/lg_pod_plugin/pod/external_pod.rb +21 -0
- data/lib/lg_pod_plugin/pod/release-pod.rb +158 -0
- data/lib/lg_pod_plugin/utils/aes-crypt.rb +82 -0
- data/lib/lg_pod_plugin/{file_path.rb → utils/file_path.rb} +3 -5
- data/lib/lg_pod_plugin/utils/l_util.rb +133 -0
- data/lib/lg_pod_plugin/{log.rb → utils/log.rb} +1 -1
- data/lib/lg_pod_plugin/{string.rb → utils/string.rb} +0 -0
- data/lib/lg_pod_plugin/version.rb +1 -1
- data/lib/lg_pod_plugin.rb +24 -9
- data/lib/sqlite3-1.5.3-arm64-darwin/API_CHANGES.md +49 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/CHANGELOG.md +462 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/CONTRIBUTING.md +24 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ChangeLog.cvs +88 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/README.md +235 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/dependencies.yml +14 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.c +274 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/aggregator.h +12 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.c +168 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/backup.h +15 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.c +853 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/database.h +17 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.c +98 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/exception.h +8 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/extconf.rb +251 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3.c +163 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/sqlite3_ruby.h +48 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.c +442 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/ext/sqlite3/statement.h +16 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.md +431 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.rb +145 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/faq/faq.yml +426 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/constants.rb +50 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/database.rb +741 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/errors.rb +35 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/pragmas.rb +595 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/resultset.rb +187 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/statement.rb +145 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/translator.rb +118 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/value.rb +57 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3/version.rb +23 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/lib/sqlite3.rb +15 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/helper.rb +27 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_backup.rb +33 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_collation.rb +82 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database.rb +545 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_flags.rb +95 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readonly.rb +36 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_database_readwrite.rb +41 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_deprecated.rb +44 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_encoding.rb +155 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration.rb +507 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_aggregate.rb +336 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_open_close.rb +30 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_pending.rb +115 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_resultset.rb +142 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_integration_statement.rb +194 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_result_set.rb +37 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_sqlite3.rb +30 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement.rb +263 -0
- data/lib/sqlite3-1.5.3-arm64-darwin/test/test_statement_execute.rb +35 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/API_CHANGES.md +49 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/CHANGELOG.md +462 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/CONTRIBUTING.md +24 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ChangeLog.cvs +88 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/README.md +235 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/dependencies.yml +14 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.c +274 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/aggregator.h +12 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.c +168 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/backup.h +15 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.c +853 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/database.h +17 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.c +98 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/exception.h +8 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/extconf.rb +251 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3.c +163 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/sqlite3_ruby.h +48 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.c +442 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/ext/sqlite3/statement.h +16 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.md +431 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.rb +145 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/faq/faq.yml +426 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.6/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/2.7/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.0/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/3.1/sqlite3_native.bundle +0 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/constants.rb +50 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/database.rb +741 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/errors.rb +35 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/pragmas.rb +595 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/resultset.rb +187 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/statement.rb +145 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/translator.rb +118 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/value.rb +57 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3/version.rb +23 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/lib/sqlite3.rb +15 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/helper.rb +27 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_backup.rb +33 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_collation.rb +82 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database.rb +545 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_flags.rb +95 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readonly.rb +36 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_database_readwrite.rb +41 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_deprecated.rb +44 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_encoding.rb +155 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration.rb +507 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_aggregate.rb +336 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_open_close.rb +30 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_pending.rb +115 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_resultset.rb +142 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_integration_statement.rb +194 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_result_set.rb +37 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_sqlite3.rb +30 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement.rb +263 -0
- data/lib/sqlite3-1.5.3-x86_64-darwin/test/test_statement_execute.rb +35 -0
- metadata +146 -53
- data/lib/lg_pod_plugin/downloader.rb +0 -57
- data/lib/lg_pod_plugin/gitlab_api.rb +0 -147
- data/lib/lg_pod_plugin/gitlab_archive.rb +0 -352
- data/lib/lg_pod_plugin/gitlab_download.rb +0 -159
- data/lib/lg_pod_plugin/install.rb +0 -81
- data/lib/lg_pod_plugin/l_config.rb +0 -83
- data/lib/lg_pod_plugin/l_util.rb +0 -145
- data/lib/lg_pod_plugin/net-ping.rb +0 -41
- data/lib/lg_pod_plugin/podspec.rb +0 -156
- data/lib/lg_pod_plugin/release-pod.rb +0 -90
- data/lib/lg_pod_plugin/request.rb +0 -221
- data/lib/lg_pod_plugin/runner.rb +0 -114
- data/lib/lg_pod_plugin/specification.rb +0 -52
data/lib/lg_pod_plugin/l_util.rb
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
require 'resolv'
|
2
|
-
require "ipaddr"
|
3
|
-
require 'archive/zip'
|
4
|
-
require_relative 'log'
|
5
|
-
require_relative 'l_config'
|
6
|
-
|
7
|
-
module LgPodPlugin
|
8
|
-
class LUtils
|
9
|
-
|
10
|
-
#判断对象是不是 String
|
11
|
-
def self.is_string(obj)
|
12
|
-
if "#{obj.class}" == "String"
|
13
|
-
return true
|
14
|
-
else
|
15
|
-
return false
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# 解压文件
|
20
|
-
def self.unzip_file (zip_file, dest_dir)
|
21
|
-
begin
|
22
|
-
Archive::Zip.extract(
|
23
|
-
zip_file,
|
24
|
-
dest_dir,
|
25
|
-
:symlinks => true
|
26
|
-
)
|
27
|
-
return true
|
28
|
-
rescue => err
|
29
|
-
return false
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
# 下载 zip 格式文件
|
35
|
-
def self.download_gitlab_zip_file(download_url, token, file_name)
|
36
|
-
cmds = ['curl']
|
37
|
-
cmds << "--header \"Authorization: Bearer #{token}\"" if token
|
38
|
-
# cmds << "--progress-bar"
|
39
|
-
cmds << "-o #{file_name}"
|
40
|
-
cmds << "--connect-timeout 15"
|
41
|
-
cmds << "--retry 3"
|
42
|
-
cmds << download_url
|
43
|
-
cmds_to_s = cmds.join(" ")
|
44
|
-
system(cmds_to_s)
|
45
|
-
end
|
46
|
-
|
47
|
-
# gitlab 下载压缩文件
|
48
|
-
def self.download_github_zip_file(download_url, file_name)
|
49
|
-
cmds = ['curl']
|
50
|
-
cmds << "-o #{file_name}"
|
51
|
-
cmds << "--connect-timeout 15"
|
52
|
-
cmds << "--retry 3"
|
53
|
-
cmds << download_url
|
54
|
-
cmds_to_s = cmds.join(" ")
|
55
|
-
system(cmds_to_s)
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.git_to_uri(git)
|
59
|
-
begin
|
60
|
-
uri = URI(git)
|
61
|
-
rescue
|
62
|
-
if git.include?("git@") && git.include?(":")
|
63
|
-
uri = URI("http://" + git[4...git.length].split(":").first)
|
64
|
-
else
|
65
|
-
return nil
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.commit_from_ls_remote(output, branch_name)
|
71
|
-
return nil if branch_name.nil?
|
72
|
-
encoded_branch_name = branch_name.dup.force_encoding(Encoding::ASCII_8BIT)
|
73
|
-
if branch_name == "HEAD"
|
74
|
-
match1 = %r{([a-z0-9]*)\t#{Regexp.quote(encoded_branch_name)}}.match(output)
|
75
|
-
sha = match1[1] unless match1.nil?
|
76
|
-
refs = output.split("\n")
|
77
|
-
return [sha, nil] unless refs.is_a?(Array)
|
78
|
-
refs.each do |element|
|
79
|
-
next if element.include?("HEAD") || element.include?("refs/tags")
|
80
|
-
next unless element.include?(sha)
|
81
|
-
find_branch = element.split("refs/heads/").last
|
82
|
-
return [sha, find_branch]
|
83
|
-
end
|
84
|
-
else
|
85
|
-
match = %r{([a-z0-9]*)\trefs\/(heads|tags)\/#{Regexp.quote(encoded_branch_name)}}.match(output)
|
86
|
-
sha = match[1] unless match.nil?
|
87
|
-
ref = match[0].split("refs/heads/").last unless match.nil?
|
88
|
-
return [sha, ref]
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
#截取git-url 拿到项目绝对名称 比如 l-base-ios
|
94
|
-
def self.get_git_project_name(git)
|
95
|
-
self.get_gitlab_base_url(git).split("/").last
|
96
|
-
end
|
97
|
-
|
98
|
-
# 是否能够使用 gitlab 下载 zip 文件
|
99
|
-
def self.is_use_gitlab_archive_file(git)
|
100
|
-
return false if git.include?("https://github.com") || git.include?("https://gitee.com")
|
101
|
-
config = LRequest.shared.config
|
102
|
-
return false if (!config || !config.access_token)
|
103
|
-
return true if project = config.project
|
104
|
-
project_name = self.get_git_project_name(git)
|
105
|
-
LRequest.shared.config.project = GitLabAPI.request_project_info(config.host, project_name, config.access_token, git)
|
106
|
-
return true if LRequest.shared.config.project
|
107
|
-
end
|
108
|
-
|
109
|
-
# 截取 url
|
110
|
-
def self.get_gitlab_base_url(git)
|
111
|
-
if git.include?(".git")
|
112
|
-
base_url = git.split(".git").first
|
113
|
-
else
|
114
|
-
base_url = git
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
# 根据参数生成下载 url
|
119
|
-
def self.get_gitlab_download_url(base_url, branch, tag, commit, project_name)
|
120
|
-
if base_url.include?("http:") || base_url.include?("https:")
|
121
|
-
if branch
|
122
|
-
return base_url + "/-/archive/" + branch + "/#{project_name}-#{branch}.zip"
|
123
|
-
elsif tag
|
124
|
-
return base_url + "/-/archive/" + tag + "/#{project_name}-#{tag}.zip"
|
125
|
-
elsif commit
|
126
|
-
return base_url + "/-/archive/" + commit + "/#{project_name}-#{commit}.zip"
|
127
|
-
else
|
128
|
-
return nil
|
129
|
-
end
|
130
|
-
end
|
131
|
-
return nil unless base_url.include?("ssh://git@gitlab") || base_url.include?("git@")
|
132
|
-
project = LRequest.shared.config.project
|
133
|
-
if project && project.web_url && project.web_url.include?("http")
|
134
|
-
self.get_gitlab_download_url(project.web_url, branch, tag, commit, project_name)
|
135
|
-
else
|
136
|
-
return nil
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
def self.url_encode(url)
|
141
|
-
url.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| sprintf('%%%02X', m.unpack1('C')) }
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'uri'
|
2
|
-
require 'resolv'
|
3
|
-
require "ipaddr"
|
4
|
-
require_relative 'l_util'
|
5
|
-
|
6
|
-
module LgPodPlugin
|
7
|
-
|
8
|
-
class Ping
|
9
|
-
attr_accessor :uri
|
10
|
-
attr_accessor :ip
|
11
|
-
attr_accessor :network_ok
|
12
|
-
def initialize(url)
|
13
|
-
self.uri = LUtils.git_to_uri(url)
|
14
|
-
end
|
15
|
-
|
16
|
-
def ping
|
17
|
-
return false unless self.uri
|
18
|
-
result = %x(ping #{uri.host} -t 1)
|
19
|
-
if result.include?("timeout")
|
20
|
-
return false
|
21
|
-
end
|
22
|
-
if result && result.include?("(") && result.include?("):")
|
23
|
-
ip_address = result.split("(").last.split(")").first
|
24
|
-
begin
|
25
|
-
if IPAddr.new ip_address
|
26
|
-
self.ip = ip_address
|
27
|
-
return true
|
28
|
-
else
|
29
|
-
return false
|
30
|
-
end
|
31
|
-
rescue
|
32
|
-
return false
|
33
|
-
end
|
34
|
-
else
|
35
|
-
return false
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
@@ -1,156 +0,0 @@
|
|
1
|
-
require 'cocoapods'
|
2
|
-
require 'cocoapods-core'
|
3
|
-
|
4
|
-
module LgPodPlugin
|
5
|
-
|
6
|
-
class PodSpec
|
7
|
-
attr_accessor :source_files
|
8
|
-
def self.form_file(path)
|
9
|
-
spec = Pod::Specification.from_file(path)
|
10
|
-
return PodSpec.new(spec)
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize(spec)
|
14
|
-
set = Set[]
|
15
|
-
attributes_hash = spec.send(:attributes_hash)
|
16
|
-
return nil unless attributes_hash.is_a?(Hash)
|
17
|
-
license = attributes_hash["license"]
|
18
|
-
if license.is_a?(Hash)
|
19
|
-
license_file = license["file"]
|
20
|
-
set.add(license_file) if license_file
|
21
|
-
else
|
22
|
-
set.add("LICENSE")
|
23
|
-
end
|
24
|
-
# 解析主模块依赖信息
|
25
|
-
set.merge(parse_subspec_with(attributes_hash))
|
26
|
-
subspecs = spec.subspecs
|
27
|
-
unless subspecs.is_a?(Array)
|
28
|
-
self.source_files = set
|
29
|
-
return
|
30
|
-
end
|
31
|
-
subspecs.each do |sub_spec|
|
32
|
-
next unless sub_attributes_hash = sub_spec.send(:attributes_hash)
|
33
|
-
next unless sub_attributes_hash.is_a?(Hash)
|
34
|
-
sub_set = self.parse_subspec_with(sub_attributes_hash)
|
35
|
-
next if sub_set.empty?
|
36
|
-
set.merge(sub_set)
|
37
|
-
end
|
38
|
-
self.source_files = set
|
39
|
-
end
|
40
|
-
|
41
|
-
# 公共解析解析subspec
|
42
|
-
def parse_subspec_with(hash)
|
43
|
-
set = Set[]
|
44
|
-
source_files = self.parse_source_files(hash["source_files"])
|
45
|
-
set.merge(source_files) unless source_files.empty?
|
46
|
-
resources = self.parse_resource_files(hash["resource"] ||= hash["resources"])
|
47
|
-
set.merge(resources) unless resources.empty?
|
48
|
-
resource_bundles = self.parse_resource_bundles(hash["resource_bundle"] ||= hash["resource_bundles"])
|
49
|
-
set.merge(resource_bundles) unless resource_bundles.empty?
|
50
|
-
project_header_files = self.parse_project_header_files(hash["project_header_files"])
|
51
|
-
set.merge(resource_bundles) unless project_header_files.empty?
|
52
|
-
private_header_files = self.parse_private_header_files(hash["private_header_files"])
|
53
|
-
set.merge(private_header_files) unless private_header_files.empty?
|
54
|
-
vendored_frameworks = self.parse_vendored_frameworks(hash["vendored_frameworks"])
|
55
|
-
set.merge(vendored_frameworks) unless vendored_frameworks.empty?
|
56
|
-
vendored_library = self.parse_vendored_library(hash["vendored_library"] ||= hash["vendored_libraries"])
|
57
|
-
set.merge(vendored_library) unless vendored_library.empty?
|
58
|
-
#parse_preserve_path
|
59
|
-
preserve_paths = self.parse_preserve_path(hash["preserve_path"] ||= hash["preserve_paths"])
|
60
|
-
set.merge(preserve_paths) unless preserve_paths.empty?
|
61
|
-
module_map = self.parse_module_map(hash["module_map"])
|
62
|
-
set.merge(module_map) unless module_map.empty?
|
63
|
-
return set
|
64
|
-
end
|
65
|
-
|
66
|
-
# 公共解析文件路径的方法
|
67
|
-
def parse_public_source_filse(source_files)
|
68
|
-
return [] unless source_files
|
69
|
-
array = []
|
70
|
-
if LUtils.is_string(source_files)
|
71
|
-
if source_files.include?("/")
|
72
|
-
array.append(source_files.split("/").first)
|
73
|
-
else
|
74
|
-
array.append(source_files)
|
75
|
-
end
|
76
|
-
elsif source_files.is_a?(Array)
|
77
|
-
source_files.each do |element|
|
78
|
-
next unless LUtils.is_string(element)
|
79
|
-
if element.include?("/")
|
80
|
-
array.append(element.split("/").first)
|
81
|
-
else
|
82
|
-
array.append(element)
|
83
|
-
end
|
84
|
-
end
|
85
|
-
elsif source_files.is_a?(Hash)
|
86
|
-
source_files.each do |key,val|
|
87
|
-
if LUtils.is_string(val)
|
88
|
-
if val.include?("/")
|
89
|
-
array.append(val.split("/").first)
|
90
|
-
else
|
91
|
-
array.append(val)
|
92
|
-
end
|
93
|
-
elsif val.is_a?(Array)
|
94
|
-
val.each do |element|
|
95
|
-
next unless LUtils.is_string(element)
|
96
|
-
if element.include?("/")
|
97
|
-
array.append(element.split("/").first)
|
98
|
-
else
|
99
|
-
array.append(element)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
return array
|
106
|
-
end
|
107
|
-
|
108
|
-
# 解析source_fils路径
|
109
|
-
def parse_source_files(source_files)
|
110
|
-
return self.parse_public_source_filse(source_files)
|
111
|
-
end
|
112
|
-
|
113
|
-
# 解析 resource所在路径
|
114
|
-
def parse_resource_files(source_files)
|
115
|
-
return self.parse_public_source_filse(source_files)
|
116
|
-
end
|
117
|
-
|
118
|
-
# 解析public_header_files字段的值
|
119
|
-
def parse_public_header_files(source_files)
|
120
|
-
return self.parse_public_source_filse(source_files)
|
121
|
-
end
|
122
|
-
# 解析 parse_resource_bundles
|
123
|
-
def parse_resource_bundles(source_files)
|
124
|
-
return self.parse_public_source_filse(source_files)
|
125
|
-
end
|
126
|
-
# 解析 project_header_files
|
127
|
-
def parse_project_header_files(source_files)
|
128
|
-
return self.parse_public_source_filse(source_files)
|
129
|
-
end
|
130
|
-
|
131
|
-
# 解析 private_header_files
|
132
|
-
def parse_private_header_files(source_files)
|
133
|
-
return self.parse_public_source_filse(source_files)
|
134
|
-
end
|
135
|
-
# 解析 vendored_frameworks
|
136
|
-
def parse_vendored_frameworks(source_files)
|
137
|
-
return self.parse_public_source_filse(source_files)
|
138
|
-
end
|
139
|
-
# 解析 parse_vendored_library
|
140
|
-
def parse_vendored_library(source_files)
|
141
|
-
return self.parse_public_source_filse(source_files)
|
142
|
-
end
|
143
|
-
|
144
|
-
# 解析 parse_preserve_path
|
145
|
-
def parse_preserve_path(source_files)
|
146
|
-
return self.parse_public_source_filse(source_files)
|
147
|
-
end
|
148
|
-
|
149
|
-
# 解析 module_map
|
150
|
-
def parse_module_map(source_files)
|
151
|
-
return self.parse_public_source_filse(source_files)
|
152
|
-
end
|
153
|
-
|
154
|
-
end
|
155
|
-
|
156
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'cocoapods'
|
2
|
-
require 'cocoapods-core'
|
3
|
-
require_relative 'l_util'
|
4
|
-
require_relative 'l_cache'
|
5
|
-
|
6
|
-
module LgPodPlugin
|
7
|
-
|
8
|
-
class ReleasePod
|
9
|
-
|
10
|
-
def self.resolve_dependencies(work_space, podfile, lockfile, installer, external_pods)
|
11
|
-
installer.resolve_dependencies
|
12
|
-
analysis_result = installer.send(:analysis_result)
|
13
|
-
return unless analysis_result
|
14
|
-
root_specs = analysis_result.specifications.map(&:root).uniq
|
15
|
-
root_specs = root_specs.reject! do |spec|
|
16
|
-
spec_name = spec.send(:attributes_hash)["name"]
|
17
|
-
external_pods[spec_name] || external_pods[spec_name.split("/").first]
|
18
|
-
end unless external_pods.empty?
|
19
|
-
return unless root_specs
|
20
|
-
root_specs.sort_by(&:name).each do |spec|
|
21
|
-
attributes_hash = spec.send(:attributes_hash)
|
22
|
-
next unless attributes_hash.is_a?(Hash)
|
23
|
-
pod_name = attributes_hash["name"]
|
24
|
-
checksum = spec.send(:checksum)
|
25
|
-
if lockfile && checksum
|
26
|
-
internal_data = lockfile.send(:internal_data)
|
27
|
-
lock_checksums = internal_data["SPEC CHECKSUMS"] ||= {}
|
28
|
-
lock_checksum = lock_checksums[pod_name]
|
29
|
-
next if lock_checksum == checksum
|
30
|
-
end
|
31
|
-
pod_version = attributes_hash["version"]
|
32
|
-
source = attributes_hash['source']
|
33
|
-
next unless source.is_a?(Hash)
|
34
|
-
git = source["git"]
|
35
|
-
tag = source["tag"]
|
36
|
-
next unless (git && tag) && (git.include?("https://github.com"))
|
37
|
-
requirements = { :git => git, :tag => tag, :release_pod => true, :spec => spec}
|
38
|
-
LRequest.shared.checkout_options = requirements
|
39
|
-
next unless LCache.new(work_space).find_pod_cache(pod_name, { :git => git, :tag => tag })
|
40
|
-
LgPodPlugin::Installer.new(podfile, pod_name, requirements)
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.dependencies(installer)
|
46
|
-
installer.download_dependencies
|
47
|
-
installer.send(:validate_targets)
|
48
|
-
installation_options = installer.send(:installation_options)
|
49
|
-
skip_pods_project_generation = installation_options.send(:skip_pods_project_generation)
|
50
|
-
if skip_pods_project_generation
|
51
|
-
installer.show_skip_pods_project_generation_message
|
52
|
-
else
|
53
|
-
installer.integrate
|
54
|
-
end
|
55
|
-
installer.send(:write_lockfiles)
|
56
|
-
installer.send(:perform_post_install_actions)
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.install_release_pod(work_space, podfile, repo_update, update, external_pods, local_pods)
|
60
|
-
#切换工作目录到当前工程下, 开始执行pod install
|
61
|
-
FileUtils.chdir(work_space)
|
62
|
-
# 安装 relase_pod
|
63
|
-
LgPodPlugin.log_green "Pre-downloading Release Pods"
|
64
|
-
Pod::Config.instance.verbose = true
|
65
|
-
pods_path = work_space.join('Pods')
|
66
|
-
lockfile_path = work_space.join("Podfile.lock")
|
67
|
-
lock_file = Pod::Lockfile.from_file(lockfile_path) if lockfile_path.exist?
|
68
|
-
sandobx = Pod::Sandbox.new(pods_path)
|
69
|
-
installer = Pod::Installer.new(sandobx, podfile, lock_file)
|
70
|
-
installer.repo_update = repo_update
|
71
|
-
if update
|
72
|
-
if external_pods.empty?
|
73
|
-
installer.update = true
|
74
|
-
else
|
75
|
-
pods = LRequest.shared.libs.merge!(local_pods)
|
76
|
-
installer.update = { :pods => pods.keys}
|
77
|
-
end
|
78
|
-
else
|
79
|
-
installer.update = false
|
80
|
-
end
|
81
|
-
installer.deployment = false
|
82
|
-
installer.clean_install = false
|
83
|
-
installer.prepare
|
84
|
-
resolve_dependencies(work_space, podfile, lock_file, installer, external_pods)
|
85
|
-
dependencies(installer)
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
@@ -1,221 +0,0 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'singleton'
|
3
|
-
require 'cocoapods-core'
|
4
|
-
require_relative 'l_config'
|
5
|
-
require_relative 'l_cache'
|
6
|
-
require_relative 'net-ping'
|
7
|
-
require_relative 'downloader'
|
8
|
-
require_relative 'gitlab_download'
|
9
|
-
module LgPodPlugin
|
10
|
-
|
11
|
-
class LRequest
|
12
|
-
include Singleton
|
13
|
-
# pod name
|
14
|
-
attr_accessor :name
|
15
|
-
# 当前token
|
16
|
-
attr_accessor :token
|
17
|
-
# 缓存
|
18
|
-
attr_accessor :cache
|
19
|
-
# 配置
|
20
|
-
attr_accessor :config
|
21
|
-
# 是否更新
|
22
|
-
attr_accessor :is_update
|
23
|
-
# 工作目录
|
24
|
-
attr_accessor :workspace
|
25
|
-
# 是否是还有 git 地址参数
|
26
|
-
attr_accessor :single_git
|
27
|
-
# git 工具类
|
28
|
-
attr_accessor :git_util
|
29
|
-
# 需要更新的 pod 集合
|
30
|
-
attr_accessor :libs
|
31
|
-
# 下载类
|
32
|
-
attr_accessor :downloader
|
33
|
-
# lock_info
|
34
|
-
attr_accessor :lock_info
|
35
|
-
# 实际下载请求参数
|
36
|
-
attr_accessor :request_params
|
37
|
-
# 传入的请求参数
|
38
|
-
attr_accessor :checkout_options
|
39
|
-
# 网络ip 信息
|
40
|
-
attr_accessor :net_ping
|
41
|
-
|
42
|
-
public
|
43
|
-
def get_lock_info
|
44
|
-
lock_file_path = self.workspace.join("Podfile.lock")
|
45
|
-
if lock_file_path.exist?
|
46
|
-
lock_file = Pod::Lockfile.from_file(lock_file_path)
|
47
|
-
internal_data = lock_file.send(:internal_data)
|
48
|
-
release_pods = Hash.new
|
49
|
-
pods = internal_data["PODS"] ||= {}
|
50
|
-
pods.each do |key, val|
|
51
|
-
if LUtils.is_string(key)
|
52
|
-
pod_name = key.split(" ").first if key.include?(" ")
|
53
|
-
tag = key[/(?<=\().*?(?=\))/]
|
54
|
-
release_pods[pod_name] = tag
|
55
|
-
elsif key.is_a?(Hash)
|
56
|
-
key_name = key.keys.first
|
57
|
-
next unless key_name
|
58
|
-
pod_name = key_name.split(" ").first if key_name.include?(" ")
|
59
|
-
tag = key_name[/(?<=\().*?(?=\))/]
|
60
|
-
release_pods[pod_name] = tag
|
61
|
-
else
|
62
|
-
next
|
63
|
-
end
|
64
|
-
end
|
65
|
-
external_source = internal_data["EXTERNAL SOURCES"] ||= {}
|
66
|
-
checkout_options = internal_data["CHECKOUT OPTIONS"] ||= {}
|
67
|
-
{ "external_source" => external_source, "checkout_options" => checkout_options, "release_pods" => release_pods }
|
68
|
-
else
|
69
|
-
{ "external_source" => {}, "checkout_options" => {}, "release_pods" => {} }
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# 获取缓存用的hash_map
|
74
|
-
public
|
75
|
-
def get_cache_key_params
|
76
|
-
hash_map = Hash.new
|
77
|
-
git = self.checkout_options[:git] ||= self.request_params[:git]
|
78
|
-
tag = self.checkout_options[:tag] ||= self.request_params[:tag]
|
79
|
-
branch = self.checkout_options[:branch] ||= self.request_params[:branch]
|
80
|
-
commit = self.checkout_options[:commit] ||= self.request_params[:commit]
|
81
|
-
return hash_map unless git
|
82
|
-
hash_map[:git] = git
|
83
|
-
if git && commit
|
84
|
-
hash_map[:commit] = commit
|
85
|
-
elsif git && tag
|
86
|
-
hash_map[:tag] = tag
|
87
|
-
elsif git && branch && commit
|
88
|
-
hash_map[:commit] = commit
|
89
|
-
end
|
90
|
-
hash_map
|
91
|
-
end
|
92
|
-
|
93
|
-
public
|
94
|
-
def get_lock_params
|
95
|
-
begin
|
96
|
-
_release_pods = self.lock_info["release_pods"] ||= {}
|
97
|
-
_external_source = self.lock_info["external_source"][self.name] ||= {}
|
98
|
-
_checkout_options = self.lock_info["checkout_options"][self.name] ||= {}
|
99
|
-
rescue
|
100
|
-
_release_pods = {}
|
101
|
-
_external_source = {}
|
102
|
-
_checkout_options = {}
|
103
|
-
end
|
104
|
-
|
105
|
-
git = self.checkout_options[:git]
|
106
|
-
tag = self.checkout_options[:tag]
|
107
|
-
commit = self.checkout_options[:commit]
|
108
|
-
branch = self.checkout_options[:branch]
|
109
|
-
|
110
|
-
lock_git = _external_source[:git] ||= _checkout_options[:git]
|
111
|
-
lock_tag = _external_source[:tag] ||= _release_pods[self.name]
|
112
|
-
lock_branch = _external_source[:branch] ||= ""
|
113
|
-
lock_commit = _checkout_options[:commit] ||= ""
|
114
|
-
|
115
|
-
hash_map = Hash.new
|
116
|
-
hash_map[:git] = git if git
|
117
|
-
if git && tag
|
118
|
-
hash_map[:tag] = tag
|
119
|
-
if tag != lock_tag
|
120
|
-
hash_map["is_delete"] = false
|
121
|
-
else
|
122
|
-
hash_map["is_delete"] = true
|
123
|
-
end
|
124
|
-
return hash_map
|
125
|
-
elsif git && branch
|
126
|
-
hash_map[:branch] = branch
|
127
|
-
if branch == lock_branch && !self.is_update
|
128
|
-
if lock_commit && !lock_commit.empty?
|
129
|
-
hash_map[:commit] = lock_commit
|
130
|
-
end
|
131
|
-
hash_map["is_delete"] = true
|
132
|
-
return hash_map
|
133
|
-
else
|
134
|
-
_, new_commit = LGitUtil.git_ls_remote_refs(self.name ,git, branch, nil, nil)
|
135
|
-
if new_commit && !new_commit.empty?
|
136
|
-
hash_map[:commit] = new_commit
|
137
|
-
elsif lock_commit && !lock_commit.empty?
|
138
|
-
hash_map[:commit] = lock_commit
|
139
|
-
end
|
140
|
-
if !new_commit || !lock_commit || new_commit.empty? || lock_commit.empty?
|
141
|
-
hash_map["is_delete"] = false
|
142
|
-
elsif (new_commit != lock_commit)
|
143
|
-
hash_map["is_delete"] = false
|
144
|
-
else
|
145
|
-
hash_map["is_delete"] = true
|
146
|
-
end
|
147
|
-
end
|
148
|
-
elsif git && commit
|
149
|
-
if commit != lock_commit
|
150
|
-
hash_map["is_delete"] = false
|
151
|
-
else
|
152
|
-
hash_map["is_delete"] = true
|
153
|
-
end
|
154
|
-
hash_map[:commit] = commit
|
155
|
-
return hash_map
|
156
|
-
else
|
157
|
-
if lock_git && !self.is_update
|
158
|
-
id = LPodLatestRefs.get_pod_id(self.name, git)
|
159
|
-
pod_info = LSqliteDb.shared.query_pod_refs(id)
|
160
|
-
if pod_info && pod_info.commit
|
161
|
-
new_commit = pod_info.commit if pod_info
|
162
|
-
new_branch = pod_info.branch if pod_info
|
163
|
-
hash_map[:commit] = new_commit if new_commit
|
164
|
-
hash_map[:branch] = new_branch if new_branch
|
165
|
-
hash_map["is_delete"] = true
|
166
|
-
return hash_map
|
167
|
-
end
|
168
|
-
end
|
169
|
-
new_branch, new_commit = LGitUtil.git_ls_remote_refs(self.name, git, nil, nil, nil)
|
170
|
-
hash_map[:branch] = new_branch if new_branch
|
171
|
-
if new_commit && !new_commit.empty?
|
172
|
-
hash_map[:commit] = new_commit
|
173
|
-
end
|
174
|
-
if !new_commit || new_commit.empty?
|
175
|
-
hash_map["is_delete"] = true
|
176
|
-
else
|
177
|
-
hash_map["is_delete"] = false
|
178
|
-
end
|
179
|
-
end
|
180
|
-
hash_map
|
181
|
-
end
|
182
|
-
|
183
|
-
public
|
184
|
-
#获取下载参数
|
185
|
-
def get_request_params
|
186
|
-
if self.lock_info == nil
|
187
|
-
self.lock_info = self.get_lock_info
|
188
|
-
end
|
189
|
-
Hash.new.merge!(self.get_lock_params)
|
190
|
-
end
|
191
|
-
|
192
|
-
public
|
193
|
-
def setup_pod_info(name, workspace, options = {})
|
194
|
-
self.name = name
|
195
|
-
tag = options[:tag]
|
196
|
-
git = options[:git]
|
197
|
-
commit = options[:commit]
|
198
|
-
branch = options[:branch]
|
199
|
-
self.workspace = workspace
|
200
|
-
if (git && branch) || (git && commit) || (git && tag)
|
201
|
-
self.single_git = false
|
202
|
-
else
|
203
|
-
self.single_git = true
|
204
|
-
end
|
205
|
-
self.net_ping = Ping.new(git)
|
206
|
-
self.net_ping.network_ok = self.net_ping.ping
|
207
|
-
self.checkout_options = Hash.new.deep_merge(options)
|
208
|
-
self.request_params = self.get_request_params
|
209
|
-
self.config = LConfig.getConfig(git)
|
210
|
-
self.cache = LCache.new(self.workspace)
|
211
|
-
self.git_util = LGitUtil.new(name, self.checkout_options)
|
212
|
-
self.downloader = LDownloader.new(name, self.checkout_options)
|
213
|
-
end
|
214
|
-
|
215
|
-
def self.shared
|
216
|
-
return LRequest.instance
|
217
|
-
end
|
218
|
-
|
219
|
-
end
|
220
|
-
|
221
|
-
end
|