Class: ExercismConfig::DetermineEnvironment

Inherits:
Object
  • Object
show all
Includes:
Mandate
Defined in:
lib/exercism_config/determine_environment.rb

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
8
9
10
11
12
# File 'lib/exercism_config/determine_environment.rb', line 5

def call
  env = ENV['EXERCISM_ENV'] || ENV['RAILS_ENV'] || ENV['APP_ENV']
  env = Rails.env.to_s if !env && Object.const_defined?(:Rails) && Rails.respond_to?(:env)

  raise Exercism::ConfigError, 'No environment set - set one of EXERCISM_ENV, RAILS_ENV or APP_ENV' unless env

  Environment.new(env)
end