Class: Rget
Overview
A download manager.
Constant Summary collapse
- @@log =
init_logger(STDOUT, Logger::INFO)
Instance Method Summary collapse
-
#initialize ⇒ Rget
constructor
reads commandline-options, organizes, reads or updates the download-queue, cuts and washes the vegetables, irons my shirts and starts the download.
Methods included from Logging
init_logger, log_level=, log_target=
Methods included from File_Checking
Constructor Details
#initialize ⇒ Rget
reads commandline-options, organizes, reads or updates the download-queue, cuts and washes the vegetables, irons my shirts and starts the download.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rget.rb', line 42 def initialize() @log = @@log = ArgParser.parse(ARGV) @log.level = $log_level @log.debug('options are ' << .to_s) # create the history only after the options have been read. $HISTORY = DownloadHistory.instance if(.list_only) show_queue exit true end if(.queued_item) @log.debug('queued item is ' << .queued_item) dw = $HISTORY[.queued_item] @log.debug('from queue: ' << dw.to_s) @url = $HISTORY[.queued_item].url @file = $HISTORY[.queued_item].local_file end @url ||= ARGV.first @file ||= ARGV.last if ARGV.length > 1 if !@url || @url.strip.empty? @log.warn('No URL to download!') @log.info('Call with option "-h" to see some usage information') exit false else @log.debug('URL to download: ' << @url) if(@file) @log.debug('Requested file to write: ' << @file) else @file = File.basename(@url) @log.debug('Derived file to write: ' << @file) end verify_file end @continue = .continue #do it download end |