开发者

ruby 1.9, rvm, sinatra and rackup

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 fa开发者_StackOverflow社区iles 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?


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?


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