cocoapods-packing-cubes 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 802698251563bf4aa6878a5f82beff1b4a7761ca5ee8e85bff8bbd25bc056785
4
+ data.tar.gz: 54b4fd68ade0c0698c27b1dd2b1d02dd4711bbe0b80ac8aee503aba223d6203c
5
+ SHA512:
6
+ metadata.gz: 0d70269705da3d907d5c88a245d125f5e9e2149b4c7f6d7fa39735dbf052162f4add1f8448effec74609015e99bd2b0d2e464f1ea5135da679f73c2a292b57df
7
+ data.tar.gz: 7e40d165e412123e78b424500c04f69908e8412dc417b58b5fc5f6e0298ca230680efcb80aa3baacb37e2f8545fe08f035763e551fa05981489355336db28b97
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
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
+ %i[static dynamic].each_with_index do |linkage, index|
23
+ define_method("#{linkage}?") { linkage == @linkage }
24
+ %i[library framework].each do |packaging|
25
+ if index.zero?
26
+ define_method("#{packaging}?") { packaging == @packaging }
27
+ end
28
+
29
+ define_method("#{linkage}_#{packaging}?") do
30
+ linkage == @linkage && packaging == @packaging
31
+ end
32
+ end
33
+ end
34
+ end
35
+ NATIVE_TYPE_SUPPORT = false
36
+ end
37
+
38
+ module PodTargetMixin
39
+ attr_reader :type
40
+
41
+ def initialize(*)
42
+ super
43
+ compute_packing_cube_override_type
44
+ end
45
+
46
+ def packing_cube
47
+ @packing_cube ||= podfile.plugins.fetch('cocoapods-packing-cubes', {}).fetch(pod_name, {})
48
+ rescue
49
+ raise ::Pod::Informative, 'The cocoapods-packing-cubes plugin requires a hash of option.'
50
+ end
51
+
52
+ def compute_packing_cube_override_type
53
+ packaging = packing_cube.fetch('packaging') do
54
+ host_requires_frameworks? ? :framework : :library
55
+ end.to_sym
56
+ linkage = packing_cube.fetch('linkage') do
57
+ !host_requires_frameworks? || static_framework? ? :static : :dynamic
58
+ end.to_sym
59
+
60
+ @type = ::CocoaPodsPackingCubes::Type.new(linkage: linkage, packaging: packaging)
61
+ end
62
+
63
+ def static_framework?
64
+ type.static_framework?
65
+ end
66
+
67
+ def requires_frameworks?
68
+ # HACK: needed because CocoaPods, pre-introduction of the `type` type/attr,
69
+ # would check #requires_frameworks? instead of #host_requires_frameworks?
70
+ # for finding the PodTarget to set as a dependency of another PodTarget.
71
+ if !::CocoaPodsPackingCubes::NATIVE_TYPE_SUPPORT &&
72
+ caller_locations(1, 2).any? { |l| l.label == '#filter_dependencies' }
73
+
74
+ return super
75
+ end
76
+
77
+ type.framework?
78
+ end
79
+ end
80
+ end
81
+
82
+ module Pod
83
+ class PodTarget
84
+ prepend ::CocoaPodsPackingCubes::PodTargetMixin
85
+ end
86
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cocoapods_packing_cubes'
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-packing-cubes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Giddins
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.3'
41
+ description:
42
+ email:
43
+ - segiddins@segiddins.me
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/cocoapods_packing_cubes.rb
49
+ - lib/cocoapods_plugin.rb
50
+ homepage: https://github.com/segiddins/cocoapods-packing-cubes
51
+ licenses:
52
+ - MIT
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.7.7
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: A CocoaPods plugin that allows customizing how individual pods are packaged
74
+ and linked.
75
+ test_files: []