lg_pod_plugin 1.1.7.3 → 1.1.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ module LgPodPlugin
12
12
  attr_reader :checkout_options
13
13
 
14
14
  public
15
- REQUIRED_ATTRS ||= %i[git tag name commit branch config path spec].freeze
15
+ REQUIRED_ATTRS ||= %i[git tag name commit branch config path].freeze
16
16
  attr_accessor(*REQUIRED_ATTRS)
17
17
 
18
18
  def initialize(checkout_options = {})
@@ -20,7 +20,6 @@ module LgPodPlugin
20
20
  self.tag = checkout_options[:tag]
21
21
  self.name = checkout_options[:name]
22
22
  self.path = checkout_options[:path]
23
- self.spec = checkout_options[:spec]
24
23
  self.config = checkout_options[:config]
25
24
  self.commit = checkout_options[:commit]
26
25
  self.branch = checkout_options[:branch]
@@ -57,51 +56,9 @@ module LgPodPlugin
57
56
  else
58
57
  return nil
59
58
  end
60
- lg_spec = self.spec
61
- unless lg_spec
62
- podspec_filename = self.name + ".podspec"
63
- podspec_content = GitLabAPI.get_podspec_file_content(host, token, project.id, sha, podspec_filename)
64
- unless podspec_content && LUtils.is_a_string?(podspec_content)
65
- download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
66
- download_url += "\\&access_token\\=#{token}" if token
67
- return [{ "filename" => "#{self.name}.tar.bz2", "url" => download_url }]
68
- end
69
- pod_spec_file_path = sandbox_path.join("#{podspec_filename}")
70
- lg_spec = LgPodPlugin::PodSpec.form_string(podspec_content, pod_spec_file_path)
71
- if podspec_content
72
- begin
73
- File.open(pod_spec_file_path, "w+") do |f|
74
- f.write podspec_content
75
- end
76
- rescue => exception
77
- LgPodPlugin.log_red "#{exception}"
78
- end
79
- @podspec_content = podspec_content
80
- end
81
- unless lg_spec
82
- download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
83
- download_url += "\\&access_token\\=#{token}" if token
84
- return [{ "filename" => "#{self.name}.tar.bz2", "url" => download_url }]
85
- end
86
- self.spec = lg_spec
87
- end
88
- download_params = Array.new
89
- @source_files = lg_spec.source_files.keys
90
- lg_spec.source_files.each_key do |key|
91
- next if key == "All" || key == "LICENSE" || key == "License"
92
- path = LUtils.url_encode(key)
93
- # download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2#{"\\?"}" + "sha#{"\\="}#{sha}"
94
- download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2#{"\\?"}" + "path#{"\\="}#{path}#{"\\&"}sha#{"\\="}#{sha}"
95
- download_url += "\\&access_token\\=#{token}" if token
96
- download_params.append({ "filename" => "#{path}.tar.bz2", "url" => download_url })
97
- end
98
- if download_params.empty?
99
- download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
100
- download_url += "\\&access_token\\=#{token}" if token
101
- [{ "filename" => "#{self.name}.tar.bz2", "url" => download_url }]
102
- else
103
- download_params
104
- end
59
+ download_url = host + "/api/v4/projects/" + "#{project.id}" + "/repository/archive.tar.bz2\\?" + "sha\\=#{sha}"
60
+ download_url += "\\&access_token\\=#{token}" if token
61
+ download_params = { "filename" => "#{self.name}.tar.bz2", "url" => download_url }
105
62
  end
106
63
 
107
64
  # 根据branch 下载 zip 包
@@ -113,18 +70,8 @@ module LgPodPlugin
113
70
  download_params["token"] = token
114
71
  download_params["name"] = self.name
115
72
  download_params["type"] = "gitlab-branch"
116
- if self.spec
117
- download_params["podspec"] = self.spec
118
- else
119
- download_params["podspec_content"] = @podspec_content
120
- end
121
73
  download_params["path"] = root_path.to_path
122
- if @source_files
123
- download_params["source_files"] = @source_files
124
- else
125
- download_params["source_files"] = "All"
126
- end
127
- download_params["download_urls"] = download_urls
74
+ download_params = download_params.merge(download_urls)
128
75
  download_params
