Module: ChefConfig::Mixin::DotD

Included in:
WorkstationConfigLoader
Defined in:
lib/chef-config/mixin/dot_d.rb

Instance Method Summary collapse

Instance Method Details

#find_dot_d(path) ⇒ Array<String>

Find available configuration files in a `.d/` style include directory.

Parameters:

  • path (String)

    Base .d/ path to load from.

Returns:

  • (Array<String>)

27
28
29
# File 'lib/chef-config/mixin/dot_d.rb', line 27

def find_dot_d(path)
  Dir["#{PathHelper.escape_glob_dir(path)}/*.rb"].select { |entry| File.file?(entry) }.sort
end

#load_dot_d(path) ⇒ void

This method returns an undefined value.

Load configuration from a `.d/` style include directory.

Parameters:

  • path (String)

    Base .d/ path to load from.


36
37
38
39
40
# File 'lib/chef-config/mixin/dot_d.rb', line 36

def load_dot_d(path)
  find_dot_d(path).each do |conf|
    apply_config(IO.read(conf), conf)
  end
end