Well, I'm trying to run a simple web server through a rack. So this is my program:
require 'rubygems' require 'rack' class HelloWorld def call(env) [200, {"Content-Type" => "text/html"}, ["Hello Rack!"]] end end Rack::Handler::Mongrel.run HelloWorld.new, :Port => 9292
If I run it in the console, it works fine. If I run it in Eclipse, it ends up with an error:
/Users/MY_SUPER_SECRET_USER/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- rack (LoadError) from /Users/MY_SUPER_SECRET_USER/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /Users/MY_SUPER_SECRET_USER/Sites/service/service.rb:2:in `<main>'
The one that works is called the following:
MY_SUPER_SECRET_USER@MacBook-Pro :~/Sites/service $ which ruby /Users/MY_SUPER_SECRET_USER/.rvm/rubies/ruby-1.9.3-p194/bin/ruby MY_SUPER_SECRET_USER@MacBook-Pro :~/Sites/service $ ruby service.rb
Then, when I try to open localhost:9292 , it displays the expected Hello Rack code.
I am on Mac OS X 10.8, with ruby โโ1.9.3 installed via rvm (this should be obvious). My rack package was installed with sudo gem install rack
So, as you can see, Eclipse is configured on the same ruby โโexecutable. Any suggestions would be very helpful!
source share