lg_pod_plugin 1.1.5.5 → 1.1.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3aac9e3f7ae1ac1bec1f38f9faf0484bf7f79cd4f7cd70030203ac802b0c892e
4
- data.tar.gz: 9c22ae4997c0bf795021a4bb1ab905786af8c585622398560fe8e97a5ca4ed27
3
+ metadata.gz: ce8fcf508c4622d896bc35d848db7c9d8238648722e38cde3dca35f5b30a5c42
4
+ data.tar.gz: 756567c34b08dc9d99af1f8f9c4fd8a3adf527d60afd4155315ed4c2e7a89616
5
5
  SHA512:
6
- metadata.gz: caf7d0bd717856e93ab3c3f699c44879e69ae29762864c5d9d1a174b5e09ae800a87e8d3951bd23f071125e11232129449616a1ec971c26ba132ccaf956ce402
7
- data.tar.gz: 81b84ca084996f062d6e33c26cc09001cb2cbacb50fea6c81fe8fb4b793be3e69fadf4f27387b1223d0d5e6ae6bc6e74d3dac160144d733597cc0598106b3ef9
6
+ metadata.gz: 0e35116e0824a397cfb7021ed6ffa793d1143f3300b8eab09c827a93e704292ed13b38bab506b8754ad3379d7fc682c34d537516545c2c4e9c89581158f399e3
7
+ data.tar.gz: defe217180c036512d189a183d7ad1ce1a20a6b90bbdc56ef957851c55d6bcfee279fbfeb5ce64ac8a762fda002b76c5601ae4f57ad6449e21cfe3984e304c9f
@@ -3,7 +3,7 @@ require 'claide'
3
3
  module LgPodPlugin
4
4
  class Command
5
5
  class Install < Command
6
- REQUIRED_ATTRS ||= %i[log repo_update].freeze
6
+ REQUIRED_ATTRS ||= %i[log repo_update clean_install].freeze
7
7
  attr_accessor(*REQUIRED_ATTRS)
8
8
 
9
9
  self.summary = 'Install project dependencies according to versions from a Podfile.lock'
@@ -40,14 +40,24 @@ module LgPodPlugin
40
40
 
41
41
  def initialize(argv)
42
42
  self.log = argv.flag?('verbose')
43
- self.repo_update = argv.flag?('repo-update')
43
+ repo_flag = argv.flag?('repo-update')
44
+ if repo_flag.nil?
45
+ self.repo_update = true
46
+ else
47
+ self.repo_update = repo_flag
48
+ end
49
+ if argv.flag?('clean-install').nil?
50
+ @clean_install = false
51
+ else
52
+ @clean_install = true
53
+ end
44
54
  super
45
55
  end
46
56
 
47
57
  def run
48
58
 
49
59
  begin_time = Time.now.to_i
50
- LgPodPlugin::Main.run("install", { :verbose => self.log, :repo_update => self.repo_update })
60
+ LgPodPlugin::Main.run("install", { :verbose => self.log, :repo_update => self.repo_update, :clean_install => self.clean_install })
51
61
  end_time = Time.now.to_i
52
62
  LgPodPlugin.log_blue "`lg install`安装所需时间: #{end_time - begin_time}"
53
63
  end
@@ -2,7 +2,7 @@ require 'claide'
2
2
  module LgPodPlugin
3
3
  class Command
4
4
  class Update < Command
5
- REQUIRED_ATTRS ||= %i[log repo_update].freeze
5
+ REQUIRED_ATTRS ||= %i[log repo_update clean_install].freeze
6
6
  attr_accessor(*REQUIRED_ATTRS)
7
7
  self.summary = 'Update outdated project dependencies and create new ' \
8
8
  'Podfile.lock'
@@ -27,13 +27,23 @@ module LgPodPlugin
27
27
 
28
28
  def initialize(argv)
29
29
  self.log = argv.flag?('verbose')
30
- self.repo_update = argv.flag?('repo-update')
30
+ repo_flag = argv.flag?('repo-update')
31
+ if repo_flag.nil?
32
+ self.repo_update = true
33
+ else
34
+ self.repo_update = repo_flag
35
+ end
36
+ if argv.flag?('clean-install').nil?
37
+ @clean_install = false
38
+ else
39
+ @clean_install = true
40
+ end
31
41
  super
