2

I'm trying to write a Ruby web application and I want to use the functionality offered by Sinatra.

I used this code:

  require 'rubygems'
  require 'sinatra'

  get '/' do
      'Hello, world!'
  end

I typed localhost:8080/?hello.rb in my browser and I received an error message that the script is unable to find sinatra. I also tried to run the sinatra app using this command:

  ruby hello.rb 

and this time it worked! So I suspect the problem is not in my code, but in the way I'm using G-WAN to serve the Ruby script.

Dragos C.
  • 621
  • 2
  • 7
  • 15

2 Answers2

3

Sinatra expects to be run by a rack-compatible server, which G-Wan is apparently not. When you run script manually it is being run by a WEBrick server that comes bundled with Ruby. Examples of compatible servers are thin, unicorn or apache/nginx with phusion passenger

Slartibartfast
  • 8,735
  • 6
  • 41
  • 45
  • Do you know any Ruby web framework that doesn't require rack compatibility? Or can you suggest how can make G-WAN rack-compatible? – Dragos C. Jul 03 '13 at 12:51
2

Ruby (like Java or PHP) probably uses configuration files and/or environment variables to specify where to find packages, modules and libraries.

While G-WAN received similar requests for asm, C, C++, D, Objective-C, Java and C# support, Ruby users did not manifest interest in this area - so far.

If you point to us the relevant Ruby documentation, we will try to add this Ruby feature (just like it was done for the other languages).

Gil
  • 3,279
  • 1
  • 15
  • 25
  • I'm willing to collaborate with you on this issue. Please provide some me with some contact information. – Dragos C. Jul 03 '13 at 12:47