lib/rails/commands/runner.rb in railties-3.0.0.beta3 vs lib/rails/commands/runner.rb in railties-3.0.0.beta4
- old
+ new
@@ -1,6 +1,7 @@
require 'optparse'
+require 'rbconfig'
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
code_or_file = nil
ARGV.clone.options do |opts|
@@ -16,11 +17,11 @@
opts.separator ""
opts.on("-h", "--help",
"Show this help message.") { $stderr.puts opts; exit }
- if RUBY_PLATFORM !~ /mswin|mingw/
+ if Config::CONFIG['host_os'] !~ /mswin|mingw/
opts.separator ""
opts.separator "You can also use runner as a shebang line for your scripts like this:"
opts.separator "-------------------------------------------------------------"
opts.separator "#!/usr/bin/env #{File.expand_path($0)}"
opts.separator ""
@@ -33,10 +34,11 @@
ARGV.delete(code_or_file)
ENV["RAILS_ENV"] = options[:environment]
-require ENV_PATH
+require APP_PATH
+Rails::Application.require_environment!
begin
if code_or_file.nil?
$stderr.puts "Run '#{$0} -h' for help."
exit 1