Monthly Archive for gener, 2008

Adding Haml to rails command

To apply this patch firts of all you must know where ruby is installed in.

$ which ruby
/usr/bin/ruby

If this is the output your ruby libraries are in /usr/lib/ruby

iMac$ RUBY_HOME=/usr/lib/ruby
iMac$ GEMS_ROUTE=$RUBY_HOME/gems/1.8/gems

Modify rails source on $GEMS_ROUTE/rails-2.0.2/lib/rails_generator/generators/applications/app/app_generator.rb

Applying this patch

iMac$ cd $GEMS_ROUTE/rails-2.0.2/lib/rails_generator/generators/applications/app
iMac$ wget http://www.forniol.cat/manuals/haml_into_rails/app_generator.patch
iMac$ sudo patch -p0 < app_generator.patch

Or if you prefer doing it manually:

#app_generator.rb
record do |m|

# Pluggins
m.file “vendor/plugins/haml/init.rb”, “vendor/plugins/haml/init.rb”
end

BASEDIRS = %w(

vendor/plugins
vendor/plugins/haml

)

Once rails source is modified the next step is add the haml init.rb to rails tree

iMac$ HAML_RAILS=$GEMS_ROUTE/rails-2.0.2/vendor/plugins/haml

iMac$ sudo mkdir -p $HAML_RAILS

iMac$ cd $HAML_RAILS
iMac$ wget http://www.forniol.cat/manuals/haml_into_rails/init.rb

Go back to your home dir and try to create a new tree

iMac$ cd
iMac$ rails HamlApp
create
create app/controllers
create app/helpers
create app/models



create log/development.log
create log/test.log
create vendor/plugins/haml/init.rb