129
76
  end
130
77
 
@@ -137,18 +84,8 @@ module LgPodPlugin
137
84
  download_params["token"] = token
138
85
  download_params["name"] = self.name
139
86
  download_params["type"] = "gitlab-tag"
140
- if self.spec
141
- download_params["podspec"] = self.spec
142
- else
143
- download_params["podspec_content"] = @podspec_content
144
- end
145
87
  download_params["path"] = root_path.to_path
146
- if @source_files
147
- download_params["source_files"] = @source_files
148
- else
149
- download_params["source_files"] = "All"
150
- end
151
- download_params["download_urls"] = download_urls
88
+ download_params = download_params.merge(download_urls)
152
89
  download_params
153
90
  end
154
91
 
@@ -160,19 +97,9 @@ module LgPodPlugin
160
97
  download_params = Hash.new
161
98
  download_params["token"] = token
162
99
  download_params["name"] = self.name
163
- if self.spec
164
- download_params["podspec"] = self.spec
165
- else
166
- download_params["podspec_content"] = @podspec_content
167
- end
168
100
  download_params["type"] = "gitlab-commit"
169
101
  download_params["path"] = root_path.to_path
170
- if @source_files
171
- download_params["source_files"] = @source_files
172
- else
173
- download_params["source_files"] = "All"
174
- end
175
- download_params["download_urls"] = download_urls
102
+ download_params = download_params.merge(download_urls)
176
103
  download_params
177
104
  end
178
105
 
@@ -1,7 +1,6 @@
1
1
  require 'uri'
2
2
  require_relative 'git_download'
3
3
  require_relative '../utils/l_util'
4
- require_relative '../config/podspec'
5
4
 
6
5
  module LgPodPlugin
7
6
 
@@ -10,13 +9,12 @@ module LgPodPlugin
10
9
  private
11
10
  attr_reader :checkout_options
12
11
  public
13
- REQUIRED_ATTRS ||= %i[http name path lg_spec].freeze
12
+ REQUIRED_ATTRS ||= %i[http name path].freeze
14
13
  attr_accessor(*REQUIRED_ATTRS)
15
14
  def initialize(checkout_options = {})
16
15
  self.name = checkout_options[:name]
17
16
  self.path = checkout_options[:path]
18
17
  self.http = checkout_options[:http]
19
- self.lg_spec = checkout_options[:spec]
20
18
  @checkout_options = checkout_options
21
19
  end
22
20
 
@@ -26,11 +24,8 @@ module LgPodPlugin
26
24
  download_params["path"] = self.path.to_path
27
25
  download_params["name"] = self.name
28
26
  download_params["type"] = "http"
29
- download_params["download_urls"] = [{ "filename" => (new_filename ? new_filename : filename), "url" => http }]
30
- if self.lg_spec
31
- download_params["podspec"] = self.lg_spec
32
- download_params["source_files"] = self.lg_spec.source_files.keys
33
- end
27
+ download_params["filename"] = (new_filename ? new_filename : filename)
28
+ download_params["url"] = http
34
29
  download_params
35
30
  end
36
31
 
@@ -29,34 +29,37 @@ module LgPodPlugin
29
29
 
30
30
  public
31
31
  def copy_file_to_caches
32
- request = @downloader.send(:request)
33
- name = request.send(:name)
32
+ request = downloader.request
33
+ name = request.name
34
34
  params = Hash.new.merge!(request.params)
35
35
  checkout_options = Hash.new.merge!(request.checkout_options)
36
36
  commit = checkout_options[:commit] ||= params[:commit]
37
- if request.lg_spec
38
- cache_podspec = request.lg_spec.spec
37
+ if request.podspec
38
+ cache_podspec = request.podspec
39
39
  else
40
40
  cache_podspec = LProject.shared.cache_specs[name]
41
- request.lg_spec = LgPodPlugin::PodSpec.form_pod_spec cache_podspec if cache_podspec
41
+ request.podspec = cache_podspec if cache_podspec
42
42
  end
43
43
  destination = self.download_params["destination"]
44
44
  cache_pod_spec_path = self.download_params["cache_pod_spec_path"]
