Sha256: 4117ba4f48d01a733dd2150ccd0816dc085c513c939aa1fb305a6e38545ea0d3
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
require "cookbook-omnifetch/base" require "cookbook-omnifetch/metadata_based_installer" module CookbookOmnifetch class ChefServerLocation < BaseLocation attr_reader :cookbook_version attr_reader :uri def initialize(dependency, options = {}) super @cookbook_version = options[:version] @http_client = options[:http_client] @uri ||= options[:chef_server] end def cookbook_name dependency.name end def url_path "/cookbooks/#{cookbook_name}/#{cookbook_version}" end def installer MetadataBasedInstaller.new(http_client: http_client, url_path: url_path, install_path: install_path) end def install installer.install end # Determine if this revision is installed. # # @return [Boolean] def installed? install_path.exist? end def http_client @http_client end # The path where this cookbook would live in the store, if it were # installed. # # @return [Pathname, nil] def install_path @install_path ||= CookbookOmnifetch.storage_path.join(cache_key) end def lock_data { "chef_server" => uri, "version" => cookbook_version } end def cache_key "#{dependency.name}-#{cookbook_version}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cookbook-omnifetch-0.7.0 | lib/cookbook-omnifetch/chef_server.rb |