cocoapods-podfile_patch 0.0.1 → 0.0.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f77646a10d7c52a203f05f40f7aaf01c114bf53
|
4
|
+
data.tar.gz: 7d0847e74adf0f08706038a25368360755c977cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 175f1f52932b1da20131980b0304c8a6512813247937ccf281c568f4c69abc143a2db483692cdf2f9fd1e540b8d4979c4240dcd29561b7fb31a99ddaf838eb03
|
7
|
+
data.tar.gz: c69e2686993aec5f6af4bcf9a860e29f95fec20fe30890a78210d0af0bc1cbf485504e179934ea69f009c81ae6c87af65a7c1c834f0daac57284f2f63ab244a7
|
@@ -7,10 +7,13 @@ require 'set'
|
|
7
7
|
|
8
8
|
class PodfilePatch
|
9
9
|
|
10
|
-
def main(podfile)
|
10
|
+
def main(podfile, patchfile_path)
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
patch_file_path = Pathname.new(patchfile_path)
|
13
|
+
if not patch_file_path.expand_path.file?
|
14
|
+
podfile_root_path = Pathname.new(podfile.defined_in_file).dirname
|
15
|
+
patch_file_path = (podfile_root_path + patch_file_path).expand_path
|
16
|
+
end
|
14
17
|
if not patch_file_path.file?
|
15
18
|
Pod::UI.info "Podfile patch feature is enabled. (No patch file now.)"
|
16
19
|
return
|
@@ -30,9 +33,7 @@ class PodfilePatch
|
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
33
|
-
|
34
|
-
Pathname.new(podfile_root) + "Podfile.patch"
|
35
|
-
end
|
36
|
+
|
36
37
|
|
37
38
|
def patchfile(patch_file_path) # [Podfile]
|
38
39
|
Pod::Podfile.from_ruby(patch_file_path)
|
@@ -165,10 +166,10 @@ class PodfilePatch
|
|
165
166
|
end
|
166
167
|
|
167
168
|
# handle MODULAR_HEADERS & INHIBIT_WARNING
|
168
|
-
[
|
169
|
-
|
169
|
+
[ 'inhibit_warnings',
|
170
|
+
'use_modular_headers'].each do |method|
|
170
171
|
modify_target_defination_recursively(targetdef) do |t|
|
171
|
-
original_inhibit_warning_dict = t.send
|
172
|
+
original_inhibit_warning_dict = t.send(:get_hash_value,method, {})
|
172
173
|
original_inhibit_warning_dict.each do |key, value|
|
173
174
|
# the key is "for_pods" or "not_for_pods" or "all"
|
174
175
|
# Clear if patchfile have modified the pod
|
@@ -177,37 +178,48 @@ class PodfilePatch
|
|
177
178
|
end
|
178
179
|
|
179
180
|
patch_target = patch_file_all_targets_dict[t.name]
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
181
|
+
if not patch_target.nil?
|
182
|
+
patch_inhibit_warning_dict = patch_target.send(:get_hash_value,method, {})
|
183
|
+
patch_inhibit_warning_dict.each do |key, value|
|
184
|
+
if value.kind_of? Array
|
185
|
+
original = original_inhibit_warning_dict[key] || []
|
186
|
+
original.concat(value).uniq!
|
187
|
+
original_inhibit_warning_dict[key] = original
|
188
|
+
elsif [true, false].include? value # "all"
|
189
|
+
original_inhibit_warning_dict[key] = value
|
190
|
+
end
|
189
191
|
end
|
190
192
|
end
|
193
|
+
# delete key if blank
|
194
|
+
if original_inhibit_warning_dict.empty?
|
195
|
+
t.send(:internal_hash).delete(method)
|
196
|
+
end
|
191
197
|
end
|
192
198
|
end
|
193
199
|
|
194
200
|
# handle CONFIGURATION_WHITELIST
|
195
201
|
modify_target_defination_recursively(targetdef) do |t|
|
196
|
-
|
202
|
+
key = "configuration_pod_whitelist"
|
203
|
+
original = t.send :get_hash_value, key, {}
|
197
204
|
original.each do |config_name, pods|
|
198
205
|
# Clear if patchfile have modified the pod
|
199
206
|
next unless pods.kind_of? Array
|
200
207
|
pods.reject! { |name| modified_dependencies_names.include? name}
|
201
208
|
end
|
202
|
-
|
209
|
+
|
203
210
|
patch_target = patch_file_all_targets_dict[t.name]
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
+
if not patch_target.nil?
|
212
|
+
patched = patch_target.send :raw_configuration_pod_whitelist
|
213
|
+
patched.each do |config_name, pods|
|
214
|
+
next unless pods.kind_of? Array
|
215
|
+
original_pods = original[config_name] || []
|
216
|
+
original_pods.concat(pods).uniq!
|
217
|
+
original[config_name] = original_pods
|
218
|
+
end
|
219
|
+
end
|
220
|
+
# delete key if blank
|
221
|
+
if original.empty?
|
222
|
+
t.send(:internal_hash).delete(key)
|
211
223
|
end
|
212
224
|
end
|
213
225
|
end
|
@@ -223,6 +235,7 @@ class PodfilePatch
|
|
223
235
|
print_target_def_and_its_dependencies(target_def, intend + " ")
|
224
236
|
end
|
225
237
|
end
|
238
|
+
puts "#{podfile.defined_in_file}"
|
226
239
|
podfile.root_target_definitions.each do |target_def|
|
227
240
|
print_target_def_and_its_dependencies(target_def)
|
228
241
|
end
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -37,10 +37,13 @@ module Pod
|
|
37
37
|
# This function is base on the parsed result of podfile. It means you could do ANYTHING
|
38
38
|
# you do in podfile, i.e. your custom pod function or other plugins.
|
39
39
|
#
|
40
|
-
def use_patch_file!(
|
41
|
-
@enable_patch =
|
42
|
-
|
43
|
-
|
40
|
+
def use_patch_file!(patchfile_path = 'Podfile.patch')
|
41
|
+
@enable_patch = true
|
42
|
+
@patchfile_path = patchfile_path
|
43
|
+
|
44
|
+
# check not in patchfile
|
45
|
+
if self.defined_in_file.basename.to_s.downcase == Pathname.new(patchfile_path).basename.to_s.downcase
|
46
|
+
raise "Cannot call `#{__method__}` in Podfile patchfile"
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
@@ -57,7 +60,7 @@ module Pod
|
|
57
60
|
if @enable_patch
|
58
61
|
require 'cocoapods-podfile_patch/podfile_patch'
|
59
62
|
patcher = PodfilePatch.new
|
60
|
-
patcher.main(self)
|
63
|
+
patcher.main(self, @patchfile_path)
|
61
64
|
end
|
62
65
|
end
|
63
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-podfile_patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|