45
- # podspec.json 不存在
46
- unless cache_podspec
47
- local_spec_path = destination.glob("#{name}.podspec{,.json}").last
45
+ if cache_podspec.nil?
46
+ local_spec_path = Pathname(destination).glob("#{name}.podspec{,.json}").last
48
47
  if local_spec_path && File.exist?(local_spec_path)
49
48
  cache_podspec = Pod::Specification.from_file local_spec_path
50
49
  if cache_podspec
51
50
  LProject.shared.cache_specs[name] = cache_podspec
51
+ LCache.copy_and_clean nil, destination, cache_podspec
52
52
  LCache.write_spec cache_podspec, cache_pod_spec_path
53
- LCache.clean_pod_unused_files destination, cache_podspec
54
53
  end
55
54
  end
56
- request.lg_spec = LgPodPlugin::PodSpec.form_pod_spec cache_podspec if cache_podspec
55
+ request.podspec = cache_podspec if cache_podspec
56
+ else
57
+ LProject.shared.cache_specs[name] = cache_podspec
58
+ LCache.copy_and_clean nil, destination, cache_podspec
59
+ LCache.write_spec cache_podspec, cache_pod_spec_path
57
60
  end
58
61
  # 判断缓存是否下载成功
59
- if (destination && File.exist?(destination) && !Pathname(destination).children.empty?) && (cache_pod_spec_path && File.exist?(cache_pod_spec_path))
62
+ if destination && destination.exist? && !destination.children.empty?
60
63
  pod_is_exist = true
61
64
  else
62
65
  pod_is_exist = false
@@ -65,7 +68,7 @@ module LgPodPlugin
65
68
 
66
69
  git = checkout_options[:git]
67
70
  return unless git
68
- cache_podspec = request.lg_spec.spec if request.lg_spec
71
+ cache_podspec = request.podspec
69
72
  branch = checkout_options[:branch] ||= request.params[:branch]
70
73
  checkout_options[:name] = name if name
71
74
  checkout_options[:branch] = branch if branch
@@ -16,9 +16,14 @@ module LgPodPlugin
16
16
  end
17
17
  end
18
18
 
19
+ def self.ensure_matching_version
20
+ cache = Pod::Downloader::Cache.new(LFileManager.cache_root_path)
21
+ end
22
+
19
23
  public
20
24
  def self.run(command, options = {})
21
25
  clean_sandbox()
26
+ ensure_matching_version()
22
27
  workspace = Pathname(Dir.pwd)
23
28
  update = (command == "update")
24
29
  LSqliteDb.shared.init_database
@@ -35,46 +35,13 @@ module LgPodPlugin
35
35
  @hostname = @scheme + "://" + @host
36
36
  end
37
37
 
38
- # def get_redirect_url(host)
39
- # redirect_url = Net::HTTP.get_response(URI(host))['location']
40
- # return host unless redirect_url
41
- # uri = URI(redirect_url)
42
- # return uri.scheme + "://" + uri.host
43
- # end
44
-
45
38
  private
46
39
  #判断是否是 IP 地址
47
40
  def is_address(host)
48
41
  match = %r{^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$}.match(host)
49
42
  !(match.nil?)
50
43
  end
51
-
52
- # 获取 ip 地址
53
- # private
54
- # def getaddress(uri)
55
- # begin
56
- # if self.is_address(uri.host)
57
- # ip = uri.host
58
- # return ip
59
- # else
60
- # ip_address = Resolv.getaddress uri.host
61
- # return ip_address
62
- # end
63
- # rescue
64
- # result = %x(ping #{uri.host} -t 1)
65
- # return if !result || result == "" || result.include?("timeout")
66
- # match = %r{\d+.\d+.\d+.\d+}.match(result)
67
- # return if match.nil?
68
- # ip_address = match ? match[0] : ""
69
- # begin
70
- # return ip_address if IPAddr.new(ip_address)
71
- # rescue => exception
72
- # LgPodPlugin.log_red exception
73
- # return nil
74
- # end
75
- # end
76
- # end
77
-
44
+
78
45
  public def to_s
79
46
  return "" unless @uri
