Module: Pod::Specification::DSL::RootAttributesAccessors
- Defined in:
- lib/cocoapods-core/specification/root_attribute_accessors.rb
Overview
Provides the accessors methods for the root attributes. Root attributes do not support multi-platform values and inheritance.
Instance Method Summary collapse
-
#authors ⇒ Hash
A hash containing the authors as the keys and their email address as the values.
-
#base_name ⇒ String
The name of the specification not including the names of the parents, in case of ‘sub-specifications’.
-
#cocoapods_version ⇒ Requirement
The CocoaPods version required to use the specification.
-
#deprecated ⇒ Bool
Whether the Pod has been deprecated.
-
#deprecated? ⇒ Bool
Wether the pod is deprecated either in favor of some other pod or simply deprecated.
-
#deprecated_in_favor_of ⇒ String
The name of the Pod that this one has been deprecated in favor of.
-
#description ⇒ String
A longer description of the Pod.
-
#documentation_url ⇒ String, Nil
The documentation URL of the Pod if specified.
-
#homepage ⇒ String
The URL of the homepage of the Pod.
-
#license ⇒ Hash
A hash containing the license information of the Pod.
-
#module_map ⇒ String, Nil
The custom module map file of the Pod, if specified.
-
#name ⇒ String
The name of the specification including the names of the parents, in case of ‘sub-specifications’.
-
#prepare_command ⇒ String, Nil
The prepare command of the Pod if specified.
-
#requires_arc ⇒ Bool, ...
The requires_arc value.
-
#screenshots ⇒ Array<String>
The list of the URL for the screenshots of the Pod.
-
#social_media_url ⇒ String
The social media URL.
-
#source ⇒ Hash{Symbol=>String}
The location from where the library should be retrieved.
-
#static_framework ⇒ Bool
Indicates, that if use_frameworks! is specified, the framework should include a static library.
-
#summary ⇒ String
A short description of the Pod.
-
#swift_version ⇒ Version
The swift_versions required to use the specification.
-
#version ⇒ Version
The version of the Pod.
Instance Method Details
#authors ⇒ Hash
The value is coerced to a hash with a nil email if needed.
Returns a hash containing the authors as the keys and their email address as the values.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 69 def = attributes_hash['authors'] if .is_a?(Hash) elsif .is_a?(Array) result = {} .each do |name_or_hash| if name_or_hash.is_a?(String) result[name_or_hash] = nil else result.merge!(name_or_hash) end end result elsif .is_a?(String) { => nil } end end |
#base_name ⇒ String
Returns The name of the specification not including the names of the parents, in case of ‘sub-specifications’.
11 12 13 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 11 def base_name attributes_hash['name'] end |
#cocoapods_version ⇒ Requirement
Returns The CocoaPods version required to use the specification.
53 54 55 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 53 def cocoapods_version @cocoapods_version ||= Requirement.create(attributes_hash['cocoapods_version']) end |
#deprecated ⇒ Bool
Returns Whether the Pod has been deprecated.
172 173 174 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 172 def deprecated attributes_hash['deprecated'] end |
#deprecated? ⇒ Bool
Returns Wether the pod is deprecated either in favor of some other pod or simply deprecated.
186 187 188 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 186 def deprecated? deprecated || !deprecated_in_favor_of.nil? end |
#deprecated_in_favor_of ⇒ String
Returns The name of the Pod that this one has been deprecated in favor of.
179 180 181 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 179 def deprecated_in_favor_of attributes_hash['deprecated_in_favor_of'] end |
#description ⇒ String
The indentation is stripped from the description.
Returns A longer description of the Pod.
135 136 137 138 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 135 def description description = attributes_hash['description'] description.strip_heredoc.chomp if description end |
#documentation_url ⇒ String, Nil
Returns The documentation URL of the Pod if specified.
152 153 154 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 152 def documentation_url attributes_hash['documentation_url'] end |
#homepage ⇒ String
Returns The URL of the homepage of the Pod.
113 114 115 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 113 def homepage attributes_hash['homepage'] end |
#license ⇒ Hash
The indentation is stripped from the license text.
Returns A hash containing the license information of the Pod.
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 98 def license license = attributes_hash['license'] if license.is_a?(String) { :type => license } elsif license.is_a?(Hash) license = Specification.convert_keys_to_symbol(license) license[:text] = license[:text].strip_heredoc if license[:text] license else {} end end |
#module_map ⇒ String, Nil
Returns The custom module map file of the Pod, if specified.
193 194 195 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 193 def module_map attributes_hash['module_map'] end |
#name ⇒ String
Returns The name of the specification including the names of the parents, in case of ‘sub-specifications’.
18 19 20 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 18 def name parent ? "#{parent.name}/#{base_name}" : base_name end |
#prepare_command ⇒ String, Nil
Returns The prepare command of the Pod if specified.
158 159 160 161 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 158 def prepare_command command = attributes_hash['prepare_command'] command.strip_heredoc.chomp if command end |
#requires_arc ⇒ Bool, ...
Returns The requires_arc value.
24 25 26 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 24 def requires_arc attributes_hash['requires_arc'] end |
#screenshots ⇒ Array<String>
The value is coerced to an array.
Returns The list of the URL for the screenshots of the Pod.
145 146 147 148 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 145 def screenshots value = attributes_hash['screenshots'] [*value] end |
#social_media_url ⇒ String
Returns The social media URL.
90 91 92 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 90 def attributes_hash['social_media_url'] end |
#source ⇒ Hash{Symbol=>String}
Returns The location from where the library should be retrieved.
120 121 122 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 120 def source Specification.convert_keys_to_symbol(attributes_hash['source']) end |
#static_framework ⇒ Bool
Returns Indicates, that if use_frameworks! is specified, the framework should include a static library.
166 167 168 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 166 def static_framework attributes_hash['static_framework'] end |
#summary ⇒ String
Returns A short description of the Pod.
126 127 128 129 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 126 def summary summary = attributes_hash['summary'] summary.strip_heredoc.chomp if summary end |
#swift_version ⇒ Version
Returns The swift_versions required to use the specification.
45 46 47 48 49 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 45 def swift_version @swift_version ||= if version = attributes_hash['swift_version'] Version.new(version) end end |
#version ⇒ Version
The version is memoized because the Resolvers sets the head state on it. This information should be stored in the specification instance and the lockfile should have a more robust handling of head versions (like a dedicated section).
Returns The version of the Pod.
35 36 37 38 39 40 41 |
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 35 def version if root? @version ||= Version.new(attributes_hash['version']) else @version ||= root.version end end |