32
42
  end
33
43
 
34
44
  def run
35
45
  begin_time = Time.now.to_i
36
- LgPodPlugin::Main.run("update", { :verbose => self.log, :repo_update => self.repo_update})
46
+ LgPodPlugin::Main.run("update", { :verbose => self.log, :repo_update => self.repo_update, :clean_install => self.clean_install })
37
47
  end_time = Time.now.to_i
38
48
  LgPodPlugin.log_blue "`lg update`安装所需时间: #{end_time - begin_time}"
39
49
  end
@@ -50,11 +50,7 @@ module LgPodPlugin
50
50
  end
51
51
  hash_map = self.request.get_cache_key_params
52
52
  # 发现本地有缓存, 不需要更新缓存
53
- if self.request.single_git
54
- pod_is_exist, destination, cache_pod_spec = LCache.new.pod_cache_exist(name, hash_map, podspec, self.request.released_pod)
55
- else
56
- pod_is_exist, destination, cache_pod_spec = LCache.new.pod_cache_exist(name, hash_map, podspec, self.request.released_pod)
57
- end
53
+ pod_is_exist, destination, cache_pod_spec = LCache.new.pod_cache_exist(name, hash_map, podspec, self.request.released_pod)
58
54
  if pod_is_exist
59
55
  is_delete = self.request.params["is_delete"] ||= false
60
56
  LProject.shared.need_update_pods.delete(name) if is_delete
@@ -102,7 +98,6 @@ module LgPodPlugin
102
98
  download_params.delete("podspec_content")
103
99
  end
104
100
  end
105
- FileUtils.rm_rf podspec_path
106
101
  end
107
102
  return download_params
108
103
  elsif File.exist?(download_params.to_s) && download_params
@@ -14,8 +14,8 @@ module LgPodPlugin
14
14
  public
15
15
  def pod_cache_exist(name, options, spec = nil, released_pod = false)
16
16
  destination, cache_pod_spec = self.find_pod_cache name, options, spec, released_pod
17
- if (File.exist?(destination) && !destination.children.empty?)
18
- [true, destination, cache_pod_spec]
17
+ if (File.exist?(destination) && !destination.children.empty?) && cache_pod_spec.exist?
18
+ return [true, destination, cache_pod_spec]
19
19
  else
20
20
  [false, destination, cache_pod_spec]
21
21
  end
@@ -37,11 +37,6 @@ module LgPodPlugin
37
37
  def github_download_tag_zip(root_path)
38
38
  project_name = LUtils.get_git_project_name self.git
39
39
  download_urls = self.download_archive_zip(project_name)
40
- # unless self.spec
41
- # podspec_filename = self.name + ".podspec"
42
- # podspec_content = GithubAPI.get_podspec_file_content self.git, self.commit, podspec_filename
43
- # self.spec = LgPodPlugin::PodSpec.form_string(podspec_content, root_path + "/#{podspec_filename}") if podspec_content
44
- # end
45
40
  download_params = Hash.new
46
41
  download_params["name"] = self.name
47
42
  download_params["type"] = "github-tag"
@@ -54,7 +49,6 @@ module LgPodPlugin
54
49
  else
55
50
  download_params["podspec"] = nil
56
51
  download_params["source_files"] = ["All"]
57
- # download_params["podspec_content"] = podspec_content if podspec_content
58
52
  end
59
53
  download_params
60
54
  end
@@ -62,11 +56,6 @@ module LgPodPlugin
62
56
  def github_download_branch_zip(root_path)
63
57
  project_name = LUtils.get_git_project_name self.git
64
58
  download_urls = self.download_archive_zip(project_name)
65
- # unless self.spec
66
- # podspec_filename = self.name + ".podspec"
67
- # podspec_content = GithubAPI.get_podspec_file_content self.git, self.commit, podspec_filename
68
- # self.spec = LgPodPlugin::PodSpec.form_string(podspec_content, root_path + "/#{podspec_filename}") if podspec_content
69
- # end
70
59
  download_params = Hash.new
71
60
  download_params["name"] = self.name
72
61
  download_params["type"] = "github-branch"
