Skip to content

Instantly share code, notes, and snippets.

@jeremy
Created December 4, 2012 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremy/4206626 to your computer and use it in GitHub Desktop.
Save jeremy/4206626 to your computer and use it in GitHub Desktop.
irb rake
diff --git a/railties/lib/rails/console/helpers.rb b/railties/lib/rails/console/helpers.rb
index 230d3d9..1bbdfd2 100644
--- a/railties/lib/rails/console/helpers.rb
+++ b/railties/lib/rails/console/helpers.rb
@@ -7,5 +7,16 @@ module Rails
def controller
@controller ||= ApplicationController.new
end
+
+ def rake(task)
+ pid = Kernel.fork do
+ require 'rake'
+ include Rake::DSL
+ load Rails.root.join('Rakefile')
+ Rake::Task[task].invoke
+ Kernel.exit
+ end
+ Process.wait pid
+ end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment