Skip to content

Commit

Permalink
Added -e/--environment option to script/runner #1408 [fbeausoleil@ftm…
Browse files Browse the repository at this point in the history
…l.net]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1430 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Jun 16, 2005
1 parent 6915627 commit 4351419
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *SVN*


* Added -e/--environment option to script/runner #1408 [fbeausoleil@ftml.net]

* Modernize the scaffold generator to use the simplified render and test methods and to change style from @params["id"] to params[:id]. #1367 * Modernize the scaffold generator to use the simplified render and test methods and to change style from @params["id"] to params[:id]. #1367


* Added graceful exit from pressing CTRL-C during the run of the rails command #1150 [Caleb Tennis] * Added graceful exit from pressing CTRL-C during the run of the rails command #1150 [Caleb Tennis]
Expand Down
24 changes: 24 additions & 0 deletions railties/bin/runner
@@ -1,3 +1,27 @@
require 'optparse'

options = { :environment => "development" }

ARGV.options do |opts|
script_name = File.basename($0)
opts.banner = "Usage: runner 'puts Person.find(1).name' [options]"

opts.separator ""

opts.on("-e", "--environment=name", String,
"Specifies the environment for the runner to operate under (test/development/production).",
"Default: development") { |options[:environment]| }

opts.separator ""

opts.on("-h", "--help",
"Show this help message.") { puts opts; exit }

opts.parse!
end

ENV["RAILS_ENV"] = options[:environment]

#!/usr/local/bin/ruby #!/usr/local/bin/ruby


require File.dirname(__FILE__) + '/../config/environment' require File.dirname(__FILE__) + '/../config/environment'
Expand Down

0 comments on commit 4351419

Please sign in to comment.