Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use haml with heroku?

I try to get haml working without the gem with sinatra (Heroku doesn't allow gem install, as far as I know)

What I've done so far:

  • clone the haml git repo inside my project

  • add : require 'haml/lib/haml.rb' to my sinatra main file

the following works:

get '/test' do
  Haml::Engine.new('%p test').render
end

but the following doesn't:

get '/test2' do
  haml :my_template
end

I get the error :

NoMethodError - undefined method each' for nil:NilClass (haml):20:inrender'

./haml/lib/haml/engine.rb:152:in `render'

./haml/lib/haml/engine.rb:152:in `instance_eval'

./haml/lib/haml/engine.rb:152:in `render' ...

Is there any other files to require ? Any ideas ?

like image 418
Gaetan Dubar Avatar asked Mar 01 '09 20:03

Gaetan Dubar


1 Answers

Heroku supports installing gems by creating a .gems file in your project's root directory and adding it to Git. On your next push the gems required in there will be installed. To install Haml the file would contain this line:

haml --version '>= 2.2.0'

More information can be found here: http://docs.heroku.com/gems

like image 169
petergassner Avatar answered Nov 02 '22 23:11

petergassner