Rails Code Indentation

Hi All,

Rails code must be readable, formatted and well indented. I wanted to do indent code in my previous projects. Is there any built in rails plugin/gem that can help me to indent my existing code.

Any ideas will be really appreciated !

NOTE: Please don’t suggest editor plugins.

Thanks & Regards, Sandip R~

Hi All,

Rails code must be readable, formatted and well indented. I wanted to do indent code in my previous projects. Is there any built in rails plugin/gem that can help me to indent my existing code.

Any ideas will be really appreciated !

Do you mean you want a plugin or gem that edits the file it is interpreting? That doesn't make sense to me.

NOTE: Please don't suggest editor plugins.

Why not? Any decent editor will do this for you.

Colin

well, eclipse wont!

well, eclipse wont!

Note: the man said "decent" -- eclipse is barely an editor at all... :slight_smile:

What do you use asa good RoR editor then?

I find jEdit (with the appropriate plugins) does a pretty good job. Available for Win and Linux.

Colin

Actually, since it's Java-based, it runs on anything with a JVM, including Macs. And it's incredibly configurable and extensible.

That said, I use both jEdit and NetBeans, which among other strengths does a very nice job of reformatting raggedy code :slight_smile:

FWIW,

What do you use asa good RoR editor then?

I find jEdit (with the appropriate plugins) does a pretty good job. Available for Win and Linux.

Actually, since it's Java-based, it runs on anything with a JVM, including Macs. And it's incredibly configurable and extensible.

I thought it would likely work on Macs also, but I have no personal experience of this so I thought it better not to say what I was not certain of. Usually when I do that I end up looking foolish. :slight_smile: Colin

What do you use asa good RoR editor then?

> > well, eclipse wont!

> Note: the man said "decent" -- eclipse is barely an editor at all... :slight_smile:

If you're really attached to eclipse, I would suggest using Aptana's RadRails which you can install as a plugin. I started out that way, but didn't like the extra layer of complexity eclipse added, so I blew that out and just am using Aptana's IDE with RadRails directly. I've also used JEdit, and with the Ruby plugins it does a lot of things very well, but I like an IDE environment a little better (personal choice.) --Good luck, Wayne

JannaB wrote:

What do you use asa good RoR editor then?   

NetBeans indents very well.

Cheers, Mohit. 6/7/2009 | 11:03 AM.

Netbeans is good for that.

RubyMine has an excellent code formatter. Just write your code and Cmd- Option-L.

Scott

What do you (all the list) think about Redcar?

http://redcareditor.com/

  I'm using it actually and thought that I can be a very good editor.

davi

Hi guys,

Thanks for your reply !

I am using vi editor with rails.vim plugin as well as my own personal indentation settings for my current developments.

but i think there should be plugin/gem to indent your rails application directory LIKE annotate models plugin ( Lazy peoples ). sorry to say but i don’t wanted to indent my previous developments using editors.

  • Sandip R~

I've written a Textmate plugin that indents Ruby code (rather better than Textmate does on it's own but not as well as Netbeans which, as mentioned earlier in the thread does a great job).

It's all written in Ruby so would be easy enough to extract into a gem (it's on my to do list).

You can see it all here http://github.com/mocoso/code-beautifier.tmbundle

If anyone's interested in using a gem based on this then say (and maybe that'll poke me to get it done).

J.

Hi Joel,

Thanks for the plugin !

I would like to use it but i am working on ubuntu machine and

textmate works with mac. meanwhile i found rails.vim script for

vim that solved my auto indentation problems.

http://www.funonrails.com/2010/02/vim-editor-for-ruby-on-rails.html