Typography is the craft of endowing human language with a durable visual form, and thus with an independent existence. (...) Typography remains a source of true delight, true knowledge, true surprise.

Robert Bringhurst, The Elements of Typographic Style

April 19, 2009

Ruby Programming

3 comments

In this nice blog entry is some description of how to make rails work with passenger on site5. As I liked to have Sinatra working for myself (and had the sinatra and rack gems installed locally), here is how it works for me:

  • As usual with rails apps, have a symlink point from within $HOME/public_html to the public folder of your sinatra app.
  • Create a .htaccess file in the same public directory, looking like

    PassengerEnabled on
    RackBaseURI /linkname
    

    which certainly means that you have to put in the name of the symlink

  • Create a config.ru file in the app root

    ENV['GEM_PATH'] = "#{ENV['HOME']}/gems:/usr/lib/ruby/gems/1.8"
    ENV['GEM_HOME'] = "#{ENV['HOME']}/gems"
    
    require 'rubygems'
    require 'sinatra'
    
    set :env,  :production
    disable :run
    
    require 'app'
    

    The only significant change to a plain config.ru is the addition of the GEM_PATH at the very top of the file – this way your locally installed gems are being picked up by passenger

One more thing: it turned out to be a good idea to include the ENV['GEM_PATH'] = “#{ENV['HOME']}/gems:/usr/lib/ruby/gems/1.8″ line on top of the rails application file as well. Without that, starting a fresh passenger fork will cause an exception – it will however work on the second attempt. Will have to look into this …

April 6, 2009

Ruby Programming

1 comment

As part of a Sinatra project, I gave Haml a try. The What is it section promises (among a number of technical aspects) positive feelings galore, which I was a little sceptical about:

Give yourself 5 minutes to read the Tutorial and then go convert one of your RHTML templates to Haml. Feel the power of the “DELETE” key. Simplify. Enjoy. Laugh. 20 minutes later, you will never go back.

But after having converted all of my erb templates in about 45 minutes, I was indeed smiling. Try it yourself!