Sha256: e7b3a8a9b7aa4468c180a2fdd20b1380c59ccd0a03739dcfa54571d3a7cc6ad1

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

require 'chake/node'

module Chake
  class << self
    attr_accessor :nodes
  end
end

nodes_file = ENV['CHAKE_NODES'] || 'nodes.yaml'
nodes_directory = ENV['CHAKE_NODES_D'] || 'nodes.d'
nodes = File.exist?(nodes_file) && YAML.load_file(nodes_file) || {}
nodes.values.each do |node|
  node['chake_metadata'] = { 'definition_file' => nodes_file }
end
Dir.glob(File.join(nodes_directory, '*.yaml')).sort.each do |f|
  file_nodes = YAML.load_file(f)
  file_nodes.values.each do |node|
    node['chake_metadata'] = { 'definition_file' => f }
  end
  nodes.merge!(file_nodes)
end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chake-0.82 lib/chake/config.rb