Sha256: 57a9461afa5b2dadeb737e297e4da3aa6ef1c4b828494fa31364dcbd79ebbecf

Contents?: true

Size: 859 Bytes

Versions: 29

Compression:

Stored size: 859 Bytes

Contents

module R10K
class Deployment
class Config
class Loader
  # Search for a deployment configuration file (r10k.yaml) in all parent
  # directories and in /etc/r10k.yaml

  def initialize
    @loadpath = []

    populate_loadpath
  end

  # @return [String] The path to the first valid configfile
  def search
    first = @loadpath.find {|filename| File.file? filename}
  end

  private

  def populate_loadpath

    # Scan all parent directories for r10k
    dir_components = Dir.getwd.split(File::SEPARATOR)

    dir_components.each_with_index do |dirname, index|
      full_path = [''] # Shim case for root directory
      full_path << dir_components[0...index]
      full_path << dirname << 'r10k.yaml'

      @loadpath << File.join(full_path)
    end

    # Always check /etc/r10k.yaml
    @loadpath << '/etc/r10k.yaml'

    @loadpath
  end
end
end
end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
r10k-1.4.2 lib/r10k/deployment/config/loader.rb
r10k-1.4.1 lib/r10k/deployment/config/loader.rb
r10k-1.4.0 lib/r10k/deployment/config/loader.rb
r10k-1.3.5 lib/r10k/deployment/config/loader.rb
r10k-1.3.4 lib/r10k/deployment/config/loader.rb
r10k-1.2.4 lib/r10k/deployment/config/loader.rb
r10k-1.3.3 lib/r10k/deployment/config/loader.rb
r10k-1.3.2 lib/r10k/deployment/config/loader.rb
r10k-1.2.3 lib/r10k/deployment/config/loader.rb
r10k-1.3.1 lib/r10k/deployment/config/loader.rb
r10k-1.2.2 lib/r10k/deployment/config/loader.rb
r10k-1.3.0 lib/r10k/deployment/config/loader.rb
r10k-1.3.0rc1 lib/r10k/deployment/config/loader.rb
r10k-1.2.1 lib/r10k/deployment/config/loader.rb
r10k-1.2.0 lib/r10k/deployment/config/loader.rb
r10k-1.2.0rc2 lib/r10k/deployment/config/loader.rb
r10k-1.1.4 lib/r10k/deployment/config/loader.rb
r10k-1.2.0rc1 lib/r10k/deployment/config/loader.rb
r10k-1.1.3 lib/r10k/deployment/config/loader.rb
r10k-1.1.2 lib/r10k/deployment/config/loader.rb