Sha256: 8498b114abe318219800f02101ab956677bd885698c7da870acb5cb7b18d313c
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
require 'vagabond/uploader/berkshelf' module Vagabond class Uploader class Berkshelf < Uploader def initialize(*args) super %w(berksfile chef_server_url).each do |k| unless(options[k]) raise ArgumentError.new "Option '#{k}' must be provided!" end end end def prepare path = File.join(store, 'berks.json') if(File.exists?(path)) cur = Mash.new(JSON.load(File.read(path))) else cur = Mash.new end url = options[:chef_server_url] if(cur[:chef].nil? || cur[:chef][:chef_server_url] != url) cur[:chef] = Mash.new(:chef_server_url => url) cur[:ssl] = Mash.new(:verify => false) File.open(path, 'w') do |file| file.write(JSON.dump(cur)) end end end def upload(*args) prepare unless args.include?(:no_prepare) com = "berks upload -b #{options[:berksfile]} -c #{File.join(store, 'berks.json')}#{" #{Array(options[:berks_opts]).join(' ')}"}" debug(com) cmd = Mixlib::ShellOut.new(com, :live_stream => options[:debug], :env => {'HOME' => ENV['HOME']}) cmd.run_command cmd.error! end def vendor(*args) prepare unless args.include?(:no_prepare) FileUtils.mkdir_p(ckbk_store = File.join(store, 'cookbooks')) com = "berks install -b #{options[:berksfile]} -p #{ckbk_store}" debug(com) cmd = Mixlib::ShellOut.new(com, :live_stream => options[:debug]) cmd.run_command cmd.error! end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagabond-0.2.4 | lib/vagabond/uploader/berkshelf.rb |
vagabond-0.2.2 | lib/vagabond/uploader/berkshelf.rb |