PDA

View Full Version : HOWTO: add support for .rhtml, .html.erb, .rjs, .rxml, .builder


Eric_Jardas
June 9th, 2007, 07:00 PM
After you installed Ruby on Rails its time to add support for it's extensions.

1. First we need to add new extensions to file mime.types located in /etc folder.

1.1 Lets do that. We have to add new extensions at the end of mime.types file. We'll do that with the following command:
echo -e "text/x-ruby-source rhtml html.erb \ntext/x-eruby rjs \napplication/xml rxml builder" | sudo tee -a /etc/mime.types 1.2 Now we have to update mime-types so our new extensions get loaded with:
sudo update-mime-database /usr/share/mime2. Now it's time to download files.tar.gz (http://ubuntuforums.org/attachment.php?attachmentid=34843&stc=1&d=1181429596) from attachment

2.1 Unpack it with command:
tar -xzvf files.tar.gz 2.2 Now we have to copy .xml file to /usr/share/mime/package:
sudo cp x-rhtml.xml /usr/share/mime/packages 2.3 And .lang files to /usr/share/gtksourceview-1.0/language-specs:
sudo cp *.lang /usr/share/gtksourceview-1.0/language-specsAnd we are done ! Now editors like gedit can recognize rails extensions and you have syntax coloring for them !

Enjoy !

dishkuvek
August 7th, 2007, 08:23 PM
Do you know how you might get this working in gutsy? Since in gutsy there is now gtksourceview1.0 and gtksourceview2.0, I tried putting these files in both, and I still can't get the source to highlight in gedit.

Brian Pattison
October 20th, 2007, 04:23 AM
I can't get rhtml to be recognized in gutsy either. Can anyone please help??

Brian Pattison
October 20th, 2007, 10:27 PM
Finally got syntax highlighting for rhtml, rjs, ect in gedit on Gutsy working!!

Hope this helps others:
Ubuntu 7.10, rails, gedit and gtksourceview 2.0 (http://robzon.aenima.pl/2007/10/ubuntu-710-rails-gedit-and.html)

polypus
October 23rd, 2007, 02:04 PM
i have some more info for ubuntu rails gedit heads here:

http://crepuscular-homunculus.blogspot.com/2007/10/gedit-for-ruby-and-everything-else-on.html

thanks for the info!