Segunda-feira, 12 de Maio de 2008

Footnotes v3.0

I've been using Textmate Footnotes for a long time and since then I've been doing some updates and adding new features.

Last week I decided to send a patch to Duane, the author, and he told me that I should talk with Dr. Nic, because the plugin was merged into Ruby on Rails TextMate bundle. Finally, Dr. Nic told me that no one was currently looking after the plugin and asked me if could take care of it myself! =)

He created a new repository, which is now the Rails Footnotes home.

The new repository was created yesterday, today I've already pushed my changes to GitHub and now we have the third version of the plugin! Nice! =)

But wtf is Footnotes?

Footnotes is a Rails plugin that adds some notes in the footer of Your page (duh) that are useful for debugging. Nonetheless, if You're using a Mac, it shows links to Your controller, layout, view and assets to open them directly in TextMate (if You are not on Mac, check out the init.rb file). It also appends links to Your backtrace messages to open the file in Textmate.

If You are already convinced, You next question is...

How to install?

cd myapp/vendor/plugins
git clone git://github.com/josevalim/rails-footnotes.git footnotes
rm -rf footnotes/.git


But if You want to know what is new before installing...

So, what's new?


Above is the small footer that will appear in Your pages. The first row (Edit) contains links to open files directly in TextMate and the second row (Show) is useful to debug Your app. Session, cookies, params and log show exactly what You are thinking! =) The new features are:

+ Filters: show the Filter chain for the current Controller. Good to check if Your filters are called in the right order;

+ Routes: show the routes for the current Controller. It's very useful since map.resources creates a bunch of named routes. All the credits for this one should go to Rick Olson and his RoutingNavigator plugin (I've only adapted it).

Finally, You can use the General Debug tab to output some javascript or whatever You want!

It's also running in Rails 2.0 and some bugs were fixed, but there might be some more out there! If You are the lucky one to find them, feel free to tell me! =)

UPDATE: The current GitHub branch is working only on Rails Edge (Rails 2.1 RC1 and above). If You want to use it on Rails 2.0.x and Rails 1.x check the section "Early versions" on the README here.

Why not backward compatibility? I was worried with that until the last version (last version v3.0, current version v3.1), but Rails 2.1 has a huge code refactoring on ActionPack and it would need many workarounds to keep all Rails versions working together. =)

7 comentários:

Dr Nic disse...

Very cool. Glad its all fixed now.

Hugo Pessoa de Baraúna disse...

Very very nice! Keep the good working! =)

Marco Jansen disse...

Hi,

Great that you picked this up!

I installed footnotes on Rails 2.0.2 and got the following exception in my log file:
Footnotes Exception:
Footnotes Exception: undefined method `finder' for #ActionView::Base:0x53d874
/Users/marco/catawiki/vendor/plugins/footnotes/lib/textmate_links.rb:45:in `template_base_path'
/Users/marco/catawiki/vendor/plugins/footnotes/lib/textmate_links.rb:49:in `template_file_name'
/Users/marco/catawiki/vendor/plugins/footnotes/lib/textmate_links.rb:73:in `view_url'
/Users/marco/catawiki/vendor/plugins/footnotes/lib/textmate_links.rb:84:in `textmate_links'
/Users/marco/catawiki/vendor/plugins/footnotes/lib/textmate_footnotes.rb:65:in `insert_footnotes'
/Users/marco/catawiki/vendor/plugins/footnotes/lib/textmate_footnotes.rb:23:in `add_footnotes!'
/Users/marco/catawiki/vendor/plugins/footnotes/lib/textmate_footnotes.rb:9:in `filter'

Do I need to use the Edge version of rails or does it depend on an other plugin?

Thanks,

Marco.

José Valim disse...

Hey Marco,

The current version on GitHub is working on Edge Rails, but we have a tag called v3.0 that is the last working version on Rails 2.0.x

Check the README at GitHub here and see the section called Early versions.

Any doubts, suggestions, feel free to send another comment! =)

Marco Jansen disse...

That does the trick! I can't believe I missed this :-> It was very cleary written in the readme.

Thanks,

Marco.

jujudellago disse...

wow !

this is awsome :)

thanks !!

(followed the instructions to use with rails 2.0, worked perectly)

Juan C. disse...

Muito legal. Thanks for maintaining. The plugin is awesome