Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Such File To Load Passenger and Sinatra

I've recently updated to Ruby 1.9.2 (RVM), Sinatra 1.1 and Passenger 3.0.0. I have a simple application composed of:

# config.ru

require 'rubygems'
require 'sinatra'
require 'app.rb'

run Sinatra::Application

# app.rb

require 'rubygems'
require 'sinatra'

get '/' do
  erb :index
end

If I run the application from the terminal using ruby app.rb everythign launches as expected. However, with Passenger I get: no such file to load -- app.rb. I have other Rails applications running fine with the setup, and have setup the document root to a sub public directory. Any ideas how to fix this? Thanks!

like image 780
Kevin Sylvestre Avatar asked Oct 25 '10 19:10

Kevin Sylvestre


2 Answers

I had the same problem here:

# config.ru

require 'rubygems'
require 'sinatra'

require File.dirname(__FILE__) + "/app.rb"

run Sinatra::Application
like image 152
include Avatar answered Oct 31 '22 13:10

include


Managed to fix the issue. Figured out for some reason the config.ru requires the include to be specified relative to the current directory. The modified file is:

# config.ru

require 'rubygems'
require 'sinatra'
require './app.rb'

run Sinatra::Application
like image 34
Kevin Sylvestre Avatar answered Oct 31 '22 15:10

Kevin Sylvestre