Sha256: 8aa2c7f6d0488b1e49973f376760b0ccfd508a54879c2e1c210fba241b7e3009

Contents?: true

Size: 787 Bytes

Versions: 4

Compression:

Stored size: 787 Bytes

Contents

require 'dply/helper'
module Dply
  class ConfigDownloader

    include Helper
    attr_writer :skip_download

    def initialize(config_files , base_url)
      @config_files = config_files
      @base_url = base_url
      @skip_download = []
    end

    def download_all
      @config_files.each do |f|
        if @skip_download.include? f
          logger.debug "skipping to download file #{f}"
          next
        end
        download f
      end
    end

    private

    def download(file)
      url = "#{@base_url}/#{file}"
      logger.bullet "downloading #{file}"
      http_status = `curl -w "%{http_code}" -f -s -o 'config/#{file}' '#{url}' `
      if http_status != "200"
        error "failed to download #{file}, http status #{http_status}"
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dply-0.1.8 lib/dply/config_downloader.rb
dply-0.1.7 lib/dply/config_downloader.rb
dply-0.1.6 lib/dply/config_downloader.rb
dply-0.1.5 lib/dply/config_downloader.rb