lib/vagrant/actions/box/download.rb in vagrantup-0.3.4 vs lib/vagrant/actions/box/download.rb in vagrantup-0.4.0
- old
+ new
@@ -16,11 +16,11 @@
def prepare
# Check the URI given and prepare a downloader
[Downloaders::HTTP, Downloaders::File].each do |dler|
if dler.match?(@runner.uri)
logger.info "Downloading via #{dler}..."
- @downloader = dler.new
+ @downloader = dler.new(@runner.env)
end
end
raise ActionException.new(:box_download_unknown_type) unless @downloader
@@ -46,17 +46,12 @@
cleanup
end
def with_tempfile
logger.info "Creating tempfile for storing box file..."
- File.open(box_temp_path, file_options) do |tempfile|
+ File.open(box_temp_path, Platform.tar_file_options) do |tempfile|
yield tempfile
end
- end
-
- def file_options
- # create, write only, fail if the file exists, binary if windows
- File::WRONLY|File::EXCL|File::CREAT|(Mario::Platform.windows? ? File::BINARY : 0)
end
def box_temp_path
File.join(@runner.env.tmp_path, BASENAME + Time.now.to_i.to_s)
end