Class: Pod::Specification::Consumer
- Inherits:
-
Object
- Object
- Pod::Specification::Consumer
- 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
-
#platform_name ⇒ Symbol
readonly
The name of the platform for which the specification needs to be consumed.
-
#spec ⇒ Specification
readonly
The specification to consume.
Regular attributes collapse
-
#compiler_flags ⇒ Array<String>
The list of compiler flags needed by the specification files.
-
#frameworks ⇒ Array<String>
A list of frameworks that the user’s target needs to link against.
-
#header_dir ⇒ String
The headers directory.
-
#header_mappings_dir ⇒ String
The directory from where to preserve the headers namespacing.
-
#libraries ⇒ Array<String>
A list of libraries that the user’s target needs to link against.
-
#prefix_header_contents ⇒ String
The contents of the prefix header.
-
#prefix_header_file ⇒ String
The path of the prefix header file.
-
#requires_arc ⇒ Bool
(also: #requires_arc?)
Whether the source files of the specification require to be compiled with ARC.
-
#weak_frameworks ⇒ Array<String>
A list of frameworks that the user’s target needs to weakly link against.
-
#xcconfig ⇒ Hash{String => String}
The xcconfig flags for the current specification.
File patterns collapse
-
#exclude_files ⇒ Array<String>
The file patterns that the Pod should ignore.
-
#preserve_paths ⇒ Array<String>
The paths that should be not cleaned.
-
#private_header_files ⇒ Array<String>
The private headers of the Pod.
-
#public_header_files ⇒ Array<String>
The public headers of the Pod.
-
#resources ⇒ Array<String>
A hash where the key represents the paths of the resources to copy and the values the paths of the resources that should be copied.
-
#source_files ⇒ Array<String>
The source files of the Pod.
Dependencies collapse
-
#dependencies ⇒ Array<Dependency>
The dependencies on other Pods.
Class Method Summary collapse
-
.spec_attr_accessor(name) ⇒ Object
Creates a method to access the contents of the attribute.
Instance Method Summary collapse
-
#initialize(spec, platform) ⇒ Consumer
constructor
A new instance of Consumer.
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_name ⇒ Symbol (readonly)
29 30 31 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 29 def platform_name @platform_name end |
#spec ⇒ Specification (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_flags ⇒ Array<String>
86 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 86 spec_attr_accessor :compiler_flags |
#dependencies ⇒ Array<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_files ⇒ Array<String>
135 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 135 spec_attr_accessor :exclude_files |
#frameworks ⇒ Array<String>
71 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 71 spec_attr_accessor :frameworks |
#header_dir ⇒ String
103 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 103 spec_attr_accessor :header_dir |
#header_mappings_dir ⇒ String
108 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 108 spec_attr_accessor :header_mappings_dir |
#libraries ⇒ Array<String>
81 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 81 spec_attr_accessor :libraries |
#prefix_header_contents ⇒ String
95 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 95 spec_attr_accessor :prefix_header_contents |
#prefix_header_file ⇒ String
99 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 99 spec_attr_accessor :prefix_header_file |
#preserve_paths ⇒ Array<String>
140 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 140 spec_attr_accessor :preserve_paths |
#private_header_files ⇒ Array<String>
124 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 124 spec_attr_accessor :private_header_files |
#public_header_files ⇒ Array<String>
120 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 120 spec_attr_accessor :public_header_files |
#requires_arc ⇒ Bool Also known as: requires_arc?
65 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 65 spec_attr_accessor :requires_arc |
#resources ⇒ Array<String>
130 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 130 spec_attr_accessor :resources |
#source_files ⇒ Array<String>
116 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 116 spec_attr_accessor :source_files |
#weak_frameworks ⇒ Array<String>
76 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 76 spec_attr_accessor :weak_frameworks |
#xcconfig ⇒ Hash{String => String}
91 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 91 spec_attr_accessor :xcconfig |