lg_pod_plugin 1.0.6 → 1.0.7

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: 11f480038abd98e1d68267cdecb33fad97daf06f68c4bd542713635599485aff
4
- data.tar.gz: bdb9387659bc7c27f4ed4225f5cb7652db6b6e0c9d20f099046c8230a28cd6c7
3
+ metadata.gz: '08d6552e96028f61341cb07bbfbe2df9ac251b1b1593e660b3b3b234736b39a3'
4
+ data.tar.gz: e4874317456dceb82367c673cb889808f5457dc1e2d745dd5425a48b9c36998c
5
5
  SHA512:
6
- metadata.gz: 6458b71bf1c86653acdffa295adadbaeda165aa7890055f72fde54e03c43a7b99d7158ec6fa9eb41107c47f3093946d796f8b5b605bd5917a1f6889887a0ce66
7
- data.tar.gz: 07a5cd8e0e9e6d4630978fd38033388ce97d656f2943fe8006ee328665000a1f527db5f00073b34667b44f920bad1561d3f492359a5ff3b28202ba338b591ea7
6
+ metadata.gz: 583abb98b34e909ab5db9ceb2553d248777f13d4e148a0b9c7c7e59e03bc82c605edbed6d4369feb73c8627fbe8a2f15f9705649ecced7f4596648cb27c2476f
7
+ data.tar.gz: 4b19537a073dad421432bebde6491f667db38a7b88db6a2674547cdb63a3e43756e50bb480222dcd33cf8ad873f992b5ac4156d5652d64b4b7f7064aac8ec1fa
@@ -22,7 +22,10 @@ module LgPodPlugin
22
22
 
23
23
  # 根据branch 下载 zip 包
24
24
  def git_download_branch_zip(path, temp_name)
25
- token = ""
25
+ token = LRequest.shared.token
26
+ unless token
27
+ return self.git_clone_by_branch(path, temp_name)
28
+ end
26
29
  file_name = "#{temp_name}.zip"
27
30
  base_url = self.git[0...self.git.length - 4]
28
31
  project_name = base_url.split("/").last
@@ -48,7 +51,10 @@ module LgPodPlugin
48
51
 
49
52
  # 通过tag下载zip包
50
53
  def git_download_tag_zip(path, temp_name)
51
- token = ""
54
+ token = LRequest.shared.token
55
+ unless token
56
+ return self.git_clone_by_tag(path, temp_name)
57
+ end
52
58
  base_url = self.git[0...self.git.length - 4]
53
59
  project_name = base_url.split("/").last
54
60
  unless project_name
@@ -74,7 +80,10 @@ module LgPodPlugin
74
80
  end
75
81
  # 通过 commit 下载zip包
76
82
  def git_download_commit_zip(path, temp_name)
77
- token = ""
83
+ token = LRequest.shared.token
84
+ unless token
85
+ return self.git_clone_by_commit(path, temp_name)
86
+ end
78
87
  base_url = self.git[0...self.git.length - 4]
79
88
  project_name = base_url.split("/").last
80
89
  unless project_name
@@ -126,19 +135,19 @@ module LgPodPlugin
126
135
  FileUtils.chdir(path)
127
136
  temp_name = "lg_temp_pod"
128
137
  if self.git && self.tag
129
- if self.git.include?("xxx/capp/iOS")
138
+ if self.git.include?("capp/iOS")
130
139
  return git_download_tag_zip(path, temp_name)
131
140
  else
132
141
  return self.git_clone_by_tag(path, temp_name)
133
142
  end
134
143
  elsif self.git && self.branch
135
- if self.git.include?("xxx/capp/iOS")
144
+ if self.git.include?("capp/iOS")
136
145
  return self.git_download_branch_zip(path, temp_name)
137
146
  else
138
147
  return self.git_clone_by_branch(path, temp_name)
139
148
  end
140
149
  elsif self.git && self.commit
141
- if self.git.include?("xxx/capp/iOS")
150
+ if self.git.include?("capp/iOS")
142
151
  return self.git_download_commit_zip(path, temp_name)
143
152
  else
144
153
  return self.git_clone_by_commit(path, temp_name)
@@ -1,5 +1,7 @@
1
- require 'singleton'
2
1
  require 'yaml'
2
+ require 'json'
3
+ require 'net/http'
4
+ require 'singleton'
3
5
  require_relative 'l_cache'
4
6
  require_relative 'git_util'
5
7
  require_relative 'downloader.rb'
@@ -7,7 +9,7 @@ module LgPodPlugin
7
9
 
8
10
  class LRequest
9
11
  include Singleton
10
- REQUIRED_ATTRS ||= %i[name options workspace cache downloader git_util lock_info lock_params is_update].freeze
12
+ REQUIRED_ATTRS ||= %i[name options workspace cache downloader git_util lock_info lock_params is_update token].freeze
11
13
  attr_accessor(*REQUIRED_ATTRS)
12
14
 
13
15
  def is_update_pod
@@ -125,6 +127,9 @@ module LgPodPlugin
125
127
  hash_map[:commit] = new_commit
126
128
  hash_map[:branch] = new_branch
127
129
  end
130
+ if self.token == nil
131
+ self.token = self.request_gitlab_token(git)
132
+ end
128
133
  self.options = hash_map
129
134
  self.cache = LCache.new(self.workspace)
130
135
  self.git_util = LGitUtil.new(name, hash_map)
@@ -135,6 +140,27 @@ module LgPodPlugin
135
140
  return LRequest.instance
136
141
  end
137
142
 
143
+ def request_gitlab_token(git)
144
+ if git == nil
145
+ return nil
146
+ end
147
+ begin
148
+ #81.69.242.162
149
+ uri = URI('http://81.69.242.162:8080/v1/member/user/gitlab/token')
150
+ # uri = URI('http://127.0.0.1:8080/v1/member/user/gitlab/token')
151
+ params = {"url" => git}
152
+ res = Net::HTTP.post_form(uri, params)
153
+ json = JSON.parse(res.body)
154
+ rescue
155
+ return nil
156
+ end
157
+ unless json
158
+ return nil
159
+ end
160
+ token = json["data"]["token"]
161
+ return token
162
+ end
163
+
138
164
  end
139
165
 
140
166
  end
@@ -1,3 +1,3 @@
1
1
  module LgPodPlugin
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lg_pod_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - dongzb01