instiki/script/runner

29 lines
705 B
Plaintext
Raw Permalink Normal View History

2005-08-11 07:46:38 +02:00
#!/usr/bin/env ruby
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]
2005-08-11 07:46:38 +02:00
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/environment'
eval(ARGV.first)