80
47
  @uri.to_s
@@ -1,5 +1,4 @@
1
1
 
2
- require_relative '../config/podspec'
3
2
 
4
3
  module LgPodPlugin
5
4
 
@@ -1,7 +1,7 @@
1
1
  require 'cocoapods'
2
2
  require 'cocoapods-core'
3
3
  require 'cocoapods/user_interface'
4
- require_relative '../config/podspec'
4
+ # require_relative '../config/podspec'
5
5
  require_relative '../installer/concurrency'
6
6
 
7
7
  module LgPodPlugin
@@ -46,7 +46,8 @@ module LgPodPlugin
46
46
  http = "https://ghproxy.com/" + http
47
47
  source["http"] = http
48
48
  end
49
- requirements = {:http => http }
49
+ version = attributes_hash["version"] ||= ""
50
+ requirements = {:http => http, :version => version}
50
51
  elsif git && tag
51
52
  tag = tag.to_s unless LUtils.is_a_string? tag
52
53
  requirements = { :git => git, :tag => tag }
@@ -55,8 +56,7 @@ module LgPodPlugin
55
56
  end
56
57
  next if check_release_pod_exist(pod_name, requirements, spec, true)
57
58
  LProject.shared.cache_specs[pod_name] = spec
58
- lg_spec = LgPodPlugin::PodSpec.form_pod_spec spec
59
- release_pod = ReleasePod.new(nil, pod_name, requirements, lg_spec)
59
+ release_pod = ReleasePod.new(nil, pod_name, requirements, spec)
60
60
  pod_install = LgPodPlugin::LPodInstaller.new
61
61
  download_params = pod_install.install(release_pod)
62
62
  all_installers.append pod_install if download_params
@@ -23,6 +23,11 @@ module LgPodPlugin
23
23
  return self.download_director.join(director)
24
24
  end
25
25
 
26
+ def self.cache_root_path
27
+ cache_path = Pod::Config.instance.cache_root + 'Pods'
28
+ cache_path
29
+ end
30
+
26
31
  end
27
32
 
28
33
  end
@@ -1,36 +1,12 @@
1
- require 'json'
2
- require 'resolv'
3
- require "ipaddr"
4
- require 'base64'
5
- require 'fileutils'
6
- require_relative 'aes-crypt'
7
-
8
1
  module LgPodPlugin
9
2
 
10
3
  class LUtils
11
4
 
12
- def self.encrypt(message, password)
13
- encrypted_data = AESCrypt.encrypt(message, password)
14
- encrypted_data.tr("\n", "")
15
- end
16
-
17
- def self.decrypt(message, password)
18
- AESCrypt.decrypt message, password
19
- end
20
-
21
5
  def self.md5(text)
22
6
  return "" unless text
23
7
  return Digest::MD5.hexdigest(text)
24
8
  end
25
9
 
26
- def self.base64_encode(text)
27
- Base64.encode64(text)
28
- end
29
-
30
- def self.base64_decode(text)
31
- Base64.decode64(text)
32
- end
33
-
34
10
  #判断对象是不是 String
35
11
  def self.is_a_string?(obj)
36
12
  if "#{obj.class}" == "String"
@@ -1,3 +1,3 @@
1
1
  module LgPodPlugin
2
- VERSION = "1.1.7.3"
2
+ VERSION = "1.1.8.1"
3
3
  end
data/lib/lg_pod_plugin.rb CHANGED
@@ -22,7 +22,7 @@ require_relative 'lg_pod_plugin/utils/l_util'
22
22
  require_relative 'lg_pod_plugin/git/gitlab_api'
23
23
  require_relative 'lg_pod_plugin/net/net-ping'
24
24
  require_relative 'lg_pod_plugin/git/gitlab_archive'
25
- require_relative 'lg_pod_plugin/config/lockfile_model'
25
+ # require_relative 'lg_pod_plugin/config/lockfile_model'
26
26
  require_relative 'lg_pod_plugin/downloader/downloader'
27
27
  require_relative 'lg_pod_plugin/git/git_download'
