Sha256: a4104e956cac984462af1ffca232a8c8da534891ca6f696e48ee54e0016e467f

Contents?: true

Size: 911 Bytes

Versions: 1

Compression:

Stored size: 911 Bytes

Contents

require 'r10k/logging'

module R10K
  class Deployment
    class Config
      class Loader

        include R10K::Logging

        attr_reader :loadpath

        CONFIG_FILE = 'r10k.yaml'
        DEFAULT_LOCATION = File.join('/etc/puppetlabs/r10k', CONFIG_FILE)

        # Search for a deployment configuration file (r10k.yaml) in several locations
        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

          # Add the current directory for r10k.yaml
          @loadpath << File.join(Dir.getwd, CONFIG_FILE)

          # Add the AIO location for of r10k.yaml
          @loadpath << DEFAULT_LOCATION

          @loadpath
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
r10k-2.0.0 lib/r10k/deployment/config/loader.rb