Class: Pod::Specification::Consumer

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-core/specification/consumer.rb

Overview

Allows to conveniently access a Specification programmatically.

It takes care of:

  • standardizing the attributes

  • handling multi-platform values

  • handle default values

  • handle inherited values

This class allows to store the values of the attributes in the Specification as specified in the DSL. The benefits is reduced reliance on meta programming to access the attributes and the possibility of serializing a specification back exactly as defined in a file.

Instance Attribute Summary collapse

Regular attributes collapse

File patterns collapse

Dependencies collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, platform) ⇒ Consumer



35
36
37
38
39
40
41
42
# File 'lib/cocoapods-core/specification/consumer.rb', line 35

def initialize(spec, platform)
  @spec = spec
  @platform_name = platform.is_a?(Symbol) ? platform : platform.name

  unless spec.supported_on_platform?(platform)
    raise StandardError, "#{to_s} is not compatible with #{platform}."
  end
end

Instance Attribute Details

#platform_nameSymbol (readonly)



29
30
31
# File 'lib/cocoapods-core/specification/consumer.rb', line 29

def platform_name
  @platform_name
end

#specSpecification (readonly)



24
25
26
# File 'lib/cocoapods-core/specification/consumer.rb', line 24

def spec
  @spec
end

Class Method Details

.spec_attr_accessor(name) ⇒ Object

Creates a method to access the contents of the attribute.



52
53
54
55
56
# File 'lib/cocoapods-core/specification/consumer.rb', line 52

def self.spec_attr_accessor(name)
  define_method(name) do
    value_for_attribute(name)
  end
end

Instance Method Details

#compiler_flagsArray<String>



86
# File 'lib/cocoapods-core/specification/consumer.rb', line 86

spec_attr_accessor :compiler_flags

#dependenciesArray<Dependency>



148
149
150
151
152
153
# File 'lib/cocoapods-core/specification/consumer.rb', line 148

def dependencies
  value = value_for_attribute(:dependencies)
  value.map do |name, requirements|
    Dependency.new(name, requirements)
  end
end

#exclude_filesArray<String>



135
# File 'lib/cocoapods-core/specification/consumer.rb', line 135

spec_attr_accessor :exclude_files

#frameworksArray<String>



71
# File 'lib/cocoapods-core/specification/consumer.rb', line 71

spec_attr_accessor :frameworks

#header_dirString



103
# File 'lib/cocoapods-core/specification/consumer.rb', line 103

spec_attr_accessor :header_dir

#header_mappings_dirString



108
# File 'lib/cocoapods-core/specification/consumer.rb', line 108

spec_attr_accessor :header_mappings_dir

#librariesArray<String>



81
# File 'lib/cocoapods-core/specification/consumer.rb', line 81

spec_attr_accessor :libraries

#prefix_header_contentsString



95
# File 'lib/cocoapods-core/specification/consumer.rb', line 95

spec_attr_accessor :prefix_header_contents

#prefix_header_fileString



99
# File 'lib/cocoapods-core/specification/consumer.rb', line 99

spec_attr_accessor :prefix_header_file

#preserve_pathsArray<String>



140
# File 'lib/cocoapods-core/specification/consumer.rb', line 140

spec_attr_accessor :preserve_paths

#private_header_filesArray<String>



124
# File 'lib/cocoapods-core/specification/consumer.rb', line 124

spec_attr_accessor :private_header_files

#public_header_filesArray<String>



120
# File 'lib/cocoapods-core/specification/consumer.rb', line 120

spec_attr_accessor :public_header_files

#requires_arcBool Also known as: requires_arc?



65
# File 'lib/cocoapods-core/specification/consumer.rb', line 65

spec_attr_accessor :requires_arc

#resourcesArray<String>



130
# File 'lib/cocoapods-core/specification/consumer.rb', line 130

spec_attr_accessor :resources

#source_filesArray<String>



116
# File 'lib/cocoapods-core/specification/consumer.rb', line 116

spec_attr_accessor :source_files

#weak_frameworksArray<String>



76
# File 'lib/cocoapods-core/specification/consumer.rb', line 76

spec_attr_accessor :weak_frameworks

#xcconfigHash{String => String}



91
# File 'lib/cocoapods-core/specification/consumer.rb', line 91

spec_attr_accessor :xcconfig