Class: Pod::ExternalSources::PathSource

Inherits:
AbstractExternalSource show all
Defined in:
lib/cocoapods/external_sources/path_source.rb

Overview

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

Instance Attribute Summary

Attributes inherited from AbstractExternalSource

#can_cache, #name, #params, #podfile_path

Helpers collapse

Instance Method Summary collapse

Methods inherited from AbstractExternalSource

#==, #download_request, #initialize, #pre_download, #store_podspec, #validate_podspec, #validator_for_podspec

Constructor Details

This class inherits a constructor from Pod::ExternalSources::AbstractExternalSource

Instance Method Details

#absolute?(path) ⇒ Bool (private)

Returns:

  • (Bool)

50
51
52
# File 'lib/cocoapods/external_sources/path_source.rb', line 50

def absolute?(path)
  Pathname(path).absolute? || path.to_s.start_with?('~')
end

#declared_pathString (private)

Returns The path as declared by the user.

Returns:

  • (String)

    The path as declared by the user.


36
37
38
39
# File 'lib/cocoapods/external_sources/path_source.rb', line 36

def declared_path
  result = params[:path]
  result.to_s if result
end

#descriptionObject


26
27
28
# File 'lib/cocoapods/external_sources/path_source.rb', line 26

def description
  "from `#{declared_path}`"
end

#fetch(sandbox) ⇒ Object


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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

#podspec_pathPathname (private)

Returns The absolute path of the podspec.

Returns:

  • (Pathname)

    The absolute path of the podspec.


43
44
45
46
# 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