module Vagrant::Box::Remote
This module enables the Box
for server mode
Public Class Methods
new(name, provider, version, directory, metadata_url: nil, hook: nil, client: nil)
click to toggle source
This is used to initialize a box.
@param [String] name Logical name of the box. @param [Symbol] provider The provider that this box implements. @param [Pathname] directory The directory where this box exists on
disk.
@param [String] metadata_url Metadata URL for box @param [Hook] hook A hook to apply to the box downloader, for example, for authentication
# File lib/vagrant/box/remote.rb, line 22 def initialize(name, provider, version, directory, metadata_url: nil, hook: nil, client: nil) @logger = Log4r::Logger.new("vagrant::box") @name = name @version = version @provider = provider @directory = directory @metadata_url = metadata_url @hook = hook if client.nil? raise ArgumentError, "Remote client is required for `#{self.class.name}'" end @client = client @metadata = client.box_metadata end
prepended(klass)
click to toggle source
Add an attribute reader for the client when applied to the Box
class
# File lib/vagrant/box/remote.rb, line 8 def self.prepended(klass) klass.class_eval do attr_reader :client end end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/vagrant/box/remote.rb, line 71 def <=>(other) client.compare(other.to_proto) end
automatic_update_check_allowed?()
click to toggle source
# File lib/vagrant/box/remote.rb, line 63 def automatic_update_check_allowed? client.automatic_update_check_allowed end
destroy!()
click to toggle source
# File lib/vagrant/box/remote.rb, line 40 def destroy! client.destroy end
has_update?(version=nil, **opts)
click to toggle source
# File lib/vagrant/box/remote.rb, line 48 def has_update?(version=nil, **opts) update_info = client.update_info(version) if update_info.nil? return nil end metadata = update_info[0] new_version = update_info[1] new_provider = update_info[2] [ BoxMetadata.new(nil, client: metadata), BoxMetadata::Version.new({"version" => new_version}, ver: new_version, client: metadata), BoxMetadata::Provider.new({"name" => new_provider}, client: metadata), ] end
in_use?(index)
click to toggle source
# File lib/vagrant/box/remote.rb, line 44 def in_use?(index) client.machines(index.to_proto) end
repackage(path)
click to toggle source
# File lib/vagrant/box/remote.rb, line 67 def repackage(path) client.repackage(path) end
to_proto()
click to toggle source
# File lib/vagrant/box/remote.rb, line 75 def to_proto client.proto end