class Pod::ExternalSources::PathSource

Provides support for fetching a specification file from a path local to the machine running the installation.

Public Instance Methods

description() click to toggle source

@see AbstractExternalSource#description

# File lib/cocoapods/external_sources/path_source.rb, line 26
def description
  "from `#{declared_path}`"
end
fetch(sandbox) click to toggle source

@see AbstractExternalSource#fetch

# File lib/cocoapods/external_sources/path_source.rb, line 9
def fetch(sandbox)
  title = "Fetching podspec for `#{name}` #{description}"
  UI.section(title, '-> ') do
    podspec = podspec_path
    unless podspec.exist?
      raise Informative, "No podspec found for `#{name}` in " \
        "`#{declared_path}`"
    end
    store_podspec(sandbox, podspec, podspec.extname == '.json')
    is_absolute = absolute?(declared_path)
    sandbox.store_local_path(name, podspec, is_absolute)
    sandbox.remove_checkout_source(name)
  end
end

Private Instance Methods

absolute?(path) click to toggle source

@return [Bool]

# File lib/cocoapods/external_sources/path_source.rb, line 50
def absolute?(path)
  Pathname(path).absolute? || path.to_s.start_with?('~')
end
declared_path() click to toggle source

@return [String] The path as declared by the user.

# File lib/cocoapods/external_sources/path_source.rb, line 36
def declared_path
  result = params[:path]
  result.to_s if result
end
podspec_path() click to toggle source

@return [Pathname] The absolute path of the podspec.

# File lib/cocoapods/external_sources/path_source.rb, line 43
def podspec_path
  path = Pathname(normalized_podspec_path(declared_path))
  path.exist? ? path : Pathname("#{path}.json")
end