Class: Travis::Config::Files

Inherits:
Struct
  • Object
show all
Includes:
Helpers
Defined in:
lib/travis/config/files.rb

Constant Summary collapse

MSGS =
{
  empty: "    Warning: config in %{filename} has no data for current env %{env}.\n    If you are expecting config to be loaded from this file, please make sure\n    your config is indented under a key of the environment (%{env}).\n  msg\n}\n".split("\n").map(&:strip).join("\n")

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#blank?, #camelize, #compact, #deep_merge, #deep_symbolize_keys

Instance Attribute Details

#defaultsObject

Returns the value of attribute defaults

Returns:

  • (Object)

    the current value of defaults



6
7
8
# File 'lib/travis/config/files.rb', line 6

def defaults
  @defaults
end

Instance Method Details

#loadObject



17
18
19
20
21
22
23
# File 'lib/travis/config/files.rb', line 17

def load
  filenames.inject({}) do |result, filename|
    config = load_file(filename)
    warn_empty(filename) if warn_empty? && config[env].nil?
    deep_merge(result, config[env] || {})
  end
end