lg_pod_plugin 1.1.6.0 → 1.1.6.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: 8cf74181198e5c879bdbf6ef84ca2de6286d56fa355665a9f68db20fda87b9ba
4
- data.tar.gz: bc480be0ff2a011c60aa23a48355c03c6b329c0a6360708c9c7aa5e1a26b44a2
3
+ metadata.gz: 75b2349a1ddeb538035e926a25be2f3a18589e307c158dce81e3282e9c656e5d
4
+ data.tar.gz: 284ee67f49b9d6dba2123aba1c0649f8c525a5528666f772568a81c24c489b87
5
5
  SHA512:
6
- metadata.gz: ce2163d8778eb68adef6fec76595ba9a2cd66be2abea079011c8294155b30f84d48bc659dc510f27e046a1637a9e554357e81d3ceb5cb0a45a11e23f364d34f7
7
- data.tar.gz: 79005659b57432323474fc0237f1c0e01aff28602d6d72cd349e42f8e6ef755b2fc09519f3f577c4a483d17275cc2dac4bd0491d776a349aefbf32d8ceab234c
6
+ metadata.gz: dd8f333635e20d8f19a76bb0077ba52e48dd92d700941b22584ec5c875044ff827dec95eba287f8af1f820ac592140b98d76869f29b5d38e5fd21678e9c4ca08
7
+ data.tar.gz: 99c8fe2a58f062dc236862e2af6802afa2d7832a8a3a0a9c4d2c1ba9a1c814c18fb51fd8bde6686e301e4a9d61a1baef1bb77f7c788f51d0ae347c6167c922a6
@@ -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
- nil
58
+ return nil
61
59
  else
62
60
  LgPodPlugin.log_green "find the new commit of `#{name}`, Git downloading now."
63
61
  # 本地 git 下载 pod 目录
@@ -17,7 +17,7 @@ module LgPodPlugin
17
17
  if (File.exist?(destination) && !destination.children.empty?) && cache_pod_spec.exist?
18
18
  return [true, destination, cache_pod_spec]
19
19
  else
20
- [false, destination, cache_pod_spec]
20
+ return [false, destination, cache_pod_spec]
21
21
  end
22
22
  end
23
23
 
@@ -58,12 +58,12 @@ module LgPodPlugin
58
58
  Pathname.new(path.to_path + '.podspec.json')
59
59
  end
60
60
 
61
- def self.cached_spec(request)
62
- path = path_for_spec(request)
63
- path.file? && Specification.from_file(path)
64
- rescue JSON::ParserError
65
- nil
66
- end
61
+ # def self.cached_spec(request)
62
+ # path = path_for_spec(request)
63
+ # path.file? && Specification.from_file(path)
64
+ # rescue JSON::ParserError
65
+ # nil
66
+ # end
67
67
 
68
68
  def self.get_local_spec(request, target)
69
69
  result = Pod::Downloader::Response.new
@@ -86,7 +86,7 @@ module LgPodPlugin
86
86
  [result, local_specs]
87
87
  end
88
88
 
89
- def self.group_sub_specs_by_platform(spec)
89
+ def self.group_subspecs_by_platform(spec)
90
90
  specs_by_platform = {}
91
91
  [spec, *spec.recursive_subspecs].each do |ss|
92
92
  ss.available_platforms.each do |platform|
@@ -98,7 +98,7 @@ module LgPodPlugin
98
98
  end
99
99
 
100
100
  def self.copy_and_clean(source, destination, spec)
101
- specs_by_platform = group_sub_specs_by_platform(spec)
101
+ specs_by_platform = group_subspecs_by_platform(spec)
102
102
  destination.parent.mkpath
103
103
  self.write_lock(destination) do
104
104
  FileUtils.rm_rf(destination)
@@ -109,7 +109,8 @@ module LgPodPlugin
109
109
  end
110
110
 
111
111
  def self.clean_pod_unused_files(destination, spec)
112
- specs_by_platform = group_sub_specs_by_platform(spec)
112
+ specs_by_platform = group_subspecs_by_platform(spec)
113
+ destination.parent.mkpath
113
114
  self.write_lock(destination) do
114
115
  Pod::Installer::PodSourcePreparer.new(spec, destination).prepare!
115
116
  Pod::Sandbox::PodDirCleaner.new(destination, specs_by_platform).clean!
@@ -117,37 +118,37 @@ module LgPodPlugin
117
118
  end
118
119
 
119
120
  def self.write_lock(location, &block)
120
- self.lock(location, File::LOCK_EX, &block)
121
- end
122
-
123
- def self.lock(location, lock_type)
124
- raise ArgumentError, 'no block given' unless block_given?
125
- lockfile = "#{location}.lock"
126
- f = nil
127
- loop do
128
- f.close if f
129
- f = File.open(lockfile, File::CREAT, 0o644)
130
- f.flock(lock_type)
131
- break if self.valid_lock?(f, lockfile)
132
- end
133
- begin
134
- yield location
135
- ensure
136
- if lock_type == File::LOCK_SH
137
- f.flock(File::LOCK_EX)
138
- File.delete(lockfile) if self.valid_lock?(f, lockfile)
139
- else
140
- File.delete(lockfile)
141
- end
142
- f.close
143
- end
144
- end
145
-
146
- def self.valid_lock?(file, filename)
147
- file.stat.ino == File.stat(filename).ino
148
- rescue Errno::ENOENT
149
- false
150
- end
121
+ Pod::Downloader::Cache.lock(location, File::LOCK_SH, &block)
122
+ end
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
151
152
 
