cocoapods-soul-component-plugin 0.0.10 → 0.0.11
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fe112b7a0c2576a90976d2ad3893dff3ebf8043b1426f61273282ae1d0344b8
|
4
|
+
data.tar.gz: 78f2bc8841a4005661a077c460dc4714a548a37cc00f1e57f438dc46cf227a61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc7abff4f40879636d4e611dd7a61992cdd7a3acbb51d14d29659934eff48c1b8ecb073efe29fc5c567ab8724941b7e2b66b131ab5b7900a9b4a6658df575f73
|
7
|
+
data.tar.gz: b25d96af0cb3455fbb40c6f0ad3f2c4f934f0ea23bc60d9449748b492b3211ab64c36960405bbc38f31b577b6c20bc138bba392ba75177bd95c3db1d61549ef2
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods'
|
2
4
|
require 'fileutils'
|
3
5
|
require 'json'
|
@@ -10,9 +12,15 @@ module Pod
|
|
10
12
|
module Downloader
|
11
13
|
class Git < Base
|
12
14
|
def download_deep
|
13
|
-
clone(false,false
|
15
|
+
clone(false, false)
|
14
16
|
checkout_commit if options[:commit]
|
15
17
|
end
|
18
|
+
|
19
|
+
def self.check_if_has_auth_clone(url)
|
20
|
+
cmd = "git ls-remote #{url} --exit-code"
|
21
|
+
stdout, stderr, status = Open3.capture3(cmd)
|
22
|
+
status.success?
|
23
|
+
end
|
16
24
|
end
|
17
25
|
end
|
18
26
|
|
@@ -24,7 +32,6 @@ module Pod
|
|
24
32
|
self.description = <<-DESC
|
25
33
|
Install components through devops/components.json
|
26
34
|
DESC
|
27
|
-
self.arguments = []
|
28
35
|
|
29
36
|
def run
|
30
37
|
# do nothing
|
@@ -35,7 +42,20 @@ module Pod
|
|
35
42
|
end
|
36
43
|
|
37
44
|
module CocoapodsSoulComponentPlugin
|
38
|
-
|
45
|
+
@@components = []
|
46
|
+
@@use_source = false
|
47
|
+
|
48
|
+
def self.use_source=(t_use_source)
|
49
|
+
@@use_source = t_use_source
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.use_source
|
53
|
+
@@use_source
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.components
|
57
|
+
@@components
|
58
|
+
end
|
39
59
|
|
40
60
|
class Soul_Component
|
41
61
|
attr_accessor :name, :local, :submodule, :version, :git, :branch, :path, :commit
|
@@ -50,6 +70,12 @@ module CocoapodsSoulComponentPlugin
|
|
50
70
|
@path = path
|
51
71
|
@commit = commit
|
52
72
|
end
|
73
|
+
|
74
|
+
def to_hash
|
75
|
+
instance_variables.map do |var|
|
76
|
+
[var[1..-1].to_sym, instance_variable_get(var)]
|
77
|
+
end.to_h
|
78
|
+
end
|
53
79
|
end
|
54
80
|
|
55
81
|
def self.use_components
|
@@ -85,7 +111,7 @@ module CocoapodsSoulComponentPlugin
|
|
85
111
|
group = project.main_group
|
86
112
|
group.set_source_tree('SOURCE_ROOT')
|
87
113
|
# 向group中添加 文件引用
|
88
|
-
file_ref = group.new_reference(
|
114
|
+
file_ref = group.new_reference(component_file_path)
|
89
115
|
# podfile_local排序
|
90
116
|
podfile_local_group = group.children.last
|
91
117
|
group.children.pop
|
@@ -94,28 +120,36 @@ module CocoapodsSoulComponentPlugin
|
|
94
120
|
end
|
95
121
|
|
96
122
|
def self.pre_run
|
97
|
-
|
98
|
-
json = File.read(self.component_file_path)
|
123
|
+
json = File.read(component_file_path)
|
99
124
|
obj = JSON.parse(json)
|
100
125
|
dependencies = obj['dependencies']
|
101
126
|
|
102
127
|
dependencies.each do |each|
|
103
|
-
|
128
|
+
component = Soul_Component.new(each[0], each[1]['local'], each[1]['submodule'], each[1]['version'], each[1]['git'],
|
129
|
+
each[1]['branch'], each[1]['path'], each[1]['commit'])
|
130
|
+
if @@use_source
|
131
|
+
component.local = true
|
132
|
+
if Pod::Downloader::Git.check_if_has_auth_clone(component.git) == false
|
133
|
+
component.local = false
|
134
|
+
Pod::UI.puts "本地依赖 #{component.name} 切换失败,使用 binary 。参数:#{component.to_hash}".red
|
135
|
+
end
|
136
|
+
end
|
137
|
+
@@components.push(component)
|
104
138
|
end
|
105
139
|
|
106
|
-
|
107
|
-
if each.path
|
140
|
+
@@components.each do |each|
|
141
|
+
if each.path.nil?
|
108
142
|
if each.submodule == false
|
109
143
|
if each.local == true
|
110
144
|
local_path = each.name
|
111
145
|
|
112
|
-
if each.commit
|
146
|
+
if !each.commit.nil?
|
113
147
|
local_path += '-'
|
114
148
|
local_path += each.commit.to_s
|
115
|
-
elsif each.branch
|
149
|
+
elsif !each.branch.nil?
|
116
150
|
local_path += '-'
|
117
151
|
local_path += each.branch.to_s
|
118
|
-
elsif each.version
|
152
|
+
elsif !each.version.nil?
|
119
153
|
local_path += '-'
|
120
154
|
local_path += each.version.to_s
|
121
155
|
end
|
@@ -123,7 +157,7 @@ module CocoapodsSoulComponentPlugin
|
|
123
157
|
each.path = target_path
|
124
158
|
|
125
159
|
if File.exist?(target_path) == false
|
126
|
-
options = { git: each.git, commit: each.commit, tag: each.version, branch:each.branch }
|
160
|
+
options = { git: each.git, commit: each.commit, tag: each.version, branch: each.branch }
|
127
161
|
options = Pod::Downloader.preprocess_options(options)
|
128
162
|
downloader = Pod::Downloader.for_target(target_path, options)
|
129
163
|
Pod::UI.puts "本地依赖 #{each.name} 不存在,即将进行下载 。参数:#{options}".green
|
@@ -132,10 +166,8 @@ module CocoapodsSoulComponentPlugin
|
|
132
166
|
Pod::UI.puts "本地依赖 #{each.name} 已存在,不进行变更,如需更新请删除重新 install。位置:#{target_path}".yellow
|
133
167
|
end
|
134
168
|
end
|
135
|
-
|
136
|
-
|
137
|
-
each.path = "SOPods/#{each.name}"
|
138
|
-
end
|
169
|
+
elsif each.local == true
|
170
|
+
each.path = "SOPods/#{each.name}"
|
139
171
|
end
|
140
172
|
end
|
141
173
|
end
|
@@ -146,8 +178,21 @@ end
|
|
146
178
|
module Pod
|
147
179
|
class Command
|
148
180
|
class Install < Command
|
181
|
+
def self.options
|
182
|
+
[
|
183
|
+
['--source', 'Use source']
|
184
|
+
].concat(super)
|
185
|
+
end
|
186
|
+
|
187
|
+
def initialize(argv)
|
188
|
+
CocoapodsSoulComponentPlugin.use_source = argv.flag?('source')
|
189
|
+
super
|
190
|
+
end
|
191
|
+
|
149
192
|
alias old_run run
|
193
|
+
|
150
194
|
def run
|
195
|
+
Pod::UI.puts "当前版本:#{CocoapodsSoulComponentPlugin::VERSION}".green
|
151
196
|
CocoapodsSoulComponentPlugin.pre_run if CocoapodsSoulComponentPlugin.use_components
|
152
197
|
old_run
|
153
198
|
CocoapodsSoulComponentPlugin.post_run if CocoapodsSoulComponentPlugin.use_components
|
@@ -159,7 +204,7 @@ module Pod
|
|
159
204
|
alias old_initialize initialize
|
160
205
|
|
161
206
|
def initialize(name = nil, *requirements)
|
162
|
-
if requirements
|
207
|
+
if requirements.nil?
|
163
208
|
old_initialize(name)
|
164
209
|
return
|
165
210
|
end
|
@@ -168,14 +213,14 @@ module Pod
|
|
168
213
|
# puts name, requirements
|
169
214
|
# end
|
170
215
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
216
|
+
CocoapodsSoulComponentPlugin.components.each do |each|
|
217
|
+
next unless each.name == name
|
218
|
+
|
219
|
+
requirements = if each.local == true
|
220
|
+
[{ name: each.name, path: each.path }]
|
221
|
+
else
|
222
|
+
[each.version]
|
223
|
+
end
|
179
224
|
end
|
180
225
|
|
181
226
|
old_initialize(name, *requirements)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-soul-component-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09
|
11
|
+
date: 2021-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|