aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/commands')
-rw-r--r--railties/lib/rails/commands/rake_proxy.rb9
-rw-r--r--railties/lib/rails/commands/runner.rb4
2 files changed, 11 insertions, 2 deletions
diff --git a/railties/lib/rails/commands/rake_proxy.rb b/railties/lib/rails/commands/rake_proxy.rb
index ad5249ff48..b9e50f3e5a 100644
--- a/railties/lib/rails/commands/rake_proxy.rb
+++ b/railties/lib/rails/commands/rake_proxy.rb
@@ -1,10 +1,11 @@
-require "rake"
require "active_support"
module Rails
module RakeProxy #:nodoc:
private
def run_rake_task(command)
+ require_rake
+
ARGV.unshift(command) # Prepend the command, so Rake knows how to run it.
Rake.application.standard_exception_handling do
@@ -15,6 +16,8 @@ module Rails
end
def rake_tasks
+ require_rake
+
return @rake_tasks if defined?(@rake_tasks)
ActiveSupport::Deprecation.silence do
@@ -30,5 +33,9 @@ module Rails
def formatted_rake_tasks
rake_tasks.map { |t| [ t.name_with_args, t.comment ] }
end
+
+ def require_rake
+ require "rake" # Defer booting Rake until we know it's needed.
+ end
end
end
diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb
index 11ef1d10e2..b74addf587 100644
--- a/railties/lib/rails/commands/runner.rb
+++ b/railties/lib/rails/commands/runner.rb
@@ -61,9 +61,11 @@ elsif File.exist?(code_or_file)
else
begin
eval(code_or_file, binding, __FILE__, __LINE__)
- rescue SyntaxError, NameError
+ rescue SyntaxError, NameError => e
$stderr.puts "Please specify a valid ruby command or the path of a script to run."
$stderr.puts "Run '#{command} -h' for help."
+ $stderr.puts
+ $stderr.puts e
exit 1
end
end