Class: Dply::ConfigDownloader

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/dply/config_downloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#cmd, #error, #git, #logger, #sh, #symlink

Constructor Details

#initialize(config_files, base_url, dir: "config") ⇒ ConfigDownloader



11
12
13
14
15
16
# File 'lib/dply/config_downloader.rb', line 11

def initialize(config_files , base_url, dir: "config")
  @config_files = config_files
  @base_url = base_url
  @dir = dir
  @skip_download = []
end

Instance Attribute Details

#skip_download=(value) ⇒ Object (writeonly)

Sets the attribute skip_download



9
10
11
# File 'lib/dply/config_downloader.rb', line 9

def skip_download=(value)
  @skip_download = value
end

Instance Method Details

#download_allObject



18
19
20
21
22
23
24
25
26
# File 'lib/dply/config_downloader.rb', line 18

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