Sinatra on Dreamhost

sinatra dreamhost tilt

Tue Dec 14 02:22:33 -0800 2010

This is the raw howto install Sinatra 1.0 on Dreamhost.

At this momento, there are some issues with Tilt version used on Sinatra 1.1.0 that Dreamhost Passenger is complaining, so thats why I’m using Sinatra 1.0.

###  Sinatra on Dreamhost - 13/13/2010
 
### Installing Rubygems into another path while using Ruby from Dreamhost (without rvm for now)
 
$ mkdir ~/.gems
$ mkdir ~/bin
$ mkdir ~/lib
 
$ mkdir ~/src
$ cd ~/src
$ wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
$ tar xzvf rubygems-1.3.7.tgz
$ cd rubygems-1.3.0
$ ruby setup.rb --prefix=$HOME
 
 
### Changing ENV
 
# Add the next 3 lines in to ~/.bash_profile
 
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$GEM_HOME"
export RUBYLIB="$HOME/lib:$RUBYLIB"
 
# also in your ~/.bash_profile change the line bellow
 
export PATH="$HOME/bin:$HOME/.gem/bin:$HOME/.gem/ruby/1.8/bin:$HOME/usr/local/bin:$HOME/usr/bin:$PATH"
 
# load the changed .bash_profile
 
$ source ~/.bash_profile
 
 
### Installing Sinatra and Tilt to ~/.gems
 
$ gem install sinatra -v 1.0
$ gem install tilt -v 1.0
 
$ cd YOURAPP
$ mkdir vendor
 
### unpack gems to your app vendor
 
$ gem unpack sinatra -v 1.0
$ gem unpack tilt -v 1.0
 
 
### config.ru
 
require 'rubygems'
require 'vendor/sinatra-1.0/lib/sinatra.rb'
require 'vendor/tilt-1.0/lib/tilt.rb'
 
set :run, false
set :environment, :production
 
# logging
FileUtils.mkdir_p 'log' unless File.exists?('log')
log = File.new("log/sinatra.log", "a")
$stdout.reopen(log)
$stderr.reopen(log)
 
require 'app'
run Sinatra::Application
 
 
### app.rb
require 'rubygems'
 
get '/' do
  "Hi"
end
 
get '/version' do
  "hello" + Sinatra::VERSION
end

Have fun

blog comments powered by Disqus