Checkout of Instiki Trunk 1/21/2007.
This commit is contained in:
commit
69b62b6f33
1138 changed files with 139586 additions and 0 deletions
27
vendor/rails/railties/lib/commands/runner.rb
vendored
Normal file
27
vendor/rails/railties/lib/commands/runner.rb
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
require 'optparse'
|
||||
|
||||
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
|
||||
|
||||
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") { |v| options[:environment] = v }
|
||||
|
||||
opts.separator ""
|
||||
|
||||
opts.on("-h", "--help",
|
||||
"Show this help message.") { puts opts; exit }
|
||||
|
||||
opts.parse!
|
||||
end
|
||||
|
||||
ENV["RAILS_ENV"] = options[:environment]
|
||||
RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
|
||||
|
||||
require RAILS_ROOT + '/config/environment'
|
||||
ARGV.empty? ? puts("Usage: runner 'code' [options]") : eval(ARGV.first)
|
Loading…
Add table
Add a link
Reference in a new issue