Class: VagrantVbguest::DownloadBase

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-vbguest/download.rb

Direct Known Subclasses

Download

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, destination, options = nil) ⇒ DownloadBase

Returns a new instance of DownloadBase.



6
7
8
9
10
11
12
13
14
# File 'lib/vagrant-vbguest/download.rb', line 6

def initialize(source, destination, options=nil)
  @downloader = nil
  @source = source
  @destination = destination
  if File.directory?(destination)
    @destination = File.join(destination, "vbguest_download_#{Time.now.to_i.to_s}")
  end
  @ui = options[:ui]
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



4
5
6
# File 'lib/vagrant-vbguest/download.rb', line 4

def destination
  @destination
end

#downloaderObject (readonly)

Returns the value of attribute downloader.



4
5
6
# File 'lib/vagrant-vbguest/download.rb', line 4

def downloader
  @downloader
end

#sourceObject (readonly)

Returns the value of attribute source.



4
5
6
# File 'lib/vagrant-vbguest/download.rb', line 4

def source
  @source
end

Instance Method Details

#cleanupObject



20
21
22
23
24
25
# File 'lib/vagrant-vbguest/download.rb', line 20

def cleanup
  if destination && File.exist?(destination)
    @ui.info I18n.t("vagrant_vbguest.download.cleaning")
    File.unlink(destination)
  end
end

#download!Object

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/vagrant-vbguest/download.rb', line 16

def download!
  raise NotImplementedError
end