class Dotenv::Rails

def env

See https://github.com/bkeepers/dotenv/issues/219

check which rake tasks are being run to determine the environment.
When running `rake`, the Rails application is initialized in development, so we have to

The current environment that the app is running in.
def env
  @env ||= if defined?(Rake.application) && Rake.application.top_level_tasks.grep(TEST_RAKE_TASKS).any?
    env = Rake.application.options.show_tasks ? "development" : "test"
    ActiveSupport::EnvironmentInquirer.new(env)
  else
    ::Rails.env
  end
end