152
153
  public
153
154
  def self.write_spec(spec, path)
@@ -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
@@ -113,11 +107,6 @@ module LgPodPlugin
113
107
  hash_map[:git] = git if git
114
108
  if git && tag
115
109
  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
110
  return hash_map
122
111
  elsif git && branch
123
112
  hash_map[:branch] = branch
@@ -127,7 +116,6 @@ module LgPodPlugin
127
116
  new_commit = pod_info[:sha] ||= ""
128
117
  if lock_branch == branch && new_commit == lock_commit
129
118
  hash_map[:commit] = lock_commit
130
- hash_map["is_delete"] = true
131
119
  return hash_map
132
120
  end
133
121
  end
@@ -137,19 +125,7 @@ module LgPodPlugin
137
125
  elsif lock_commit && !lock_commit.empty?
138
126
  hash_map[:commit] = lock_commit
139
127
  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
147
128
  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
129
  hash_map[:commit] = commit
154
130
  return hash_map
155
131
  else
@@ -173,7 +149,6 @@ module LgPodPlugin
173
149
  if new_branch
174
150
  hash_map[:branch] = new_branch
175
151
  end
176
- hash_map["is_delete"] = true
177
152
  return hash_map
178
153
  end
179
154
  end
@@ -182,11 +157,6 @@ module LgPodPlugin
182
157
  if new_commit && !new_commit.empty?
183
158
  hash_map[:commit] = new_commit
184
159
  end
185
- if !new_commit || new_commit.empty?
186
- hash_map["is_delete"] = true
187
- else
188
- hash_map["is_delete"] = false
189
- end
190
160
  end
191
161
  hash_map
192
162
  end
@@ -21,7 +21,10 @@ module LgPodPlugin
21
21
  def install(pod)
22
22
  hash = pod.checkout_options
23
23
  path = hash[:path]
24
- return nil if path
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
- is_delete = request.params["is_delete"] ||= false
66
- LProject.shared.need_update_pods.delete(name) if is_delete
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
- git = checkout_options[:git]
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
- all_installers[download_params["name"]] = installer
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
@@ -35,7 +35,7 @@ module LgPodPlugin
35
35
  end
36
36
  @cache_specs = Hash.new
37
37
  @external_pods = Hash.new.merge!(external_pods)
38
- @need_update_pods = Hash.new.merge!(external_pods)
38
+ @need_update_pods = Hash.new
39
39
  @redirect_url_hash = Hash.new
40
40
  return self
41
41
  end
@@ -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
@@ -47,8 +47,7 @@ module LgPodPlugin
47
47
  http = "https://ghproxy.com/" + http
48
48
  source["http"] = http
49
49
  end
50
- version = attributes_hash["version"]
51
- requirements = {:http => http, :version => version}
50
+ requirements = {:http => http }
52
51
  elsif git && tag
53
52
  tag = tag.to_s unless LUtils.is_a_string? tag
54
53
  requirements = { :git => git, :tag => tag }
@@ -74,14 +73,17 @@ module LgPodPlugin
74
73
  # 通过 swift 可执行文件进行异步下载任务
75
74
  LgPodPlugin::Concurrency.async_download_pods all_installers
76
75
  end
76
+
77
77
 
78
- def self.dependencies(installer)
79
- installer.download_dependencies
78
+ def self.download_dependencies(installer)
79
+ installer.send(:download_dependencies)
80
80
  installer.send(:validate_targets)
81
+ installer.send(:clean_sandbox)
81
82
  installation_options = installer.send(:installation_options)
82
83
  skip_pods_project_generation = installation_options.send(:skip_pods_project_generation)
83
84
  if skip_pods_project_generation
84
85
  installer.show_skip_pods_project_generation_message
86
+ installer.send(:run_podfile_post_install_hooks)
85
87
  else
86
88
  installer.integrate
87
89
  end
@@ -132,7 +134,7 @@ module LgPodPlugin
132
134
  raise Pod::Informative, "No `Podfile.lock' found in the project directory, run `pod install'."
133
135
  end
134
136
  end
135
-
137
+
136
138
  def self.install_release_pod(update, repo_update, verbose, clean_install)
137
139
  #切换工作目录到当前工程下, 开始执行pod install
138
140
  workspace = LProject.shared.workspace
@@ -173,7 +175,7 @@ module LgPodPlugin
173
175
  installer.clean_install = clean_install
174
176
  installer.prepare
175
177
  resolve_dependencies(lockfile, installer)
176
- dependencies(installer)
178
+ download_dependencies(installer)
177
179
  end
178
180
 
179
181
  end
@@ -1,3 +1,3 @@
1
1
  module LgPodPlugin
2
- VERSION = "1.1.6.0"
2
+ VERSION = "1.1.6.3"
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.6.0
4
+ version: 1.1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - dongzb01
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-15 00:00:00.000000000 Z
11
+ date: 2023-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.11.3
19
+ version: 1.12.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.11.3
26
+ version: 1.12.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: claide
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -76,16 +76,16 @@ dependencies:
76
76
  name: bundler
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '='
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 2.3.7
81
+ version: 2.0.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '='
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 2.3.7
88
+ version: 2.0.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: rake
91
91
  requirement: !ruby/object:Gem::Requirement