lg_pod_plugin 1.1.1 → 1.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51b66b843efb74dad6c4bead07bedda8df047db87f23e69d00b1a6bb326ba7d7
4
- data.tar.gz: 553ffdd0eeed2e9f7fd28d858c110a52cfa9a50f00e0cdee64d85fd68c966ede
3
+ metadata.gz: 3edf15fe0a8e9cfcc59a9224cd55aa947dc4c347f3a2dedbbdab3bb07b4b1f65
4
+ data.tar.gz: '09cbcc226c7176f819d23b950adfaaab4d4cefa918403edac8b2cd8eec9e0cef'
5
5
  SHA512:
6
- metadata.gz: a0ecf3adb2ac46859ca9b58e02306f279c3fd85084b08cb88e40da4d10aa4fdf2739aaf03c37ce7f64828682835352a3b00786aa4d6bc3cea2561b73052616b3
7
- data.tar.gz: 1061f2907c3b2e3b345902277d2f45ca94fcd4a2aba7637f1674f43112441516f3882c40e1b4b67c35d661315fde8f30218492677d43e79f07286926a6b7e478
6
+ metadata.gz: e422b84be0ca83287c305152a8543a195ca27fa742937d81113f30a0e697d97865b114ca71222e5280eb62c196985e2da333a71f07e2b718bf71515b497ff2e5
7
+ data.tar.gz: 686b7cb744ed6857dee9317bb74eaa3841fd34e75f388be3912ca2ea1dd7ac2eeccbce9fdec1ac563e28ffd34b59f478a68f9cf9d0aa48d2d1517c776e588fc8
@@ -45,7 +45,7 @@ module LgPodPlugin
45
45
  end
46
46
 
47
47
  def run
48
- LgPodPlugin.install({ :verbose => self.log, :repo_update => self.repo_update })
48
+ LgPodPlugin::Main.run("install",{ :verbose => self.log, :repo_update => self.repo_update })
49
49
  end
50
50
  end
51
51
  end
@@ -32,7 +32,7 @@ module LgPodPlugin
32
32
  end
33
33
 
34
34
  def run
35
- LgPodPlugin.update({ :verbose => self.log, :repo_update => self.repo_update })
35
+ LgPodPlugin::Main.run("update",{ :verbose => self.log, :repo_update => self.repo_update })
36
36
  end
37
37
  end
38
38
  end
@@ -39,17 +39,9 @@ module LgPodPlugin
39
39
  self.commit = commit
40
40
  end
41
41
 
42
- def self.get_pod_id(name, git, branch, tag)
43
- if git && branch
44
- key = name + git + branch
45
- return Digest::MD5.hexdigest(key)
46
- elsif git && tag
47
- key = name + git + tag
48
- return Digest::MD5.hexdigest(key)
49
- else
50
- key = name + git
51
- return Digest::MD5.hexdigest(key)
52
- end
42
+ def self.get_pod_id(name, git)
43
+ key = name + git
44
+ return Digest::MD5.hexdigest(key)
53
45
  end
54
46
 
55
47
  end
@@ -202,7 +194,7 @@ module LgPodPlugin
202
194
  end
203
195
 
204
196
  def insert_pod_refs(name, git, branch, tag , commit)
205
- id = LPodLatestRefs.get_pod_id(name, git, branch, tag)
197
+ id = LPodLatestRefs.get_pod_id(name, git)
206
198
  pod = LPodLatestRefs.new(id, name, git, branch, tag, commit)
207
199
  if self.query_pod_refs(id) != nil
