Module: Vagrant::BoxCollection::Remote
- Defined in:
- lib/vagrant/box_collection/remote.rb
Overview
This module enables the BoxCollection for server mode
Class Method Summary collapse
-
.prepended(klass) ⇒ Object
Add an attribute reader for the client when applied to the BoxCollection class.
Instance Method Summary collapse
- #add(path, name, version, **opts) ⇒ Vagrant::Box
-
#all ⇒ Array
Array of
[name, version, provider]
of the boxes installed on this system. - #clean(name) ⇒ Object
-
#find(name, providers, version) ⇒ Box
The box found, or
nil
if not found. - #initialize(directory, options = nil) ⇒ Object
Class Method Details
.prepended(klass) ⇒ Object
Add an attribute reader for the client when applied to the BoxCollection class
11 12 13 14 15 |
# File 'lib/vagrant/box_collection/remote.rb', line 11 def self.prepended(klass) klass.class_eval do attr_reader :client end end |
Instance Method Details
#add(path, name, version, **opts) ⇒ Vagrant::Box
28 29 30 31 32 |
# File 'lib/vagrant/box_collection/remote.rb', line 28 def add(path, name, version, **opts) client.add( path, name, version, opts[:force], opts[:metadata_url], opts[:providers] ) end |
#all ⇒ Array
Returns Array of [name, version, provider]
of the boxes
installed on this system.
37 38 39 40 41 42 43 44 |
# File 'lib/vagrant/box_collection/remote.rb', line 37 def all all_boxes = client.all boxes = [] all_boxes.each do |b| boxes << [b.name, b.version, b.provider] end boxes end |
#clean(name) ⇒ Object
51 52 53 |
# File 'lib/vagrant/box_collection/remote.rb', line 51 def clean(name) client.clean(name) end |
#find(name, providers, version) ⇒ Box
Returns The box found, or nil
if not found.
47 48 49 |
# File 'lib/vagrant/box_collection/remote.rb', line 47 def find(name, providers, version) client.find(name, providers, version) end |
#initialize(directory, options = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/vagrant/box_collection/remote.rb', line 17 def initialize(directory, =nil) @client = [:client] if @client.nil? raise ArgumentError, "Remote client is required for `#{self.class.name}'" end @hook = [:hook] @logger = Log4r::Logger.new("vagrant::box_collection") end |