cocoapods-cafswitcher 0.0.21 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +9 -9
- data/lib/cocoapods-cafswitcher/Main.rb +73 -82
- data/lib/cocoapods-cafswitcher/cafswitcher_config.rb +2 -2
- data/lib/cocoapods-cafswitcher/gem_version.rb +1 -1
- data/lib/cocoapods-cafswitcher/podfile_switch.rb +167 -157
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2b650e49c2c0a6f19a7f0aa37fa64c9b64c09f0359ee306dfcc8a659c1725bc
|
4
|
+
data.tar.gz: 0c9dfea436263167b1f129ac65490967800cc670a838267cb32456d40f06ccab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7676648a65cabf108a3f69013afcfe0ae95d6a1db77d012d589609d1d9d9cf28d270dddf5ff1b20f4343bf5f24a164976a1278ad4ae25406fb7a86bcb70efdef
|
7
|
+
data.tar.gz: 2e3b89f31b5d7012a7d9d68d4de22b08a4d344702cc96e7e916048bd5422d042e04aa6ced600eb1a4ff31c831d48d6709dbd4d350f85c892773ce8624cf4d74b
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cocoapods-cafswitcher (0.0.
|
4
|
+
cocoapods-cafswitcher (0.0.23)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -15,11 +15,11 @@ GEM
|
|
15
15
|
atomos (0.1.3)
|
16
16
|
bacon (1.2.0)
|
17
17
|
claide (1.0.2)
|
18
|
-
cocoapods (1.
|
18
|
+
cocoapods (1.7.0)
|
19
19
|
activesupport (>= 4.0.2, < 5)
|
20
20
|
claide (>= 1.0.2, < 2.0)
|
21
|
-
cocoapods-core (= 1.
|
22
|
-
cocoapods-deintegrate (>= 1.0.
|
21
|
+
cocoapods-core (= 1.7.0)
|
22
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
23
23
|
cocoapods-downloader (>= 1.2.2, < 2.0)
|
24
24
|
cocoapods-plugins (>= 1.0.0, < 2.0)
|
25
25
|
cocoapods-search (>= 1.0.0, < 2.0)
|
@@ -33,8 +33,8 @@ GEM
|
|
33
33
|
molinillo (~> 0.6.6)
|
34
34
|
nap (~> 1.0)
|
35
35
|
ruby-macho (~> 1.4)
|
36
|
-
xcodeproj (>= 1.8.
|
37
|
-
cocoapods-core (1.
|
36
|
+
xcodeproj (>= 1.8.2, < 2.0)
|
37
|
+
cocoapods-core (1.7.0)
|
38
38
|
activesupport (>= 4.0.2, < 6)
|
39
39
|
fuzzy_match (~> 2.0.4)
|
40
40
|
nap (~> 1.0)
|
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
concurrent-ruby (~> 1.0)
|
59
59
|
metaclass (0.0.4)
|
60
60
|
minitest (5.11.3)
|
61
|
-
mocha (1.
|
61
|
+
mocha (1.8.0)
|
62
62
|
metaclass (~> 0.0.1)
|
63
63
|
mocha-on-bacon (0.2.3)
|
64
64
|
mocha (>= 0.13.0)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
netrc (0.11.0)
|
69
69
|
prettybacon (0.0.2)
|
70
70
|
bacon (~> 1.2)
|
71
|
-
rake (12.3.
|
71
|
+
rake (12.3.2)
|
72
72
|
ruby-macho (1.4.0)
|
73
73
|
thread_safe (0.3.6)
|
74
74
|
tzinfo (1.2.5)
|
@@ -89,7 +89,7 @@ DEPENDENCIES
|
|
89
89
|
cocoapods
|
90
90
|
cocoapods-cafswitcher!
|
91
91
|
cocoapods-plugins
|
92
|
-
cocoapods-stats
|
92
|
+
cocoapods-stats (= 1.0.0)
|
93
93
|
mocha
|
94
94
|
mocha-on-bacon
|
95
95
|
prettybacon
|
@@ -35,65 +35,60 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_
|
|
35
35
|
#
|
36
36
|
#
|
37
37
|
allNames = Pod::Podfile.allPodName.uniq
|
38
|
-
|
38
|
+
gitPathList = Pod::Podfile.gitPathList.uniq
|
39
39
|
currentSourceList = Pod::Podfile.sourceList.uniq
|
40
|
-
currentArchiveList = Pod::Podfile.archiveList.uniq
|
41
40
|
currentFrameworkList = Pod::Podfile.frameworkList.uniq
|
41
|
+
currentUnspecifiedList = Pod::Podfile.unspecifiedList.uniq
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
setEnv(name, '_ARCHIVE')
|
47
|
-
# ENV["#{name}_ARCHIVE"] = '1'
|
48
|
-
end
|
49
|
-
elsif ENV['IS_SOURCE']
|
43
|
+
is_Source = false
|
44
|
+
if ENV['IS_SOURCE']
|
45
|
+
is_Source = true
|
50
46
|
ENV.delete('IS_SOURCE')
|
51
47
|
allNames.each do |name|
|
52
48
|
setEnv(name, '_SOURCE')
|
53
|
-
#
|
54
|
-
Pod::Podfile.tmpSourceList << name
|
49
|
+
# Pod::Podfile.tmpSourceList << name
|
55
50
|
end
|
56
51
|
end
|
57
52
|
|
58
53
|
isDebug = true
|
59
54
|
if ENV['IS_RELEASE']
|
60
|
-
isDebug =
|
55
|
+
isDebug = false
|
61
56
|
end
|
62
57
|
|
63
58
|
# 对debug和release切换,release级别高
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# # ENV["#{releaseName}_RELEASE"] = '1'
|
74
|
-
# end
|
59
|
+
for debugName in Pod::Podfile.debugPackageList.uniq
|
60
|
+
cleanDebugENV(debugName)
|
61
|
+
setEnv(debugName, "_DEBUG")
|
62
|
+
end
|
63
|
+
|
64
|
+
for releaseName in Pod::Podfile.releasePackageList.uniq
|
65
|
+
cleanDebugENV(releaseName)
|
66
|
+
setEnv(releaseName, "_RELEASE")
|
67
|
+
end
|
75
68
|
|
76
69
|
# 二进制切换
|
77
70
|
currentSourceList.each do |sourceName|
|
78
71
|
cleanENV(sourceName)
|
79
72
|
setEnv(sourceName, '_SOURCE')
|
80
|
-
# ENV["#{sourceName}_SOURCE"] = '1'
|
81
|
-
end
|
82
|
-
|
83
|
-
currentArchiveList.each do |archiveName|
|
84
|
-
cleanENV(archiveName)
|
85
|
-
setEnv(archiveName, '_ARCHIVE')
|
86
|
-
# ENV["#{archiveName}_ARCHIVE"] = '1'
|
87
73
|
end
|
88
74
|
|
89
75
|
currentFrameworkList.each do |frameworkName|
|
90
76
|
cleanENV(frameworkName)
|
91
77
|
setEnv(frameworkName, '_FRAMEWORK')
|
92
|
-
# ENV["#{frameworkName}_FRAMEWORK"] = '1'
|
93
78
|
end
|
94
79
|
|
80
|
+
currentUnspecifiedList.each do |unspecifiedName|
|
81
|
+
next unless !is_Source
|
82
|
+
cleanENV(unspecifiedName)
|
83
|
+
if gitPathList.include?(unspecifiedName)
|
84
|
+
setEnv(unspecifiedName, '_SOURCE')
|
85
|
+
else
|
86
|
+
setEnv(unspecifiedName, '_FRAMEWORK')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
95
91
|
sourceList = []
|
96
|
-
archiveList = []
|
97
92
|
frameworkList = []
|
98
93
|
debugPackageList = Array.new
|
99
94
|
releasePackageList = Array.new
|
@@ -109,24 +104,27 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_
|
|
109
104
|
|
110
105
|
if ENV["#{envName}_SOURCE"] == '1'
|
111
106
|
sourceList << name
|
112
|
-
elsif ENV["#{envName}_ARCHIVE"] == '1'
|
113
|
-
archiveList << name
|
114
107
|
else
|
115
108
|
frameworkList << name
|
116
109
|
end
|
117
110
|
end
|
118
111
|
Pod::UI.puts "\n"
|
119
112
|
Pod::UI.puts "is Source :\n #{sourceList}"
|
120
|
-
Pod::UI.puts "is Archive :\n #{archiveList}"
|
121
113
|
Pod::UI.puts "is Framework :\n #{frameworkList}"
|
122
114
|
|
123
115
|
Pod::UI.puts "debugPackage tag :\n #{debugPackageList}"
|
124
116
|
Pod::UI.puts "releasePackage tag:\n #{releasePackageList}"
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
117
|
+
|
118
|
+
# 保存最终设置
|
119
|
+
Pod::Podfile.sourceList.clear()
|
120
|
+
Pod::Podfile.frameworkList.clear()
|
121
|
+
Pod::Podfile.debugPackageList.clear()
|
122
|
+
Pod::Podfile.releasePackageList.clear()
|
123
|
+
|
124
|
+
Pod::Podfile.sourceList.concat(sourceList)
|
125
|
+
Pod::Podfile.frameworkList.concat(frameworkList)
|
126
|
+
Pod::Podfile.debugPackageList.concat(debugPackageList)
|
127
|
+
Pod::Podfile.releasePackageList.concat(releasePackageList)
|
130
128
|
|
131
129
|
# 如果某一个Pod和上一次比发生变化,需要清除缓存
|
132
130
|
# 1. 清除pod缓存
|
@@ -134,11 +132,10 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_
|
|
134
132
|
# 2. 清除壳工程的pod文件夹下的缓存(如果指向的是path,即本地,不做处理)
|
135
133
|
# rm -r -f Pod/LJCache
|
136
134
|
# 3. 保存本次配置
|
137
|
-
#
|
138
135
|
|
139
|
-
|
140
|
-
#
|
141
|
-
caf_hash = Hash['sourceList' => sourceList, '
|
136
|
+
|
137
|
+
# 现在的状态
|
138
|
+
caf_hash = Hash['sourceList' => sourceList, 'frameworkList' => frameworkList,
|
142
139
|
'debugPackageList' => debugPackageList, 'releasePackageList' => releasePackageList ]
|
143
140
|
|
144
141
|
|
@@ -149,12 +146,13 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_
|
|
149
146
|
configPath = config.cafConfigPath
|
150
147
|
FileUtils.mkdir_p(configPath) unless configPath.exist?
|
151
148
|
configFile = config.cafConfigFile
|
152
|
-
|
149
|
+
# 旧的状态
|
150
|
+
cafConfig = Hash['sourceList' => [], 'frameworkList' => [],
|
153
151
|
'debugPackageList' => [], 'releasePackageList' => []]
|
154
152
|
if configFile.exist?
|
155
|
-
|
156
|
-
if
|
157
|
-
cafConfig =
|
153
|
+
cafConfigLockContent = YAML.load(File.open(configFile))
|
154
|
+
if cafConfigLockContent
|
155
|
+
cafConfig = cafConfigLockContent
|
158
156
|
end
|
159
157
|
else
|
160
158
|
FileUtils.touch configFile
|
@@ -180,12 +178,6 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_
|
|
180
178
|
cafSourceList = cafConfig['sourceList']
|
181
179
|
end
|
182
180
|
changedSubPods |= (value | cafSourceList) - (value & cafSourceList)
|
183
|
-
elsif key == 'archiveList'
|
184
|
-
cafArchiveList = []
|
185
|
-
if cafConfig.include?('archiveList')
|
186
|
-
cafArchiveList = cafConfig['archiveList']
|
187
|
-
end
|
188
|
-
changedSubPods |= (value | cafArchiveList) - (value & cafArchiveList)
|
189
181
|
elsif key == 'frameworkList'
|
190
182
|
cafFrameworkList = []
|
191
183
|
if cafConfig.include?('frameworkList')
|
@@ -197,39 +189,47 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_
|
|
197
189
|
|
198
190
|
Pod::UI.puts "\nchanged sub Pod is:\n " + changedSubPods.to_s unless changedSubPods.empty?
|
199
191
|
# changedPod 里是根据subspec来存的,需要进行合并,找到pod库而不是含有subspec的库
|
200
|
-
|
192
|
+
|
201
193
|
changedPods = []
|
202
194
|
changedSubPods.each do |subPod|
|
203
195
|
podName = subPod.split('/')[0]
|
204
196
|
changedPods << podName
|
205
197
|
end
|
206
198
|
changedPods.uniq!
|
207
|
-
Pod::Podfile.changedPods.concat changedPods if changedPods
|
208
|
-
Pod::Podfile.changedSubPods.concat changedSubPods if changedSubPods
|
209
199
|
Pod::UI.puts "\nchanged Pod is:\n " + changedPods.to_s + "\n" unless changedPods.empty?
|
210
200
|
|
201
|
+
clean(changedSubPods)
|
202
|
+
|
203
|
+
# 把新的配置写入file
|
204
|
+
File.open(configFile, 'wb') {|f| YAML.dump(caf_hash, f) } unless changedSubPods.empty?
|
205
|
+
end
|
206
|
+
|
207
|
+
|
208
|
+
def clean(changedSubPods)
|
209
|
+
config = Pod::Config.instance
|
211
210
|
@cache = Pod::Downloader::Cache.new(Pod::Config.instance.cache_root + 'Pods')
|
212
211
|
# 根据不同删除cache
|
213
212
|
podRoot = config.project_pods_root
|
214
213
|
changedSubPods.each do |changedSubPod|
|
215
214
|
changedPod = changedSubPod.split('/')[0]
|
215
|
+
|
216
|
+
# 清除本地的localFile 的JSON
|
216
217
|
localspecPath = podRoot + "Local Podspecs/" + "#{changedPod}.podspec.json"
|
217
218
|
if localspecPath.exist?
|
218
|
-
Pod::UI.message "Removing local Podspecs #{localspecPath}"
|
219
|
+
Pod::UI.message "Removing local Podspecs.json #{localspecPath}"
|
219
220
|
FileUtils.rm_r(localspecPath)
|
220
221
|
end
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
end
|
229
|
-
Pod::UI.message("Removing cache #{desc[:slug]}") do
|
230
|
-
FileUtils.rm_rf(desc[:slug])
|
231
|
-
end
|
222
|
+
# 清空缓存,因为缓存里有podspec.json
|
223
|
+
cache_descriptors = @cache.cache_descriptors_per_pod[changedPod]
|
224
|
+
if cache_descriptors
|
225
|
+
# TODO 检查changedSubPod
|
226
|
+
cache_descriptors.each do |desc|
|
227
|
+
Pod::UI.message("Removing spec #{desc[:spec_file]} (v#{desc[:version]})") do
|
228
|
+
FileUtils.rm desc[:spec_file]
|
232
229
|
end
|
230
|
+
# Pod::UI.message("Removing cache #{desc[:slug]}") do
|
231
|
+
# FileUtils.rm_rf(desc[:slug])
|
232
|
+
# end
|
233
233
|
end
|
234
234
|
end
|
235
235
|
# next unless changedSubPod =~ /^(?i)LJ/ || changedSubPod =~ /^(?i)Lianjia/ || changedSubPod.include?('/')
|
@@ -240,9 +240,6 @@ Pod::HooksManager.register('cocoapods-cafswitcher', :pre_install) do |installer_
|
|
240
240
|
FileUtils.rm_r(changedPodPath)
|
241
241
|
end
|
242
242
|
end
|
243
|
-
|
244
|
-
# 把新的配置写入file
|
245
|
-
File.open(configFile, 'wb') {|f| YAML.dump(caf_hash, f) } unless changedSubPods.empty?
|
246
243
|
end
|
247
244
|
|
248
245
|
|
@@ -258,17 +255,11 @@ end
|
|
258
255
|
def cleanENV(name)
|
259
256
|
envName = name.gsub(/[\/]/, '_')
|
260
257
|
ENV.delete("#{envName}_SOURCE")
|
261
|
-
ENV.delete("#{envName}_ARCHIVE")
|
262
258
|
ENV.delete("#{envName}_FRAMEWORK")
|
263
259
|
ENV.delete('IS_SOURCE')
|
264
|
-
ENV.delete('IS_ARCHIVE')
|
265
260
|
end
|
266
261
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
# end
|
272
|
-
#
|
273
|
-
|
274
|
-
Pod
|
262
|
+
def cleanDebugENV(name)
|
263
|
+
ENV.delete("#{name}_DEBUG")
|
264
|
+
ENV.delete("#{name}_RELEASE")
|
265
|
+
end
|
@@ -6,13 +6,13 @@ module Pod
|
|
6
6
|
attr_accessor :caf_config_path
|
7
7
|
|
8
8
|
def cafConfigPath
|
9
|
-
@caf_config_path = project_root + "
|
9
|
+
@caf_config_path = project_root + "Pods/"
|
10
10
|
end
|
11
11
|
|
12
12
|
attr_accessor :caf_config_file
|
13
13
|
|
14
14
|
def cafConfigFile
|
15
|
-
@caf_config_file = caf_config_path + "
|
15
|
+
@caf_config_file = caf_config_path + "CAFSwitcher.lock"
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
@@ -10,11 +10,6 @@ module Pod
|
|
10
10
|
:isSource
|
11
11
|
end
|
12
12
|
|
13
|
-
# add flag
|
14
|
-
# :isArchive => true
|
15
|
-
def self.isArchive
|
16
|
-
:isArchive
|
17
|
-
end
|
18
13
|
# add flag
|
19
14
|
# :isFramework
|
20
15
|
def self.isFramework
|
@@ -23,15 +18,15 @@ module Pod
|
|
23
18
|
|
24
19
|
# add flag
|
25
20
|
# :isDebugPackage
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
def self.isDebugPackage
|
22
|
+
:isDebugPackage
|
23
|
+
end
|
29
24
|
|
30
25
|
# add flag
|
31
26
|
# :isReleasePackage
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
def self.isReleasePackage
|
28
|
+
:isReleasePackage
|
29
|
+
end
|
35
30
|
|
36
31
|
@@sourceList = []
|
37
32
|
|
@@ -39,10 +34,10 @@ module Pod
|
|
39
34
|
@@sourceList
|
40
35
|
end
|
41
36
|
|
42
|
-
@@
|
37
|
+
@@unspecifiedList = []
|
43
38
|
|
44
|
-
def self.
|
45
|
-
@@
|
39
|
+
def self.unspecifiedList
|
40
|
+
@@unspecifiedList
|
46
41
|
end
|
47
42
|
|
48
43
|
@@frameworkList = []
|
@@ -70,31 +65,12 @@ module Pod
|
|
70
65
|
@@allPodName
|
71
66
|
end
|
72
67
|
|
73
|
-
@@
|
74
|
-
|
75
|
-
def self.needUpdatePodList
|
76
|
-
@@needUpdatePodList
|
77
|
-
end
|
78
|
-
|
79
|
-
@@changedSubPods = []
|
80
|
-
|
81
|
-
def self.changedSubPods
|
82
|
-
@@changedSubPods
|
83
|
-
end
|
84
|
-
|
85
|
-
@@changedPods= []
|
86
|
-
|
87
|
-
def self.changedPods
|
88
|
-
@@changedPods
|
89
|
-
end
|
90
|
-
|
91
|
-
@@tmpSourceList= []
|
68
|
+
@@gitPathList = []
|
92
69
|
|
93
|
-
def self.
|
94
|
-
|
70
|
+
def self.gitPathList
|
71
|
+
@@gitPathList
|
95
72
|
end
|
96
73
|
|
97
|
-
|
98
74
|
module DSL
|
99
75
|
# Enable code for all pods
|
100
76
|
# it has a lower priority to other binary settings
|
@@ -102,91 +78,54 @@ module Pod
|
|
102
78
|
ENV['IS_SOURCE'] = '1'
|
103
79
|
end
|
104
80
|
|
105
|
-
# Enable archive for all pods
|
106
|
-
# it has a lower priority to other binary settings
|
107
|
-
def all_archive!
|
108
|
-
ENV['IS_ARCHIVE'] = '1'
|
109
|
-
end
|
110
|
-
|
111
81
|
# Enable release package for all pods
|
112
82
|
# it has a lower priority to other binary settings
|
113
|
-
|
114
|
-
|
115
|
-
|
83
|
+
def all_release_package!
|
84
|
+
ENV['IS_RELEASE'] = '1'
|
85
|
+
end
|
116
86
|
|
117
87
|
end
|
118
88
|
|
119
89
|
class TargetDefinition
|
120
90
|
|
121
|
-
def
|
122
|
-
options = requirements.last
|
123
|
-
return requirements unless options.is_a?(Hash)
|
124
|
-
isFramework = options.key?(Pod::Podfile.isFramework)
|
125
|
-
# pod_name = Specification.root_name(name)
|
126
|
-
Pod::Podfile.frameworkList << name if isFramework
|
127
|
-
requirements.pop if options.empty?
|
128
|
-
end
|
129
|
-
|
130
|
-
def parse_isSource(name, requirements)
|
91
|
+
def parse_source_framework_key(name, requirements)
|
131
92
|
options = requirements.last
|
132
93
|
return requirements unless options.is_a?(Hash)
|
133
|
-
|
134
|
-
isSource = options.
|
135
|
-
|
136
|
-
|
94
|
+
isFramework = options.delete(Pod::Podfile.isFramework)
|
95
|
+
isSource = options.delete(Pod::Podfile.isSource)
|
96
|
+
if isSource or (isSource and isFramework)
|
97
|
+
Pod::Podfile.sourceList << name
|
98
|
+
elsif isFramework
|
99
|
+
Pod::Podfile.frameworkList << name
|
100
|
+
else
|
101
|
+
Pod::Podfile.unspecifiedList << name
|
102
|
+
end
|
137
103
|
requirements.pop if options.empty?
|
138
104
|
end
|
139
105
|
|
140
|
-
def
|
106
|
+
def parse_debug_release_package(name, requirements)
|
141
107
|
options = requirements.last
|
142
108
|
return requirements unless options.is_a?(Hash)
|
143
109
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
110
|
+
isDebugPackage = options.delete(Pod::Podfile.isDebugPackage)
|
111
|
+
isReleasePackage = options.delete(Pod::Podfile.isReleasePackage)
|
112
|
+
if (isDebugPackage and isReleasePackage) or isReleasePackage
|
113
|
+
Pod::Podfile.releasePackageList << name
|
114
|
+
else
|
115
|
+
Pod::Podfile.debugPackageList << name
|
116
|
+
end
|
148
117
|
requirements.pop if options.empty?
|
149
118
|
end
|
150
119
|
|
151
|
-
|
152
|
-
# options = requirements.last
|
153
|
-
# return requirements unless options.is_a?(Hash)
|
154
|
-
#
|
155
|
-
# isDebugPackage = options.has_key?(Pod::Podfile.isDebugPackage)
|
156
|
-
# # pod_name = Specification.root_name(name)
|
157
|
-
# Pod::Podfile.debugPackageList << name if isDebugPackage
|
158
|
-
# requirements.pop if options.empty?
|
159
|
-
# end
|
160
|
-
|
161
|
-
# def parse_release_package(name, requirements)
|
162
|
-
# options = requirements.last
|
163
|
-
# return requirements unless options.is_a?(Hash)
|
164
|
-
#
|
165
|
-
# isReleasePackage = options.has_key?(Pod::Podfile.isReleasePackage)
|
166
|
-
# # pod_name = Specification.root_name(name)
|
167
|
-
# Pod::Podfile.releasePackageList << name if isReleasePackage
|
168
|
-
# requirements.pop if options.empty?
|
169
|
-
# end
|
170
|
-
|
171
|
-
def parse_needUpdatePod_git(name, requirements)
|
120
|
+
def parse_git_path(name, requirements)
|
172
121
|
options = requirements.last
|
173
122
|
return requirements unless options.is_a?(Hash)
|
174
123
|
|
175
124
|
isGitPath = options.key?(:git)
|
176
|
-
|
177
|
-
Pod::Podfile.needUpdatePodList << name if isGitPath
|
178
|
-
Pod::Podfile.sourceList << name if isGitPath
|
179
|
-
requirements.pop if options.empty?
|
180
|
-
end
|
181
|
-
|
182
|
-
def parse_needUpdatePod_path(name, requirements)
|
183
|
-
options = requirements.last
|
184
|
-
return requirements unless options.is_a?(Hash)
|
125
|
+
Pod::Podfile.gitPathList << name if isGitPath
|
185
126
|
|
186
127
|
isPath = options.key?(:path)
|
187
|
-
|
188
|
-
Pod::Podfile.needUpdatePodList << name if isPath
|
189
|
-
Pod::Podfile.sourceList << name if isPath
|
128
|
+
Pod::Podfile.gitPathList << name if isPath
|
190
129
|
requirements.pop if options.empty?
|
191
130
|
end
|
192
131
|
|
@@ -196,52 +135,48 @@ module Pod
|
|
196
135
|
old_method = instance_method(:parse_inhibit_warnings)
|
197
136
|
|
198
137
|
define_method(:parse_inhibit_warnings) do |name, requirements|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
# parse_debug_package(name, requirements)
|
203
|
-
# parse_release_package(name, requirements)
|
204
|
-
parse_needUpdatePod_git(name, requirements)
|
205
|
-
parse_needUpdatePod_path(name, requirements)
|
138
|
+
parse_source_framework_key(name, requirements)
|
139
|
+
parse_debug_release_package(name, requirements)
|
140
|
+
parse_git_path(name, requirements)
|
206
141
|
Pod::Podfile.allPodName << name
|
207
142
|
old_method.bind(self).call(name, requirements)
|
208
143
|
end
|
209
144
|
|
210
|
-
def deep_copy(o)
|
211
|
-
|
212
|
-
end
|
213
|
-
|
214
|
-
def clean(name, requirements)
|
215
|
-
tmp_hash = deep_copy(requirements)
|
216
|
-
options = tmp_hash.last
|
217
|
-
return tmp_hash unless options.is_a?(Hash)
|
218
|
-
|
219
|
-
isFramework = options.delete(Pod::Podfile.isFramework)
|
220
|
-
isSource = options.delete(Pod::Podfile.isSource)
|
221
|
-
isArchive = options.delete(Pod::Podfile.isArchive)
|
222
|
-
# isDebugPackage = options.delete(Pod::Podfile.isDebugPackage)
|
223
|
-
# isReleasePackage = options.delete(Pod::Podfile.isReleasePackage)
|
224
|
-
tmp_hash.pop if options.empty?
|
225
|
-
tmp_hash
|
226
|
-
end
|
227
|
-
|
228
|
-
|
229
|
-
define_method(:store_pod) do |name, *requirements|
|
230
|
-
return if parse_subspecs(name, requirements) # This parse method must be called first
|
231
|
-
parse_inhibit_warnings(name, requirements)
|
232
|
-
parse_configuration_whitelist(name, requirements)
|
145
|
+
# def deep_copy(o)
|
146
|
+
# Marshal.load(Marshal.dump(o))
|
147
|
+
# end
|
233
148
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
149
|
+
# def clean(name, requirements)
|
150
|
+
# tmp_hash = deep_copy(requirements)
|
151
|
+
# options = tmp_hash.last
|
152
|
+
# return tmp_hash unless options.is_a?(Hash)
|
153
|
+
#
|
154
|
+
# isFramework = options.delete(Pod::Podfile.isFramework)
|
155
|
+
# isSource = options.delete(Pod::Podfile.isSource)
|
156
|
+
# isArchive = options.delete(Pod::Podfile.isArchive)
|
157
|
+
# # isDebugPackage = options.delete(Pod::Podfile.isDebugPackage)
|
158
|
+
# # isReleasePackage = options.delete(Pod::Podfile.isReleasePackage)
|
159
|
+
# tmp_hash.pop if options.empty?
|
160
|
+
# tmp_hash
|
161
|
+
# end
|
241
162
|
|
242
|
-
|
243
|
-
|
244
|
-
|
163
|
+
#
|
164
|
+
# define_method(:store_pod) do |name, *requirements|
|
165
|
+
# return if parse_subspecs(name, requirements) # This parse method must be called first
|
166
|
+
# parse_inhibit_warnings(name, requirements)
|
167
|
+
# parse_configuration_whitelist(name, requirements)
|
168
|
+
#
|
169
|
+
# # 去掉添加的字段
|
170
|
+
# tmp_hash = clean(name, requirements)
|
171
|
+
# pod = if tmp_hash && !tmp_hash.empty?
|
172
|
+
# { name => tmp_hash }
|
173
|
+
# else
|
174
|
+
# name
|
175
|
+
# end
|
176
|
+
#
|
177
|
+
# get_hash_value('dependencies', []) << pod
|
178
|
+
# nil
|
179
|
+
# end
|
245
180
|
|
246
181
|
end
|
247
182
|
end
|
@@ -249,40 +184,81 @@ module Pod
|
|
249
184
|
|
250
185
|
class Specification
|
251
186
|
|
187
|
+
def self.addDependency(spec, subspec)
|
188
|
+
dependence_note = []
|
189
|
+
if subspec.dependencies
|
190
|
+
subspec.dependencies.each do |dependency|
|
191
|
+
next unless dependency.name =~ /^(?i)#{spec.name}\//
|
192
|
+
dependency_subspec = nil?
|
193
|
+
spec.subspecs.each do |temSubspec|
|
194
|
+
if temSubspec.name == dependency.name
|
195
|
+
dependency_subspec = temSubspec
|
196
|
+
end
|
197
|
+
end
|
198
|
+
if dependency_subspec
|
199
|
+
dependence_note = dependence_note + addDependency(spec, dependency_subspec)
|
200
|
+
end
|
201
|
+
dependence_note << dependency.name
|
202
|
+
end
|
203
|
+
end
|
204
|
+
dependence_note.uniq
|
205
|
+
end
|
206
|
+
|
207
|
+
# 处理subspec的内部依赖为相应的形式。
|
252
208
|
old_specification_from_file = method(:from_file)
|
253
209
|
define_singleton_method(:from_file) do |path, subspec_name = nil|
|
254
210
|
spec = old_specification_from_file.call(path, subspec_name)
|
211
|
+
need_reload = false
|
255
212
|
if spec.subspecs
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
213
|
+
source_dependence_note =[]
|
214
|
+
framework_dependence_note = []
|
215
|
+
# 如果指定的是库本身,则全部subspec改变。
|
216
|
+
if Pod::Podfile.frameworkList.include?(spec.name)
|
217
|
+
spec.subspecs.each do |subspec|
|
218
|
+
framework_dependence_note << subspec.name
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
if Pod::Podfile.sourceList.include?(spec.name)
|
223
|
+
spec.subspecs.each do |subspec|
|
224
|
+
source_dependence_note << subspec.name
|
263
225
|
end
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
next unless
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
226
|
+
end
|
227
|
+
|
228
|
+
if !Pod::Podfile.frameworkList.include?(spec.name) and !Pod::Podfile.sourceList.include?(spec.name)
|
229
|
+
spec.subspecs.each do |subspec|
|
230
|
+
next unless subspec.dependencies
|
231
|
+
# 如果指定的是susbpec库,则subspec 的dependency改变。
|
232
|
+
|
233
|
+
if Pod::Podfile.frameworkList.include?(subspec.name)
|
234
|
+
framework_dependence_note = framework_dependence_note + addDependency(spec, subspec)
|
235
|
+
end
|
236
|
+
if Pod::Podfile.sourceList.include?(subspec.name)
|
237
|
+
source_dependence_note = source_dependence_note + addDependency(spec, subspec)
|
238
|
+
end
|
273
239
|
end
|
274
240
|
end
|
275
241
|
|
276
|
-
|
242
|
+
framework_dependence_note.each do |note|
|
243
|
+
need_reload = true
|
244
|
+
cleanENV note
|
245
|
+
setEnv note, '_FRAMEWORK'
|
246
|
+
end
|
247
|
+
|
248
|
+
source_dependence_note.each do |note|
|
249
|
+
need_reload = true
|
277
250
|
cleanENV note
|
278
251
|
setEnv note, '_SOURCE'
|
279
252
|
end
|
253
|
+
|
254
|
+
end
|
255
|
+
if need_reload
|
256
|
+
spec = old_specification_from_file.call(path, subspec_name)
|
280
257
|
end
|
281
|
-
spec = old_specification_from_file.call(path, subspec_name)
|
282
258
|
spec
|
283
259
|
end
|
260
|
+
end
|
284
261
|
|
285
|
-
end
|
286
262
|
|
287
263
|
|
288
264
|
|
@@ -308,4 +284,38 @@ module Pod
|
|
308
284
|
# end
|
309
285
|
#
|
310
286
|
# end
|
311
|
-
|
287
|
+
#
|
288
|
+
|
289
|
+
# class Dependency
|
290
|
+
# old_method = instance_method(:compatible?)
|
291
|
+
#
|
292
|
+
# define_method(:compatible?) do |other|
|
293
|
+
# # 改变状态
|
294
|
+
# old_method.bind(self).call(other)
|
295
|
+
# end
|
296
|
+
# end
|
297
|
+
|
298
|
+
# class Resolver
|
299
|
+
#
|
300
|
+
#
|
301
|
+
# old_method = instance_method(:resolve)
|
302
|
+
#
|
303
|
+
# define_method(:resolve) do ||
|
304
|
+
# state = old_method.bind(self).call()
|
305
|
+
# # 找到所有的依赖,如果不是
|
306
|
+
# changedSubPods = []
|
307
|
+
# all_pod_name = []
|
308
|
+
# Pod::Podfile.allPodName.each do |subPod|
|
309
|
+
# podName = subPod.split('/')[0]
|
310
|
+
# all_pod_name << podName
|
311
|
+
# end
|
312
|
+
# @activated.vertices.each do |key, value|
|
313
|
+
# podName = key.split('/')[0]
|
314
|
+
# next if all_pod_name.include?(podName)
|
315
|
+
# changedSubPods << key
|
316
|
+
# end
|
317
|
+
# # 清空缓存
|
318
|
+
# clean changedSubPods
|
319
|
+
# end
|
320
|
+
# end
|
321
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-cafswitcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- handa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|