我正在尝试设置 Bundler,以便可以将我的 Sinatra 应用程序部署到具有所有正确 gem 的服务器。
我已经创建了我的 Gemfile
source :gemcutter
gem 'sinatra', '1.0'
gem "nokogiri", "1.4.2"
gem "rack", "1.1.0"
gem "dm-core", "1.0.0"
gem "dm-migrations", "1.0.0"
gem "dm-sqlite-adapter", "1.0.0"
gem "pony", "1.0"
接下来我创建了一个 Config.ru
require 'rubygems'
require 'bundler'
Bundler.setup
require 'sinatra'
require 'dm-core'
require 'dm-migrations'
require 'dm-sqlite-adapter'
require 'open-uri'
require 'nokogiri'
require 'csv'
require 'pony'
require 'parsedate'
require 'digest/md5'
require 'MyApp'
run MyApp
到目前为止一切顺利,所以接下来我运行bundle install
并获得了“Bundle Complete”,所以现在我需要做的就是Rackup
然后我得到:
config.ru:18: undefined local variable or method `MyApp' for #<Rack::Builder:0x1227350 @ins=[]> (NameError)
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
from config.ru:1:in `new'
from config.ru:1
这是一个简单的 MyApp.rb 将触发相同的错误
get '/' do
erb :index
end
怎么了?:(