@@ -78,7 +67,6 @@ module LgPodPlugin
78
67
  else
79
68
  download_params["podspec"] = nil
80
69
  download_params["source_files"] = ["All"]
81
- # download_params["podspec_content"] = podspec_content if podspec_content
82
70
  end
83
71
  download_params
84
72
  end
@@ -86,11 +74,6 @@ module LgPodPlugin
86
74
  def github_download_commit_zip(root_path)
87
75
  project_name = LUtils.get_git_project_name self.git
88
76
  download_urls = self.download_archive_zip(project_name)
89
- # unless self.spec
90
- # podspec_filename = self.name + ".podspec"
91
- # podspec_content = GithubAPI.get_podspec_file_content self.git, self.commit, podspec_filename
92
- # self.spec = LgPodPlugin::PodSpec.form_string(podspec_content, root_path + "/#{podspec_filename}") if podspec_content
93
- # end
94
77
  download_params = Hash.new
95
78
  download_params["name"] = self.name
96
79
  download_params["type"] = "github-commit"
@@ -102,7 +85,6 @@ module LgPodPlugin
102
85
  else
103
86
  download_params["podspec"] = nil
104
87
  download_params["source_files"] = ["All"]
105
- # download_params["podspec_content"] = podspec_content if podspec_content
106
88
  end
107
89
  download_params
108
90
  end
@@ -118,27 +100,9 @@ module LgPodPlugin
118
100
  repo_name = nil
119
101
  end
120
102
  return nil unless repo_name
121
- # network_ok = false
122
- # result = %x(ping gh.api.99988866.xyz -t 1)
123
- # if !result || result == "" || result.include?("timeout")
124
- # network_ok = false
125
- # else
126
- # network_ok = true
127
- # end
128
103
  if self.git && self.tag
129
104
  download_url = "https://codeload.github.com/#{repo_name}/tar.gz/refs/tags/#{self.tag}"
130
105
  [{ "filename" => "#{project_name}.tar.gz", "url" => download_url }]
131
- # if network_ok
132
- # repo_info = GithubAPI.get_repo_info(repo_name)
133
- # html_url = repo_info["html_url"]
134
- # if html_url
135
- # base_url = html_url
136
- # end
137
- # download_url = "https://gh.api.99988866.xyz/#{base_url}/archive/refs/tags/#{self.tag}.tar.gz"
138
- # [{ "filename" => "#{project_name}.tar.gz", "url" => download_url }]
139
- # else
140
- #
141
- # end
142
106
  elsif self.git && self.branch
143
107
  if self.branch == "HEAD"
144
108
  download_url = "https://gh.api.99988866.xyz/" + "#{base_url}" + "/archive/#{self.branch}.tar.gz"
@@ -147,12 +111,6 @@ module LgPodPlugin
147
111
  download_url = "https://codeload.github.com/#{repo_name}/tar.gz/refs/heads/#{self.branch}"
148
112
  [{ "filename" => "#{project_name}.tar.gz", "url" => download_url }]
149
113
  end
150
- # if network_ok
151
- # download_url = "https://gh.api.99988866.xyz/#{base_url}/archive/#{self.branch}.tar.gz"
152
- # [{ "filename" => "#{project_name}.tar.gz", "url" => download_url }]
153
- # else
154
- #
155
- # end
156
114
  elsif self.git && self.commit
157
115
  download_url = "https://codeload.github.com/#{repo_name}/tar.gz/#{self.commit}"
158
116
  return [{ "filename" => "#{project_name}.tar.gz", "url" => download_url }]
@@ -68,17 +68,17 @@ module LgPodPlugin
68
68
  end
69
69
  pod_spec_file_path = sandbox_path.join("#{podspec_filename}")
70
70
  lg_spec = LgPodPlugin::PodSpec.form_string(podspec_content, pod_spec_file_path)
71
- unless lg_spec
72
- if podspec_content
73
- begin
74
- File.open(pod_spec_file_path, "w+") do |f|
75
- f.write podspec_content
76
- end
77
- rescue => exception
78
- LgPodPlugin.log_red "#{exception}"
71
+ if podspec_content
72
+ begin
73
+ File.open(pod_spec_file_path, "w+") do |f|
74
+ f.write podspec_content
79
75
  end
