3

我有一个使用 resque 的简单 ruby​​(非 Rails)应用程序,并且在 heroku 上没有 config.ru 就无法启动。当我添加 config.ru 文件时,在rackup本地运行时出现以下错误:

/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:133:in `to_app': missing run or map statement (RuntimeError)
from /Users/nickkarrasch/Dropbox/Coding/Ruby/smsnotifyv2/config.ru:in `<main>'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:250:in `start'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:141:in `start'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/bin/rackup:4:in `<top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p194/bin/rackup:23:in `load'
from /usr/local/Cellar/ruby/1.9.3-p194/bin/rackup:23:in `<main>'

我需要在 config.ru 中添加什么?

4

1 回答 1

6

The content of that file (config.ru), will depend on what you're actually trying to do and the framework you're using since is just used for configuring Rack applications, it tells the Rack::Builder what middleware should be used and in which order. These are some of the examples offered in the Heroku documentation for deploying rack applications.:

Sinatra:

require './hello'
run Sinatra::Application

Ramaze:

require ::File.expand_path('./../hello', __FILE__)
Ramaze.start(:file => __FILE__, :started => true)
run Ramaze

Camping

require './hello'
run Rack::Adapter::Camping.new(Hello)
于 2013-04-08T22:01:59.607 回答