aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc
diff options
context:
space:
mode:
authorJeff Dean <jeff@zilkey.com>2008-05-29 20:16:18 -0700
committerJeff Dean <jeff@zilkey.com>2008-05-29 20:16:18 -0700
commitbf8defba08b0f8ec55197bd95232c29ea4e0ba6d (patch)
tree794a2dbcdadfb8e74c073e1d437eb8d5c9bc666f /railties/doc
parent8ea92f3cd48755210ae0ea0b6bee203dd897cd1b (diff)
downloadrails-bf8defba08b0f8ec55197bd95232c29ea4e0ba6d.tar.gz
rails-bf8defba08b0f8ec55197bd95232c29ea4e0ba6d.tar.bz2
rails-bf8defba08b0f8ec55197bd95232c29ea4e0ba6d.zip
added documentation for rake tasks to the plugin tutorial
Diffstat (limited to 'railties/doc')
-rw-r--r--railties/doc/guides/creating_plugins/basics.markdown22
1 files changed, 22 insertions, 0 deletions
diff --git a/railties/doc/guides/creating_plugins/basics.markdown b/railties/doc/guides/creating_plugins/basics.markdown
index bb60ee90d0..7311f78e20 100644
--- a/railties/doc/guides/creating_plugins/basics.markdown
+++ b/railties/doc/guides/creating_plugins/basics.markdown
@@ -771,6 +771,28 @@ Adding directories to the load path makes them appear just like files in the the
Adding directories to the load once paths allow those changes to picked up as soon as you save the file - without having to restart the web server.
+Writing custom rake tasks in your plugin
+-------------------------
+
+When you created the plugin with the built-in rails generator, it generated a rake file for you in `vendor/plugins/yaffle/tasks/yaffle.rake`. Any rake task you add here will be available to the app.
+
+Many plugin authors put all of their rake tasks into a common namespace that is the same as the plugin, like so:
+
+ # File: vendor/plugins/yaffle/tasks/yaffle.rake
+
+ namespace :yaffle do
+ desc "Prints out the word 'Yaffle'"
+ task :squawk => :environment do
+ puts "squawk!"
+ end
+ end
+
+When you run `rake -T` from your plugin you will see
+
+ yaffle:squawk "Prints out..."
+
+You can add as many files as you want in the tasks directory, and if they end in .rake Rails will pick them up.
+
Storing plugins in alternate locations
-------------------------