28
28
  require_relative 'lg_pod_plugin/git/git_clone'
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.7.3
4
+ version: 1.1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dongzb01
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2024-02-29 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.12.1
19
+ version: 1.14.2
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.12.1
26
+ version: 1.14.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: claide
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,20 +92,20 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '1.6'
95
+ version: '1.7'
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: 1.6.3
98
+ version: 1.7.2
99
99
  type: :runtime
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: '1.6'
105
+ version: '1.7'
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 1.6.3
108
+ version: 1.7.2
109
109
  description: 拦截pod_install 方法, 并设置 pod 方法参数列表
110
110
  email:
111
111
  - 1060545231@qq.com
@@ -125,8 +125,6 @@ files:
125
125
  - lib/command/update.rb
126
126
  - lib/lg_pod_plugin.rb
127
127
  - lib/lg_pod_plugin/config/l_config.rb
128
- - lib/lg_pod_plugin/config/lockfile_model.rb
129
- - lib/lg_pod_plugin/config/podspec.rb
130
128
  - lib/lg_pod_plugin/config/target.rb
131
129
  - lib/lg_pod_plugin/db/database.rb
132
130
  - lib/lg_pod_plugin/downloader/downloader.rb
@@ -149,7 +147,6 @@ files:
149
147
  - lib/lg_pod_plugin/net/net-ping.rb
150
148
  - lib/lg_pod_plugin/pod/external_pod.rb
151
149
  - lib/lg_pod_plugin/pod/release-pod.rb
152
- - lib/lg_pod_plugin/utils/aes-crypt.rb
153
150
  - lib/lg_pod_plugin/utils/file_path.rb
154
151
  - lib/lg_pod_plugin/utils/l_util.rb
155
152
  - lib/lg_pod_plugin/utils/log.rb
@@ -174,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
171
  - !ruby/object:Gem::Version
175
172
  version: '0'
176
173
  requirements: []
177
- rubygems_version: 3.4.20
174
+ rubygems_version: 3.5.6
178
175
  signing_key:
179
176
  specification_version: 4
180
177
  summary: 封装了自定义podfile 中pod 方法
@@ -1,58 +0,0 @@
1
- require 'cocoapods-core'
2
-
3
- module LgPodPlugin
4
-
5
- class LockfileModel
6
- attr_accessor :lockfile
7
- attr_accessor :release_pods
8
- attr_accessor :external_sources_data
9
- attr_accessor :checkout_options_data
10
-
11
- def initialize
12
- end
13
-
14
- def self.from_file
15
- lockfile = LProject.shared.lockfile
16
- unless lockfile
17
- lockfile_model = LockfileModel.new
18
- lockfile_model.lockfile = nil
19
- lockfile_model.release_pods = {}
20
- lockfile_model.checkout_options_data = {}
21
- lockfile_model.external_sources_data = {}
22
- return lockfile_model
23
- end
24
- release_pods = Hash.new
25
- pods = lockfile.send(:generate_pod_names_and_versions)
26
- pods.each do |element|
27
- if LUtils.is_a_string?(element) || element.is_a?(Hash)
28
- key = element.is_a?(Hash) ? element.keys.first : element
29
- next unless key
30
- if key.include?(" ")
31
- pod_name = LUtils.pod_real_name(key.split(" ").first)
32
- else
33
- pod_name = key
34
- end
35
- tag = key[/(?<=\().*?(?=\))/]
36
- release_pods[pod_name] = tag
37
- else
38
- next
39
- end
40
- end
41
- lockfile_model = LockfileModel.new
42
- lockfile_model.lockfile = lockfile
43
- lockfile_model.release_pods = release_pods
44
- lockfile_model.checkout_options_data = lockfile.send(:checkout_options_data)
45
- lockfile_model.checkout_options_data = {} unless lockfile_model.checkout_options_data
46
- lockfile_model.external_sources_data = lockfile.send(:external_sources_data)
47
- lockfile_model.external_sources_data = {} unless lockfile_model.external_sources_data
48
- lockfile_model
49
- end
50
-
51
- def checkout_options_for_pod_named(name)
52
- return {} unless @lockfile
53
- hash = @lockfile.checkout_options_for_pod_named(name)
54
- hash ? hash : {}
55
- end
56
-
57
- end
58
- end