Class: Vagrant::Command::BoxCommand

Inherits:
GroupBase
  • Object
show all
Defined in:
lib/vagrant/command/box.rb

Instance Attribute Summary

Attributes inherited from GroupBase

#env

Instance Method Summary collapse

Methods inherited from GroupBase

#initialize, register

Methods included from Helpers

#initialize_environment, #target_vms

Constructor Details

This class inherits a constructor from Vagrant::Command::GroupBase

Instance Method Details

#add(name, uri) ⇒ Object



7
8
9
# File 'lib/vagrant/command/box.rb', line 7

def add(name, uri)
  Box.add(env, name, uri)
end

#listObject



26
27
28
29
30
# File 'lib/vagrant/command/box.rb', line 26

def list
  boxes = env.boxes.sort
  return env.ui.warn(I18n.t("vagrant.commands.box.no_installed_boxes"), :prefix => false) if boxes.empty?
  boxes.each { |b| env.ui.info(b.name, :prefix => false) }
end

#remove(name) ⇒ Object



12
13
14
15
16
# File 'lib/vagrant/command/box.rb', line 12

def remove(name)
  b = env.boxes.find(name)
  raise Errors::BoxNotFound, :name => name if !b
  b.destroy
end

#repackage(name) ⇒ Object



19
20
21
22
23
# File 'lib/vagrant/command/box.rb', line 19

def repackage(name)
  b = env.boxes.find(name)
  raise Errors::BoxNotFound, :name => name if !b
  b.repackage
end