Sha256: 944a4ecd851c4c27e9cf763f198f0c61e92829566d8fe77bd7ff9a3724351bc1
Contents?: true
Size: 1.37 KB
Versions: 7
Compression:
Stored size: 1.37 KB
Contents
require 'digest/sha1' require 'fileutils' require 'knife-solo/cookbook_manager' require 'knife-solo/tools' module KnifeSolo class Berkshelf include CookbookManager def self.gem_libraries %w[berkshelf] end def self.conf_file_name 'Berksfile' end def install! path = berkshelf_path ui.msg "Installing Berkshelf cookbooks to '#{path}'..." if Gem::Version.new(::Berkshelf::VERSION) >= Gem::Version.new("3.0.0") berkshelf_options = KnifeSolo::Tools.config_value(config, :berkshelf_options) || {} berksfile = ::Berkshelf::Berksfile.from_file('Berksfile',berkshelf_options) else berksfile = ::Berkshelf::Berksfile.from_file('Berksfile') end if berksfile.respond_to?(:vendor) FileUtils.rm_rf(path) berksfile.vendor(path) else berksfile.install(:path => path) end path end def berkshelf_path KnifeSolo::Tools.config_value(config, :berkshelf_path) || default_path end def default_path File.join(::Berkshelf.berkshelf_path, 'knife-solo', Digest::SHA1.hexdigest(File.expand_path('.'))) end def initial_config if defined?(::Berkshelf) && Gem::Version.new(::Berkshelf::VERSION) >= Gem::Version.new("3.0.0") 'source "https://api.berkshelf.com"' else 'site :opscode' end end end end
Version data entries
7 entries across 7 versions & 1 rubygems