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.
-
#resource_bundles ⇒ Hash{String=>String}
] hash where the keys are the names of the resource bundles and the values are their relative file patterns.
-
#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.
-
#vendored_frameworks ⇒ Array<String>
The paths of the framework bundles shipped with the Pod.
-
#vendored_libraries ⇒ Array<String>
The paths of the libraries shipped with 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
Returns a new instance of 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, "#{self} is not compatible with #{platform}." end end |
Instance Attribute Details
#platform_name ⇒ Symbol (readonly)
Returns The name of the platform for which the specification needs to be consumed.
29 30 31 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 29 def platform_name @platform_name end |
#spec ⇒ Specification (readonly)
Returns The specification to consume.
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>
Returns the list of compiler flags needed by the specification files.
86 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 86 spec_attr_accessor :compiler_flags |
#dependencies ⇒ Array<Dependency>
Returns the dependencies on other Pods.
164 165 166 167 168 169 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 164 def dependencies value = value_for_attribute(:dependencies) value.map do |name, requirements| Dependency.new(name, requirements) end end |
#exclude_files ⇒ Array<String>
Returns The file patterns that the Pod should ignore.
151 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 151 spec_attr_accessor :exclude_files |
#frameworks ⇒ Array<String>
Returns A list of frameworks that the user’s target needs to link against.
71 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 71 spec_attr_accessor :frameworks |
#header_dir ⇒ String
Returns the headers directory.
103 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 103 spec_attr_accessor :header_dir |
#header_mappings_dir ⇒ String
Returns the directory from where to preserve the headers namespacing.
108 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 108 spec_attr_accessor :header_mappings_dir |
#libraries ⇒ Array<String>
Returns A list of libraries that the user’s target needs to link against.
81 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 81 spec_attr_accessor :libraries |
#prefix_header_contents ⇒ String
Returns The contents of the prefix header.
95 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 95 spec_attr_accessor :prefix_header_contents |
#prefix_header_file ⇒ String
Returns The path of the prefix header file.
99 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 99 spec_attr_accessor :prefix_header_file |
#preserve_paths ⇒ Array<String>
Returns The paths that should be not cleaned.
156 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 156 spec_attr_accessor :preserve_paths |
#private_header_files ⇒ Array<String>
Returns the private headers of the Pod.
124 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 124 spec_attr_accessor :private_header_files |
#public_header_files ⇒ Array<String>
Returns the public headers of the Pod.
120 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 120 spec_attr_accessor :public_header_files |
#requires_arc ⇒ Bool Also known as: requires_arc?
Returns Whether the source files of the specification require to be compiled with ARC.
65 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 65 spec_attr_accessor :requires_arc |
#resource_bundles ⇒ Hash{String=>String}
Returns ] hash where the keys are the names of the resource bundles and the values are their relative file patterns.
140 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 140 spec_attr_accessor :resource_bundles |
#resources ⇒ Array<String>
Returns 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.
146 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 146 spec_attr_accessor :resources |
#source_files ⇒ Array<String>
Returns the source files of the Pod.
116 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 116 spec_attr_accessor :source_files |
#vendored_frameworks ⇒ Array<String>
Returns The paths of the framework bundles shipped with the Pod.
129 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 129 spec_attr_accessor :vendored_frameworks |
#vendored_libraries ⇒ Array<String>
Returns The paths of the libraries shipped with the Pod.
134 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 134 spec_attr_accessor :vendored_libraries |
#weak_frameworks ⇒ Array<String>
Returns A list of frameworks that the user’s target needs to weakly link against.
76 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 76 spec_attr_accessor :weak_frameworks |
#xcconfig ⇒ Hash{String => String}
Returns the xcconfig flags for the current specification.
91 |
# File 'lib/cocoapods-core/specification/consumer.rb', line 91 spec_attr_accessor :xcconfig |