Sha256: 2cf26b9c795a5f08beeed985a2068b3051293f1343dec6f6268a2c7084a6e786
Contents?: true
Size: 927 Bytes
Versions: 1
Compression:
Stored size: 927 Bytes
Contents
# encoding: utf-8 require "pathname" require "desi/local_install" require "desi/http_client" require "uri" module Desi class Downloader def initialize(opts = {}) @destination_dir = Pathname(opts.fetch(:destination_dir, Desi::LocalInstall.new)) @host = URI(opts.fetch(:host, 'https://nodeload.github.com/')) @client = opts.fetch(:http_client_factory, Desi::HttpClient).new(@host) @verbose = opts[:verbose] end def download!(version, opts = {}) path = "/elasticsearch/elasticsearch/tar.gz/#{version.version_name}" destination_name = @destination_dir.join File.basename(version.filename) raise "ERROR: File #{destination_name} already present!" if destination_name.exist? puts " * fetching release #{version} from #{@host + path}" if @verbose File.open(destination_name, 'w') {|f| f << @client.get(path).body } destination_name end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
desi-0.2.8 | lib/desi/downloader.rb |