Class: MxxRu::Externals::ArchiveAsExternals
Overview
Implementation of externals represented as downloadable archive (like tar.gz, zip, rar or 7z).
Constant Summary
collapse
- @@archive_handlers =
{
:tar => proc {
['tar', 'x'].push(*@unpacker_options).push('-f').push(archive_name)
},
:zip => proc {
['unzip'].push(*@unpacker_options).push(archive_name)
},
:sevenzip => proc {
['7z', 'x'].push(*@unpacker_options).push(archive_name)
}
}
- @@archive_extensions =
{
'.tar' => :tar,
'.tar.gz' => :tar,
'.tgz' => :tar,
'.taz' => :tar,
'.tar.Z' => :tar,
'.taZ' => :tar,
'.tar.bz2' => :tar,
'.tz2' => :tar,
'.tbz2' => :tar,
'.tar.lz' => :tar,
'.tar.lzma' => :tar,
'.tlz' => :tar,
'.tar.lzo' => :tar,
'.tar.xz' => :tar,
'.zip' => :zip,
'.7z' => :sevenzip
}
Instance Attribute Summary
#name, #paths, #url
Instance Method Summary
collapse
#all_downloader_options, #downloader_option, #downloader_options_for
#map, #map_dir, #map_file
Constructor Details
Returns a new instance of ArchiveAsExternals.
653
654
655
656
657
658
659
660
661
662
663
|
# File 'lib/mxx_ru/externals.rb', line 653
def initialize(name)
defaults(name)
@unpacker_options = []
yield self if block_given?
parse_uri
detect_archive_type
Registry::handle_external(@name, self)
end
|
Instance Method Details
#define_rules(old_or_new) ⇒ Object
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
|
# File 'lib/mxx_ru/externals.rb', line 695
def define_rules(old_or_new)
define(old_or_new) do |tmp_dir|
successful = false
begin
mkdir(tmp_dir, fileop_options) if !Dir.exists?(tmp_dir)
cd tmp_dir do
download_archive
unpack_archive
end
successful = true
ensure
rm_dir_if_exists(tmp_dir) unless successful
end
end
end
|
#make_hash ⇒ Object
685
686
687
688
689
690
691
692
693
|
# File 'lib/mxx_ru/externals.rb', line 685
def make_hash
all_downloader_options.merge( basics_to_map ).merge!(
{ :md5 => @md5,
:sha1 => @sha1,
:sha256 => @sha256,
:sha512 => @sha512,
:unpacker_options => @unpacker_options
} )
end
|
#md5(v) ⇒ Object
665
666
667
|
# File 'lib/mxx_ru/externals.rb', line 665
def md5(v)
@md5 = v
end
|
#sha1(v) ⇒ Object
669
670
671
|
# File 'lib/mxx_ru/externals.rb', line 669
def sha1(v)
@sha1 = v
end
|
#sha256(v) ⇒ Object
673
674
675
|
# File 'lib/mxx_ru/externals.rb', line 673
def sha256(v)
@sha256 = v
end
|
#sha512(v) ⇒ Object
677
678
679
|
# File 'lib/mxx_ru/externals.rb', line 677
def sha512(v)
@sha512 = v
end
|
#unpacker_option(v) ⇒ Object
681
682
683
|
# File 'lib/mxx_ru/externals.rb', line 681
def unpacker_option(v)
@unpacker_options.push(v)
end
|