cocoapods-packing-cubes 0.2.0 → 0.3.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods_packing_cubes.rb +12 -70
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef6e4802dc5a9c6a4dc05b9a3ae063be59b3a8e61738d97da97b13462f7b7893
4
- data.tar.gz: 73980c7c5a5e5f2ab0b5f015b37966c071056fec25937d5da043cca6bfaa8304
3
+ metadata.gz: 37b1756cf73aa013fc264aaa924365337be1d7246da4c7edacb6990040f02607
4
+ data.tar.gz: 436c333a1cd15abf7d12a925315cf3230e8f5d462c1e7ad6e52673a2a549e087
5
5
  SHA512:
6
- metadata.gz: be490650b38e592becc59e7b858bb1a311a08b9db04782152282e47d2b3920ca072827419bbf749a6432f9746622413d75d07da2333cd82f08e7b5d4ffe66fa0
7
- data.tar.gz: 18263c3bf2b02e95b070588e438617c7a2d175be61f43aa3f27abea66f2edc647ad1a703fc30c768280e4f34915fbc6bc8ce43d3f11e0f841ad3af6d27b3cfe2
6
+ metadata.gz: b6074a44d1d35cecb29818494623f37bea65b2e6085296b846e793d76a89e41065923d531b15de59ba80106d6896f68d06423a9e9595d38c8c93df4b4893aa1a
7
+ data.tar.gz: f4e1a45665a4810b73b63f7d090213e29f0ce29316acb86e32527166a6af932b77fab9886ee5f96245d64ab94441373e8546075f4efc4e8c6336119fe406fe61
@@ -1,59 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CocoaPodsPackingCubes
4
- if defined?(::Pod::Target::Type)
5
- Type = ::Pod::Target::Type
6
- NATIVE_TYPE_SUPPORT = true
7
- else
8
- class Type
9
- def initialize(linkage: :static, packaging: :library)
10
- @linkage = linkage
11
- @packaging = packaging
12
-
13
- case [linkage, packaging]
14
- when %i[static library], %i[static framework], %i[dynamic framework]
15
- # ok
16
- nil
17
- else
18
- raise ::Pod::Informative, "Unsupported target build type: #{inspect}"
19
- end
20
- end
21
-
22
- attr_reader :linkage, :packaging
23
- protected :linkage, :packaging
24
-
25
- def ==(other)
26
- linkage == other.linkage &&
27
- packaging == other.packaging
28
- end
29
- alias eql? ==
30
-
31
- def hash
32
- linkage.hash ^ packaging.hash
33
- end
34
-
35
- %i[static dynamic].each_with_index do |linkage, index|
36
- define_method("#{linkage}?") { linkage == @linkage }
37
- %i[library framework].each do |packaging|
38
- if index.zero?
39
- define_method("#{packaging}?") { packaging == @packaging }
40
- end
41
-
42
- define_method("#{linkage}_#{packaging}?") do
43
- linkage == @linkage && packaging == @packaging
44
- end
45
- end
46
- end
4
+ def self.warn_for_outdated_cocoapods
5
+ @warn_for_outdated_cocoapods ||= begin
6
+ Pod::UI.warn '[cocoapods-packing-cubes] Pod::Target::BuildType must be defined, either:',
7
+ ['Update to CocoaPods master or 1.6.0+', 'Downgrade to packing cubes < 0.3']
8
+ true
47
9
  end
48
- NATIVE_TYPE_SUPPORT = false
49
10
  end
50
11
 
51
12
  module PodTargetMixin
52
- attr_reader :type
53
-
54
13
  def initialize(*)
55
14
  super
56
15
 
16
+ return CocoaPodsPackingCubes.warn_for_outdated_cocoapods unless defined?(::Pod::Target::BuildType) && !packing_cube.empty?
57
17
  compute_packing_cube_override_type
58
18
  compute_packing_cube_override_defines_module
59
19
  end
@@ -65,36 +25,18 @@ module CocoaPodsPackingCubes
65
25
  end
66
26
 
67
27
  def compute_packing_cube_override_type
68
- packaging = packing_cube.fetch('packaging') do
69
- host_requires_frameworks? ? :framework : :library
70
- end.to_sym
71
- linkage = packing_cube.fetch('linkage') do
72
- !host_requires_frameworks? || root_spec.static_framework ? :static : :dynamic
73
- end.to_sym
28
+ return if packing_cube.empty?
29
+
30
+ linkage = packing_cube.fetch('linkage') { build_type.linkage }.to_sym
31
+ packaging = packing_cube.fetch('packaging') { build_type.packaging }.to_sym
74
32
 
75
- @type = ::CocoaPodsPackingCubes::Type.new(linkage: linkage, packaging: packaging)
33
+ @build_type = ::Pod::Target::BuildType.new(linkage: linkage, packaging: packaging)
76
34
  end
77
35
 
78
36
  def compute_packing_cube_override_defines_module
79
37
  return unless packing_cube.key?('defines_module')
80
- @defines_module = packing_cube['defines_module']
81
- end
82
-
83
- def static_framework?
84
- type.static_framework?
85
- end
86
38
 
87
- def requires_frameworks?
88
- # HACK: needed because CocoaPods, pre-introduction of the `type` type/attr,
89
- # would check #requires_frameworks? instead of #host_requires_frameworks?
90
- # for finding the PodTarget to set as a dependency of another PodTarget.
91
- if !::CocoaPodsPackingCubes::NATIVE_TYPE_SUPPORT && !packing_cube.empty? &&
92
- caller_locations(1, 2).any? { |l| l.base_label == 'filter_dependencies' }
93
-
94
- return super
95
- end
96
-
97
- type.framework?
39
+ @defines_module = packing_cube['defines_module']
98
40
  end
99
41
  end
100
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-packing-cubes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Giddins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-07 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  version: '0'
68
68
  requirements: []
69
69
  rubyforge_project:
70
- rubygems_version: 2.7.6
70
+ rubygems_version: 2.7.7
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: A CocoaPods plugin that allows customizing how individual pods are packaged