resources/download_buildpack_cache.rb
# Returns array of config maps containing references to the root index.yml
# of file sets to be included in the cache.
#
# @param [Array<String>] config_files list of config files to check. By default it contains all yml files in buildpack config directory.
# @param [Array<String>] cached_hosts list of host names which content should be cached. Collect all remote content by default.
Returns array of config maps containing references to the root index.yml
of file sets to be included in the cache.
Returns array of config maps containing references to the root index . yml of file sets to be included in the cache .
def collect_configs(config_files = nil, cached_hosts = nil)
    config_files = Dir[File.expand_path(File.join('..', '..', 'config', '*.yml'), __FILE__)] if config_files.nil?
    configs = []
    config_files.each do |file|
      @logger.debug "Checking #{file}"
      begin
        config = YAML.load_file(file)
      rescue => e
        abort "ERROR: Failed loading config #{file}: #{e}"
      end
      if !config.nil? && config.has_key?(REPOSITORY_ROOT) && config.has_key?(VERSION) && (File.exists?(index_path(config)) || cached_hosts.nil? || cached_hosts.include?(URI(config[REPOSITORY_ROOT]).host))
        configs.push(config)
      end
    end
    configs
  end
def collect_configs ( config_files = nil , cached_hosts = nil ) config_files = Dir [ File . expand_path ( File . join ( '..' , '..' , 'config' , '*.yml' ) , __FILE__ ) ] if config_files . nil? configs = [ ] config_files . each do | file | @logger . debug "Checking #{file}" begin config = YAML . load_file ( file ) rescue => e abort "ERROR: Failed loading config #{file}: #{e}" end if ! config . nil? && config . has_key? ( REPOSITORY_ROOT ) && config . has_key? ( VERSION ) && ( File . exists? ( index_path ( config ) ) || cached_hosts . nil? || cached_hosts . include? ( URI ( config [ REPOSITORY_ROOT ] ) . host ) ) configs . push ( config ) end end configs end
Returns array of config maps containing references to the root index.yml
of file sets to be included in the cache.
Returns array of config maps containing references to the root index . yml of file sets to be included in the cache .
config_files
cached_hosts
cached_hosts list of host names which content should be cached. Collect all remote content by default.
cached_hosts list of host names which content should be cached . Collect all remote content by default .