Reputation: 915
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?
Upvotes: 1
Views: 1261
Reputation: 15736
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?
Upvotes: 4
Reputation: 2118
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)
Upvotes: 1