208
200
  self.db.execute_batch(
@@ -38,7 +38,7 @@ module LgPodPlugin
38
38
  user_id = LUserAuthInfo.get_user_id(host)
39
39
  user_model = LUserAuthInfo.new(user_id, username, password, host, access_token, refresh_token, (created_at + expires_in))
40
40
  LSqliteDb.shared.insert_user_info(user_model)
41
- GitLabAPI.get_user_projects(access_token, host, 1)
41
+ # GitLabAPI.get_user_projects(access_token, host, 1)
42
42
  LgPodPlugin.log_green "请求成功: `access_token` => #{access_token}, expires_in => #{expires_in}"
43
43
  rescue => exception
44
44
  LgPodPlugin.log_red "获取 `access_token` 失败, error => #{exception.to_s}"
@@ -46,39 +46,35 @@ module LgPodPlugin
46
46
  end
47
47
 
48
48
  #获取用户所有项目
49
- def self.get_user_projects(access_token, host, page)
50
- begin
51
- hash_map = Hash.new
52
- hash_map["page"] = page
53
- hash_map["per_page"] = 100
54
- hash_map["access_token"] = access_token
55
- uri = URI("#{host}/api/v4/projects")
56
- uri.query = URI.encode_www_form(hash_map)
57
- res = Net::HTTP.get_response(uri)
58
- array = JSON.parse(res.body) if res.body
59
- unless array.is_a?(Array)
60
- return
61
- end
62
- # pp array
63
- array.each do |json|
64
- id = json["id"]
65
- name = json["name"]
66
- path = json["path"]
67
- web_url = json["web_url"]
68
- description = json["description"]
69
- ssh_url_to_repo = json["ssh_url_to_repo"]
70
- http_url_to_repo = json["http_url_to_repo"]
71
- path_with_namespace = json["path_with_namespace"] ||= ""
72
- name_with_namespace = (json["name_with_namespace"] ||= "").gsub(/[ ]/, '')
73
- project = ProjectModel.new(id, name, description, path, ssh_url_to_repo, http_url_to_repo, web_url, name_with_namespace, path_with_namespace)
74
- LSqliteDb.shared.insert_project(project)
75
- end
76
- if array.count >= 100
77
- GitLabAPI.get_user_projects(access_token, host, page + 1)
78
- end
79
-
80
- end
81
- end
49
+ # def self.get_user_projects(access_token, host, page)
50
+ # begin
51
+ # hash_map = Hash.new
52
+ # hash_map["page"] = page
53
+ # hash_map["per_page"] = 20
54
+ # hash_map["access_token"] = access_token
55
+ # uri = URI("#{host}/api/v4/projects")
56
+ # uri.query = URI.encode_www_form(hash_map)
57
+ # res = Net::HTTP.get_response(uri)
58
+ # array = JSON.parse(res.body) if res.body
59
+ # unless array.is_a?(Array)
60
+ # return
61
+ # end
62
+ # # pp array
63
+ # array.each do |json|
64
+ # id = json["id"]
65
+ # name = json["name"]
66
+ # path = json["path"]
67
+ # web_url = json["web_url"]
68
+ # description = json["description"]
69
+ # ssh_url_to_repo = json["ssh_url_to_repo"]
70
+ # http_url_to_repo = json["http_url_to_repo"]
71
+ # path_with_namespace = json["path_with_namespace"] ||= ""
72
+ # name_with_namespace = (json["name_with_namespace"] ||= "").gsub(/[ ]/, '')
73
+ # project = ProjectModel.new(id, name, description, path, ssh_url_to_repo, http_url_to_repo, web_url, name_with_namespace, path_with_namespace)
74
+ # LSqliteDb.shared.insert_project(project)
75
+ # end
76
+ # end
77
+ # end
82
78
 
83
79
  # 刷新gitlab_token
84
80
  def self.refresh_gitlab_access_token(host, refresh_token)
@@ -43,7 +43,9 @@ module LgPodPlugin
43
43
  end
44
44
  LUtils.download_gitlab_zip_file(download_url, token, temp_name)
45
45
  return nil unless File.exist?(temp_name)
46
- return nil unless (result = LUtils.unzip_file(temp_name, "./"))
46
+ result = LUtils.unzip_file(temp_name, "./")
47
+ FileUtils.rm_rf temp_name unless result
48
+ return nil unless result
47
49
  temp_zip_folder = nil
48
50
  path.each_child do |f|
49
51
  ftype = File::ftype(f)
@@ -77,7 +79,7 @@ module LgPodPlugin
77
79
  project_path.mkdir
78
80
  FileUtils.chdir(project_path)
79
81
  end
80
- branch = self.branch ||= "master"
82
+ branch = self.branch ||= "HEAD"
81
83
  token = LRequest.shared.config.access_token
82
84
  base_url = LRequest.shared.config.project.web_url
83
85
  project_name = LRequest.shared.config.project.path
@@ -196,15 +198,19 @@ module LgPodPlugin
196
198
  # 根据branch 下载 zip 包
197
199
  def github_download_branch_zip(path, temp_name)
198
200
  file_name = "#{temp_name}.zip"
199
- branch = self.branch ||= "master"
201
+ branch = self.branch ||= "HEAD"
200
202
  if self.git.include?(".git")
201
203
  base_url = self.git[0...self.git.length - 4]
202
204
  else
203
205
  base_url = self.git
204
206
  end
205
- origin_url = base_url + "/archive/#{branch}.zip"
206
207
  project_name = base_url.split("/").last if base_url
207
- download_url = "https://gh.api.99988866.xyz/#{origin_url}"
208
+ url_path = base_url.split("https://github.com/").last
209
+ if branch == "HEAD"
210
+ download_url = "https://gh.api.99988866.xyz/" + "#{base_url}" + "/archive/#{branch}.zip"
211
+ else
212
+ download_url = "https://codeload.github.com/#{url_path}/zip/refs/heads/#{branch}"
213
+ end
208
214
  LgPodPlugin.log_blue "开始下载 => #{download_url}"
209
215
  LUtils.download_github_zip_file(download_url, file_name)
210
216
  unless File.exist?(file_name)
@@ -213,12 +219,19 @@ module LgPodPlugin
213
219
  end
214
220
  # 解压文件
215
221
  result = LUtils.unzip_file(path.join(file_name).to_path, "./")
216
- new_file_name = "#{project_name}-#{branch}"
217
- unless result && File.exist?(new_file_name)
222
+ temp_zip_folder = nil
223
+ path.each_child do |f|
224
+ ftype = File::ftype(f)
225
+ next unless ftype == "directory"
226
+ next unless f.to_path.include?("#{branch}") || f.to_path.include?("#{project_name}")
227
+ temp_zip_folder = f
228
+ break
229
+ end
230
+ unless temp_zip_folder && File.exist?(temp_zip_folder)
218
231
  LgPodPlugin.log_red("正在尝试git clone #{self.git}")
219
232
  return self.git_clone_by_branch(path, temp_name)
220
233
  end
221
- path.join(new_file_name)
234
+ temp_zip_folder
222
235
  end
223
236
 
224
237
  # 通过tag下载zip包
@@ -229,9 +242,9 @@ module LgPodPlugin
229
242
  else
230
243
  base_url = self.git
231
244
  end
245
+ uri = URI(base_url)
232
246
  project_name = base_url.split("/").last if base_url
233
- origin_url = base_url + "/archive/refs/tags/#{self.tag}.zip"
234
- download_url = "https://gh.api.99988866.xyz/#{origin_url}"
247
+ download_url = "https://codeload.github.com#{uri.path}/zip/refs/tags/#{self.tag}"
235
248
  # 下载文件
236
249
  LgPodPlugin.log_blue "开始下载 => #{download_url}"
237
250
  LUtils.download_github_zip_file(download_url, file_name)
@@ -241,17 +254,20 @@ module LgPodPlugin
241
254
  end
242
255
  # 解压文件
243
256
  result = LUtils.unzip_file(path.join(file_name).to_path, "./")
244
- if self.tag.include?("v") && self.tag[0...1] == "v"
245
- this_tag = self.tag[1...self.tag.length]
246
- else
247
- this_tag = self.tag
257
+ temp_zip_folder = nil
258
+ path.each_child do |f|
259
+ ftype = File::ftype(f)
260
+ next unless ftype == "directory"
261
+ version = self.tag.split("v").last ||= self.tag
262
+ next unless f.to_path.include?("#{project_name}") || f.to_path.include?(version)
263
+ temp_zip_folder = f
264
+ break
248
265
  end
249
- new_file_name = "#{project_name}-#{this_tag}"
250
- unless result && File.exist?(new_file_name)
266
+ unless temp_zip_folder && File.exist?(temp_zip_folder)
251
267
  LgPodPlugin.log_red("正在尝试git clone #{self.git}")
252
268
  return self.git_clone_by_tag(path, temp_name)
253
269
  end
254
- path.join(new_file_name)
270
+ temp_zip_folder
255
271
  end
256
272
 
257
273
  # 通过 commit 下载zip包
@@ -262,9 +278,9 @@ module LgPodPlugin
262
278
  else
263
279
  base_url = self.git
264
280
  end
281
+ uri = URI(base_url)
265
282
  project_name = base_url.split("/").last if base_url
266
- origin_url = base_url + "/archive/#{self.commit}.zip"
267
- download_url = "https://gh.api.99988866.xyz/#{origin_url}"
283
+ download_url = "https://codeload.github.com#{uri.path}/zip/#{self.commit}"
268
284
  # 下载文件
269
285
  LgPodPlugin.log_blue "开始下载 => #{download_url}"
270
286
  LUtils.download_github_zip_file(download_url, file_name)
@@ -282,6 +298,55 @@ module LgPodPlugin
282
298
  path.join(new_file_name)
283
299
  end
284
300
 
301
+ def git_clone_by_branch(path, temp_name)
302
+ download_temp_path = path.join(temp_name)
303
+ if self.git && self.branch
304
+ git_download_command(temp_name, self.git, self.branch, nil)
305
+ else
306
+ git_download_command(temp_name, self.git, nil, nil)
307
+ if File.exist?(temp_name)
308
+ system("git -C #{download_temp_path.to_path} rev-parse HEAD")
309
+ end
310
+ end
311
+ download_temp_path
312
+ end
313
+
314
+ def git_clone_by_tag(path, temp_name)
315
+ git_download_command(temp_name, self.git, nil, self.tag)
316
+ path.join(temp_name)
317
+ end
318
+
319
+ # git clone commit
320
+ def git_clone_by_commit(path, temp_name)
321
+ Git.init(temp_name)
322
+ FileUtils.chdir(temp_name)
323
+ LgPodPlugin.log_blue "git clone #{self.git}"
324
+ system("git remote add origin #{self.git}")
325
+ system("git fetch origin #{self.commit}")
326
+ system("git reset --hard FETCH_HEAD")
327
+ path.join(temp_name)
328
+ end
329
+
330
+ # 封装 git clone命令
331
+ def git_download_command(temp_name, git, branch, tag)
332
+ cmds = ['git']
333
+ cmds << "clone"
334
+ cmds << "#{git}"
335
+ cmds << "#{temp_name} "
336
+ cmds << "--template="
337
+ cmds << "--single-branch --depth 1"
338
+ if branch
339
+ cmds << "--branch"
340
+ cmds << branch
341
+ elsif tag
342
+ cmds << "--branch"
343
+ cmds << tag
344
+ end
345
+ cmds_to_s = cmds.join(" ")
346
+ LgPodPlugin.log_blue cmds_to_s
347
+ system(cmds_to_s)
348
+ end
349
+
285
350
  end
286
351
 
287
352
  end
@@ -24,34 +24,6 @@ module LgPodPlugin
24
24
  self.commit = options[:commit]
25
25
  end
26
26
 
27
- def git_clone_by_branch(path, temp_name)
28
- if self.git && self.branch
29
- LgPodPlugin.log_blue "git clone --template= --single-branch --depth 1 -b #{self.branch} #{self.git}"
30
- system("git clone --template= --single-branch --depth 1 -b #{self.branch} #{self.git} #{temp_name}")
31
- else
32
- LgPodPlugin.log_blue "git clone --template= --single-branch --depth 1 #{self.git}"
33
- system("git clone --template= --single-branch --depth 1 #{self.git} #{temp_name}")
34
- end
35
- path.join(temp_name)
36
- end
37
-
38
- def git_clone_by_tag(path, temp_name)
39
- LgPodPlugin.log_blue "git clone --template= --single-branch --depth 1 -b #{self.tag} #{self.git}"
40
- system("git clone --template= --single-branch --depth 1 -b #{self.tag} #{self.git} #{temp_name}")
41
- path.join(temp_name)
42
- end
43
-
44
- # git clone commit
45
- def git_clone_by_commit(path, temp_name)
46
- Git.init(temp_name)
47
- FileUtils.chdir(temp_name)
48
- LgPodPlugin.log_blue "git clone #{self.git}"
49
- system("git remote add origin #{self.git}")
50
- system("git fetch origin #{self.commit}")
51
- system("git reset --hard FETCH_HEAD")
52
- path.join(temp_name)
53
- end
54
-
55
27
  # clone 代码仓库
56
28
  def git_clone_repository(path)
57
29
  FileUtils.chdir(path)
@@ -64,10 +36,10 @@ module LgPodPlugin
64
36
  elsif self.git.include?("https://github.com")
65
37
  return git_archive.github_download_tag_zip path, temp_name
66
38
  else
67
- return self.git_clone_by_tag(path, temp_name)
39
+ return git_archive.git_clone_by_tag(path, temp_name)
68
40
  end
69
41
  rescue
70
- return self.git_clone_by_tag(path, temp_name)
42
+ return git_archive.git_clone_by_tag(path, temp_name)
71
43
  end
72
44
  elsif self.git && self.branch
73
45
  begin
@@ -76,10 +48,10 @@ module LgPodPlugin
76
48
  elsif self.git.include?("https://github.com")
77
49
  return git_archive.github_download_branch_zip path, temp_name
78
50
  else
79
- return self.git_clone_by_branch(path, temp_name)
51
+ return git_archive.git_clone_by_branch(path, temp_name)
80
52
  end
81
53
  rescue
82
- return self.git_clone_by_branch(path, temp_name)
54
+ return git_archive.git_clone_by_branch(path, temp_name)
83
55
  end
84
56
  elsif self.git && self.commit
85
57
  if LUtils.is_use_gitlab_archive_file(self.git)
@@ -87,7 +59,7 @@ module LgPodPlugin
87
59
  elsif self.git.include?("https://github.com")
88
60
  return git_archive.github_download_commit_zip path, temp_name
89
61
  else
90
- return self.git_clone_by_commit(path, temp_name)
62
+ return git_archive.git_clone_by_commit(path, temp_name)
91
63
  end
92
64
  elsif self.git
93
65
  if LUtils.is_use_gitlab_archive_file(self.git)
@@ -95,7 +67,7 @@ module LgPodPlugin
95
67
  elsif self.git.include?("https://github.com")
96
68
  return git_archive.github_download_branch_zip path, temp_name
97
69
  else
98
- return self.git_clone_by_branch(path, temp_name)
70
+ return git_archive.git_clone_by_branch(path, temp_name)
99
71
  end
100
72
  end
101
73
 
@@ -104,21 +76,13 @@ module LgPodPlugin
104
76
  # git 预下载
105
77
  def pre_download_git_repository
106
78
  temp_path = LFileManager.download_director.join("temp")
107
- if temp_path.exist?
108
- FileUtils.rm_rf(temp_path)
109
- end
79
+ FileUtils.rm_rf(temp_path) if temp_path.exist?
110
80
  lg_pod_path = LRequest.shared.cache.cache_root
111
- unless lg_pod_path.exist?
112
- lg_pod_path.mkdir(0700)
113
- end
81
+ lg_pod_path.mkdir(0700) unless lg_pod_path.exist?
114
82
  get_temp_folder = git_clone_repository(lg_pod_path)
115
83
  #下载 git 仓库失败
116
- unless get_temp_folder && get_temp_folder.exist?
117
- return nil
118
- end
119
- if LRequest.shared.single_git
120
- LgPodPlugin::LCache.cache_pod(self.name, get_temp_folder, { :git => self.git })
121
- end
84
+ return nil unless (get_temp_folder && get_temp_folder.exist?)
85
+ LgPodPlugin::LCache.cache_pod(self.name, get_temp_folder, { :git => self.git }) if LRequest.shared.single_git
122
86
  LgPodPlugin::LCache.cache_pod(self.name, get_temp_folder, LRequest.shared.get_cache_key_params)
123
87
  FileUtils.chdir(LFileManager.download_director)
124
88
  FileUtils.rm_rf(lg_pod_path)
@@ -130,49 +94,63 @@ module LgPodPlugin
130
94
  network_ok = LRequest.shared.net_ping.network_ok
131
95
  return [nil, nil] unless (ip && network_ok)
132
96
  if branch
133
- LgPodPlugin.log_blue "git ls-remote --refs #{git} #{branch}"
134
- result = %x(timeout 5 git ls-remote --refs #{git} #{branch})
97
+ LgPodPlugin.log_blue "git ls-remote #{git} #{branch}"
98
+ begin
99
+ result = %x(timeout 5 git ls-remote #{git} #{branch})
100
+ rescue
101
+ result = %x(git ls-remote #{git} #{branch})
102
+ end
135
103
  unless result && result != ""
136
- id = LPodLatestRefs.get_pod_id(name, git, branch, tag)
104
+ id = LPodLatestRefs.get_pod_id(name, git)
137
105
  pod_info = LSqliteDb.shared.query_pod_refs(id)
138
106
  new_commit = pod_info.commit if pod_info
139
107
  return [branch, new_commit]
140
108
  end
141
- new_commit = LUtils.commit_from_ls_remote(result, branch)
109
+ new_commit, new_branch = LUtils.commit_from_ls_remote(result, branch)
142
110
  if new_commit
143
111
  LSqliteDb.shared.insert_pod_refs(name, git, branch, tag, new_commit)
144
112
  end
145
113
  return [branch, new_commit]
146
114
  elsif tag
147
115
  LgPodPlugin.log_blue "git ls-remote --tags #{git}"
148
- result = %x(timeout 5 git ls-remote --tags #{git})
116
+ begin
117
+ result = %x(timeout 5 git ls-remote --tags #{git})
118
+ rescue
119
+ result = %x(git ls-remote --tags #{git})
120
+ end
149
121
  unless result && result != ""
150
- id = LPodLatestRefs.get_pod_id(name, git, branch, tag)
122
+ id = LPodLatestRefs.get_pod_id(name, git)
151
123
  pod_info = LSqliteDb.shared.query_pod_refs(id)
152
124
  new_commit = pod_info.commit if pod_info
153
- return [nil, new_commit]
125
+ new_branch = pod_info.branch if pod_info
126
+ return [new_branch, new_commit]
154
127
  end
155
- new_commit = LUtils.commit_from_ls_remote(result, tag)
128
+ new_commit, new_branch = LUtils.commit_from_ls_remote(result, tag)
156
129
  if new_commit
157
130
  LSqliteDb.shared.insert_pod_refs(name, git, branch, tag, new_commit)
158
131
  end
159
- return [nil, new_commit]
132
+ return [new_branch, new_commit]
160
133
  elsif commit
161
134
  return nil, commit
162
135
  else
163
- LgPodPlugin.log_blue "git ls-remote --refs #{git}"
164
- result = %x(timeout 5 git ls-remote -- #{git})
136
+ LgPodPlugin.log_blue "git ls-remote #{git}"
137
+ begin
138
+ result = %x(timeout 5 git ls-remote -- #{git})
139
+ rescue
140
+ result = %x(git ls-remote -- #{git})
141
+ end
165
142
  unless result && result != ""
166
- id = LPodLatestRefs.get_pod_id(name, git, branch, tag)
143
+ id = LPodLatestRefs.get_pod_id(name, git)
167
144
  pod_info = LSqliteDb.shared.query_pod_refs(id)
168
145
  new_commit = pod_info.commit if pod_info
169
- return [nil, new_commit]
146
+ new_branch = pod_info.branch if pod_info
147
+ return [new_branch, new_commit]
170
148
  end
171
- new_commit = LUtils.commit_from_ls_remote(result, "HEAD")
149
+ new_commit, new_branch = LUtils.commit_from_ls_remote(result, "HEAD")
172
150
  if new_commit
173
- LSqliteDb.shared.insert_pod_refs(name, git, branch, tag, new_commit)
151
+ LSqliteDb.shared.insert_pod_refs(name, git, new_branch, tag, new_commit)
174
152
  end
175
- return nil, new_commit
153
+ return [new_branch, new_commit]
176
154
  end
177
155
  end
178
156
 
@@ -6,6 +6,7 @@ require_relative 'request'
6
6
  require_relative 'database'
7
7
  require_relative 'downloader'
8
8
  require 'cocoapods-core/podfile'
9
+ require_relative 'release-pod'
9
10
  require_relative 'gitlab_download'
10
11
  require 'cocoapods-core/podfile/target_definition'
11
12
 
@@ -37,11 +38,7 @@ module LgPodPlugin
37
38
  tag = requirements[:tag]
38
39
  commit = requirements[:commit]
39
40
  branch = requirements[:branch]
40
- hash_map = Hash.new
41
- hash_map[:git] = git if git
42
- hash_map[:tag] = tag if tag
43
- hash_map[:commit] = commit if commit
44
- hash_map[:branch] = branch if branch
41
+ hash_map = Hash.new.merge!(requirements)
45
42
  if git
46
43
  if tag
47
44
  hash_map.delete(:branch)
@@ -80,74 +77,5 @@ module LgPodPlugin
80
77
  end
81
78
  end
82
79
 
83
- public
84
- # 执行pod install/update命令
85
- def self.run_pod_install(update, libs, options = {})
86
- verbose = options[:verbose]
87
- repo_update = options[:repo_update]
88
- if update
89
- if libs.empty?
90
- LgPodPlugin.log_red "no external pod update, you can use `pod update` to update --all pods"
91
- system("bundle exec arch -x86_64 pod update #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""} ")
92
- else
93
- pod_names = libs.join(" ")
94
- LgPodPlugin.log_green libs.join("\n")
95
- LgPodPlugin.log_green "bundle exec arch -x86_64 pod update #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""} "
96
- system("bundle exec arch -x86_64 pod update #{pod_names} #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""} ")
97
- end
98
- else
99
- LgPodPlugin.log_green "bundle exec arch -x86_64 pod install #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""}"
100
- system("bundle exec arch -x86_64 pod install #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""}")
101
- end
102
- end
103
-
104
- #执行lg install/update命令
105
- def self.run(command, options = {})
106
- work_space = Pathname(Dir.pwd)
107
- LgPodPlugin.log_green "当前工作目录 #{work_space}"
108
- podfile_path = work_space.join("Podfile")
109
- unless podfile_path.exist?
110
- LgPodPlugin.log_red "no such file `Podfile`"
111
- return
112
- end
113
- LRequest.shared.is_update = (command == "update")
114
- podfile = Pod::Podfile.from_file(podfile_path)
115
- target = podfile.send(:current_target_definition)
116
- release_pods = []
117
- install_hash_map = {}
118
- children = target.children
119
- children.each do |s|
120
- internal_hash = s.send(:internal_hash)
121
- next unless internal_hash.is_a?(Hash)
122
- dependencies = internal_hash["dependencies"]
123
- next unless dependencies.is_a?(Array)
124
- dependencies.each { |e|
125
- next unless e.is_a?(Hash)
126
- next if (key = e.keys.first) == nil
127
- next if (val = e[key].last) == nil
128
- if val.is_a?(Hash)
129
- next unless val[:path] == nil
130
- next unless val[:podspec] == nil
131
- install_hash_map[key] = val
132
- else
133
- release_pods.append(key)
134
- end
135
- }
136
- end
137
- LRequest.shared.libs = install_hash_map
138
- LgPodPlugin.log_red "预下载Pod"
139
- install_hash_map.each do |key, val|
140
- Installer.new(podfile, key, val)
141
- end
142
-
143
- LgPodPlugin.log_red "开始安装pod"
144
- #切换工作目录到当前工程下, 开始执行pod install
145
- FileUtils.chdir(podfile_path.dirname)
146
- libs = LRequest.shared.libs.keys.empty? ? release_pods : LRequest.shared.libs.keys
147
- # 执行pod install/ update 方法入口
148
- update_pod = (command == "update")
149
- run_pod_install(update_pod, libs, options)
150
- end
151
-
152
80
  end
153
81
  end
@@ -21,7 +21,7 @@ module LgPodPlugin
21
21
  request = LCache.download_request(name, hash_map)
22
22
  destination = LCache.path_for_pod(request, {})
23
23
  cache_pod_spec = LCache.path_for_spec(request, {})
24
- if File.exist?(destination) && File.exist?(cache_pod_spec)
24
+ if (File.exist?(destination) && File.exist?(cache_pod_spec))
25
25
  false
26
26
  else
27
27
  true
@@ -34,7 +34,9 @@ module LgPodPlugin
34
34
  end
35
35
 
36
36
  def self.download_request(name, params)
37
- Pod::Downloader::Request.new(spec: nil, released: false, name: name, params: params)
37
+ spec = LRequest.shared.checkout_options[:spec] ||= nil
38
+ released_pod = LRequest.shared.checkout_options[:release_pod] ||= false
39
+ Pod::Downloader::Request.new(spec: spec, released: released_pod, name: name, params: params)
38
40
  end
39
41
 
40
42
  def self.path_for_pod(request, slug_opts = {})
@@ -142,27 +144,21 @@ module LgPodPlugin
142
144
 
143
145
  # 拷贝 pod 缓存文件到 sandbox
144
146
  def self.cache_pod(name, target, options = {})
145
- hash_map = Hash.new.deep_merge(options).reject do |key, val|
147
+ checkout_options = Hash.new.deep_merge(options).reject do |key, val|
146
148
  !key || !val
147
149
  end
148
- request = LCache.download_request(name, hash_map)
150
+ request = LCache.download_request(name, checkout_options)
149
151
  result, pods_pecs = get_local_spec(request, target)
150
- result.location = nil
151
- result.checkout_options = hash_map
152
152
  pods_pecs.each do |s_name, s_spec|
153
- destination = path_for_pod(request, :name => name, :params => hash_map)
153
+ destination = path_for_pod(request, :name => name, :params => checkout_options)
154
154
  unless File.exist?(destination)
155
155
  LgPodPlugin.log_green "Copying #{name} from `#{target}` to `#{destination}` "
156
156
  copy_and_clean(target, destination, s_spec)
157
157
  end
158
- cache_pod_spec = path_for_spec(request, :name => name, :params => result.checkout_options)
158
+ cache_pod_spec = path_for_spec(request, :name => name, :params => checkout_options)
159
159
  unless File.exist?(cache_pod_spec)
160
160
  write_spec(s_spec, cache_pod_spec)
161
161
  end
162
- if request.name == s_name
163
- result.location = destination
164
- end
165
-
166
162
  end
167
163
 
168
164
  end
@@ -71,11 +71,23 @@ module LgPodPlugin
71
71
  return nil if branch_name.nil?
72
72
  encoded_branch_name = branch_name.dup.force_encoding(Encoding::ASCII_8BIT)
73
73
  if branch_name == "HEAD"
74
- match = %r{([a-z0-9]*)\t#{Regexp.quote(encoded_branch_name)}}.match(output)
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
75
84
  else
76
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]
77
89
  end
78
- match[1] unless match.nil?
90
+
79
91
  end
80
92
 
81
93
  #截取git-url 拿到项目绝对名称 比如 l-base-ios
@@ -0,0 +1,90 @@
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,7 +1,6 @@
1
- require 'yaml'
2
- require 'json'
3
1
  require 'net/http'
4
2
  require 'singleton'
3
+ require 'cocoapods-core'
5
4
  require_relative 'l_config'
6
5
  require_relative 'l_cache'
7
6
  require_relative 'net-ping'
@@ -42,18 +41,32 @@ module LgPodPlugin
42
41
 
43
42
  public
44
43
  def get_lock_info
45
- lock_file = self.workspace.join("Podfile.lock")
46
- if lock_file.exist?
47
- begin
48
- json = YAML.load_file(lock_file.to_path)
49
- rescue
50
- json = {}
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
51
64
  end
52
- external_source = json["EXTERNAL SOURCES"] ||= {}
53
- checkout_options = json["CHECKOUT OPTIONS"] ||= {}
54
- { "external_source" => external_source, "checkout_options" => checkout_options }
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 }
55
68
  else
56
- { "external_source" => {}, "checkout_options" => {} }
69
+ { "external_source" => {}, "checkout_options" => {}, "release_pods" => {} }
57
70
  end
58
71
  end
59
72
 
@@ -80,9 +93,11 @@ module LgPodPlugin
80
93
  public
81
94
  def get_lock_params
82
95
  begin
96
+ _release_pods = self.lock_info["release_pods"] ||= {}
83
97
  _external_source = self.lock_info["external_source"][self.name] ||= {}
84
98
  _checkout_options = self.lock_info["checkout_options"][self.name] ||= {}
85
99
  rescue
100
+ _release_pods = {}
86
101
  _external_source = {}
87
102
  _checkout_options = {}
88
103
  end
@@ -92,46 +107,80 @@ module LgPodPlugin
92
107
  commit = self.checkout_options[:commit]
93
108
  branch = self.checkout_options[:branch]
94
109
 
95
- lock_commit = _checkout_options[:commit] ||= ""
110
+ lock_git = _external_source[:git] ||= _checkout_options[:git]
111
+ lock_tag = _external_source[:tag] ||= _release_pods[self.name]
96
112
  lock_branch = _external_source[:branch] ||= ""
113
+ lock_commit = _checkout_options[:commit] ||= ""
114
+
97
115
  hash_map = Hash.new
98
116
  hash_map[:git] = git if git
99
117
  if git && tag
100
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
101
124
  return hash_map
102
125
  elsif git && branch
126
+ hash_map[:branch] = branch
103
127
  if branch == lock_branch && !self.is_update
104
- hash_map[:branch] = branch if branch
105
- hash_map[:commit] = lock_commit if lock_commit
128
+ if lock_commit && !lock_commit.empty?
129
+ hash_map[:commit] = lock_commit
130
+ end
131
+ hash_map["is_delete"] = true
106
132
  return hash_map
107
133
  else
108
- hash_map[:branch] = branch if branch
109
- _, new_commit = LGitUtil.git_ls_remote_refs(self.name ,git, branch, tag, commit)
110
- if new_commit && (new_commit != lock_commit)
134
+ _, new_commit = LGitUtil.git_ls_remote_refs(self.name ,git, branch, nil, nil)
135
+ if new_commit && !new_commit.empty?
111
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)
112
143
  hash_map["is_delete"] = false
113
144
  else
114
145
  hash_map["is_delete"] = true
115
146
  end
116
147
  end
117
148
  elsif git && commit
118
- hash_map[:commit] = commit if 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
119
155
  return hash_map
120
156
  else
121
- _, new_commit = LGitUtil.git_ls_remote_refs(self.name ,git, branch, tag, commit)
122
- if (new_commit != lock_commit)
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?
123
172
  hash_map[:commit] = new_commit
124
- hash_map["is_delete"] = false
125
- else
126
- hash_map[:commit] = new_commit if new_commit
173
+ end
174
+ if !new_commit || new_commit.empty?
127
175
  hash_map["is_delete"] = true
176
+ else
177
+ hash_map["is_delete"] = false
128
178
  end
129
179
  end
130
180
  hash_map
131
181
  end
132
182
 
133
183
  public
134
-
135
184
  #获取下载参数
136
185
  def get_request_params
137
186
  if self.lock_info == nil
@@ -0,0 +1,114 @@
1
+ require 'cocoapods'
2
+ require 'cocoapods-core'
3
+ require_relative 'l_util'
4
+ require_relative 'install'
5
+ require_relative 'request'
6
+ require_relative 'release-pod'
7
+ # require_relative 'specification'
8
+
9
+ module LgPodPlugin
10
+ class Main
11
+
12
+ public
13
+
14
+ def self.run(command, options = {})
15
+ is_update = (command == "update")
16
+ work_space = Pathname(Dir.pwd)
17
+ LgPodPlugin.log_green "当前工作目录 #{work_space}"
18
+ podfile_path = work_space.join("Podfile")
19
+ unless podfile_path.exist?
20
+ LgPodPlugin.log_red "no such file `Podfile`"
21
+ return
22
+ end
23
+ LRequest.shared.is_update = is_update
24
+ podfile = Pod::Podfile.from_file(podfile_path)
25
+ target = podfile.send(:current_target_definition)
26
+ local_pods = Hash.new
27
+ release_pods = Hash.new
28
+ install_hash_map = {}
29
+ children = target.children
30
+ children.each do |s|
31
+ internal_hash = s.send(:internal_hash)
32
+ next unless internal_hash.is_a?(Hash)
33
+ dependencies = internal_hash["dependencies"]
34
+ next unless dependencies.is_a?(Array)
35
+ dependencies.each { |e|
36
+ next unless e.is_a?(Hash)
37
+ next if (key = e.keys.first) == nil
38
+ pod_name = key
39
+ val = e[key].last
40
+ pod_name = key.split("/").first if key.include?("/")
41
+ next unless val.is_a?(Hash)
42
+ next unless val[:podspec] == nil
43
+ if path = val[:path]
44
+ local_pods[pod_name] = val
45
+ else
46
+ install_hash_map[pod_name] = val
47
+ end
48
+ }
49
+ end
50
+ # 安装开发版本pod
51
+ self.install_external_pod(work_space, podfile, Hash.new.merge!(install_hash_map))
52
+ # 下载 release_pod
53
+ repo_update = options[:repo_update] ||= false
54
+ external_pods = install_hash_map.merge!(local_pods)
55
+ ReleasePod.install_release_pod(work_space, podfile,repo_update, is_update, Hash.new.merge!(external_pods), local_pods)
56
+ # LgPodPlugin.log_green "开始安装Pod"
57
+ # #切换工作目录到当前工程下, 开始执行pod install
58
+ # FileUtils.chdir(work_space)
59
+ # libs = Set[]
60
+ # libs += Array(local_pods)
61
+ # libs += LRequest.shared.libs.keys
62
+ # 执行pod install/ update 方法入口
63
+ # update_pod = (command == "update")
64
+ # run_pod_install(update_pod, libs, options)
65
+ end
66
+
67
+ def self.install_external_pod(work_space, podfile, install_hash_map)
68
+ #下载 External pods
69
+ LRequest.shared.libs = Hash.new.merge!(install_hash_map)
70
+ LgPodPlugin.log_green "Pre-downloading External Pods" unless install_hash_map.empty?
71
+ install_hash_map.each do |key, val|
72
+ git = val[:git]
73
+ tag = val[:tag]
74
+ commit = val[:commit]
75
+ if git && tag
76
+ LRequest.shared.checkout_options = { :git => git, :tag => tag, :spec => nil, :release_pod => false }
77
+ unless LCache.new(work_space).find_pod_cache(key, { :git => git, :tag => tag })
78
+ LRequest.shared.libs.delete(key)
79
+ next
80
+ end
81
+ elsif git && commit
82
+ LRequest.shared.checkout_options = { :git => git, :commit => commit, :spec => nil, :release_pod => false }
83
+ unless LCache.new(work_space).find_pod_cache(key, { :git => git, :commit => commit })
84
+ LRequest.shared.libs.delete(key)
85
+ next
86
+ end
87
+ end
88
+ LgPodPlugin::Installer.new(podfile, key, val)
89
+ end
90
+ end
91
+
92
+ public
93
+ # 执行pod install/update命令
94
+ def self.run_pod_install(update, libs, options = {})
95
+ verbose = options[:verbose]
96
+ repo_update = options[:repo_update]
97
+ if update
98
+ if libs.empty?
99
+ LgPodPlugin.log_red "no external pod update, you can use `pod update` to update --all pods"
100
+ system("bundle exec arch -x86_64 pod update #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""} ")
101
+ else
102
+ pod_names = Array(libs).join(" ")
103
+ LgPodPlugin.log_green Array(libs).join("\n")
104
+ LgPodPlugin.log_green "bundle exec arch -x86_64 pod update #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""} "
105
+ system("bundle exec arch -x86_64 pod update #{pod_names} #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""} ")
106
+ end
107
+ else
108
+ LgPodPlugin.log_green "bundle exec arch -x86_64 pod install #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""}"
109
+ system("bundle exec arch -x86_64 pod install #{repo_update ? "--repo-update" : "--no-repo-update"} #{verbose ? "--verbose" : ""}")
110
+ end
111
+ end
112
+
113
+ end
114
+ end
@@ -0,0 +1,52 @@
1
+ require 'cocoapods'
2
+ require 'cocoapods-core'
3
+ require_relative 'l_util'
4
+ require_relative 'l_cache'
5
+ require_relative 'request'
6
+ require_relative 'install'
7
+
8
+ module LgPodPlugin
9
+
10
+ class Specification
11
+ attr_accessor :spec
12
+ attr_accessor :podfile
13
+ attr_accessor :work_space
14
+ attr_accessor :attributes_hash
15
+ attr_accessor :dependencies
16
+ def initialize(work_space, podfile, name = nil, version = nil)
17
+ config = Pod::Config.instance
18
+ sources_manager = config.send(:sources_manager)
19
+ dependency = Pod::Dependency.new(name, version)
20
+ set = sources_manager.search(dependency)
21
+ self.podfile = podfile
22
+ self.work_space = work_space
23
+ self.spec = set.send(:specification)
24
+ self.attributes_hash = self.spec.send(:attributes_hash)
25
+ self.dependencies = self.attributes_hash["dependencies"]
26
+ end
27
+
28
+ def install
29
+ pod_name = self.attributes_hash["name"]
30
+ if pod_name.include?("/")
31
+ real_name = pod_name.split("/").first
32
+ else
33
+ real_name = pod_name
34
+ end
35
+ return if LRequest.shared.libs[real_name]
36
+ pod_version = self.attributes_hash["version"]
37
+ prepare_command = self.attributes_hash['prepare_command']
38
+ return if prepare_command
39
+ source = self.attributes_hash['source']
40
+ return unless source.is_a?(Hash)
41
+ git = source["git"] ||= ""
42
+ tag = source["tag"] ||= ""
43
+ return unless git.include?("https://github.com")
44
+ requirements = {:git => git, :tag => tag, :spec => spec, :release_pod => true }
45
+ LRequest.shared.checkout_options = requirements
46
+ return unless LCache.new(self.work_space).find_pod_cache(real_name, {:git => git, :tag => tag})
47
+ LRequest.shared.libs[real_name] = requirements
48
+ LgPodPlugin::Installer.new(self.podfile, real_name, requirements)
49
+ end
50
+
51
+ end
52
+ end
@@ -1,3 +1,3 @@
1
1
  module LgPodPlugin
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.3"
3
3
  end
data/lib/lg_pod_plugin.rb CHANGED
@@ -3,6 +3,7 @@ require 'claide'
3
3
  require 'cocoapods-downloader'
4
4
  require "lg_pod_plugin/version"
5
5
  require_relative 'lg_pod_plugin/log'
6
+ require_relative 'lg_pod_plugin/runner'
6
7
  require_relative 'lg_pod_plugin/install'
7
8
  require_relative 'lg_pod_plugin/request'
8
9
  require_relative 'lg_pod_plugin/database'
@@ -14,13 +15,4 @@ require 'cocoapods-core/podfile/target_definition'
14
15
  module LgPodPlugin
15
16
  autoload :Command, 'command/command'
16
17
  class Error < StandardError; end
17
-
18
- def self.install(options = {})
19
- LgPodPlugin::Installer.run("install", options)
20
- end
21
-
22
- def self.update(options = {})
23
- LgPodPlugin::Installer.run("update", options)
24
- end
25
-
26
18
  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.1
4
+ version: 1.1.3
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-10 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -158,7 +158,10 @@ files:
158
158
  - lib/lg_pod_plugin/log.rb
159
159
  - lib/lg_pod_plugin/net-ping.rb
160
160
  - lib/lg_pod_plugin/podspec.rb
161
+ - lib/lg_pod_plugin/release-pod.rb
161
162
  - lib/lg_pod_plugin/request.rb
163
+ - lib/lg_pod_plugin/runner.rb
164
+ - lib/lg_pod_plugin/specification.rb
162
165
  - lib/lg_pod_plugin/string.rb
163
166
  - lib/lg_pod_plugin/version.rb
164
167
  homepage: https://gitee.com/fmdb_beantech_admin/lg_pod_plugin