80
- @podspec_content = podspec_content
76
+ rescue => exception
77
+ LgPodPlugin.log_red "#{exception}"
81
78
  end
79
+ @podspec_content = podspec_content
80
+ end
81
+ unless lg_spec
82
82
  download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
83
83
  download_url += "\\&access_token\\=#{token}" if token
84
84
  return [{ "filename" => "#{self.name}.tar.bz2", "url" => download_url }]
@@ -37,29 +37,13 @@ module LgPodPlugin
37
37
  if request.lg_spec
38
38
  cache_podspec = request.lg_spec.spec
39
39
  else
40
- cache_podspec = nil
41
- end
42
-
43
- unless cache_podspec
44
40
  cache_podspec = LProject.shared.cache_specs[name]
45
41
  request.lg_spec = LgPodPlugin::PodSpec.form_pod_spec cache_podspec if cache_podspec
46
42
  end
47
-
48
- if cache_podspec
49
- destination = self.download_params["destination"]
50
- if destination && File.exist?(destination) && !Pathname(destination).children.empty?
51
- pod_is_exist = true
52
- else
53
- pod_is_exist = false
54
- end
55
- else
56
- destination = self.download_params["destination"]
57
- if destination && File.exist?(destination) && !Pathname(destination).children.empty?
58
- pod_is_exist = true
59
- else
60
- pod_is_exist = false
61
- end
62
- cache_pod_spec_path = self.download_params["cache_pod_spec_path"]
43
+ destination = self.download_params["destination"]
44
+ cache_pod_spec_path = self.download_params["cache_pod_spec_path"]
45
+ # podspec.json 不存在
46
+ unless cache_podspec
63
47
  local_spec_path = destination.glob("#{name}.podspec{,.json}").last
64
48
  if local_spec_path && File.exist?(local_spec_path)
65
49
  cache_podspec = Pod::Specification.from_file local_spec_path
@@ -71,6 +55,12 @@ module LgPodPlugin
71
55
  end
72
56
  request.lg_spec = LgPodPlugin::PodSpec.form_pod_spec cache_podspec if cache_podspec
73
57
  end
58
+ # 判断缓存是否下载成功
59
+ if (destination && File.exist?(destination) && !Pathname(destination).children.empty?) && (cache_pod_spec_path && File.exist?(cache_pod_spec_path))
60
+ pod_is_exist = true
61
+ else
62
+ pod_is_exist = false
63
+ end
74
64
  if pod_is_exist
75
65
  is_delete = request.params["is_delete"] ||= false
76
66
  LProject.shared.need_update_pods.delete(name) if is_delete
@@ -31,7 +31,8 @@ module LgPodPlugin
31
31
  self.install_external_pod(project)
32
32
  # # 安装开发版本pod
33
33
  verbose = options[:verbose] ||= false
34
- ReleasePod.install_release_pod(update, repo_update, verbose)
34
+ clean_install = options[:clean_install] ||= false
35
+ ReleasePod.install_release_pod(update, repo_update, verbose, clean_install)
35
36
  end
36
37
 
37
38
  def self.install_external_pod(project)
@@ -133,7 +133,7 @@ module LgPodPlugin
133
133
  end
134
134
  end
135
135
 
136
- def self.install_release_pod(update, repo_update, verbose)
136
+ def self.install_release_pod(update, repo_update, verbose, clean_install)
137
137
  #切换工作目录到当前工程下, 开始执行pod install
138
138
  workspace = LProject.shared.workspace
139
139
  FileUtils.chdir(workspace)
@@ -170,7 +170,7 @@ module LgPodPlugin
170
170
  installer.update = false
171
171
  end
172
172
  installer.deployment = false
173
- installer.clean_install = false
173
+ installer.clean_install = clean_install
174
174
  installer.prepare
175
175
  resolve_dependencies(lockfile, installer)
176
176
  dependencies(installer)
@@ -1,3 +1,3 @@
1
1
  module LgPodPlugin
2
- VERSION = "1.1.5.5"
2
+ VERSION = "1.1.5.7"
3
3
  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.5.5
4
+ version: 1.1.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - dongzb01
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods