module Vagrant::BoxCollection::Remote
This module enables the BoxCollection
for server mode
Public Class Methods
new(directory, options=nil)
click to toggle source
# File lib/vagrant/box_collection/remote.rb, line 14 def initialize(directory, options=nil) @client = options[:client] if @client.nil? raise ArgumentError, "Remote client is required for `#{self.class.name}'" end @hook = options[:hook] @logger = Log4r::Logger.new("vagrant::box_collection") end
prepended(klass)
click to toggle source
Add an attribute reader for the client when applied to the BoxCollection
class
# File lib/vagrant/box_collection/remote.rb, line 8 def self.prepended(klass) klass.class_eval do attr_reader :client end end
Public Instance Methods
add(path, name, version, **opts)
click to toggle source
@return [Vagrant::Box]
# File lib/vagrant/box_collection/remote.rb, line 25 def add(path, name, version, **opts) client.add( path, name, version, opts[:force], opts[:metadata_url], opts[:providers] ) end
all()
click to toggle source
@return [Array] Array of ‘[name, version, provider]` of the boxes
installed on this system.
# File lib/vagrant/box_collection/remote.rb, line 34 def all all_boxes = client.all boxes = [] all_boxes.each do |b| boxes << [b.name, b.version, b.provider] end boxes end
clean(name)
click to toggle source
# File lib/vagrant/box_collection/remote.rb, line 48 def clean(name) client.clean(name) end
find(name, providers, version)
click to toggle source
@return [Box] The box found, or ‘nil` if not found.
# File lib/vagrant/box_collection/remote.rb, line 44 def find(name, providers, version) client.find(name, providers, version) end