cocoapods-soul-component-plugin 0.0.7 → 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,11 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'cocoapods'
|
2
4
|
require 'fileutils'
|
3
5
|
require 'json'
|
4
6
|
require 'xcodeproj'
|
5
7
|
require 'cocoapods-downloader'
|
8
|
+
require 'cocoapods/user_interface'
|
6
9
|
require_relative '../gem_version'
|
7
10
|
|
8
11
|
module Pod
|
12
|
+
module Downloader
|
13
|
+
class Git < Base
|
14
|
+
def download_deep
|
15
|
+
clone(false, false)
|
16
|
+
checkout_commit if options[:commit]
|
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
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
9
27
|
class Command
|
10
28
|
class Devops < Command
|
11
29
|
self.summary = <<-SUMMARY
|
@@ -14,7 +32,6 @@ module Pod
|
|
14
32
|
self.description = <<-DESC
|
15
33
|
Install components through devops/components.json
|
16
34
|
DESC
|
17
|
-
self.arguments = []
|
18
35
|
|
19
36
|
def run
|
20
37
|
# do nothing
|
@@ -25,12 +42,25 @@ module Pod
|
|
25
42
|
end
|
26
43
|
|
27
44
|
module CocoapodsSoulComponentPlugin
|
28
|
-
|
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
|
29
59
|
|
30
60
|
class Soul_Component
|
31
61
|
attr_accessor :name, :local, :submodule, :version, :git, :branch, :path, :commit
|
32
62
|
|
33
|
-
def initialize(name, local, submodule, version, git, branch, path)
|
63
|
+
def initialize(name, local, submodule, version, git, branch, path, commit)
|
34
64
|
@name = name
|
35
65
|
@local = local
|
36
66
|
@submodule = submodule
|
@@ -40,6 +70,12 @@ module CocoapodsSoulComponentPlugin
|
|
40
70
|
@path = path
|
41
71
|
@commit = commit
|
42
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
|
43
79
|
end
|
44
80
|
|
45
81
|
def self.use_components
|
@@ -75,7 +111,7 @@ module CocoapodsSoulComponentPlugin
|
|
75
111
|
group = project.main_group
|
76
112
|
group.set_source_tree('SOURCE_ROOT')
|
77
113
|
# 向group中添加 文件引用
|
78
|
-
file_ref = group.new_reference(
|
114
|
+
file_ref = group.new_reference(component_file_path)
|
79
115
|
# podfile_local排序
|
80
116
|
podfile_local_group = group.children.last
|
81
117
|
group.children.pop
|
@@ -84,43 +120,54 @@ module CocoapodsSoulComponentPlugin
|
|
84
120
|
end
|
85
121
|
|
86
122
|
def self.pre_run
|
87
|
-
|
88
|
-
json = File.read(self.component_file_path)
|
123
|
+
json = File.read(component_file_path)
|
89
124
|
obj = JSON.parse(json)
|
90
125
|
dependencies = obj['dependencies']
|
91
126
|
|
92
127
|
dependencies.each do |each|
|
93
|
-
|
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)
|
94
138
|
end
|
95
139
|
|
96
|
-
|
97
|
-
if each.path
|
140
|
+
@@components.each do |each|
|
141
|
+
if each.path.nil?
|
98
142
|
if each.submodule == false
|
99
143
|
if each.local == true
|
100
144
|
local_path = each.name
|
101
|
-
|
102
|
-
|
103
|
-
local_path += each.branch.to_s.tr('/','-')
|
104
|
-
end
|
105
|
-
if each.commit != nil
|
145
|
+
|
146
|
+
if !each.commit.nil?
|
106
147
|
local_path += '-'
|
107
148
|
local_path += each.commit.to_s
|
149
|
+
elsif !each.branch.nil?
|
150
|
+
local_path += '-'
|
151
|
+
local_path += each.branch.to_s
|
152
|
+
elsif !each.version.nil?
|
153
|
+
local_path += '-'
|
154
|
+
local_path += each.version.to_s
|
108
155
|
end
|
109
156
|
target_path = "#{root_path}/LocalPods/#{local_path}"
|
110
157
|
each.path = target_path
|
111
158
|
|
112
159
|
if File.exist?(target_path) == false
|
113
|
-
options = { git: each.git, commit: each.commit, branch: each.branch }
|
160
|
+
options = { git: each.git, commit: each.commit, tag: each.version, branch: each.branch }
|
114
161
|
options = Pod::Downloader.preprocess_options(options)
|
115
162
|
downloader = Pod::Downloader.for_target(target_path, options)
|
116
|
-
|
117
|
-
downloader.
|
163
|
+
Pod::UI.puts "本地依赖 #{each.name} 不存在,即将进行下载 。参数:#{options}".green
|
164
|
+
downloader.download_deep
|
165
|
+
else
|
166
|
+
Pod::UI.puts "本地依赖 #{each.name} 已存在,不进行变更,如需更新请删除重新 install。位置:#{target_path}".yellow
|
118
167
|
end
|
119
168
|
end
|
120
|
-
|
121
|
-
|
122
|
-
each.path = "SOPods/#{each.name}"
|
123
|
-
end
|
169
|
+
elsif each.local == true
|
170
|
+
each.path = "SOPods/#{each.name}"
|
124
171
|
end
|
125
172
|
end
|
126
173
|
end
|
@@ -131,8 +178,21 @@ end
|
|
131
178
|
module Pod
|
132
179
|
class Command
|
133
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
|
+
|
134
192
|
alias old_run run
|
193
|
+
|
135
194
|
def run
|
195
|
+
Pod::UI.puts "当前版本:#{CocoapodsSoulComponentPlugin::VERSION}".green
|
136
196
|
CocoapodsSoulComponentPlugin.pre_run if CocoapodsSoulComponentPlugin.use_components
|
137
197
|
old_run
|
138
198
|
CocoapodsSoulComponentPlugin.post_run if CocoapodsSoulComponentPlugin.use_components
|
@@ -144,7 +204,7 @@ module Pod
|
|
144
204
|
alias old_initialize initialize
|
145
205
|
|
146
206
|
def initialize(name = nil, *requirements)
|
147
|
-
if requirements
|
207
|
+
if requirements.nil?
|
148
208
|
old_initialize(name)
|
149
209
|
return
|
150
210
|
end
|
@@ -153,14 +213,14 @@ module Pod
|
|
153
213
|
# puts name, requirements
|
154
214
|
# end
|
155
215
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
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
|
164
224
|
end
|
165
225
|
|
166
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
|