public
Description: PLEASE CHECK http://github.com/lifo/docrails/wikis
Homepage: http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch
Clone URL: git://github.com/lifo/docrails.git
Search Repo:
added final tree structure, changed String to String.class_eval do
zilkey (author)
Fri May 30 10:13:29 -0700 2008
commit  60e37868e40ac11f07cbda81f24dcdb0a9c68783
tree    fb87acd340ba39f0ca3310cebc46b438ee0948a5
parent  1b43884c729662e4f0b12f4141dc493ead7da258
...
266
267
268
269
270
 
271
272
273
274
275
276
 
277
278
 
279
280
281
...
824
825
826
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
266
267
268
 
 
269
270
271
272
273
274
 
275
276
 
277
278
279
280
...
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
0
@@ -266,16 +266,15 @@ Great - now you are ready to start development. The first thing we'll do is to
0
 
0
     # File: vendor/plugins/yaffle/lib/core_ext.rb
0
 
0
- class String
0
- # returns the current string, prefixed by "squawk!"
0
+ String.class_eval do
0
       def to_squawk
0
         "squawk! #{self}".strip
0
       end
0
     end
0
 
0
-To test that your method does what it says it does, run the unit tests. To make sure your code is picked up by
1
+When monkey-patching existing classes it's often better to use `class_eval` instead of opening the class directly.
0
 
0
-To test this, fire up a console and start squawking:
0
+To test that your method does what it says it does, run the unit tests. To test this manually, fire up a console and start squawking:
0
 
0
     script/console
0
     >> "Hello World".to_squawk
0
@@ -824,3 +823,40 @@ References
0
 * [http://nubyonrails.com/articles/2006/05/09/the-complete-guide-to-rails-plugins-part-ii](http://nubyonrails.com/articles/2006/05/09/the-complete-guide-to-rails-plugins-part-ii)
0
 * [http://github.com/technoweenie/attachment_fu/tree/master](http://github.com/technoweenie/attachment_fu/tree/master)
0
 * [http://daddy.platte.name/2007/05/rails-plugins-keep-initrb-thin.html](http://daddy.platte.name/2007/05/rails-plugins-keep-initrb-thin.html)
0
+
0
+Appendices
0
+------------------------
0
+
0
+The final plugin should have a directory structure that looks something like this:
0
+
0
+ |-- MIT-LICENSE
0
+ |-- README
0
+ |-- Rakefile
0
+ |-- generators
0
+ | `-- yaffle
0
+ | |-- USAGE
0
+ | |-- templates
0
+ | | `-- definition.txt
0
+ | `-- yaffle_generator.rb
0
+ |-- init.rb
0
+ |-- install.rb
0
+ |-- lib
0
+ | |-- acts_as_yaffle.rb
0
+ | |-- commands.rb
0
+ | |-- core_ext.rb
0
+ | |-- routing.rb
0
+ | `-- view_helpers.rb
0
+ |-- tasks
0
+ | `-- yaffle_tasks.rake
0
+ |-- test
0
+ | |-- acts_as_yaffle_test.rb
0
+ | |-- core_ext_test.rb
0
+ | |-- database.yml
0
+ | |-- debug.log
0
+ | |-- routing_test.rb
0
+ | |-- schema.rb
0
+ | |-- test_helper.rb
0
+ | `-- view_helpers_test.rb
0
+ |-- uninstall.rb
0
+ `-- yaffle_plugin.sqlite3.db
0
+

Comments