Sha256: d560df5db5c111feae8a09d7e1ab55fc2c087967740819e71ce8baa18a1cfc43
Contents?: true
Size: 1.4 KB
Versions: 6
Compression:
Stored size: 1.4 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].first}", "mkdir -p #{@options[:archives].first}" ] end def install_commands #:nodoc: commands = [ "bash -c 'wget -cq --directory-prefix=#{@options[:archives].first} #{@binary_archive}'" ] commands << "bash -c 'cd #{@options[:prefix].first} && #{extract_command} #{@options[:archives].first}/#{@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
6 entries across 6 versions & 1 rubygems