Sha256: f3985bda733df94f5c92685bf788a5770b3a21b118edb865b62061421d53e28a
Contents?: true
Size: 1.37 KB
Versions: 3
Compression:
Stored size: 1.37 KB
Contents
module Sprinkle module Installers # = Binary Installer # # binary "http://some.url.com/archive.tar.gz" do # prefix "/home/user/local" # archives "/home/user/sources" # end # class Binary < Installer def initialize(parent, binary_archive, options = {}, &block) #:nodoc: @binary_archive = binary_archive @options = options super parent, options, &block end 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 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 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 -o' else raise "Unknown binary archive format: #{archive_name}" end end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
dhill-sprinkle-0.3.3.1 | lib/sprinkle/installers/binary.rb |
sprinkle-0.3.3 | lib/sprinkle/installers/binary.rb |
sprinkle-0.3.2 | lib/sprinkle/installers/binary.rb |