From 31f09a2b1821886164ffb629085d0f5b75bd0a40 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sat, 21 May 2011 17:10:59 -0300 Subject: Remove extra white spaces on guides. --- railties/guides/source/plugins.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source/plugins.textile') diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index d486e8ade3..b12aa78947 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -319,7 +319,7 @@ When you run +rake+ you should see the tests all pass: h4. Add an Instance Method -This plugin will add a method named 'squawk' to any Active Record objects that call 'acts_as_yaffle'. The 'squawk' +This plugin will add a method named 'squawk' to any Active Record objects that call 'acts_as_yaffle'. The 'squawk' method will simply set the value of one of the fields in the database. To start out, write a failing test that shows the behavior you'd like: -- cgit v1.2.3 From e368a3468ff209825a74075afcd4045f85963b66 Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Sat, 21 May 2011 17:33:28 -0700 Subject: Removed the `enginex` plugin reference which is broken -- rails 3.1.0.beta1 has that functionality now. --- railties/guides/source/plugins.textile | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'railties/guides/source/plugins.textile') diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index b12aa78947..842b538bc8 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -25,33 +25,36 @@ endprologue. h3. Setup -h4. Generating the Plugin Skeleton +Before you continue, take a moment to decide if your new plugin will be potentially shared across different rails applications. -Rails currently ships with a generator to generate a plugin within a Rails application. Help text is available that will explain -how this generator works. +* If your plugin is specific to your application, your new plugin will be a _vendored plugin_. +* If you think your plugin may be used across applications, build it as a _gemified plugin_. + +h4. Either generate a vendored plugin... + +Use the +rails generate plugin+ command in your rails root directory + to create a new plugin that will live in the +vendor/plugins+ + directory. See usage and options by asking for help: -$ rails generate plugin --help +$ rails generate plugin new --help -This generator places the plugin into the vendor/plugins directory. +h4. Or generate a gemified plugin. -Vendored plugins are useful for quickly prototyping your plugin but current thinking in the Rails community is shifting towards -packaging plugins as gems, especially with the inclusion of Bundler as the Rails dependency manager. -Packaging a plugin as a gem may be overkill for any plugins that will not be shared across projects but doing so from the start makes it easier to share the plugin going forward without adding too much additional overhead during development. +Writing your rails plugin as a gem, rather than as a vendored plugin, + lets you share your plugin across different rails applications using + rubygems and bundler. -Rails 3.1 will ship with a plugin generator that will default to setting up a plugin -as a gem. This tutorial will begin to bridge that gap by demonstrating how to create a gem based plugin using the -"Enginex gem":http://www.github.com/josevalim/enginex. +Rails 3.1 ships with a +rails plugin new+ command which creates a + skeleton for developing any kind of Rails extension with the ability + to run integration tests using a dummy Rails application. See usage + and options by asking for help: -$ gem install enginex -$ enginex --help -$ enginex yaffle +$ rails plugin --help -This command will create a new directory named "yaffle" within the current directory. - h3. Testing your newly generated plugin You can navigate to the directory that contains the plugin, run the +bundle install+ command -- cgit v1.2.3 From 330fc8c48d91b8909985fd82d7fc3761b1242526 Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Sun, 22 May 2011 16:07:47 -0700 Subject: Following proper naming conventions while referring to Rails, Bundler --- railties/guides/source/plugins.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'railties/guides/source/plugins.textile') diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index 842b538bc8..b71cd0c89d 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -25,14 +25,14 @@ endprologue. h3. Setup -Before you continue, take a moment to decide if your new plugin will be potentially shared across different rails applications. +Before you continue, take a moment to decide if your new plugin will be potentially shared across different Rails applications. * If your plugin is specific to your application, your new plugin will be a _vendored plugin_. * If you think your plugin may be used across applications, build it as a _gemified plugin_. h4. Either generate a vendored plugin... -Use the +rails generate plugin+ command in your rails root directory +Use the +rails generate plugin+ command in your Rails root directory to create a new plugin that will live in the +vendor/plugins+ directory. See usage and options by asking for help: @@ -42,9 +42,9 @@ $ rails generate plugin new --help h4. Or generate a gemified plugin. -Writing your rails plugin as a gem, rather than as a vendored plugin, +Writing your Rails plugin as a gem, rather than as a vendored plugin, lets you share your plugin across different rails applications using - rubygems and bundler. + RubyGems and Bundler. Rails 3.1 ships with a +rails plugin new+ command which creates a skeleton for developing any kind of Rails extension with the ability -- cgit v1.2.3 From 12ab1653dc9263d35f0633ff1a0c83f97c96f4bf Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Mon, 23 May 2011 14:13:57 -0700 Subject: NOTE: doesn't handle newlines. --- railties/guides/source/plugins.textile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'railties/guides/source/plugins.textile') diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index b71cd0c89d..53d2381db4 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -390,9 +390,7 @@ Run +rake+ one final time and you should see: 7 tests, 7 assertions, 0 failures, 0 errors, 0 skips -NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can -interact with the model, and will not always be the right method to use. For example, you could also -use +send("#{self.class.yaffle_text_field}=", string.to_squawk)+. +NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use +send("#{self.class.yaffle_text_field}=", string.to_squawk)+. h3. Generators -- cgit v1.2.3 From c6ec7e825e37a894d47386e9d6ca3021de1eb056 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 May 2011 20:09:58 -0300 Subject: Fix styling error on plugins guide. --- railties/guides/source/plugins.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides/source/plugins.textile') diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index 53d2381db4..2eb71e49c4 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -390,7 +390,7 @@ Run +rake+ one final time and you should see: 7 tests, 7 assertions, 0 failures, 0 errors, 0 skips -NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use +send("#{self.class.yaffle_text_field}=", string.to_squawk)+. +NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use send("#{self.class.yaffle_text_field}=", string.to_squawk). h3. Generators -- cgit v1.2.3