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

Instance Method Details

#authorsHash

Note:

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.

Examples:

Possible values


{ 'Author' => '[email protected]' }
[ 'Author', { 'Author_2' => '[email protected]' } ]
[ 'Author', 'Author_2' ]
'Author'

Returns:

  • (Hash)

    a hash containing the authors as the keys and their email address as the values.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 51

def authors
  authors = attributes_hash["authors"]
  if authors.is_a?(Hash)
    authors
  elsif authors.is_a?(Array)
    result = {}
    authors.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 authors.is_a?(String)
    { authors => nil }
  end
end

#base_nameString

Returns The name of the specification not including the names of the parents, in case of ‘sub-specifications’.

Returns:

  • (String)

    The name of the specification not including the names of the parents, in case of ‘sub-specifications’.



13
14
15
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 13

def base_name
  attributes_hash["name"]
end

#descriptionString

Note:

The indentation is stripped from the description.

Returns A longer description of the Pod.

Returns:

  • (String)

    A longer description of the Pod.



122
123
124
125
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 122

def description
  description = attributes_hash["description"]
  description.strip_heredoc.chomp if description
end

#docset_urlString

Returns The docset URL.

Returns:

  • (String)

    The docset URL.



78
79
80
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 78

def docset_url
  attributes_hash["docset_url"]
end

#documentation_urlString, Nil

Returns The documentation URL of the Pod if specified.

Returns:

  • (String, Nil)

    The documentation URL of the Pod if specified.



139
140
141
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 139

def documentation_url
  attributes_hash["documentation_url"]
end

#homepageString

Returns The URL of the homepage of the Pod.

Returns:

  • (String)

    The URL of the homepage of the Pod.



101
102
103
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 101

def homepage
  attributes_hash["homepage"]
end

#licenseHash

Note:

The indentation is stripped from the license text.

Returns A hash containing the license information of the Pod.

Returns:

  • (Hash)

    A hash containing the license information of the Pod.



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 86

def license
  license = attributes_hash["license"]
  if license.is_a?(String)
    { :type => license }
  elsif license.is_a?(Hash)
    license = convert_keys_to_symbol(license)
    license[:text] = license[:text].strip_heredoc if license[:text]
    license
  else
    {}
  end
end

#nameString

Returns The name of the specification including the names of the parents, in case of ‘sub-specifications’.

Returns:

  • (String)

    The name of the specification including the names of the parents, in case of ‘sub-specifications’.



20
21
22
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 20

def name
  parent ? "#{parent.name}/#{base_name}" : base_name
end

#prepare_commandString, Nil

Returns The prepare command of the Pod if specified.

Returns:

  • (String, Nil)

    The prepare command of the Pod if specified.



145
146
147
148
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 145

def prepare_command
  command = attributes_hash["prepare_command"]
  command.strip_heredoc.chomp if command
end

#screenshotsArray<String>

Note:

The value is coerced to an array.

Returns The list of the URL for the screenshots of the Pod.

Returns:

  • (Array<String>)

    The list of the URL for the screenshots of the Pod.



132
133
134
135
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 132

def screenshots
  value = attributes_hash["screenshots"]
  [*value]
end

#social_media_urlString

Returns The social media URL.

Returns:

  • (String)

    The social media URL.



72
73
74
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 72

def social_media_url
  attributes_hash["social_media_url"]
end

#sourceHash{Symbol=>String}

Returns The location from where the library should be retrieved.

Returns:

  • (Hash{Symbol=>String})

    The location from where the library should be retrieved.



108
109
110
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 108

def source
  convert_keys_to_symbol(attributes_hash["source"])
end

#summaryString

Returns A short description of the Pod.

Returns:

  • (String)

    A short description of the Pod.



114
115
116
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 114

def summary
  attributes_hash["summary"]
end

#versionVersion

TODO:

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.

Returns:

  • (Version)

    The version of the Pod.



31
32
33
34
35
36
37
# File 'lib/cocoapods-core/specification/root_attribute_accessors.rb', line 31

def version
  if root?
    @version ||= Version.new(attributes_hash["version"])
  else
    @version ||= root.version
  end
end