Delete more unused actions

This commit is contained in:
Mitchell Hashimoto 2012-08-15 21:55:25 -07:00
parent 85a4fb82a8
commit fcffcb2ee0
4 changed files with 0 additions and 137 deletions

View File

@ -1,21 +0,0 @@
module Vagrant
module Action
module Env
# A middleware which just sets up the environment with some
# options which are passed to it.
class Set
def initialize(app, env, options=nil)
@app = app
@options = options || {}
end
def call(env)
# Merge the options that were given to us
env.merge!(@options)
@app.call(env)
end
end
end
end
end

View File

@ -1,57 +0,0 @@
require 'fileutils'
module Vagrant
module Action
module VM
class Export
attr_reader :temp_dir
def initialize(app, env)
@app = app
@env = env
end
def call(env)
@env = env
raise Errors::VMPowerOffToPackage if @env["vm"].state != :poweroff
setup_temp_dir
export
@app.call(env)
recover(env) # called to cleanup temp directory
end
def recover(env)
if temp_dir && File.exist?(temp_dir)
FileUtils.rm_rf(temp_dir)
end
end
def setup_temp_dir
@env[:ui].info I18n.t("vagrant.actions.vm.export.create_dir")
@temp_dir = @env["export.temp_dir"] = @env[:tmp_path].join(Time.now.to_i.to_s)
FileUtils.mkpath(@env["export.temp_dir"])
end
def export
@env[:ui].info I18n.t("vagrant.actions.vm.export.exporting")
@env[:vm].driver.export(ovf_path) do |progress|
@env[:ui].clear_line
@env[:ui].report_progress(progress.percent, 100, false)
end
# Clear the line a final time so the next data can appear
# alone on the line.
@env[:ui].clear_line
end
def ovf_path
File.join(@env["export.temp_dir"], "box.ovf")
end
end
end
end
end

View File

@ -1,23 +0,0 @@
require 'vagrant/action/general/package'
module Vagrant
module Action
module VM
# A subclass of {General::Package} which simply makes sure that
# the package directory is set to the directory which the VM
# was exported to.
class Package < General::Package
# Doing this so that we can test that the parent is properly
# called in the unit tests.
alias_method :general_call, :call
def call(env)
# Just match up a couple environmental variables so that
# the superclass will do the right thing. Then, call the
# superclass
env["package.directory"] = env["export.temp_dir"]
general_call(env)
end
end
end
end
end

View File

@ -1,36 +0,0 @@
require 'vagrant/util/template_renderer'
module Vagrant
module Action
module VM
# Puts a generated Vagrantfile into the package directory so that
# it can be included in the package.
class PackageVagrantfile
# For TemplateRenderer
include Util
def initialize(app, env)
@app = app
@env = env
end
def call(env)
@env = env
create_vagrantfile
@app.call(env)
end
# This method creates the auto-generated Vagrantfile at the root of the
# box. This Vagrantfile contains the MAC address so that the user doesn't
# have to worry about it.
def create_vagrantfile
File.open(File.join(@env["export.temp_dir"], "Vagrantfile"), "w") do |f|
f.write(TemplateRenderer.render("package_Vagrantfile", {
:base_mac => @env["vm"].driver.read_mac_address
}))
end
end
end
end
end
end