How to ship a Sinatra application as a gem and deploy it?

耗尽温柔 提交于 2019-12-03 15:52:38

Ignoring path-issues for now, here is how I solved it:

The application bundled as gem, tubemp.

A Gemfile to install and include the gemified application:

gem 'tubemp'

A config.ru which runs the gemified application, called Tubemp:

require 'rubygems'
require 'bundler/setup' # To allow inclusion via the Bundle/Gemfile
require 'sinatra'       # Sinatra is required so we can call its "set"
require 'tubemp'        # And include the application

# Set the environment to :production on production
set :environment, ENV['RACK_ENV'].to_sym

# And fire the application.
run Tubemp

These two files is all that is needed to make a new rack-application, which includes the gemified Sinatra-app and as such are bootable trough e.g. nginx, passenger or simply rackup.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!