Sha256: d82b71ccd114428411f8395c02f6360d960120f64aef7c2acf85cad5b22797d5

Contents?: true

Size: 643 Bytes

Versions: 4

Compression:

Stored size: 643 Bytes

Contents

require 'chake/node'

module Chake
  class << self
    attr_accessor :chef_config
    attr_accessor :nodes
    attr_accessor :tmpdir
  end
end

chef_config = ENV['CHAKE_CHEF_CONFIG'] || 'config.rb'
nodes_file = ENV['CHAKE_NODES'] || 'nodes.yaml'
nodes_directory = ENV['CHAKE_NODES_D'] || 'nodes.d'
node_data = File.exists?(nodes_file) && YAML.load_file(nodes_file) || {}
Dir.glob(File.join(nodes_directory, '*.yaml')).sort.each do |f|
  node_data.merge!(YAML.load_file(f))
end

Chake.chef_config = chef_config
Chake.nodes = node_data.map { |node,data| Chake::Node.new(node, data) }.reject(&:skip?).uniq(&:hostname)
Chake.tmpdir = Chake.tmpdir

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chake-0.21.2 lib/chake/config.rb
chake-0.21.1 lib/chake/config.rb
chake-0.21 lib/chake/config.rb
chake-0.20 lib/chake/config.rb