Class: Travis::Config
- Inherits:
-
Hash
- Object
- Hash
- Travis::Config
- Defined in:
- lib/travis/config.rb
Instance Method Summary collapse
- #environment ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #load_env ⇒ Object
- #load_file ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 |
# File 'lib/travis/config.rb', line 5 def initialize replace(load_env || load_file || {}) end |
Instance Method Details
#environment ⇒ Object
18 19 20 |
# File 'lib/travis/config.rb', line 18 def environment defined?(Rails) ? Rails.env : 'test' end |
#load_env ⇒ Object
9 10 11 |
# File 'lib/travis/config.rb', line 9 def load_env YAML.load(ENV['travis_config']) if ENV['travis_config'] end |
#load_file ⇒ Object
13 14 15 16 |
# File 'lib/travis/config.rb', line 13 def load_file file = File.('../../../config/travis.yml', __FILE__) YAML.load_file(file)[environment] if File.exists?(file) end |