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

The to_sentence method is nothing terribly new – just another reason why one would want to work with Ruby on Rails:

irb(main):005:0> require 'rubygems'
=> true
irb(main):006:0> require 'activesupport'
=> true
irb(main):007:0> ['John', 'Paul', 'George', 'Ringo'].to_sentence
=> "John, Paul, George, and Ringo"

As this has never worked right out of the box (the necessary files are in places not expected by the gem installer), here is what I do:
sudo gem install mysql -- --with-mysql-config=/usr/lib/mysql/mysql_config

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 …