Sha256: 0ad7e58ef39e8e6f38f35fc804084bd30ce2ebc75b65856038959c0e4f255dfc
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
module Getme class Utilities def cmd(badass, url) if badass == :wget `wget #{Shellwords.escape url}` elsif badass == :curl `curl -O #{Shellwords.escape url}` end end def downloader if cmd?('wget') :wget elsif cmd?('curl') :curl else raise Getme::WgetOrCurlNotAvailableError, 'Wget or Curl not available for download files, install one? :D' end end # check if cmd available from system def cmd?(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = File.join(path, "#{cmd}#{ext}") return true if File.executable? exe } end return false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
getme-0.0.2 | lib/getme/utilities.rb |