aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source/creating_plugins/index.txt
diff options
context:
space:
mode:
Diffstat (limited to 'railties/doc/guides/source/creating_plugins/index.txt')
-rw-r--r--railties/doc/guides/source/creating_plugins/index.txt108
1 files changed, 38 insertions, 70 deletions
diff --git a/railties/doc/guides/source/creating_plugins/index.txt b/railties/doc/guides/source/creating_plugins/index.txt
index f2ed6ed8bb..19484e2830 100644
--- a/railties/doc/guides/source/creating_plugins/index.txt
+++ b/railties/doc/guides/source/creating_plugins/index.txt
@@ -1,81 +1,49 @@
The Basics of Creating Rails Plugins
====================================
-Pretend for a moment that you are an avid bird watcher. Your favorite bird is the Yaffle, and you want to create a plugin that allows other developers to share in the Yaffle goodness.
-
-In this tutorial you will learn how to create a plugin that includes:
-
- * Core Extensions - extending String with a `to_squawk` method:
-+
-[source, ruby]
--------------------------------------------
-# Anywhere
-"hello!".to_squawk # => "squawk! hello!"
--------------------------------------------
-
-* An `acts_as_yaffle` method for ActiveRecord models that adds a `squawk` method:
-+
-[source, ruby]
--------------------------------------------
-class Hickwall < ActiveRecord::Base
- acts_as_yaffle :yaffle_text_field => :last_sang_at
-end
-
-Hickwall.new.squawk("Hello World")
--------------------------------------------
-
-* A view helper that will print out squawking info:
-+
-[source, ruby]
--------------------------------------------
-squawk_info_for(@hickwall)
--------------------------------------------
-
-* A generator that creates a migration to add squawk columns to a model:
-+
--------------------------------------------
-script/generate yaffle hickwall
--------------------------------------------
-
-* A custom generator command:
-+
-[source, ruby]
--------------------------------------------
-class YaffleGenerator < Rails::Generator::NamedBase
- def manifest
- m.yaffle_definition
- end
-end
--------------------------------------------
-
-* A custom route method:
-+
-[source, ruby]
--------------------------------------------
-ActionController::Routing::Routes.draw do |map|
- map.yaffles
-end
--------------------------------------------
-
-In addition you'll learn how to:
-
- * test your plugins.
- * work with 'init.rb', how to store model, views, controllers, helpers and even other plugins in your plugins.
- * create documentation for your plugin.
- * write custom Rake tasks in your plugin.
-
-
-include::preparation.txt[]
-
-include::string_to_squawk.txt[]
+A Rails plugin is either an extension or a modification of the core framework. Plugins provide:
+
+ * a way for developers to share bleeding-edge ideas without hurting the stable code base
+ * a segmented architecture so that units of code can be fixed or updated on their own release schedule
+ * an outlet for the core developers so that they don’t have to include every cool new feature under the sun
+
+After reading this guide you should be familiar with:
+
+ * Creating a plugin from scratch
+ * Writing and running tests for the plugin
+ * Storing models, views, controllers, helpers and even other plugins in your plugins
+ * Writing generators
+ * Writing custom Rake tasks in your plugin
+ * Generating RDoc documentation for your plugin
+ * Avoiding common pitfalls with 'init.rb'
+
+This guide describes how to build a test-driven plugin that will:
+
+ * Extend core ruby classes like Hash and String
+ * Add methods to ActiveRecord::Base in the tradition of the 'acts_as' plugins
+ * Add a view helper that can be used in erb templates
+ * Add a new generator that will generate a migration
+ * Add a custom generator command
+ * A custom route method that can be used in routes.rb
+
+For the purpose of this guide pretend for a moment that you are an avid bird watcher. Your favorite bird is the Yaffle, and you want to create a plugin that allows other developers to share in the Yaffle goodness. First, you need to get setup for development.
-include::acts_as_yaffle.txt[]
-include::view_helper.txt[]
+include::test_setup.txt[]
+
+include::core_ext.txt[]
+
+include::acts_as_yaffle.txt[]
include::migration_generator.txt[]
-include::custom_generator.txt[]
+include::generator_method.txt[]
+
+include::models.txt[]
+
+include::controllers.txt[]
+
+include::helpers.txt[]
include::custom_route.txt[]