Sinatra app in stone

I have a Sinatra application that I created, and I would like to package it as a gem based binary.

I have gemspec and gem created to create a suitable executable that points to my_sinatra_app.rb(which is executable), but the synatra server never starts. Any ideas why and how to make it work?

my_sinatra_app executable file:

#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
#
# This file was generated by RubyGems.
require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'my_sinatra_app', version
load Gem.bin_path('my_sinatra_app', 'my_sinatra_app', version)
+5
source share
1 answer

Detected: D

You need to wrap the Sinatra application in this class:

class MySinatraApp < Sinatra::Application
  # Stuff
end

Then in the file that launches the application, you can simply do MySinatraApp.run!Simple :)

+5
source

All Articles