lg_pod_plugin 1.1.5.9 → 1.1.6.0

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: ebaf5437bed598ffa64a8ed94863d10c05c0cfcb848e9edbf726ad212662878b
4
- data.tar.gz: 1e10a6ad2ec5b02e8771a2580db0374d635998320aaa8739bb4bebcf80eba0ba
3
+ metadata.gz: 8cf74181198e5c879bdbf6ef84ca2de6286d56fa355665a9f68db20fda87b9ba
4
+ data.tar.gz: bc480be0ff2a011c60aa23a48355c03c6b329c0a6360708c9c7aa5e1a26b44a2
5
5
  SHA512:
6
- metadata.gz: 629fa53e19b009413466cd44b9c6ecf28bffcfd7e500524cdf449d4ef6ef0f298a925f7eb0390b734d0937f57712f7cc078227afbe60950d39a923f845b4c026
7
- data.tar.gz: 7772b927826ef6fe0476db3933e9863b27a98aced13853b58583d3141cdf89c09ff5655e2da90e2258f82e1697155aa2a6c0d24d1bb1729b288df6b6b93578fe
6
+ metadata.gz: ce2163d8778eb68adef6fec76595ba9a2cd66be2abea079011c8294155b30f84d48bc659dc510f27e046a1637a9e554357e81d3ceb5cb0a45a11e23f364d34f7
7
+ data.tar.gz: 79005659b57432323474fc0237f1c0e01aff28602d6d72cd349e42f8e6ef755b2fc09519f3f577c4a483d17275cc2dac4bd0491d776a349aefbf32d8ceab234c
@@ -4,10 +4,11 @@ module LgPodPlugin
4
4
  class LPodTarget
5
5
  attr_reader :name
6
6
  attr_reader :dependencies
7
+ attr_reader :internal_hash
7
8
  def initialize(target)
8
- internal_hash = target.send(:internal_hash)
9
- @name = internal_hash["name"]
10
- array = Array.new(internal_hash['dependencies'] ||= [])
9
+ @internal_hash = target.send(:internal_hash)
10
+ @name = @internal_hash["name"]
11
+ array = Array.new(@internal_hash['dependencies'] ||= [])
11
12
  dependencies = array.reject do |e|
12
13
  if LUtils.is_a_string?(e)
13
14
  true
@@ -29,5 +30,6 @@ module LgPodPlugin
29
30
  end
30
31
  @dependencies = external_pods
31
32
  end
33
+
32
34
  end
33
35
  end
@@ -49,13 +49,13 @@ module LgPodPlugin
49
49
  LgPodPlugin.log_green "Using `#{name}`"
50
50
  end
51
51
  hash_map = self.request.get_cache_key_params
52
+ self.request.checkout_options.delete(:branch) if commit
53
+ self.request.checkout_options[:commit] = commit if commit
52
54
  # 发现本地有缓存, 不需要更新缓存
53
55
  pod_is_exist, destination, cache_pod_spec = LCache.new.pod_cache_exist(name, hash_map, podspec, self.request.released_pod)
54
56
  if pod_is_exist
55
57
  is_delete = self.request.params["is_delete"] ||= false
56
58
  LProject.shared.need_update_pods.delete(name) if is_delete
57
- self.request.checkout_options.delete(:branch) if commit
58
- self.request.checkout_options[:commit] = commit if commit
59
59
  LgPodPlugin.log_green "find the cache of `#{name}`, you can use it now."
60
60
  nil
61
61
  else
@@ -106,8 +106,6 @@ module LgPodPlugin
106
106
  LgPodPlugin::LCache.cache_pod(name, download_params, self.request.get_cache_key_params,podspec, self.request.released_pod)
107
107
  FileUtils.chdir(LFileManager.download_director)
108
108
  FileUtils.rm_rf(download_params)
109
- self.request.checkout_options.delete(:branch) if commit
110
- self.request.checkout_options[:commit] = commit if commit
111
109
  end
112
110
  nil
113
111
  end
@@ -64,8 +64,6 @@ module LgPodPlugin
64
64
  if pod_is_exist
65
65
  is_delete = request.params["is_delete"] ||= false
66
66
  LProject.shared.need_update_pods.delete(name) if is_delete
67
- request.checkout_options.delete(:branch) if commit
68
- request.checkout_options[:commit] = commit if commit
69
67
  else
70
68
  git = checkout_options[:git]
71
69
  return unless git
@@ -91,8 +89,6 @@ module LgPodPlugin
91
89
  end
92
90
  FileUtils.chdir(LFileManager.download_director)
93
91
  FileUtils.rm_rf(download_params)
94
- request.checkout_options.delete(:branch) if commit
95
- request.checkout_options[:commit] = commit if commit
96
92
  end
97
93
 
98
94
  end
