lg_pod_plugin 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lg_pod_plugin/gitlab_archive.rb +12 -5
- data/lib/lg_pod_plugin/gitlab_download.rb +45 -13
- data/lib/lg_pod_plugin/install.rb +5 -2
- data/lib/lg_pod_plugin/l_util.rb +1 -0
- data/lib/lg_pod_plugin/request.rb +18 -5
- 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: fd233eb34e3646ecb5b2951bc2064b2b62a9894ce9bef5493fdab8042051993a
|
4
|
+
data.tar.gz: '0977cc3bd3baa86f483337fc554382d144c32cf05ae6f9b52b40379918d379ef'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3db736be690ea602631f5fbacc02a4cdd2d4dcce8647ea2f51bd9b019586fbbfe8e7611aab10b35881152905062017f60d07dc51e02e569af172a9cab1f9aac3
|
7
|
+
data.tar.gz: 968bb82236aa20eeddb4d27126a6e47521910b75aacea84d4adc2030e5677b5314e59b74b5c6018f19b8bca320b0f648610279cebc9b58c56861b015b2717284
|
@@ -77,7 +77,7 @@ module LgPodPlugin
|
|
77
77
|
project_path.mkdir
|
78
78
|
FileUtils.chdir(project_path)
|
79
79
|
end
|
80
|
-
branch = self.branch ||= "
|
80
|
+
branch = self.branch ||= "HEAD"
|
81
81
|
token = LRequest.shared.config.access_token
|
82
82
|
base_url = LRequest.shared.config.project.web_url
|
83
83
|
project_name = LRequest.shared.config.project.path
|
@@ -196,7 +196,7 @@ module LgPodPlugin
|
|
196
196
|
# 根据branch 下载 zip 包
|
197
197
|
def github_download_branch_zip(path, temp_name)
|
198
198
|
file_name = "#{temp_name}.zip"
|
199
|
-
branch = self.branch ||= "
|
199
|
+
branch = self.branch ||= "HEAD"
|
200
200
|
if self.git.include?(".git")
|
201
201
|
base_url = self.git[0...self.git.length - 4]
|
202
202
|
else
|
@@ -213,12 +213,19 @@ module LgPodPlugin
|
|
213
213
|
end
|
214
214
|
# 解压文件
|
215
215
|
result = LUtils.unzip_file(path.join(file_name).to_path, "./")
|
216
|
-
|
217
|
-
|
216
|
+
temp_zip_folder = nil
|
217
|
+
path.each_child do |f|
|
218
|
+
ftype = File::ftype(f)
|
219
|
+
next unless ftype == "directory"
|
220
|
+
next unless f.to_path.include?("#{branch}") || f.to_path.include?("#{project_name}")
|
221
|
+
temp_zip_folder = f
|
222
|
+
break
|
223
|
+
end
|
224
|
+
unless temp_zip_folder && File.exist?(temp_zip_folder)
|
218
225
|
LgPodPlugin.log_red("正在尝试git clone #{self.git}")
|
219
226
|
return self.git_clone_by_branch(path, temp_name)
|
220
227
|
end
|
221
|
-
|
228
|
+
temp_zip_folder
|
222
229
|
end
|
223
230
|
|
224
231
|
# 通过tag下载zip包
|
@@ -23,21 +23,41 @@ module LgPodPlugin
|
|
23
23
|
self.branch = options[:branch]
|
24
24
|
self.commit = options[:commit]
|
25
25
|
end
|
26
|
+
# 封装 git clone命令
|
27
|
+
def git_download_command(temp_name, git, branch, tag)
|
28
|
+
cmds = ['git']
|
29
|
+
cmds << "clone"
|
30
|
+
cmds << "#{git}"
|
31
|
+
cmds << "#{temp_name} "
|
32
|
+
cmds << "--template="
|
33
|
+
cmds << "--single-branch --depth 1"
|
34
|
+
if branch
|
35
|
+
cmds << "--branch"
|
36
|
+
cmds << branch
|
37
|
+
elsif tag
|
38
|
+
cmds << "--branch"
|
39
|
+
cmds << tag
|
40
|
+
end
|
41
|
+
cmds_to_s = cmds.join(" ")
|
42
|
+
LgPodPlugin.log_blue cmds_to_s
|
43
|
+
system(cmds_to_s)
|
44
|
+
end
|
26
45
|
|
27
46
|
def git_clone_by_branch(path, temp_name)
|
47
|
+
download_temp_path = path.join(temp_name)
|
28
48
|
if self.git && self.branch
|
29
|
-
|
30
|
-
system("git clone --template= --single-branch --depth 1 -b #{self.branch} #{self.git} #{temp_name}")
|
49
|
+
git_download_command(temp_name, self.git, self.branch, nil)
|
31
50
|
else
|
32
|
-
|
33
|
-
|
51
|
+
git_download_command(temp_name, self.git, nil, nil)
|
52
|
+
if File.exist?(temp_name)
|
53
|
+
system("git -C #{download_temp_path.to_path} rev-parse HEAD")
|
54
|
+
end
|
34
55
|
end
|
35
|
-
|
56
|
+
download_temp_path
|
36
57
|
end
|
37
58
|
|
38
59
|
def git_clone_by_tag(path, temp_name)
|
39
|
-
|
40
|
-
system("git clone --template= --single-branch --depth 1 -b #{self.tag} #{self.git} #{temp_name}")
|
60
|
+
git_download_command(temp_name, self.git, nil, self.tag)
|
41
61
|
path.join(temp_name)
|
42
62
|
end
|
43
63
|
|
@@ -130,8 +150,12 @@ module LgPodPlugin
|
|
130
150
|
network_ok = LRequest.shared.net_ping.network_ok
|
131
151
|
return [nil, nil] unless (ip && network_ok)
|
132
152
|
if branch
|
133
|
-
LgPodPlugin.log_blue "git ls-remote
|
134
|
-
|
153
|
+
LgPodPlugin.log_blue "git ls-remote #{git} #{branch}"
|
154
|
+
begin
|
155
|
+
result = %x(timeout 5 git ls-remote #{git} #{branch})
|
156
|
+
rescue
|
157
|
+
result = %x(git ls-remote #{git} #{branch})
|
158
|
+
end
|
135
159
|
unless result && result != ""
|
136
160
|
id = LPodLatestRefs.get_pod_id(name, git, branch, tag)
|
137
161
|
pod_info = LSqliteDb.shared.query_pod_refs(id)
|
@@ -145,7 +169,11 @@ module LgPodPlugin
|
|
145
169
|
return [branch, new_commit]
|
146
170
|
elsif tag
|
147
171
|
LgPodPlugin.log_blue "git ls-remote --tags #{git}"
|
148
|
-
|
172
|
+
begin
|
173
|
+
result = %x(timeout 5 git ls-remote --tags #{git})
|
174
|
+
rescue
|
175
|
+
result = %x(git ls-remote --tags #{git})
|
176
|
+
end
|
149
177
|
unless result && result != ""
|
150
178
|
id = LPodLatestRefs.get_pod_id(name, git, branch, tag)
|
151
179
|
pod_info = LSqliteDb.shared.query_pod_refs(id)
|
@@ -160,8 +188,12 @@ module LgPodPlugin
|
|
160
188
|
elsif commit
|
161
189
|
return nil, commit
|
162
190
|
else
|
163
|
-
LgPodPlugin.log_blue "git ls-remote
|
164
|
-
|
191
|
+
LgPodPlugin.log_blue "git ls-remote #{git}"
|
192
|
+
begin
|
193
|
+
result = %x(timeout 5 git ls-remote -- #{git})
|
194
|
+
rescue
|
195
|
+
result = %x(git ls-remote -- #{git})
|
196
|
+
end
|
165
197
|
unless result && result != ""
|
166
198
|
id = LPodLatestRefs.get_pod_id(name, git, branch, tag)
|
167
199
|
pod_info = LSqliteDb.shared.query_pod_refs(id)
|
@@ -172,7 +204,7 @@ module LgPodPlugin
|
|
172
204
|
if new_commit
|
173
205
|
LSqliteDb.shared.insert_pod_refs(name, git, branch, tag, new_commit)
|
174
206
|
end
|
175
|
-
return nil, new_commit
|
207
|
+
return [nil, new_commit]
|
176
208
|
end
|
177
209
|
end
|
178
210
|
|
@@ -113,6 +113,7 @@ module LgPodPlugin
|
|
113
113
|
LRequest.shared.is_update = (command == "update")
|
114
114
|
podfile = Pod::Podfile.from_file(podfile_path)
|
115
115
|
target = podfile.send(:current_target_definition)
|
116
|
+
local_pods = []
|
116
117
|
release_pods = []
|
117
118
|
install_hash_map = {}
|
118
119
|
children = target.children
|
@@ -126,8 +127,10 @@ module LgPodPlugin
|
|
126
127
|
next if (key = e.keys.first) == nil
|
127
128
|
next if (val = e[key].last) == nil
|
128
129
|
if val.is_a?(Hash)
|
129
|
-
next unless val[:path] == nil
|
130
130
|
next unless val[:podspec] == nil
|
131
|
+
path = val[:path]
|
132
|
+
local_pods.append(key) if path
|
133
|
+
next unless path == nil
|
131
134
|
install_hash_map[key] = val
|
132
135
|
else
|
133
136
|
release_pods.append(key)
|
@@ -143,7 +146,7 @@ module LgPodPlugin
|
|
143
146
|
LgPodPlugin.log_red "开始安装pod"
|
144
147
|
#切换工作目录到当前工程下, 开始执行pod install
|
145
148
|
FileUtils.chdir(podfile_path.dirname)
|
146
|
-
libs = LRequest.shared.libs.keys.empty? ? release_pods : LRequest.shared.libs.keys
|
149
|
+
libs = LRequest.shared.libs.keys.empty? ? (release_pods + local_pods) : (LRequest.shared.libs.keys + local_pods)
|
147
150
|
# 执行pod install/ update 方法入口
|
148
151
|
update_pod = (command == "update")
|
149
152
|
run_pod_install(update_pod, libs, options)
|
data/lib/lg_pod_plugin/l_util.rb
CHANGED
@@ -102,13 +102,21 @@ module LgPodPlugin
|
|
102
102
|
elsif git && branch
|
103
103
|
if branch == lock_branch && !self.is_update
|
104
104
|
hash_map[:branch] = branch if branch
|
105
|
-
|
105
|
+
if lock_commit && !lock_commit.empty?
|
106
|
+
hash_map[:commit] = lock_commit
|
107
|
+
end
|
106
108
|
return hash_map
|
107
109
|
else
|
108
110
|
hash_map[:branch] = branch if branch
|
109
111
|
_, new_commit = LGitUtil.git_ls_remote_refs(self.name ,git, branch, tag, commit)
|
110
|
-
if new_commit &&
|
112
|
+
if new_commit && !new_commit.empty?
|
111
113
|
hash_map[:commit] = new_commit
|
114
|
+
elsif lock_commit && !lock_commit.empty?
|
115
|
+
hash_map[:commit] = lock_commit
|
116
|
+
end
|
117
|
+
if !new_commit || !lock_commit || new_commit.empty? || lock_commit.empty?
|
118
|
+
hash_map["is_delete"] = false
|
119
|
+
elsif (new_commit != lock_commit)
|
112
120
|
hash_map["is_delete"] = false
|
113
121
|
else
|
114
122
|
hash_map["is_delete"] = true
|
@@ -118,12 +126,17 @@ module LgPodPlugin
|
|
118
126
|
hash_map[:commit] = commit if commit
|
119
127
|
return hash_map
|
120
128
|
else
|
121
|
-
_, new_commit = LGitUtil.git_ls_remote_refs(self.name ,git,
|
122
|
-
if
|
129
|
+
_, new_commit = LGitUtil.git_ls_remote_refs(self.name ,git, nil, nil, nil)
|
130
|
+
if new_commit && !new_commit.empty?
|
123
131
|
hash_map[:commit] = new_commit
|
132
|
+
elsif lock_commit && !lock_commit.empty?
|
133
|
+
hash_map[:commit] = lock_commit
|
134
|
+
end
|
135
|
+
if !new_commit || !lock_commit || new_commit.empty? || lock_commit.empty?
|
136
|
+
hash_map["is_delete"] = false
|
137
|
+
elsif (new_commit != lock_commit)
|
124
138
|
hash_map["is_delete"] = false
|
125
139
|
else
|
126
|
-
hash_map[:commit] = new_commit if new_commit
|
127
140
|
hash_map["is_delete"] = true
|
128
141
|
end
|
129
142
|
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.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dongzb01
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|