class Librarian::Chef::Source::Site
Attributes
environment[RW]
uri[RW]
Public Class Methods
new(environment, uri, options = {})
click to toggle source
# File lib/librarian/chef/source/site.rb, line 395 def initialize(environment, uri, options = {}) self.environment = environment self.uri = uri end
Public Instance Methods
==(other)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 404 def ==(other) other && self.class == other.class && self.uri == other.uri end
cache_path()
click to toggle source
# File lib/librarian/chef/source/site.rb, line 446 def cache_path @cache_path ||= begin dir = Digest::MD5.hexdigest(uri)[0..15] environment.cache_path.join("source/chef/site/#{dir}") end end
fetch_dependencies(name, version, version_uri)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 461 def fetch_dependencies(name, version, version_uri) line(name).version_dependencies(version).map{|k, v| Dependency.new(k, v, nil)} end
fetch_version(name, version_uri)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 457 def fetch_version(name, version_uri) line(name).to_version(version_uri) end
install!(manifest)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 425 def install!(manifest) manifest.source == self or raise ArgumentError name = manifest.name version = manifest.version install_path = install_path(name) line = line(name) info { "Installing #{manifest.name} (#{manifest.version})" } debug { "Installing #{manifest}" } line.install_version! version, install_path end
install_path(name)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 453 def install_path(name) environment.install_path.join(name) end
manifests(name)
click to toggle source
NOTE:
Assumes the Opscode Site API responds with versions in reverse sorted order
# File lib/librarian/chef/source/site.rb, line 442 def manifests(name) line(name).manifests end
pinned?()
click to toggle source
# File lib/librarian/chef/source/site.rb, line 418 def pinned? false end
to_lock_options()
click to toggle source
# File lib/librarian/chef/source/site.rb, line 414 def to_lock_options {:remote => uri} end
to_s()
click to toggle source
# File lib/librarian/chef/source/site.rb, line 400 def to_s uri end
to_spec_args()
click to toggle source
# File lib/librarian/chef/source/site.rb, line 410 def to_spec_args [uri, {}] end
unpin!()
click to toggle source
# File lib/librarian/chef/source/site.rb, line 422 def unpin! end
Private Instance Methods
debug(*args, &block)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 476 def debug(*args, &block) environment.logger.debug(*args, &block) end
info(*args, &block)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 472 def info(*args, &block) environment.logger.info(*args, &block) end
line(name)
click to toggle source
# File lib/librarian/chef/source/site.rb, line 467 def line(name) @line ||= { } @line[name] ||= Line.new(self, name) end