Class: Vagrant::Downloaders::File
- Inherits:
-
Base
- Object
- Base
- Vagrant::Downloaders::File
- Defined in:
- lib/vagrant/downloaders/file.rb
Overview
“Downloads” a file to a temporary file. Basically, this downloader simply does a file copy.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.match?(uri) ⇒ Boolean
8 9 10 |
# File 'lib/vagrant/downloaders/file.rb', line 8 def self.match?(uri) ::File.file?(::File.(uri)) end |
Instance Method Details
#download!(source_url, destination_file) ⇒ Object
16 17 18 19 |
# File 'lib/vagrant/downloaders/file.rb', line 16 def download!(source_url, destination_file) @ui.info I18n.t("vagrant.downloaders.file.download") FileUtils.symlink(::File.(source_url), destination_file.path, :force => true) end |
#prepare(source_url) ⇒ Object
12 13 14 |
# File 'lib/vagrant/downloaders/file.rb', line 12 def prepare(source_url) raise Errors::DownloaderFileDoesntExist if !::File.file?(::File.(source_url)) end |