Developer documentation for box actions
This commit is contained in:
parent
a88e75f357
commit
bf738d4db5
|
@ -1,12 +1,18 @@
|
|||
module Vagrant
|
||||
module Actions
|
||||
module Box
|
||||
# A meta-action which adds a box by downloading and unpackaging it.
|
||||
# This action downloads and unpackages a box with a given URI. This
|
||||
# is a _meta action_, meaning it simply adds more actions to the
|
||||
# action chain, and those actions do the work.
|
||||
#
|
||||
# This is the action called by {Box#add}.
|
||||
class Add < Base
|
||||
def prepare
|
||||
if File.exists?(@runner.directory)
|
||||
raise ActionException.new("A box with the name '#{@runner.name}' already exists, please use another name or use `vagrant box remove #{@runner.name}`")
|
||||
end
|
||||
|
||||
|
||||
@runner.add_action(Download)
|
||||
@runner.add_action(Unpackage)
|
||||
end
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
module Vagrant
|
||||
module Actions
|
||||
module Box
|
||||
# Action to destroy a box. This action is not reversible and expects
|
||||
# to be called by a {Box} object.
|
||||
class Destroy < Base
|
||||
def execute!
|
||||
logger.info "Deleting box directory..."
|
||||
|
|
|
@ -2,7 +2,11 @@ module Vagrant
|
|||
module Actions
|
||||
module Box
|
||||
# An action which acts on a box by downloading the box file from
|
||||
# the given URI into a temporary location.
|
||||
# the given URI into a temporary location. This action parses a
|
||||
# given URI and handles downloading it via one of the many Vagrant
|
||||
# downloads (such as {Vagrant::Downloaders::File}).
|
||||
#
|
||||
# This action cleans itself up by removing the downloaded box file.
|
||||
class Download < Base
|
||||
BASENAME = "box"
|
||||
BUFFERSIZE = 1048576 # 1 MB
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
module Vagrant
|
||||
module Actions
|
||||
module Box
|
||||
# This action unpackages a downloaded box file into its final
|
||||
# box destination within the vagrant home folder.
|
||||
class Unpackage < Base
|
||||
TAR_OPTIONS = [File::RDONLY, 0644, Tar::GNU]
|
||||
|
||||
|
|
Loading…
Reference in New Issue