Modify box download action to work with new runnerx
This commit is contained in:
parent
3c8261f4ac
commit
f261c0571f
|
@ -37,8 +37,8 @@ module Vagrant
|
|||
# Use the class if it matches the given URI or if this
|
||||
# is the last class...
|
||||
if classes.length == (i + 1) || klass.match?(@env["box_url"])
|
||||
@env.ui.info I18n.t("vagrant.actions.box.download.with", :class => klass.to_s)
|
||||
@downloader = klass.new(@env)
|
||||
@env[:ui].info I18n.t("vagrant.actions.box.download.with", :class => klass.to_s)
|
||||
@downloader = klass.new(@env[:ui])
|
||||
break
|
||||
end
|
||||
end
|
||||
|
@ -60,7 +60,7 @@ module Vagrant
|
|||
|
||||
def recover(env)
|
||||
if temp_path && File.exist?(temp_path)
|
||||
env.ui.info I18n.t("vagrant.actions.box.download.cleaning")
|
||||
env[:ui].info I18n.t("vagrant.actions.box.download.cleaning")
|
||||
File.unlink(temp_path)
|
||||
end
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def box_temp_path
|
||||
@env.env.tmp_path.join(BASENAME + Time.now.to_i.to_s)
|
||||
@env[:tmp_path].join(BASENAME + Time.now.to_i.to_s)
|
||||
end
|
||||
|
||||
def download_to(f)
|
||||
|
|
|
@ -5,11 +5,8 @@ module Vagrant
|
|||
class Base
|
||||
include Vagrant::Util
|
||||
|
||||
# The environment which this downloader is operating.
|
||||
attr_reader :env
|
||||
|
||||
def initialize(env)
|
||||
@env = env
|
||||
def initialize(ui)
|
||||
@ui = ui
|
||||
end
|
||||
|
||||
# Called prior to execution so any error checks can be done
|
||||
|
|
|
@ -14,7 +14,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def download!(source_url, destination_file)
|
||||
env.ui.info I18n.t("vagrant.downloaders.file.download")
|
||||
@ui.info I18n.t("vagrant.downloaders.file.download")
|
||||
FileUtils.cp(source_url, destination_file.path)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
http.start do |h|
|
||||
env.ui.info I18n.t("vagrant.downloaders.http.download", :url => source_url)
|
||||
@ui.info I18n.t("vagrant.downloaders.http.download", :url => source_url)
|
||||
|
||||
headers = nil
|
||||
if uri.user && uri.password
|
||||
|
@ -56,8 +56,8 @@ module Vagrant
|
|||
# Progress reporting is limited to every 25 segments just so
|
||||
# we're not constantly updating
|
||||
if segment_count % 25 == 0
|
||||
env.ui.clear_line
|
||||
env.ui.report_progress(progress, total)
|
||||
@ui.clear_line
|
||||
@ui.report_progress(progress, total)
|
||||
segment_count = 0
|
||||
end
|
||||
|
||||
|
@ -66,7 +66,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
# Clear the line one last time so that the progress meter disappears
|
||||
env.ui.clear_line
|
||||
@ui.clear_line
|
||||
end
|
||||
end
|
||||
rescue SocketError
|
||||
|
|
|
@ -209,7 +209,9 @@ module Vagrant
|
|||
#
|
||||
# @return [Action::Runner]
|
||||
def action_runner
|
||||
@action_runner ||= Action::Runner.new(action_registry, :ui => @ui)
|
||||
@action_runner ||= Action::Runner.new(action_registry,
|
||||
:tmp_path => tmp_path,
|
||||
:ui => @ui)
|
||||
end
|
||||
|
||||
# Action registry for registering new actions with this environment.
|
||||
|
|
Loading…
Reference in New Issue