lg_pod_plugin 1.1.7.4 → 1.1.8.1
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/lg_pod_plugin/db/database.rb +1 -1
- data/lib/lg_pod_plugin/downloader/downloader.rb +9 -48
- data/lib/lg_pod_plugin/downloader/l_cache.rb +58 -66
- data/lib/lg_pod_plugin/downloader/overload_cache.rb +14 -284
- data/lib/lg_pod_plugin/downloader/request.rb +2 -4
- data/lib/lg_pod_plugin/git/github_api.rb +2 -49
- data/lib/lg_pod_plugin/git/github_archive.rb +11 -32
- data/lib/lg_pod_plugin/git/gitlab_api.rb +42 -42
- data/lib/lg_pod_plugin/git/gitlab_archive.rb +7 -80
- data/lib/lg_pod_plugin/git/http_download.rb +3 -8
- data/lib/lg_pod_plugin/installer/PodDownload +0 -0
- data/lib/lg_pod_plugin/installer/install.rb +15 -12
- data/lib/lg_pod_plugin/installer/main.rb +5 -0
- data/lib/lg_pod_plugin/net/l_uri.rb +1 -34
- data/lib/lg_pod_plugin/pod/external_pod.rb +0 -1
- data/lib/lg_pod_plugin/pod/release-pod.rb +4 -4
- data/lib/lg_pod_plugin/utils/file_path.rb +5 -0
- data/lib/lg_pod_plugin/utils/l_util.rb +0 -24
- data/lib/lg_pod_plugin/version.rb +1 -1
- data/lib/lg_pod_plugin.rb +1 -1
- metadata +9 -26
- data/lib/lg_pod_plugin/config/lockfile_model.rb +0 -58
- data/lib/lg_pod_plugin/config/podspec.rb +0 -266
- data/lib/lg_pod_plugin/utils/aes-crypt.rb +0 -82
@@ -5,7 +5,7 @@ module LgPodPlugin
|
|
5
5
|
|
6
6
|
class GithubAPI
|
7
7
|
|
8
|
-
|
8
|
+
# 获取 gitlab最新 commit_id
|
9
9
|
def self.request_github_refs_heads(git, branch)
|
10
10
|
base_url = LUtils.get_gitlab_base_url git
|
11
11
|
if base_url.include?("https://github.com/")
|
@@ -55,6 +55,7 @@ module LgPodPlugin
|
|
55
55
|
end
|
56
56
|
|
57
57
|
public
|
58
|
+
|
58
59
|
def self.get_gitlab_repository_tree(git, sha)
|
59
60
|
base_url = LUtils.get_gitlab_base_url git
|
60
61
|
if base_url.include?("https://github.com/")
|
@@ -85,54 +86,6 @@ module LgPodPlugin
|
|
85
86
|
end
|
86
87
|
end
|
87
88
|
|
88
|
-
public
|
89
|
-
|
90
|
-
def self.get_podspec_file_content(git, sha, filename)
|
91
|
-
base_url = LUtils.get_gitlab_base_url git
|
92
|
-
if base_url.include?("https://github.com/")
|
93
|
-
repo_name = base_url.split("https://github.com/", 0).last
|
94
|
-
elsif base_url.include?("git@github.com:")
|
95
|
-
repo_name = base_url.split("git@github.com:", 0).last
|
96
|
-
else
|
97
|
-
repo_name = nil
|
98
|
-
end
|
99
|
-
return nil unless repo_name
|
100
|
-
trees = self.get_gitlab_repository_tree git, sha
|
101
|
-
return nil if trees.empty?
|
102
|
-
request_url = nil
|
103
|
-
trees.each do |dict|
|
104
|
-
type = dict["type"]
|
105
|
-
next if type == "tree"
|
106
|
-
path = dict["path"]
|
107
|
-
next unless path.include?(".podspec")
|
108
|
-
if path == filename
|
109
|
-
request_url = dict["url"]
|
110
|
-
break
|
111
|
-
end
|
112
|
-
end
|
113
|
-
begin
|
114
|
-
uri = URI(request_url)
|
115
|
-
res = Net::HTTP.get_response(uri)
|
116
|
-
if res.body
|
117
|
-
json = JSON.parse(res.body)
|
118
|
-
else
|
119
|
-
json = nil
|
120
|
-
end
|
121
|
-
return nil unless json && json.is_a?(Hash)
|
122
|
-
content = json["content"]
|
123
|
-
return nil unless content && LUtils.is_a_string?(content)
|
124
|
-
encoding = json["encoding"] ||= "base64"
|
125
|
-
if encoding == "base64"
|
126
|
-
content = LUtils.base64_decode(content)
|
127
|
-
return content
|
128
|
-
else
|
129
|
-
return nil
|
130
|
-
end
|
131
|
-
rescue
|
132
|
-
return nil
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
89
|
end
|
137
90
|
|
138
91
|
end
|
@@ -1,15 +1,17 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require_relative 'git_download'
|
3
3
|
require_relative '../utils/l_util'
|
4
|
-
require_relative '../config/podspec'
|
5
4
|
|
6
5
|
module LgPodPlugin
|
7
6
|
|
8
7
|
class GitHubArchive
|
9
8
|
private
|
9
|
+
|
10
10
|
attr_reader :checkout_options
|
11
|
+
|
11
12
|
public
|
12
|
-
|
13
|
+
|
14
|
+
REQUIRED_ATTRS ||= %i[git tag name commit branch config path].freeze
|
13
15
|
attr_accessor(*REQUIRED_ATTRS)
|
14
16
|
|
15
17
|
def initialize(checkout_options = {})
|
@@ -17,7 +19,6 @@ module LgPodPlugin
|
|
17
19
|
self.tag = checkout_options[:tag]
|
18
20
|
self.name = checkout_options[:name]
|
19
21
|
self.path = checkout_options[:path]
|
20
|
-
self.spec = checkout_options[:spec]
|
21
22
|
self.config = checkout_options[:config]
|
22
23
|
self.commit = checkout_options[:commit]
|
23
24
|
self.branch = checkout_options[:branch]
|
@@ -41,15 +42,7 @@ module LgPodPlugin
|
|
41
42
|
download_params["name"] = self.name
|
42
43
|
download_params["type"] = "github-tag"
|
43
44
|
download_params["path"] = root_path.to_path
|
44
|
-
download_params
|
45
|
-
if self.spec
|
46
|
-
download_params["podspec"] = self.spec
|
47
|
-
download_params["source_files"] = self.spec.source_files.keys
|
48
|
-
download_params["podspec_content"] = nil
|
49
|
-
else
|
50
|
-
download_params["podspec"] = nil
|
51
|
-
download_params["source_files"] = ["All"]
|
52
|
-
end
|
45
|
+
download_params = download_params.merge(download_urls)
|
53
46
|
download_params
|
54
47
|
end
|
55
48
|
|
@@ -60,14 +53,7 @@ module LgPodPlugin
|
|
60
53
|
download_params["name"] = self.name
|
61
54
|
download_params["type"] = "github-branch"
|
62
55
|
download_params["path"] = root_path.to_path
|
63
|
-
download_params
|
64
|
-
if self.spec
|
65
|
-
download_params["podspec"] = self.spec
|
66
|
-
download_params["source_files"] = self.spec.source_files.keys
|
67
|
-
else
|
68
|
-
download_params["podspec"] = nil
|
69
|
-
download_params["source_files"] = ["All"]
|
70
|
-
end
|
56
|
+
download_params = download_params.merge(download_urls)
|
71
57
|
download_params
|
72
58
|
end
|
73
59
|
|
@@ -78,14 +64,7 @@ module LgPodPlugin
|
|
78
64
|
download_params["name"] = self.name
|
79
65
|
download_params["type"] = "github-commit"
|
80
66
|
download_params["path"] = root_path.to_path
|
81
|
-
download_params
|
82
|
-
if self.spec
|
83
|
-
download_params["podspec"] = self.spec
|
84
|
-
download_params["source_files"] = self.spec.source_files.keys
|
85
|
-
else
|
86
|
-
download_params["podspec"] = nil
|
87
|
-
download_params["source_files"] = ["All"]
|
88
|
-
end
|
67
|
+
download_params = download_params.merge(download_urls)
|
89
68
|
download_params
|
90
69
|
end
|
91
70
|
|
@@ -102,18 +81,18 @@ module LgPodPlugin
|
|
102
81
|
return nil unless repo_name
|
103
82
|
if self.git && self.tag
|
104
83
|
download_url = "https://codeload.github.com/#{repo_name}/tar.gz/refs/tags/#{self.tag}"
|
105
|
-
|
84
|
+
{ "filename" => "#{project_name}.tar.gz", "url" => download_url }
|
106
85
|
elsif self.git && self.branch
|
107
86
|
if self.branch == "HEAD"
|
108
87
|
download_url = "https://gh.api.99988866.xyz/" + "#{base_url}" + "/archive/#{self.branch}.tar.gz"
|
109
|
-
|
88
|
+
{ "filename" => "#{project_name}.tar.gz", "url" => download_url }
|
110
89
|
else
|
111
90
|
download_url = "https://codeload.github.com/#{repo_name}/tar.gz/refs/heads/#{self.branch}"
|
112
|
-
|
91
|
+
{ "filename" => "#{project_name}.tar.gz", "url" => download_url }
|
113
92
|
end
|
114
93
|
elsif self.git && self.commit
|
115
94
|
download_url = "https://codeload.github.com/#{repo_name}/tar.gz/#{self.commit}"
|
116
|
-
return
|
95
|
+
return { "filename" => "#{project_name}.tar.gz", "url" => download_url }
|
117
96
|
else
|
118
97
|
nil
|
119
98
|
end
|
@@ -68,11 +68,11 @@ module LgPodPlugin
|
|
68
68
|
else
|
69
69
|
# 判断 token 是否失效
|
70
70
|
if user_info.expires_in <= time_now
|
71
|
-
return
|
71
|
+
return refresh_user_token uri, refresh_token, user_info.id, user_info.username, user_info.password
|
72
72
|
else
|
73
73
|
update_time = user_info.update_time.to_i
|
74
74
|
if time_now - update_time > 1800
|
75
|
-
user_info =
|
75
|
+
user_info = refresh_user_token uri, refresh_token, user_info.id, user_info.username, user_info.password
|
76
76
|
return user_info
|
77
77
|
else
|
78
78
|
return user_info
|
@@ -264,46 +264,46 @@ module LgPodPlugin
|
|
264
264
|
end
|
265
265
|
end
|
266
266
|
|
267
|
-
public
|
268
|
-
def self.get_podspec_file_content(host, token, project_id, sha, filepath)
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
end
|
267
|
+
# public
|
268
|
+
# def self.get_podspec_file_content(host, token, project_id, sha, filepath)
|
269
|
+
# begin
|
270
|
+
# hash_map = Hash.new
|
271
|
+
# hash_map["ref"] = sha
|
272
|
+
# hash_map["access_token"] = token
|
273
|
+
# uri = URI("#{host}/api/v4/projects/#{project_id}/repository/files/#{filepath}")
|
274
|
+
# uri.query = URI.encode_www_form(hash_map)
|
275
|
+
# res = Net::HTTP.get_response(uri)
|
276
|
+
# case res
|
277
|
+
# when Net::HTTPSuccess, Net::HTTPRedirection
|
278
|
+
# json = JSON.parse(res.body)
|
279
|
+
# else
|
280
|
+
# body = JSON.parse(res.body)
|
281
|
+
# message = body["message"]
|
282
|
+
# if message == "404 Project Not Found"
|
283
|
+
# LSqliteDb.shared.delete_project_by_id(project_id)
|
284
|
+
# end
|
285
|
+
# json = nil
|
286
|
+
# end
|
287
|
+
# return nil unless json && json.is_a?(Hash)
|
288
|
+
# content = json["content"]
|
289
|
+
# return nil unless content && LUtils.is_a_string?(content)
|
290
|
+
# encoding = json["encoding"] ||= "base64"
|
291
|
+
# if encoding == "base64"
|
292
|
+
# require 'base64'
|
293
|
+
# content = Base64.decode64(content)
|
294
|
+
# if content.respond_to?(:encoding) && content.encoding.name != 'UTF-8'
|
295
|
+
# text = content.force_encoding("gb2312").force_encoding("utf-8")
|
296
|
+
# return text
|
297
|
+
# else
|
298
|
+
# return content
|
299
|
+
# end
|
300
|
+
# else
|
301
|
+
# return nil
|
302
|
+
# end
|
303
|
+
# rescue
|
304
|
+
# return nil
|
305
|
+
# end
|
306
|
+
# end
|
307
307
|
|
308
308
|
# 通过名称搜索项目信息
|
309
309
|
public
|
@@ -12,7 +12,7 @@ module LgPodPlugin
|
|
12
12
|
attr_reader :checkout_options
|
13
13
|
|
14
14
|
public
|
15
|
-
REQUIRED_ATTRS ||= %i[git tag name commit branch config path
|
15
|
+
REQUIRED_ATTRS ||= %i[git tag name commit branch config path].freeze
|
16
16
|
attr_accessor(*REQUIRED_ATTRS)
|
17
17
|
|
18
18
|
def initialize(checkout_options = {})
|
@@ -20,7 +20,6 @@ module LgPodPlugin
|
|
20
20
|
self.tag = checkout_options[:tag]
|
21
21
|
self.name = checkout_options[:name]
|
22
22
|
self.path = checkout_options[:path]
|
23
|
-
self.spec = checkout_options[:spec]
|
24
23
|
self.config = checkout_options[:config]
|
25
24
|
self.commit = checkout_options[:commit]
|
26
25
|
self.branch = checkout_options[:branch]
|
@@ -57,51 +56,9 @@ module LgPodPlugin
|
|
57
56
|
else
|
58
57
|
return nil
|
59
58
|
end
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
podspec_content = GitLabAPI.get_podspec_file_content(host, token, project.id, sha, podspec_filename)
|
64
|
-
unless podspec_content && LUtils.is_a_string?(podspec_content)
|
65
|
-
download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
|
66
|
-
download_url += "\\&access_token\\=#{token}" if token
|
67
|
-
return [{ "filename" => "#{self.name}.tar.bz2", "url" => download_url }]
|
68
|
-
end
|
69
|
-
pod_spec_file_path = sandbox_path.join("#{podspec_filename}")
|
70
|
-
lg_spec = LgPodPlugin::PodSpec.form_string(podspec_content, pod_spec_file_path)
|
71
|
-
if podspec_content
|
72
|
-
begin
|
73
|
-
File.open(pod_spec_file_path, "w+") do |f|
|
74
|
-
f.write podspec_content
|
75
|
-
end
|
76
|
-
rescue => exception
|
77
|
-
LgPodPlugin.log_red "#{exception}"
|
78
|
-
end
|
79
|
-
@podspec_content = podspec_content
|
80
|
-
end
|
81
|
-
unless lg_spec
|
82
|
-
download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
|
83
|
-
download_url += "\\&access_token\\=#{token}" if token
|
84
|
-
return [{ "filename" => "#{self.name}.tar.bz2", "url" => download_url }]
|
85
|
-
end
|
86
|
-
self.spec = lg_spec
|
87
|
-
end
|
88
|
-
download_params = Array.new
|
89
|
-
@source_files = lg_spec.source_files.keys
|
90
|
-
lg_spec.source_files.each_key do |key|
|
91
|
-
next if key == "All" || key == "LICENSE" || key == "License"
|
92
|
-
path = LUtils.url_encode(key)
|
93
|
-
# download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2#{"\\?"}" + "sha#{"\\="}#{sha}"
|
94
|
-
download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2#{"\\?"}" + "path#{"\\="}#{path}#{"\\&"}sha#{"\\="}#{sha}"
|
95
|
-
download_url += "\\&access_token\\=#{token}" if token
|
96
|
-
download_params.append({ "filename" => "#{path}.tar.bz2", "url" => download_url })
|
97
|
-
end
|
98
|
-
if download_params.empty?
|
99
|
-
download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
|
100
|
-
download_url += "\\&access_token\\=#{token}" if token
|
101
|
-
[{ "filename" => "#{self.name}.tar.bz2", "url" => download_url }]
|
102
|
-
else
|
103
|
-
download_params
|
104
|
-
end
|
59
|
+
download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
|
60
|
+
download_url += "\\&access_token\\=#{token}" if token
|
61
|
+
download_params = { "filename" => "#{self.name}.tar.bz2", "url" => download_url }
|
105
62
|
end
|
106
63
|
|
107
64
|
# 根据branch 下载 zip 包
|
@@ -113,18 +70,8 @@ module LgPodPlugin
|
|
113
70
|
download_params["token"] = token
|
114
71
|
download_params["name"] = self.name
|
115
72
|
download_params["type"] = "gitlab-branch"
|
116
|
-
if self.spec
|
117
|
-
download_params["podspec"] = self.spec
|
118
|
-
else
|
119
|
-
download_params["podspec_content"] = @podspec_content
|
120
|
-
end
|
121
73
|
download_params["path"] = root_path.to_path
|
122
|
-
|
123
|
-
download_params["source_files"] = @source_files
|
124
|
-
else
|
125
|
-
download_params["source_files"] = "All"
|
126
|
-
end
|
127
|
-
download_params["download_urls"] = download_urls
|
74
|
+
download_params = download_params.merge(download_urls)
|
128
75
|
download_params
|
129
76
|
end
|
130
77
|
|
@@ -137,18 +84,8 @@ module LgPodPlugin
|
|
137
84
|
download_params["token"] = token
|
138
85
|
download_params["name"] = self.name
|
139
86
|
download_params["type"] = "gitlab-tag"
|
140
|
-
if self.spec
|
141
|
-
download_params["podspec"] = self.spec
|
142
|
-
else
|
143
|
-
download_params["podspec_content"] = @podspec_content
|
144
|
-
end
|
145
87
|
download_params["path"] = root_path.to_path
|
146
|
-
|
147
|
-
download_params["source_files"] = @source_files
|
148
|
-
else
|
149
|
-
download_params["source_files"] = "All"
|
150
|
-
end
|
151
|
-
download_params["download_urls"] = download_urls
|
88
|
+
download_params = download_params.merge(download_urls)
|
152
89
|
download_params
|
153
90
|
end
|
154
91
|
|
@@ -160,19 +97,9 @@ module LgPodPlugin
|
|
160
97
|
download_params = Hash.new
|
161
98
|
download_params["token"] = token
|
162
99
|
download_params["name"] = self.name
|
163
|
-
if self.spec
|
164
|
-
download_params["podspec"] = self.spec
|
165
|
-
else
|
166
|
-
download_params["podspec_content"] = @podspec_content
|
167
|
-
end
|
168
100
|
download_params["type"] = "gitlab-commit"
|
169
101
|
download_params["path"] = root_path.to_path
|
170
|
-
|
171
|
-
download_params["source_files"] = @source_files
|
172
|
-
else
|
173
|
-
download_params["source_files"] = "All"
|
174
|
-
end
|
175
|
-
download_params["download_urls"] = download_urls
|
102
|
+
download_params = download_params.merge(download_urls)
|
176
103
|
download_params
|
177
104
|
end
|
178
105
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require_relative 'git_download'
|
3
3
|
require_relative '../utils/l_util'
|
4
|
-
require_relative '../config/podspec'
|
5
4
|
|
6
5
|
module LgPodPlugin
|
7
6
|
|
@@ -10,13 +9,12 @@ module LgPodPlugin
|
|
10
9
|
private
|
11
10
|
attr_reader :checkout_options
|
12
11
|
public
|
13
|
-
REQUIRED_ATTRS ||= %i[http name path
|
12
|
+
REQUIRED_ATTRS ||= %i[http name path].freeze
|
14
13
|
attr_accessor(*REQUIRED_ATTRS)
|
15
14
|
def initialize(checkout_options = {})
|
16
15
|
self.name = checkout_options[:name]
|
17
16
|
self.path = checkout_options[:path]
|
18
17
|
self.http = checkout_options[:http]
|
19
|
-
self.lg_spec = checkout_options[:spec]
|
20
18
|
@checkout_options = checkout_options
|
21
19
|
end
|
22
20
|
|
@@ -26,11 +24,8 @@ module LgPodPlugin
|
|
26
24
|
download_params["path"] = self.path.to_path
|
27
25
|
download_params["name"] = self.name
|
28
26
|
download_params["type"] = "http"
|
29
|
-
download_params["
|
30
|
-
|
31
|
-
download_params["podspec"] = self.lg_spec
|
32
|
-
download_params["source_files"] = self.lg_spec.source_files.keys
|
33
|
-
end
|
27
|
+
download_params["filename"] = (new_filename ? new_filename : filename)
|
28
|
+
download_params["url"] = http
|
34
29
|
download_params
|
35
30
|
end
|
36
31
|
|
Binary file
|
@@ -29,34 +29,37 @@ module LgPodPlugin
|
|
29
29
|
|
30
30
|
public
|
31
31
|
def copy_file_to_caches
|
32
|
-
request =
|
33
|
-
name = request.
|
32
|
+
request = downloader.request
|
33
|
+
name = request.name
|
34
34
|
params = Hash.new.merge!(request.params)
|
35
35
|
checkout_options = Hash.new.merge!(request.checkout_options)
|
36
36
|
commit = checkout_options[:commit] ||= params[:commit]
|
37
|
-
if request.
|
38
|
-
cache_podspec = request.
|
37
|
+
if request.podspec
|
38
|
+
cache_podspec = request.podspec
|
39
39
|
else
|
40
40
|
cache_podspec = LProject.shared.cache_specs[name]
|
41
|
-
request.
|
41
|
+
request.podspec = cache_podspec if cache_podspec
|
42
42
|
end
|
43
43
|
destination = self.download_params["destination"]
|
44
44
|
cache_pod_spec_path = self.download_params["cache_pod_spec_path"]
|
45
|
-
|
46
|
-
|
47
|
-
local_spec_path = destination.glob("#{name}.podspec{,.json}").last
|
45
|
+
if cache_podspec.nil?
|
46
|
+
local_spec_path = Pathname(destination).glob("#{name}.podspec{,.json}").last
|
48
47
|
if local_spec_path && File.exist?(local_spec_path)
|
49
48
|
cache_podspec = Pod::Specification.from_file local_spec_path
|
50
49
|
if cache_podspec
|
51
50
|
LProject.shared.cache_specs[name] = cache_podspec
|
51
|
+
LCache.copy_and_clean nil, destination, cache_podspec
|
52
52
|
LCache.write_spec cache_podspec, cache_pod_spec_path
|
53
|
-
LCache.clean_pod_unused_files destination, cache_podspec
|
54
53
|
end
|
55
54
|
end
|
56
|
-
request.
|
55
|
+
request.podspec = cache_podspec if cache_podspec
|
56
|
+
else
|
57
|
+
LProject.shared.cache_specs[name] = cache_podspec
|
58
|
+
LCache.copy_and_clean nil, destination, cache_podspec
|
59
|
+
LCache.write_spec cache_podspec, cache_pod_spec_path
|
57
60
|
end
|
58
61
|
# 判断缓存是否下载成功
|
59
|
-
if
|
62
|
+
if destination && destination.exist? && !destination.children.empty?
|
60
63
|
pod_is_exist = true
|
61
64
|
else
|
62
65
|
pod_is_exist = false
|
@@ -65,7 +68,7 @@ module LgPodPlugin
|
|
65
68
|
|
66
69
|
git = checkout_options[:git]
|
67
70
|
return unless git
|
68
|
-
cache_podspec = request.
|
71
|
+
cache_podspec = request.podspec
|
69
72
|
branch = checkout_options[:branch] ||= request.params[:branch]
|
70
73
|
checkout_options[:name] = name if name
|
71
74
|
checkout_options[:branch] = branch if branch
|
@@ -16,9 +16,14 @@ module LgPodPlugin
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.ensure_matching_version
|
20
|
+
cache = Pod::Downloader::Cache.new(LFileManager.cache_root_path)
|
21
|
+
end
|
22
|
+
|
19
23
|
public
|
20
24
|
def self.run(command, options = {})
|
21
25
|
clean_sandbox()
|
26
|
+
ensure_matching_version()
|
22
27
|
workspace = Pathname(Dir.pwd)
|
23
28
|
update = (command == "update")
|
24
29
|
LSqliteDb.shared.init_database
|
@@ -35,46 +35,13 @@ module LgPodPlugin
|
|
35
35
|
@hostname = @scheme + "://" + @host
|
36
36
|
end
|
37
37
|
|
38
|
-
# def get_redirect_url(host)
|
39
|
-
# redirect_url = Net::HTTP.get_response(URI(host))['location']
|
40
|
-
# return host unless redirect_url
|
41
|
-
# uri = URI(redirect_url)
|
42
|
-
# return uri.scheme + "://" + uri.host
|
43
|
-
# end
|
44
|
-
|
45
38
|
private
|
46
39
|
#判断是否是 IP 地址
|
47
40
|
def is_address(host)
|
48
41
|
match = %r{^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$}.match(host)
|
49
42
|
!(match.nil?)
|
50
43
|
end
|
51
|
-
|
52
|
-
# 获取 ip 地址
|
53
|
-
# private
|
54
|
-
# def getaddress(uri)
|
55
|
-
# begin
|
56
|
-
# if self.is_address(uri.host)
|
57
|
-
# ip = uri.host
|
58
|
-
# return ip
|
59
|
-
# else
|
60
|
-
# ip_address = Resolv.getaddress uri.host
|
61
|
-
# return ip_address
|
62
|
-
# end
|
63
|
-
# rescue
|
64
|
-
# result = %x(ping #{uri.host} -t 1)
|
65
|
-
# return if !result || result == "" || result.include?("timeout")
|
66
|
-
# match = %r{\d+.\d+.\d+.\d+}.match(result)
|
67
|
-
# return if match.nil?
|
68
|
-
# ip_address = match ? match[0] : ""
|
69
|
-
# begin
|
70
|
-
# return ip_address if IPAddr.new(ip_address)
|
71
|
-
# rescue => exception
|
72
|
-
# LgPodPlugin.log_red exception
|
73
|
-
# return nil
|
74
|
-
# end
|
75
|
-
# end
|
76
|
-
# end
|
77
|
-
|
44
|
+
|
78
45
|
public def to_s
|
79
46
|
return "" unless @uri
|
80
47
|
@uri.to_s
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'cocoapods'
|
2
2
|
require 'cocoapods-core'
|
3
3
|
require 'cocoapods/user_interface'
|
4
|
-
require_relative '../config/podspec'
|
4
|
+
# require_relative '../config/podspec'
|
5
5
|
require_relative '../installer/concurrency'
|
6
6
|
|
7
7
|
module LgPodPlugin
|
@@ -46,7 +46,8 @@ module LgPodPlugin
|
|
46
46
|
http = "https://ghproxy.com/" + http
|
47
47
|
source["http"] = http
|
48
48
|
end
|
49
|
-
|
49
|
+
version = attributes_hash["version"] ||= ""
|
50
|
+
requirements = {:http => http, :version => version}
|
50
51
|
elsif git && tag
|
51
52
|
tag = tag.to_s unless LUtils.is_a_string? tag
|
52
53
|
requirements = { :git => git, :tag => tag }
|
@@ -55,8 +56,7 @@ module LgPodPlugin
|
|
55
56
|
end
|
56
57
|
next if check_release_pod_exist(pod_name, requirements, spec, true)
|
57
58
|
LProject.shared.cache_specs[pod_name] = spec
|
58
|
-
|
59
|
-
release_pod = ReleasePod.new(nil, pod_name, requirements, lg_spec)
|
59
|
+
release_pod = ReleasePod.new(nil, pod_name, requirements, spec)
|
60
60
|
pod_install = LgPodPlugin::LPodInstaller.new
|
61
61
|
download_params = pod_install.install(release_pod)
|
62
62
|
all_installers.append pod_install if download_params
|
@@ -1,36 +1,12 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'resolv'
|
3
|
-
require "ipaddr"
|
4
|
-
require 'base64'
|
5
|
-
require 'fileutils'
|
6
|
-
require_relative 'aes-crypt'
|
7
|
-
|
8
1
|
module LgPodPlugin
|
9
2
|
|
10
3
|
class LUtils
|
11
4
|
|
12
|
-
def self.encrypt(message, password)
|
13
|
-
encrypted_data = AESCrypt.encrypt(message, password)
|
14
|
-
encrypted_data.tr("\n", "")
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.decrypt(message, password)
|
18
|
-
AESCrypt.decrypt message, password
|
19
|
-
end
|
20
|
-
|
21
5
|
def self.md5(text)
|
22
6
|
return "" unless text
|
23
7
|
return Digest::MD5.hexdigest(text)
|
24
8
|
end
|
25
9
|
|
26
|
-
def self.base64_encode(text)
|
27
|
-
Base64.encode64(text)
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.base64_decode(text)
|
31
|
-
Base64.decode64(text)
|
32
|
-
end
|
33
|
-
|
34
10
|
#判断对象是不是 String
|
35
11
|
def self.is_a_string?(obj)
|
36
12
|
if "#{obj.class}" == "String"
|
data/lib/lg_pod_plugin.rb
CHANGED
@@ -22,7 +22,7 @@ require_relative 'lg_pod_plugin/utils/l_util'
|
|
22
22
|
require_relative 'lg_pod_plugin/git/gitlab_api'
|
23
23
|
require_relative 'lg_pod_plugin/net/net-ping'
|
24
24
|
require_relative 'lg_pod_plugin/git/gitlab_archive'
|
25
|
-
require_relative 'lg_pod_plugin/config/lockfile_model'
|
25
|
+
# require_relative 'lg_pod_plugin/config/lockfile_model'
|
26
26
|
require_relative 'lg_pod_plugin/downloader/downloader'
|
27
27
|
require_relative 'lg_pod_plugin/git/git_download'
|
28
28
|
require_relative 'lg_pod_plugin/git/git_clone'
|