Class: Librarian::Puppet::Source::GitHubTarball
- Inherits:
-
Object
- Object
- Librarian::Puppet::Source::GitHubTarball
show all
- Includes:
- Util
- Defined in:
- lib/librarian/puppet/source/githubtarball.rb,
lib/librarian/puppet/source/githubtarball/repo.rb
Defined Under Namespace
Classes: Repo
Constant Summary
collapse
- LOCK_NAME =
'GITHUBTARBALL'
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#clean_uri, #cp_r, #debug, #info, #module_name, #normalize_name, #rsync?, #warn
Constructor Details
#initialize(environment, uri, _options = {}) ⇒ GitHubTarball
Returns a new instance of GitHubTarball.
37
38
39
40
41
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 37
def initialize(environment, uri, _options = {})
self.environment = environment
@uri = URI.parse(uri)
@cache_path = nil
end
|
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
33
34
35
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 33
def environment
@environment
end
|
#uri ⇒ Object
Returns the value of attribute uri.
35
36
37
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 35
def uri
@uri
end
|
Class Method Details
.from_lock_options(environment, options) ⇒ Object
20
21
22
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 20
def from_lock_options(environment, options)
new(environment, options[:remote], options.reject { |k, _v| k == :remote })
end
|
.from_spec_args(environment, uri, options) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 24
def from_spec_args(environment, uri, options)
recognised_options = []
unrecognised_options = options.keys - recognised_options
raise Error, "unrecognised options: #{unrecognised_options.join(', ')}" unless unrecognised_options.empty?
new(environment, uri, options)
end
|
.lock_name ⇒ Object
16
17
18
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 16
def lock_name
LOCK_NAME
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
47
48
49
50
51
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 47
def ==(other)
other &&
self.class == other.class &&
uri == other.uri
end
|
#cache_path ⇒ Object
93
94
95
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 93
def cache_path
@cache_path ||= environment.cache_path.join("source/puppet/githubtarball/#{uri.host}#{uri.path}")
end
|
#fetch_dependencies(_name, _version, _version_uri) ⇒ Object
110
111
112
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 110
def fetch_dependencies(_name, _version, _version_uri)
{}
end
|
#fetch_version(name, version_uri) ⇒ Object
101
102
103
104
105
106
107
108
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 101
def fetch_version(name, version_uri)
versions = repo(name).versions
if versions.include? version_uri
version_uri
else
versions.first
end
end
|
#hash ⇒ Object
55
56
57
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 55
def hash
to_s.hash
end
|
#install!(manifest) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 73
def install!(manifest)
manifest.source == self or raise ArgumentError
debug { "Installing #{manifest}" }
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
97
98
99
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 97
def install_path(name)
environment.install_path.join(module_name(name))
end
|
#manifest(name, version, dependencies) ⇒ Object
86
87
88
89
90
91
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 86
def manifest(name, version, dependencies)
manifest = Manifest.new(self, name)
manifest.version = version
manifest.dependencies = dependencies
manifest
end
|
#manifests(name) ⇒ Object
114
115
116
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 114
def manifests(name)
repo(name).manifests
end
|
#pinned? ⇒ Boolean
67
68
69
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 67
def pinned?
false
end
|
#to_lock_options ⇒ Object
63
64
65
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 63
def to_lock_options
{ remote: clean_uri(uri).to_s }
end
|
#to_s ⇒ Object
43
44
45
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 43
def to_s
clean_uri(uri).to_s
end
|
#to_spec_args ⇒ Object
59
60
61
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 59
def to_spec_args
[clean_uri(uri).to_s, {}]
end
|
#unpin! ⇒ Object
71
|
# File 'lib/librarian/puppet/source/githubtarball.rb', line 71
def unpin!; end
|