Class: Drupid::DownloadStrategy::Base

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/drupid/download_strategy.rb

Overview

url

The URL to download from

dest

The target directory for the download

name

The name (without extension) to assign to the downloaded entity

download_specs

A hash of optional download parameters.

Direct Known Subclasses

Bazaar, CVS, Curl, Fossil, Git, Mercurial, Subversion

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#blah, #bzr, #compare_paths, #curl, #cvs, #debug, #dont_debug, #git, #hg, #ignore_interrupts, #interactive_shell, #odie, #ofail, #ohai, #owarn, #runBabyRun, #svn, #tempdir, #uncompress, #which, #writeFile

Constructor Details

#initialize(url, dest, name, download_specs = {}) ⇒ Base

Returns a new instance of Base.



112
113
114
115
116
117
118
119
120
# File 'lib/drupid/download_strategy.rb', line 112

def initialize url, dest, name, download_specs = {}
  @url  = url
  @dest = Pathname.new(dest).expand_path
  @name = name
  @specs = download_specs
  @staged_path = nil
  debug "#{self.class.to_s.split(/::/).last} downloader created for url=#{@url}, dest=#{@dest}, name=#{@name}"
  debug "Download specs: #{download_specs}" unless download_specs.empty?
end

Instance Attribute Details

#destObject (readonly)

Returns the value of attribute dest.



108
109
110
# File 'lib/drupid/download_strategy.rb', line 108

def dest
  @dest
end

#nameObject (readonly)

Returns the value of attribute name.



109
110
111
# File 'lib/drupid/download_strategy.rb', line 109

def name
  @name
end

#staged_pathObject (readonly)

Returns the value of attribute staged_path.



110
111
112
# File 'lib/drupid/download_strategy.rb', line 110

def staged_path
  @staged_path
end

#urlObject (readonly)

Returns the value of attribute url.



107
108
109
# File 'lib/drupid/download_strategy.rb', line 107

def url
  @url
end