lg_pod_plugin 1.1.6.2 → 1.1.6.4
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/downloader/downloader.rb +1 -3
- data/lib/lg_pod_plugin/downloader/l_cache.rb +0 -29
- data/lib/lg_pod_plugin/downloader/request.rb +2 -86
- data/lib/lg_pod_plugin/git/github_api.rb +1 -0
- data/lib/lg_pod_plugin/git/gitlab_api.rb +2 -2
- data/lib/lg_pod_plugin/installer/install.rb +28 -28
- data/lib/lg_pod_plugin/installer/main.rb +3 -1
- data/lib/lg_pod_plugin/installer/project.rb +1 -1
- data/lib/lg_pod_plugin/net/l_uri.rb +14 -13
- data/lib/lg_pod_plugin/pod/release-pod.rb +4 -4
- data/lib/lg_pod_plugin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa46fff13f24c1345099a41de0fd69d57f52ea6d701944c964dc602fc71f82be
|
|
4
|
+
data.tar.gz: 1918987895e07fed61e3a07e521f571210472f0baade5aad98e91a0a19145dd7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81ff396511000ce3a021c365d2dd1d5959373e5d3005af4c768a09bd22fd203ba0e858ab9d79d4e128428b0cc358f1dbe23f6c32490316551d70dc1783d83cac
|
|
7
|
+
data.tar.gz: e8354d1b63266ec23978d13c6abcdac7a2a2b9e137f00cedc83ee1712fb19928d9c96fac552df26d9550b2eb2d77ed712c17b44ce01cba47395db1d2192ea34c
|
|
@@ -54,10 +54,8 @@ module LgPodPlugin
|
|
|
54
54
|
# 发现本地有缓存, 不需要更新缓存
|
|
55
55
|
pod_is_exist, destination, cache_pod_spec = LCache.new.pod_cache_exist(name, hash_map, podspec, self.request.released_pod)
|
|
56
56
|
if pod_is_exist
|
|
57
|
-
is_delete = self.request.params["is_delete"] ||= false
|
|
58
|
-
LProject.shared.need_update_pods.delete(name) if is_delete
|
|
59
57
|
LgPodPlugin.log_green "find the cache of `#{name}`, you can use it now."
|
|
60
|
-
|
|
58
|
+
return nil
|
|
61
59
|
else
|
|
62
60
|
LgPodPlugin.log_green "find the new commit of `#{name}`, Git downloading now."
|
|
63
61
|
# 本地 git 下载 pod 目录
|
|
@@ -121,35 +121,6 @@ module LgPodPlugin
|
|
|
121
121
|
Pod::Downloader::Cache.lock(location, File::LOCK_SH, &block)
|
|
122
122
|
end
|
|
123
123
|
|
|
124
|
-
# def self.lock(location, lock_type)
|
|
125
|
-
# raise ArgumentError, 'no block given' unless block_given?
|
|
126
|
-
# lockfile = "#{location}.lock"
|
|
127
|
-
# f = nil
|
|
128
|
-
# loop do
|
|
129
|
-
# f.close if f
|
|
130
|
-
# f = File.open(lockfile, File::CREAT, 0o644)
|
|
131
|
-
# f.flock(lock_type)
|
|
132
|
-
# break if self.valid_lock?(f, lockfile)
|
|
133
|
-
# end
|
|
134
|
-
# begin
|
|
135
|
-
# yield location
|
|
136
|
-
# ensure
|
|
137
|
-
# if lock_type == File::LOCK_SH
|
|
138
|
-
# f.flock(File::LOCK_EX)
|
|
139
|
-
# File.delete(lockfile) if self.valid_lock?(f, lockfile)
|
|
140
|
-
# else
|
|
141
|
-
# File.delete(lockfile)
|
|
142
|
-
# end
|
|
143
|
-
# f.close
|
|
144
|
-
# end
|
|
145
|
-
# end
|
|
146
|
-
|
|
147
|
-
# def self.valid_lock?(file, filename)
|
|
148
|
-
# file.stat.ino == File.stat(filename).ino
|
|
149
|
-
# rescue Errno::ENOENT
|
|
150
|
-
# false
|
|
151
|
-
# end
|
|
152
|
-
|
|
153
124
|
public
|
|
154
125
|
def self.write_spec(spec, path)
|
|
155
126
|
path.dirname.mkpath
|
|
@@ -24,12 +24,6 @@ module LgPodPlugin
|
|
|
24
24
|
@lg_spec = pod.spec
|
|
25
25
|
end
|
|
26
26
|
self.preprocess_request
|
|
27
|
-
# require 'benchmark'
|
|
28
|
-
# col_width = 10
|
|
29
|
-
# Benchmark.bm(col_width) do |bm|
|
|
30
|
-
# bm.report("time") do
|
|
31
|
-
# end
|
|
32
|
-
# end
|
|
33
27
|
end
|
|
34
28
|
|
|
35
29
|
def preprocess_request
|
|
@@ -88,105 +82,27 @@ module LgPodPlugin
|
|
|
88
82
|
|
|
89
83
|
public
|
|
90
84
|
def get_lock_params
|
|
91
|
-
begin
|
|
92
|
-
_release_pods = self.lockfile.release_pods ||= []
|
|
93
|
-
_external_source = (self.lockfile.external_sources_data[self.name])
|
|
94
|
-
_external_source = {} unless _external_source
|
|
95
|
-
_checkout_options = self.lockfile.checkout_options_for_pod_named(self.name)
|
|
96
|
-
rescue
|
|
97
|
-
_release_pods = {}
|
|
98
|
-
_external_source = {}
|
|
99
|
-
_checkout_options = {}
|
|
100
|
-
end
|
|
101
|
-
|
|
102
85
|
git = self.checkout_options[:git]
|
|
103
86
|
tag = self.checkout_options[:tag]
|
|
104
87
|
commit = self.checkout_options[:commit]
|
|
105
88
|
branch = self.checkout_options[:branch]
|
|
106
89
|
|
|
107
|
-
lock_git = _external_source[:git] ||= _checkout_options[:git]
|
|
108
|
-
lock_tag = _external_source[:tag] ||= _release_pods[self.name]
|
|
109
|
-
lock_branch = _external_source[:branch] ||= ""
|
|
110
|
-
lock_commit = _checkout_options[:commit] ||= ""
|
|
111
|
-
|
|
112
90
|
hash_map = Hash.new
|
|
113
91
|
hash_map[:git] = git if git
|
|
114
92
|
if git && tag
|
|
115
93
|
hash_map[:tag] = tag
|
|
116
|
-
if tag != lock_tag
|
|
117
|
-
hash_map["is_delete"] = false
|
|
118
|
-
else
|
|
119
|
-
hash_map["is_delete"] = true
|
|
120
|
-
end
|
|
121
94
|
return hash_map
|
|
122
95
|
elsif git && branch
|
|
123
96
|
hash_map[:branch] = branch
|
|
124
|
-
if lock_commit && !lock_commit.empty? && !LProject.shared.update
|
|
125
|
-
pod_info = LSqliteDb.shared.query_branch_with_sha(self.name, git, lock_commit)
|
|
126
|
-
lock_branch = pod_info[:branch] if lock_branch.empty?
|
|
127
|
-
new_commit = pod_info[:sha] ||= ""
|
|
128
|
-
if lock_branch == branch && new_commit == lock_commit
|
|
129
|
-
hash_map[:commit] = lock_commit
|
|
130
|
-
hash_map["is_delete"] = true
|
|
131
|
-
return hash_map
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
97
|
_, new_commit = git_ls_remote_refs(self.name, git, branch)
|
|
135
|
-
|
|
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
|
|
98
|
+
hash_map[:commit] = new_commit if new_commit
|
|
147
99
|
elsif git && commit
|
|
148
|
-
if commit != lock_commit
|
|
149
|
-
hash_map["is_delete"] = false
|
|
150
|
-
else
|
|
151
|
-
hash_map["is_delete"] = true
|
|
152
|
-
end
|
|
153
100
|
hash_map[:commit] = commit
|
|
154
101
|
return hash_map
|
|
155
102
|
else
|
|
156
|
-
if lock_git && !LProject.shared.update
|
|
157
|
-
id = LPodLatestRefs.get_pod_id(self.name, git)
|
|
158
|
-
pod_info = LSqliteDb.shared.query_pod_refs(id)
|
|
159
|
-
if pod_info&.commit
|
|
160
|
-
if pod_info
|
|
161
|
-
new_commit = pod_info.commit
|
|
162
|
-
else
|
|
163
|
-
new_commit = nil
|
|
164
|
-
end
|
|
165
|
-
if pod_info
|
|
166
|
-
new_branch = pod_info.branch
|
|
167
|
-
else
|
|
168
|
-
new_branch = nil
|
|
169
|
-
end
|
|
170
|
-
if new_commit
|
|
171
|
-
hash_map[:commit] = new_commit
|
|
172
|
-
end
|
|
173
|
-
if new_branch
|
|
174
|
-
hash_map[:branch] = new_branch
|
|
175
|
-
end
|
|
176
|
-
hash_map["is_delete"] = true
|
|
177
|
-
return hash_map
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
103
|
new_branch, new_commit = git_ls_remote_refs(self.name, git, nil)
|
|
181
104
|
hash_map[:branch] = new_branch if new_branch
|
|
182
|
-
|
|
183
|
-
hash_map[:commit] = new_commit
|
|
184
|
-
end
|
|
185
|
-
if !new_commit || new_commit.empty?
|
|
186
|
-
hash_map["is_delete"] = true
|
|
187
|
-
else
|
|
188
|
-
hash_map["is_delete"] = false
|
|
189
|
-
end
|
|
105
|
+
hash_map[:commit] = new_commit if new_commit
|
|
190
106
|
end
|
|
191
107
|
hash_map
|
|
192
108
|
end
|
|
@@ -178,11 +178,11 @@ module LgPodPlugin
|
|
|
178
178
|
end
|
|
179
179
|
return self.use_default_refs_heads git, branch
|
|
180
180
|
end
|
|
181
|
-
commit, _ =
|
|
181
|
+
commit, _ = self.use_default_refs_heads git, branch
|
|
182
182
|
if commit
|
|
183
183
|
return [commit, branch]
|
|
184
184
|
else
|
|
185
|
-
return
|
|
185
|
+
return GithubAPI.request_github_refs_heads git, branch
|
|
186
186
|
end
|
|
187
187
|
end
|
|
188
188
|
|
|
@@ -21,7 +21,10 @@ module LgPodPlugin
|
|
|
21
21
|
def install(pod)
|
|
22
22
|
hash = pod.checkout_options
|
|
23
23
|
path = hash[:path]
|
|
24
|
-
|
|
24
|
+
unless path.nil?
|
|
25
|
+
LProject.shared.need_update_pods[pod.name] = "1"
|
|
26
|
+
return nil
|
|
27
|
+
end
|
|
25
28
|
@downloader = LDownloader.new(pod)
|
|
26
29
|
self.download_params = @downloader.pre_download_pod
|
|
27
30
|
return self.download_params
|
|
@@ -61,35 +64,32 @@ module LgPodPlugin
|
|
|
61
64
|
else
|
|
62
65
|
pod_is_exist = false
|
|
63
66
|
end
|
|
64
|
-
if pod_is_exist
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
return if pod_is_exist
|
|
68
|
+
|
|
69
|
+
git = checkout_options[:git]
|
|
70
|
+
return unless git
|
|
71
|
+
cache_podspec = request.lg_spec.spec if request.lg_spec
|
|
72
|
+
branch = checkout_options[:branch]
|
|
73
|
+
checkout_options[:name] = name if name
|
|
74
|
+
unless branch
|
|
75
|
+
branch = self.request.params[:branch] if request.params[:branch]
|
|
76
|
+
checkout_options[:branch] = branch if branch
|
|
77
|
+
end
|
|
78
|
+
lg_pod_path = LFileManager.cache_workspace(LProject.shared.workspace)
|
|
79
|
+
lg_pod_path.mkdir(0700) unless lg_pod_path.exist?
|
|
80
|
+
checkout_options[:path] = lg_pod_path
|
|
81
|
+
FileUtils.chdir lg_pod_path
|
|
82
|
+
git_clone = GitRepository.new(checkout_options)
|
|
83
|
+
download_params = git_clone.download
|
|
84
|
+
return unless download_params && File.exist?(download_params)
|
|
85
|
+
FileUtils.chdir download_params
|
|
86
|
+
if request.single_git
|
|
87
|
+
LgPodPlugin::LCache.cache_pod(name, download_params, { :git => git }, cache_podspec, request.released_pod)
|
|
67
88
|
else
|
|
68
|
-
|
|
69
|
-
return unless git
|
|
70
|
-
cache_podspec = request.lg_spec.spec if request.lg_spec
|
|
71
|
-
branch = checkout_options[:branch]
|
|
72
|
-
checkout_options[:name] = name if name
|
|
73
|
-
unless branch
|
|
74
|
-
branch = self.request.params[:branch] if request.params[:branch]
|
|
75
|
-
checkout_options[:branch] = branch if branch
|
|
76
|
-
end
|
|
77
|
-
lg_pod_path = LFileManager.cache_workspace(LProject.shared.workspace)
|
|
78
|
-
lg_pod_path.mkdir(0700) unless lg_pod_path.exist?
|
|
79
|
-
checkout_options[:path] = lg_pod_path
|
|
80
|
-
FileUtils.chdir lg_pod_path
|
|
81
|
-
git_clone = GitRepository.new(checkout_options)
|
|
82
|
-
download_params = git_clone.download
|
|
83
|
-
return unless download_params && File.exist?(download_params)
|
|
84
|
-
FileUtils.chdir download_params
|
|
85
|
-
if request.single_git
|
|
86
|
-
LgPodPlugin::LCache.cache_pod(name, download_params, { :git => git }, cache_podspec, request.released_pod)
|
|
87
|
-
else
|
|
88
|
-
LgPodPlugin::LCache.cache_pod(name, download_params, request.get_cache_key_params, cache_podspec, request.released_pod)
|
|
89
|
-
end
|
|
90
|
-
FileUtils.chdir(LFileManager.download_director)
|
|
91
|
-
FileUtils.rm_rf(download_params)
|
|
89
|
+
LgPodPlugin::LCache.cache_pod(name, download_params, request.get_cache_key_params, cache_podspec, request.released_pod)
|
|
92
90
|
end
|
|
91
|
+
FileUtils.chdir(LFileManager.download_director)
|
|
92
|
+
FileUtils.rm_rf(download_params)
|
|
93
93
|
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -44,7 +44,9 @@ module LgPodPlugin
|
|
|
44
44
|
installer = LPodInstaller.new
|
|
45
45
|
download_params = installer.install(pod)
|
|
46
46
|
if download_params
|
|
47
|
-
|
|
47
|
+
name = download_params["name"]
|
|
48
|
+
all_installers[name] = installer
|
|
49
|
+
LProject.shared.need_update_pods[name] = "1"
|
|
48
50
|
end
|
|
49
51
|
end
|
|
50
52
|
end
|
|
@@ -29,24 +29,25 @@ module LgPodPlugin
|
|
|
29
29
|
origin_uri = URI(git)
|
|
30
30
|
end
|
|
31
31
|
return if origin_uri.nil?
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
@uri = origin_uri
|
|
33
|
+
# redirect_url = LProject.shared.redirect_url_hash[origin_uri.host]
|
|
34
|
+
# if redirect_url
|
|
35
|
+
# @uri = redirect_url
|
|
36
|
+
# else
|
|
37
|
+
# @uri = URI(get_redirect_url(origin_uri.scheme + "://" + origin_uri.host))
|
|
38
|
+
# LProject.shared.redirect_url_hash[origin_uri.host] = @uri
|
|
39
|
+
# end
|
|
39
40
|
@host = @uri.host
|
|
40
41
|
@scheme = @uri.scheme ||= "https"
|
|
41
42
|
@hostname = @scheme + "://" + @host
|
|
42
43
|
end
|
|
43
44
|
|
|
44
|
-
def get_redirect_url(host)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
end
|
|
45
|
+
# def get_redirect_url(host)
|
|
46
|
+
# redirect_url = Net::HTTP.get_response(URI(host))['location']
|
|
47
|
+
# return host unless redirect_url
|
|
48
|
+
# uri = URI(redirect_url)
|
|
49
|
+
# return uri.scheme + "://" + uri.host
|
|
50
|
+
# end
|
|
50
51
|
|
|
51
52
|
private
|
|
52
53
|
#判断是否是 IP 地址
|
|
@@ -21,7 +21,7 @@ module LgPodPlugin
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def self.resolve_dependencies(lockfile, installer)
|
|
24
|
-
installer.resolve_dependencies
|
|
24
|
+
installer.send(:resolve_dependencies)
|
|
25
25
|
external_pods = LProject.shared.external_pods ||= {}
|
|
26
26
|
analysis_result = installer.send(:analysis_result)
|
|
27
27
|
return unless analysis_result
|
|
@@ -75,8 +75,8 @@ module LgPodPlugin
|
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
|
|
78
|
-
def self.
|
|
79
|
-
installer.download_dependencies
|
|
78
|
+
def self.download_dependencies(installer)
|
|
79
|
+
installer.send(:download_dependencies)
|
|
80
80
|
installer.send(:validate_targets)
|
|
81
81
|
installer.send(:clean_sandbox)
|
|
82
82
|
installation_options = installer.send(:installation_options)
|
|
@@ -175,7 +175,7 @@ module LgPodPlugin
|
|
|
175
175
|
installer.clean_install = clean_install
|
|
176
176
|
installer.prepare
|
|
177
177
|
resolve_dependencies(lockfile, installer)
|
|
178
|
-
|
|
178
|
+
download_dependencies(installer)
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lg_pod_plugin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.6.
|
|
4
|
+
version: 1.1.6.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- dongzb01
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cocoapods
|