I saw a lot of buzz about the new Sinatra web framework and decided I’d give it a try. I have a client now that has a simple site they need up now and then I can migrate them to Rails over time. When I saw how easy Sinatra looked, I thought I could give it a chance to see what it could do.
I installed Sinatra via RubyGems:
gem install sinatra -y
After that I created a simple file following the example:
require 'rubygems'
require 'sinatra'
get '/' do
"Now we're cooking with gas"
end
But much to my dismay, nothing happened when running this on my windows box. I instantly searched Google for “Sinatra on windows” and found the Google Group for Sinatra and a post explaining that Sinatra doesn’t run on Windows yet. As I read into the thread, I found someone had some suggestions for making it work.
John Bledsoe had the following suggestions:
My humble suggestion would be to remove the FileUtils#touch from
Sinatra::Server#tail and update Environment#prepare_loggers to
something like:
def prepare_loggers(logger = nil)
if logger.nil?
FileUtils.touch(Options.log_file)
logger = Logger.new(open(Options.log_file, 'w')
end
end
Making these changes allowed Sinatra to run, but it wouldn’t server the page. Instead it returned an error:
Fri Nov 09 16:26:26 -0800 2007: ERROR: undefined method `info’ for nil:NilClass
I made a post to the group and was promptly replied to! The general advice given is that it is a rapidly emerging framework undergoing a lot of changes and to check back soon.
More on testing Sinatra in Linux coming soon….
