Module: Suvii
- Defined in:
- lib/suvii.rb,
lib/suvii/http.rb,
lib/suvii/cache.rb,
lib/suvii/extract.rb,
lib/suvii/extract/zip.rb,
lib/suvii/extract/targz.rb
Overview
Defined Under Namespace
Class Method Summary collapse
-
.fetch(url, options = {}) ⇒ String
Downloads and extracts an archive to a temp directory.
-
.logger ⇒ Logger
Instance of Logger compatible class.
-
.logger=(logger) ⇒ Object
Overrides default logger instance.
Class Method Details
.fetch(url, options = {}) ⇒ String
Downloads and extracts an archive to a temp directory.
17 18 19 20 21 22 23 24 |
# File 'lib/suvii.rb', line 17 def self.fetch(url, = {}) path_to_archive = Cache.fetch(url, ) do |path| Http.save(url, path, ) end extractor = Extract.class_for(path_to_archive).new(path_to_archive, ) extractor.extract_to(Dir.mktmpdir) end |
.logger ⇒ Logger
Returns instance of Logger compatible class.
27 28 29 30 31 32 |
# File 'lib/suvii.rb', line 27 def self.logger @logger ||= Logger.new(STDOUT).tap do |logger| logger.level = Logger::INFO logger.formatter = proc { |_, _, _, msg| msg } end end |
.logger=(logger) ⇒ Object
Overrides default logger instance.
37 38 39 |
# File 'lib/suvii.rb', line 37 def self.logger=(logger) @logger = logger end |