@@ -19,7 +19,7 @@ module LgPodPlugin
19
19
 
20
20
  public
21
21
  def self.run(command, options = {})
22
- self.clean_sandbox
22
+ clean_sandbox()
23
23
  workspace = Pathname(Dir.pwd)
24
24
  update = (command == "update")
25
25
  LSqliteDb.shared.init_database
@@ -16,6 +16,7 @@ module LgPodPlugin
16
16
  attr_reader :external_pods
17
17
  attr_reader :need_update_pods
18
18
  attr_accessor :cache_specs
19
+ attr_accessor :redirect_url_hash
19
20
  def setup(workspace,podfile_path, update, repo_update)
20
21
  @podfile = Pod::Podfile.from_file(podfile_path)
21
22
  @update = update
@@ -35,7 +36,8 @@ module LgPodPlugin
35
36
  @cache_specs = Hash.new
36
37
  @external_pods = Hash.new.merge!(external_pods)
37
38
  @need_update_pods = Hash.new.merge!(external_pods)
38
- self
39
+ @redirect_url_hash = Hash.new
40
+ return self
39
41
  end
40
42
 
41
43
  def self.shared
@@ -5,7 +5,7 @@ module LgPodPlugin
5
5
 
6
6
  class LURI
7
7
  public
8
- attr_reader :path
8
+ # attr_reader :path
9
9
  attr_reader :host
10
10
  attr_reader :scheme
11
11
  attr_reader :hostname
@@ -13,51 +13,47 @@ module LgPodPlugin
13
13
  attr_reader :uri
14
14
  public
15
15
  def initialize(git)
16
- begin
17
- uri = URI(git)
18
- rescue => exception
19
- if git.include?("git@") && git.include?(":")
20
- match = %r{(?<=git@).*?(?=:)}.match(git)
21
- host = match ? match[0] : ""
16
+ if git.include?("git@") && git.include?(":")
17
+ match = %r{(?<=git@).*?(?=:)}.match(git)
18
+ host = match ? match[0] : ""
19
+ if is_address(host)
22
20
  base_url = LUtils.get_gitlab_base_url(git)
23
21
  path = base_url.split(":").last
24
- uri = URI("http://#{host}/#{path}")
22
+ origin_uri = URI("http://#{host}/#{path}")
25
23
  else
26
- LgPodPlugin.log_red exception
27
- uri = nil
24
+ base_url = LUtils.get_gitlab_base_url(git)
25
+ path = base_url.split(":").last
26
+ origin_uri = URI("https://#{host}/#{path}")
28
27
  end
28
+ else
29
+ origin_uri = URI(git)
29
30
  end
30
- return unless uri
31
- if git.include?("ssh") || git.include?("git@gitlab") || git.include?("git@")
32
- redirect_url = get_redirect_url("https://#{uri.host}#{uri.path}")
33
- @uri = URI(redirect_url)
31
+ return if origin_uri.nil?
32
+ redirect_url = LProject.shared.redirect_url_hash[origin_uri.host]
33
+ if redirect_url
34
+ @uri = redirect_url
34
35
  else
35
- redirect_url = get_redirect_url("#{uri.scheme}://#{uri.host}#{uri.path}")
36
- @uri = URI(redirect_url)
36
+ @uri = URI(get_redirect_url(origin_uri.scheme + "://" + origin_uri.host))
37
+ LProject.shared.redirect_url_hash[origin_uri.host] = @uri
37
38
  end
38
- @host = @uri.host ||= ""
39
- @path = @uri.path ||= ""
40
- @scheme = @uri.scheme ||= ""
39
+ @host = @uri.host
40
+ @scheme = @uri.scheme ||= "https"
41
41
  @hostname = @scheme + "://" + @host
42
42
  end
43
43
 
44
44
  def get_redirect_url(host)
45
45
  redirect_url = Net::HTTP.get_response(URI(host))['location']
46
- begin
47
- uri = URI(redirect_url)
48
- return uri.scheme + "://" + uri.host
49
- rescue
50
- return host
51
- end
46
+ return host unless redirect_url
47
+ uri = URI(redirect_url)
48
+ return uri.scheme + "://" + uri.host
52
49
  end
53
50
 
54
-
55
51
  private
56
52
  #判断是否是 IP 地址
57
- # def is_address(host)
58
- # 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)
59
- # !(match.nil?)
60
- # end
53
+ def is_address(host)
54
+ 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)
55
+ !(match.nil?)
56
+ end
61
57
 
62
58
  # 获取 ip 地址
63
59
  # private
@@ -1,3 +1,3 @@
1
1
  module LgPodPlugin
2
- VERSION = "1.1.5.9"
2
+ VERSION = "1.1.6.0"
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.9
4
+ version: 1.1.6.0
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-13 00:00:00.000000000 Z
11
+ date: 2023-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods