0

Currently having a bit of a nightmare trying to run code on another machine. I've been developing a Sinatra app as part of an internship I'm doing. I'm developing on an Ubuntu 12.04 machine, with ruby1.9.3 (through RVM). My supervisor wants to run it on his Debian Squeeze machine, the development server. I listed all the necessary gems in the Gemfile, and pushed up the initial commit. However, we just can't seem to get it running on the Debian box.

Ruby1.8 was initially installed, before my supervisor was aware we'd need Ruby1.9 and up. The Ruby1.9.1-full debian package was installed, but trying to run the Sinatra app with the ruby1.9.1 application.rb does nothing. I added in some print statements to debug it, and the ruby interpreter is reaching the end of the file - the problem is that it is not starting up WEBrick. This exact same code has no problem running on my machine, why is it being so problematic on Debian?

NOTE: Don't suggest switching to RVM. My supervisor is adamant we only use official packages, so it's beyond my control.

Richard Stokes
  • 3,532
  • 7
  • 41
  • 57

1 Answers1

0

I have my Sinatra apps configured a bit differently. That is, I don't run them with ruby application.rb, rather I have a config.ru file with instructions to the Rack middleware. When I want to run my app i just run rackup and the server will start.

The minimal example layout as shown in the Sinatra Readme is as follows.

A basic Sinatra application.rb file:

require 'sinatra'

get '/' do
  'Hello world!'
end

and the config.ru:

require './application'
run Sinatra::Application

I don't really know if or how this would make a difference in your situation, but it was the first thing that sprung to mind.


P.S.

Now that I think of it, another thing you could try is to use another server than WEBrick. I think if you add

gem 'thin'

to your Gemfile it should automatically use Thin instead. Remember to re-run bundle install first.

lime
  • 6,901
  • 4
  • 39
  • 50