Class: Bolt::ModuleInstaller::Specs::ID::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bolt/module_installer/specs/id/base.rb

Direct Known Subclasses

GitClone, GitHub, GitLab

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, sha) ⇒ Base

Returns a new instance of Base.

Parameters:

  • name (String)

    The module’s name.

  • sha (String)

    The ref’s SHA1.



19
20
21
22
# File 'lib/bolt/module_installer/specs/id/base.rb', line 19

def initialize(name, sha)
  @name = name
  @sha  = sha
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/bolt/module_installer/specs/id/base.rb', line 14

def name
  @name
end

#shaObject (readonly)

Returns the value of attribute sha.



14
15
16
# File 'lib/bolt/module_installer/specs/id/base.rb', line 14

def sha
  @sha
end

Class Method Details

.request(git, ref, proxy) ⇒ Object

Request the name and SHA for a module and ref. This method must return either an ID object or nil. The GitSpec class relies on this class to return an ID object to indicate the module was found, or nil to indicate that it should try to find it another way (such as cloning the repo).

Parameters:

  • git (String)

    The URL to the git repo.

  • ref (String)

    The ref to checkout.

  • proxy (String)

    A proxy to use when making requests.



34
35
36
37
# File 'lib/bolt/module_installer/specs/id/base.rb', line 34

def self.request(git, ref, proxy)
  name, sha = name_and_sha(git, ref, proxy)
  name && sha ? new(name, sha) : nil
end