From 816a1734e4bf38d4c7e85de6c39a18040d84fb08 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 3 Mar 2010 23:40:43 -0800 Subject: [PATCH] Vagrant::Box developer documentation --- lib/vagrant/box.rb | 85 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/box.rb b/lib/vagrant/box.rb index bc9a9e9e8..d0172ec5a 100644 --- a/lib/vagrant/box.rb +++ b/lib/vagrant/box.rb @@ -1,16 +1,74 @@ module Vagrant + # Represents a "box," which is simply a packaged vagrant environment. + # Boxes are simply `tar` files which contain an exported VirtualBox + # virtual machine, at the least. They are created with `vagrant package` + # and may contain additional files if specified by the creator. This + # class serves to help manage these boxes, although most of the logic + # is kicked out to actions. + # + # What can the {Box} class do? + # + # * Find boxes + # * Add existing boxes (from some URI) + # * Delete existing boxes + # + # # Finding Boxes + # + # Using the {Box.find} method, you can search for existing boxes. This + # method will return `nil` if none is found or an instance of {Box} + # otherwise. + # + # box = Vagrant::Box.find("base") + # if box.nil? + # puts "Box not found!" + # else + # puts "Box exists at #{box.directory}" + # end + # + # # Adding a Box + # + # Boxes can be added from any URI. Some schemas aren't supported; if this + # is the case, the error will output to the logger. + # + # Vagrant::Box.add("foo", "http://myfiles.com/foo.box") + # + # # Destroying a box + # + # Boxes can be deleted as well. This method is _final_ and there is no way + # to undo this action once it is completed. + # + # box = Vagrant::Box.find("foo") + # box.destroy + # class Box < Actions::Runner + # The name of the box. attr_accessor :name + + # The URI for a new box. This is not available for existing boxes. attr_accessor :uri + + # The temporary path to the downloaded or copied box. This should + # only be used internally. attr_accessor :temp_path class <