Class: CookbookOmnifetch::ChefServerLocation
Instance Attribute Summary collapse
Attributes inherited from BaseLocation
#dependency, #options
Instance Method Summary
collapse
#to_lock, #validate_cached!
Constructor Details
#initialize(dependency, options = {}) ⇒ ChefServerLocation
Returns a new instance of ChefServerLocation.
10
11
12
13
14
15
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 10
def initialize(dependency, options = {})
super
@cookbook_version = options[:version]
@http_client = options[:http_client] || default_chef_server_http_client
@uri ||= options[:chef_server]
end
|
Instance Attribute Details
#cookbook_version ⇒ Object
Returns the value of attribute cookbook_version.
7
8
9
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 7
def cookbook_version
@cookbook_version
end
|
#uri ⇒ Object
Returns the value of attribute uri.
8
9
10
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 8
def uri
@uri
end
|
Instance Method Details
#cache_key ⇒ Object
56
57
58
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 56
def cache_key
"#{dependency.name}-#{cookbook_version}"
end
|
#cached_cookbook ⇒ Object
#cookbook_name ⇒ Object
17
18
19
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 17
def cookbook_name
dependency.name
end
|
#http_client ⇒ Object
40
41
42
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 40
def http_client
@http_client
end
|
#install ⇒ Object
29
30
31
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 29
def install
installer.install
end
|
#install_path ⇒ Pathname?
The path where this cookbook would live in the store, if it were installed.
48
49
50
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 48
def install_path
@install_path ||= CookbookOmnifetch.storage_path.join(cache_key)
end
|
#installed? ⇒ Boolean
Determine if this revision is installed.
36
37
38
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 36
def installed?
install_path.exist?
end
|
#installer ⇒ Object
25
26
27
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 25
def installer
MetadataBasedInstaller.new(http_client: http_client, url_path: url_path, install_path: install_path)
end
|
#lock_data ⇒ Object
52
53
54
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 52
def lock_data
{ "chef_server" => uri, "version" => cookbook_version }
end
|
#url_path ⇒ Object
21
22
23
|
# File 'lib/cookbook-omnifetch/chef_server.rb', line 21
def url_path
"/cookbooks/#{cookbook_name}/#{cookbook_version}"
end
|