我正在尝试首先在我使用代码创建 helloworld.ru 的目录中创建一个 rake 基本应用程序
class HelloRack def call(env) ["200",{"Content-Type" => "text/plain"}, "Hello World"] end end run HelloRack.new
我用 rackup helloworld.ru 运行它,之后我用代码在同一目录中创建了三个文件 Massive.rb
module Rack
class Massive
def initialize(app)
@app = app
end
def call(env)
status, headers, response= @app.call(env)
[status, headers, "<div style="font-size:5.0em">#{response} - it's all small stuff</div>"]
end
end
end
其他文件名为 SmallStuff.rb
class SmallStuff
def call(env)
["200", {"Content-Type" => "text/html"}, "Don't Sweat The Small Stuff"]
end
end
还有一个文件名为 config.ru 和代码
require 'rubygems'
require 'rack'
use Rack::Massive
run SmallStuff.new
当我运行 rackup config.ru 它给了我错误
/home/ritesh/rails/config.ru:4: uninitialized constant Rack::Massive (NameError)
from /var/lib/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
from /var/lib/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
from /home/ritesh/rails/config.ru:0:in `new'
from /home/ritesh/rails/config.ru:0
如何删除此错误我是 rake 应用程序的新手,任何人都可以提供 rake 应用程序教程或有用的链接!