Module: Vagrant::Box::Remote
- Defined in:
- lib/vagrant/box/remote.rb
Overview
This module enables the Box for server mode
Class Method Summary collapse
-
.prepended(klass) ⇒ Object
Add an attribute reader for the client when applied to the Box class.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #automatic_update_check_allowed? ⇒ Boolean
- #destroy! ⇒ Object
- #has_update?(version = nil, **opts) ⇒ Boolean
- #in_use?(index) ⇒ Boolean
-
#initialize(name, provider, version, directory, metadata_url: nil, hook: nil, client: nil) ⇒ Object
This is used to initialize a box.
- #repackage(path) ⇒ Object
- #to_proto ⇒ Object
Class Method Details
.prepended(klass) ⇒ Object
Add an attribute reader for the client when applied to the Box class
11 12 13 14 15 |
# File 'lib/vagrant/box/remote.rb', line 11 def self.prepended(klass) klass.class_eval do attr_reader :client end end |
Instance Method Details
#<=>(other) ⇒ Object
74 75 76 |
# File 'lib/vagrant/box/remote.rb', line 74 def <=>(other) client.compare(other.to_proto) end |
#automatic_update_check_allowed? ⇒ Boolean
66 67 68 |
# File 'lib/vagrant/box/remote.rb', line 66 def automatic_update_check_allowed? client.automatic_update_check_allowed end |
#destroy! ⇒ Object
43 44 45 |
# File 'lib/vagrant/box/remote.rb', line 43 def destroy! client.destroy end |
#has_update?(version = nil, **opts) ⇒ Boolean
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/vagrant/box/remote.rb', line 51 def has_update?(version=nil, **opts) update_info = client.update_info(version) if update_info.nil? return nil end = update_info[0] new_version = update_info[1] new_provider = update_info[2] [ BoxMetadata.new(nil, client: ), BoxMetadata::Version.new({"version" => new_version}, ver: new_version, client: ), BoxMetadata::Provider.new({"name" => new_provider}, client: ), ] end |
#in_use?(index) ⇒ Boolean
47 48 49 |
# File 'lib/vagrant/box/remote.rb', line 47 def in_use?(index) client.machines(index.to_proto) end |
#initialize(name, provider, version, directory, metadata_url: nil, hook: nil, client: nil) ⇒ Object
This is used to initialize a box.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vagrant/box/remote.rb', line 25 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 = @hook = hook if client.nil? raise ArgumentError, "Remote client is required for `#{self.class.name}'" end @client = client @metadata = client. end |
#repackage(path) ⇒ Object
70 71 72 |
# File 'lib/vagrant/box/remote.rb', line 70 def repackage(path) client.repackage(path) end |
#to_proto ⇒ Object
78 79 80 |
# File 'lib/vagrant/box/remote.rb', line 78 def to_proto client.proto end |