i am trying to create a rake basic app
first in a directory i created helloworld.ru with code
class HelloRack
def call(env)
[“200”,{“Content-Type” => “text/plain”}, “Hello World”]
end
end
run HelloRack.new
i run it with rackup helloworld.ru its working fine
after that i created three files Massive.rb in same directory with code
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
and other file’s name is SmallStuff.rb
class SmallStuff
def call(env)
["200", {"Content-Type" => "text/html"}, "Don't Sweat The Small Stuff"]
end
end
and one more file’s name is config.ru with code
require 'rubygems'
require 'rack'
use Rack::Massive
run SmallStuff.new
when i run rackup config.ru
its giving me error
/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
how to remove this error i am new to rake applications can any one please provide rake apps tutorial or helpful links!!
It looks like you are just missing one or two
requires. First rename your other files to massive.rb and small_stuff.rb (to follow Ruby conventions), then require them something like this: