Class: Gem::Checkout::Source
- Inherits:
-
Object
- Object
- Gem::Checkout::Source
- Defined in:
- lib/gem-checkout/source.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#source_reference ⇒ Object
readonly
Returns the value of attribute source_reference.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(name, version = nil) ⇒ Source
constructor
A new instance of Source.
Constructor Details
#initialize(name, version = nil) ⇒ Source
Returns a new instance of Source.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/gem-checkout/source.rb', line 102 def initialize(name, version=nil) Gem::Checkout.logger.debug "Gathering info about #{name} (#{version || 'latest'})" object = Spec.info(name, version) @version = object.version @name = name repository = RepositoryInfo.detect(object) fail Error::NoValidRepositoryFound unless repository @repository = repository.repository reference = RepositoryHash.detect(object) @source_reference = if reference reference.reference else Gem::Checkout.logger.warn "No metadata key with commit! Matching tag to version, which is insecure if you don't trust the repository owners!" @repository.get_tag_ref("v#{object.version}") end # TODO: check integrity of gem vs source end |
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
93 94 95 |
# File 'lib/gem-checkout/source.rb', line 93 def repository @repository end |
#source_reference ⇒ Object (readonly)
Returns the value of attribute source_reference.
92 93 94 |
# File 'lib/gem-checkout/source.rb', line 92 def source_reference @source_reference end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
100 101 102 |
# File 'lib/gem-checkout/source.rb', line 100 def version @version end |