1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fixed typos and made minor changes in the Plugins guide.

This commit is contained in:
Dimitar Dimitrov 2011-08-26 18:34:57 +03:00
parent 4a4dcb5059
commit b5f68cc6fe

View file

@ -290,7 +290,7 @@ You can then return to the root directory (+cd ../..+) of your plugin and rerun
</shell> </shell>
Getting closer...now we will implement the code of the acts_as_yaffle method to make the tests pass. Getting closer... Now we will implement the code of the acts_as_yaffle method to make the tests pass.
<ruby> <ruby>
# yaffle/lib/yaffle/acts_as_yaffle.rb # yaffle/lib/yaffle/acts_as_yaffle.rb
@ -322,7 +322,7 @@ When you run +rake+ you should see the tests all pass:
h4. Add an Instance Method 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 object that calls 'acts_as_yaffle'. The 'squawk'
method will simply set the value of one of the fields in the database. 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: To start out, write a failing test that shows the behavior you'd like:
@ -347,7 +347,7 @@ class ActsAsYaffleTest < Test::Unit::TestCase
assert_equal "squawk! Hello World", hickwall.last_squawk assert_equal "squawk! Hello World", hickwall.last_squawk
end end
def test_wickwalls_squawk_should_populate_last_tweeted_at def test_wickwalls_squawk_should_populate_last_tweet
wickwall = Wickwall.new wickwall = Wickwall.new
wickwall.squawk("Hello World") wickwall.squawk("Hello World")
assert_equal "squawk! Hello World", wickwall.last_tweet assert_equal "squawk! Hello World", wickwall.last_tweet
@ -355,7 +355,7 @@ class ActsAsYaffleTest < Test::Unit::TestCase
end end
</ruby> </ruby>
Run the test to make sure the last two tests fail the an error that contains "NoMethodError: undefined method `squawk'", Run the test to make sure the last two tests fail with an error that contains "NoMethodError: undefined method `squawk'",
then update 'acts_as_yaffle.rb' to look like this: then update 'acts_as_yaffle.rb' to look like this:
<ruby> <ruby>
@ -400,11 +400,11 @@ the creation of generators can be found in the "Generators Guide":generators.htm
h3. Publishing your Gem h3. Publishing your Gem
Gem plugins in progress can be easily be shared from any Git repository. To share the Yaffle gem with others, simply Gem plugins currently in development can easily be shared from any Git repository. To share the Yaffle gem with others, simply
commit the code to a Git repository (like Github) and add a line to the Gemfile of the any application: commit the code to a Git repository (like Github) and add a line to the Gemfile of the application in question:
<ruby> <ruby>
gem 'yaffle', :git => 'git://github.com/yaffle_watcher/yaffle.git' gem 'yaffle', :git => 'git://github.com/yaffle_watcher/yaffle.git'
</ruby> </ruby>
After running +bundle install+, your gem functionality will be available to the application. After running +bundle install+, your gem functionality will be available to the application.
@ -426,12 +426,12 @@ require 'yaffle'
</ruby> </ruby>
You can test this by changing to the Rails application that you added the plugin to and starting a rails console. Once in the You can test this by changing to the Rails application that you added the plugin to and starting a rails console. Once in the
console we can check to see if the String has an instance method of to_squawk. console we can check to see if the String has an instance method to_squawk:
<shell> <shell>
$ cd my_app $ cd my_app
$ rails console $ rails console
$ String.instance_methods.sort $ "Rails plugins are easy!".to_squawk
</shell> </shell>
You can also remove the .gemspec, Gemfile and Gemfile.lock files as they will no longer be needed. You can also remove the .gemspec, Gemfile and Gemfile.lock files as they will no longer be needed.
@ -445,9 +445,9 @@ The first step is to update the README file with detailed information about how
* Your name * Your name
* How to install * How to install
* How to add the functionality to the app (several examples of common use cases) * How to add the functionality to the app (several examples of common use cases)
* Warning, gotchas or tips that might help save users time * Warnings, gotchas or tips that might help users and save them time
Once your README is solid, go through and add rdoc comments to all of the methods that developers will use. It's also customary to add '#:nodoc:' comments to those parts of the code that are not part of the public api. Once your README is solid, go through and add rdoc comments to all of the methods that developers will use. It's also customary to add '#:nodoc:' comments to those parts of the code that are not included in the public api.
Once your comments are good to go, navigate to your plugin directory and run: Once your comments are good to go, navigate to your plugin directory and run: