Class: Sprinkle::Installers::Binary
- Defined in:
- lib/sprinkle/installers/binary.rb
Overview
Binary Installer
binary “some.url.com/archive.tar.gz” do
prefix "/home/user/local"
archives "/home/user/sources"
end
Instance Attribute Summary
Attributes inherited from Installer
#delivery, #options, #package, #post, #pre
Attributes included from Configurable
Instance Method Summary collapse
- #extract_command(archive_name = @binary_archive.split("/").last) ⇒ Object
-
#initialize(parent, binary_archive, options = {}, &block) ⇒ Binary
constructor
:nodoc:.
-
#install_commands ⇒ Object
:nodoc:.
-
#prepare_commands ⇒ Object
:nodoc:.
Methods inherited from Installer
Methods included from Configurable
#assert_delivery, #defaults, #method_missing, #option?
Constructor Details
#initialize(parent, binary_archive, options = {}, &block) ⇒ Binary
:nodoc:
11 12 13 14 15 |
# File 'lib/sprinkle/installers/binary.rb', line 11 def initialize(parent, binary_archive, = {}, &block) #:nodoc: @binary_archive = binary_archive @options = super parent, , &block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Sprinkle::Configurable
Instance Method Details
#extract_command(archive_name = @binary_archive.split("/").last) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sprinkle/installers/binary.rb', line 30 def extract_command(archive_name = @binary_archive.split("/").last) case archive_name when /(tar.gz)|(tgz)$/ 'tar xzf' when /(tar.bz2)|(tb2)$/ 'tar xjf' when /tar$/ 'tar xf' when /zip$/ 'unzip' else raise "Unknown binary archive format: #{archive_name}" end end |
#install_commands ⇒ Object
:nodoc:
25 26 27 28 |
# File 'lib/sprinkle/installers/binary.rb', line 25 def install_commands #:nodoc: commands = [ "bash -c 'wget -cq --directory-prefix=#{@options[:archives]} #{@binary_archive}'" ] commands << "bash -c 'cd #{@options[:prefix]} && #{extract_command} #{@options[:archives]}/#{@binary_archive.split("/").last}'" end |
#prepare_commands ⇒ Object
:nodoc:
17 18 19 20 21 22 23 |
# File 'lib/sprinkle/installers/binary.rb', line 17 def prepare_commands #:nodoc: raise 'No installation area defined' unless @options[:prefix] raise 'No archive download area defined' unless @options[:archives] [ "mkdir -p #{@options[:prefix]}", "mkdir -p #{@options[:archives]}" ] end |