Skip to content
Permalink
Browse files

Complain if RAILS_ENV != the rake environment

Just in case someone attempts to run:

  RAILS_ENV=production rake staging task
  • Loading branch information...
nathanstitt committed May 21, 2014
1 parent 31a3153 commit 2e28833845b9f843f8faa29a2b620eec1f01bf11
Showing with 6 additions and 1 deletion.
  1. +6 −1 Rakefile
@@ -2,7 +2,12 @@
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

if ['test','development','staging','production'].include?(ARGV.first)
RAILS_ENV = ENV['RAILS_ENV'] = ARGV.first
environment = ARGV.first
if ENV['RAILS_ENV'] && ENV['RAILS_ENV'] != environment
STDERR.puts "RAILS_ENV was set to #{ENV['RAILS_ENV']}, but the environment specified was #{environment}"
exit 1
end
RAILS_ENV = ENV['RAILS_ENV'] = environment
end

require File.expand_path('../config/application', __FILE__)

0 comments on commit 2e28833

Please sign in to comment.
You can’t perform that action at this time.