Class: Librarian::Puppet::Source::GitHubTarball
- Inherits:
-
Object
- Object
- Librarian::Puppet::Source::GitHubTarball
- Includes:
- Util
- Defined in:
- lib/librarian/puppet/source/githubtarball.rb
Defined Under Namespace
Classes: Repo
Constant Summary collapse
- LOCK_NAME =
'GITHUBTARBALL'
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Class Method Summary collapse
- .from_lock_options(environment, options) ⇒ Object
- .from_spec_args(environment, uri, options) ⇒ Object
- .lock_name ⇒ Object
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #cache_path ⇒ Object
- #fetch_dependencies(name, version, version_uri) ⇒ Object
- #fetch_version(name, version_uri) ⇒ Object
- #hash ⇒ Object
-
#initialize(environment, uri, options = {}) ⇒ GitHubTarball
constructor
A new instance of GitHubTarball.
- #install!(manifest) ⇒ Object
- #install_path(name) ⇒ Object
- #manifest(name, version, dependencies) ⇒ Object
- #manifests(name) ⇒ Object
- #pinned? ⇒ Boolean
- #to_lock_options ⇒ Object
- #to_s ⇒ Object
- #to_spec_args ⇒ Object
- #unpin! ⇒ Object
Methods included from Util
Constructor Details
#initialize(environment, uri, options = {}) ⇒ GitHubTarball
Returns a new instance of GitHubTarball.
189 190 191 192 193 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 189 def initialize(environment, uri, = {}) self.environment = environment @uri = uri @cache_path = nil end |
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
185 186 187 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 185 def environment @environment end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
187 188 189 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 187 def uri @uri end |
Class Method Details
.from_lock_options(environment, options) ⇒ Object
170 171 172 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 170 def (environment, ) new(environment, [:remote], .reject { |k, v| k == :remote }) end |
.from_spec_args(environment, uri, options) ⇒ Object
174 175 176 177 178 179 180 181 182 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 174 def from_spec_args(environment, uri, ) = [] = .keys - unless .empty? raise Error, "unrecognised options: #{.join(", ")}" end new(environment, uri, ) end |
.lock_name ⇒ Object
166 167 168 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 166 def lock_name LOCK_NAME end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
199 200 201 202 203 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 199 def ==(other) other && self.class == other.class && self.uri == other.uri end |
#cache_path ⇒ Object
244 245 246 247 248 249 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 244 def cache_path @cache_path ||= begin dir = Digest::MD5.hexdigest(uri) environment.cache_path.join("source/puppet/githubtarball/#{dir}") end end |
#fetch_dependencies(name, version, version_uri) ⇒ Object
264 265 266 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 264 def fetch_dependencies(name, version, version_uri) {} end |
#fetch_version(name, version_uri) ⇒ Object
255 256 257 258 259 260 261 262 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 255 def fetch_version(name, version_uri) versions = repo(name).versions if versions.include? version_uri version_uri else versions.first end end |
#hash ⇒ Object
207 208 209 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 207 def hash self.to_s.hash end |
#install!(manifest) ⇒ Object
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 226 def install!(manifest) manifest.source == self or raise ArgumentError name = manifest.name version = manifest.version install_path = install_path(name) repo = repo(name) repo.install_version! version, install_path end |
#install_path(name) ⇒ Object
251 252 253 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 251 def install_path(name) environment.install_path.join(name.split('/').last) end |
#manifest(name, version, dependencies) ⇒ Object
237 238 239 240 241 242 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 237 def manifest(name, version, dependencies) manifest = Manifest.new(self, name) manifest.version = version manifest.dependencies = dependencies manifest end |
#manifests(name) ⇒ Object
268 269 270 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 268 def manifests(name) repo(name).manifests end |
#pinned? ⇒ Boolean
219 220 221 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 219 def pinned? false end |
#to_lock_options ⇒ Object
215 216 217 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 215 def {:remote => uri} end |
#to_s ⇒ Object
195 196 197 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 195 def to_s uri end |
#to_spec_args ⇒ Object
211 212 213 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 211 def to_spec_args [uri, {}] end |
#unpin! ⇒ Object
223 224 |
# File 'lib/librarian/puppet/source/githubtarball.rb', line 223 def unpin! end |