Class: FPM::Cookery::SourceHandler::Curl
- Defined in:
- lib/fpm/cookery/source_handler/curl.rb
Direct Known Subclasses
Constant Summary collapse
- NAME =
:curl
- CHECKSUM =
true
Instance Attribute Summary
Attributes inherited from Template
#builddir, #cachedir, #has_checksum, #name, #options, #url
Instance Method Summary collapse
Methods inherited from Template
#checksum?, #initialize, #local_path, #source
Constructor Details
This class inherits a constructor from FPM::Cookery::SourceHandler::Template
Instance Method Details
#extract(config = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fpm/cookery/source_handler/curl.rb', line 23 def extract(config = {}) Dir.chdir(builddir) do case local_path.extname when '.bz2', '.gz', '.tgz' safesystem('tar', 'xf', local_path) when '.shar', '.bin' File.chmod(0755, local_path) safesystem(local_path) when '.zip' safesystem('unzip', '-d', local_path.basename('.zip'), local_path) else if !local_path.directory? && !local_path.basename.exist? Dir.mkdir(local_path.basename) end FileUtils.cp_r(local_path, local_path.basename) end extracted_source end end |
#fetch(config = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fpm/cookery/source_handler/curl.rb', line 12 def fetch(config = {}) if local_path.exist? Log.info "Using cached file #{local_path}" else Dir.chdir(cachedir) do curl(url, local_path, config) unless local_path.exist? end end local_path end |