Module: CocoaPodsPackingCubes::PodTargetMixin

Defined in:
lib/cocoapods_packing_cubes.rb

Instance Method Summary collapse

Instance Method Details

#compute_packing_cube_override_defines_moduleObject


38
39
40
41
42
# File 'lib/cocoapods_packing_cubes.rb', line 38

def compute_packing_cube_override_defines_module
  return unless packing_cube.key?('defines_module')

  @defines_module = packing_cube['defines_module']
end

#compute_packing_cube_override_typeObject


31
32
33
34
35
36
# File 'lib/cocoapods_packing_cubes.rb', line 31

def compute_packing_cube_override_type
  linkage = packing_cube.fetch('linkage') { build_type.linkage }.to_sym
  packaging = packing_cube.fetch('packaging') { build_type.packaging }.to_sym

  @build_type = ::Pod::Target::BuildType.new(linkage: linkage, packaging: packaging)
end

#initializeObject


13
14
15
16
17
18
19
20
# File 'lib/cocoapods_packing_cubes.rb', line 13

def initialize(*)
  super

  return if packing_cube.empty?
  return CocoaPodsPackingCubes.warn_for_outdated_cocoapods unless defined?(::Pod::Target::BuildType)
  compute_packing_cube_override_type
  compute_packing_cube_override_defines_module
end

#packing_cubeObject


22
23
24
25
26
27
28
29
# File 'lib/cocoapods_packing_cubes.rb', line 22

def packing_cube
  @packing_cube ||= begin
    packing_cubes_config = podfile.plugins.fetch('cocoapods-packing-cubes', {})
    packing_cubes_config.fetch(pod_name) { packing_cubes_config.fetch('*', {}) }
  end
rescue
  raise ::Pod::Informative, 'The cocoapods-packing-cubes plugin requires a hash of options.'
end