Class: PDK::Template::Fetcher::AbstractFetcher Abstract Private

Inherits:
Object
  • Object
show all
Defined in:
lib/pdk/template/fetcher.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is abstract.

An abstract class which all Template Fetchers should subclass. This class is responsible for downloading or copying a Template Directory that is pointed to by a Template URI

Direct Known Subclasses

Git, Local

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, options) ⇒ AbstractFetcher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of AbstractFetcher.

Parameters:

  • uri (PDK::Util::TemplateURI)

    The URI of the template to fetch

  • options (Hash{Object => Object})

    A list of options to pass through to the fetcher.



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/pdk/template/fetcher.rb', line 74

def initialize(uri, options)
  @uri = uri
  # Defaults
  @path = nil
  @metadata = {
    'pdk-version' => PDK::Util::Version.version_string,
    'template-url' => nil,
    'template-ref' => nil,
  }
  @fetched = false
  @temporary = false
  @options = options
end

Instance Attribute Details

#fetchedBoolean (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Whether the template has been fetched yet.

Returns:

  • (Boolean)

    Whether the template has been fetched yet



67
68
69
# File 'lib/pdk/template/fetcher.rb', line 67

def fetched
  @fetched
end

#metadataHash (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The metadata hash for this template.

Returns:

  • (Hash)

    The metadata hash for this template.



70
71
72
# File 'lib/pdk/template/fetcher.rb', line 70

def 
  @metadata
end

#pathString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The local filesystem path of the fetched template.

Returns:

  • (String)

    The local filesystem path of the fetched template



61
62
63
# File 'lib/pdk/template/fetcher.rb', line 61

def path
  @path
end

#temporaryBoolean (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns Whether the fetched path should be considered temporary and be deleted after use.

Returns:

  • (Boolean)

    Whether the fetched path should be considered temporary and be deleted after use



64
65
66
# File 'lib/pdk/template/fetcher.rb', line 64

def temporary
  @temporary
end

#uriPDK::Util::TemplateURI (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The URI of the template that is to be fetched.

Returns:



58
59
60
# File 'lib/pdk/template/fetcher.rb', line 58

def uri
  @uri
end

Instance Method Details

#fetch!void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method is abstract.

This method returns an undefined value.

Fetches the template directory and populates the path property



92
93
94
# File 'lib/pdk/template/fetcher.rb', line 92

def fetch!
  @fetched = true
end