Class: Tenderloin::Actions::Box::Add

Inherits:
Tenderloin::Actions::Base show all
Defined in:
lib/tenderloin/actions/box/add.rb

Overview

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.

Instance Attribute Summary

Attributes inherited from Tenderloin::Actions::Base

#runner

Instance Method Summary collapse

Methods inherited from Tenderloin::Actions::Base

#cleanup, #execute!, #initialize, #rescue

Methods included from Util

#error_and_exit, included, #logger, #wrap_output

Constructor Details

This class inherits a constructor from Tenderloin::Actions::Base

Instance Method Details

#prepareObject



11
12
13
14
15
16
17
18
19
# File 'lib/tenderloin/actions/box/add.rb', line 11

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 `tenderloin box remove #{@runner.name}`")
  end

  @runner.add_action(Download)
  @runner.add_action(Unpackage)
  @runner.add_action(Convert)
end