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.



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

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



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

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.



72
73
74
# File 'lib/pdk/template/fetcher.rb', line 72

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



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

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



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

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:



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

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



94
95
96
# File 'lib/pdk/template/fetcher.rb', line 94

def fetch!
  @fetched = true
end