我試圖讓Bundler安裝,所以我可以將我的Sinatra應用程序部署到所有正確的寶石服務器。Sinatra和Bundler
我已經建立了我的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
並得到了「捆綁完成」所以現在所有我需要做的僅僅是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
什麼錯? :(
你能告訴我們你的MyApp.rb嗎? – 2010-08-02 23:45:01
嘿,我已經減少了MyApp.rb觸發相同的錯誤:/ – Tom 2010-08-03 18:28:44