Class: Pod::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/swordfish/native/source.rb,
lib/swordfish/native/sources_manager.rb

Defined Under Namespace

Classes: Manager

Instance Method Summary collapse

Instance Method Details

#specification_path(name, version) ⇒ Pathname

Returns the path of the specification with the given name and version.

Parameters:

  • name (String)

    the name of the Pod.

  • version (Version, String)

    the version for the specification.

Returns:

  • (Pathname)

    The path of the specification.

Raises:

  • (ArgumentError)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/swordfish/native/source.rb', line 17

def specification_path(name, version)
  raise ArgumentError, 'No name' unless name
  raise ArgumentError, 'No version' unless version

  path = pod_path(name) + version.to_s

  specification_path = Specification::VALID_EXTNAME
                       .map { |extname| "#{name}#{extname}" }
                       .map { |file| path + file }
                       .find(&:exist?)

  unless specification_path
    raise StandardError, "Unable to find the specification #{name} " \
      "(#{version}) in the #{self.name} source."
  end
  specification_path
end