2018-03-22 18:01:53 -04:00
|
|
|
require "psenv"
|
|
|
|
|
|
|
|
if defined?(Rake.application)
|
|
|
|
is_running_specs = Rake.application.top_level_tasks.grep(/^spec(:|$)/).any?
|
|
|
|
Rails.env = ENV["RAILS_ENV"] ||= "test" if is_running_specs
|
|
|
|
end
|
|
|
|
|
|
|
|
module Psenv
|
2018-03-28 21:51:39 -04:00
|
|
|
class Railtie < Rails::Railtie
|
|
|
|
def load
|
|
|
|
Psenv.load
|
|
|
|
end
|
2018-03-22 18:01:53 -04:00
|
|
|
|
2018-03-28 21:51:39 -04:00
|
|
|
def self.load
|
|
|
|
instance.load
|
|
|
|
end
|
2018-03-22 18:01:53 -04:00
|
|
|
|
|
|
|
config.before_configuration { load }
|
2018-03-28 21:51:39 -04:00
|
|
|
end
|
2018-03-22 18:01:53 -04:00
|
|
|
end
|