Permalink
Browse files

Added one-letter aliases for the three default environments to script…

…/console, so script/console p will load the production environment (t for test, d for development) [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5655 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent cd2be89 commit 9040f406820a9cd2d6a016fd2a7965d21445bbec @dhh dhh committed Dec 1, 2006
Showing with 10 additions and 1 deletion.
  1. +2 −0 railties/CHANGELOG
  2. +8 −1 railties/lib/commands/console.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Added one-letter aliases for the three default environments to script/console, so script/console p will load the production environment (t for test, d for development) [DHH]
+
* Fixed that script/server running against Mongrel should tail the proper log regardless of the environment [DHH]
* Update initializer to load Rails::VERSION as soon as possible. Closes #6698. [Nicholas Seckar]
@@ -15,7 +15,14 @@
libs << " -r console_sandbox" if options[:sandbox]
libs << " -r console_with_helpers"
-ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'development'
+ENV['RAILS_ENV'] = case ARGV.first
+ when "p": "production"
+ when "d": "development"
+ when "t": "test"
+ else
+ ARGV.first || ENV['RAILS_ENV'] || 'development'
+end
+
if options[:sandbox]
puts "Loading #{ENV['RAILS_ENV']} environment in sandbox."
puts "Any modifications you make will be rolled back on exit."

0 comments on commit 9040f40

Please sign in to comment.