1

Gemfile

source :rubygems
gem 'sinatra'

config.ru

require 'app'
run App

app.rb

require 'bundler/setup'
require 'sinatra'

class App < Sinatra::Base
  get '/' do
   'hello world'
  end
end

rackup failes with

.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- app (LoadError)

Works with ruby 1.8 . Why?

Beffa
  • 915
  • 1
  • 8
  • 18

2 Answers2

4

I think it's because 1.9.2 no longer includes '.' in the load path by default.

See the this question for more: Why does Ruby 1.9.2 remove "." from LOAD_PATH, and what's the alternative?

Community
  • 1
  • 1
Steve
  • 15,606
  • 3
  • 44
  • 39
1

Some notes:

Gemfile, I use gem 'sinatra', :require => 'sinatra/base' to load a Modular Sinatra App.

Config.ru, usually I set Bundler on it, not in app.rb, leaving app.rb clean to my app.

require 'bundler/setup' Bundler.require(:default)

include
  • 2,108
  • 16
  • 13