Sha256: 53c89f87916f6525ffd6def57e2ea0099b6c03f2ace3942de94ba4c3a1643050

Contents?: true

Size: 984 Bytes

Versions: 2

Compression:

Stored size: 984 Bytes

Contents

#!/usr/bin/env ruby

require 'rbbt-util'
require 'rbbt/util/simpleopt'

options = SOPT.get "-e--environment*:-p--port*:-s--server*:-f--finder:-R--Rserve_session*:-ho--host*"
options[:Port] ||= options[:port]
options[:Host] ||= "0.0.0.0"
options[:Bind] ||= "0.0.0.0"

app = ARGV.shift

ENV["RServe-session"] = options[:RServe_session] || app

app_dir = Rbbt.etc.app_dir.exists? ? Path.setup(Rbbt.etc.app_dir.read.strip) : Rbbt.apps.find

app_dir = app_dir[app]

server = options[:server] || 'puma'
Misc.in_dir(app_dir) do
  require 'rack'
  ENV["RBBT_FINDER"] = "true" if options.include?(:finder)
  ENV["RACK_ENV"] = options[:environment] if options.include?(:environment)

  config_ru_file = File.exists?('./config.ru') ? './config.ru' : Rbbt.share['config.ru'].find

  if server == 'unicorn'
    `unicorn -c #{ Rbbt.share['unicorn.rb'].find } '#{config_ru_file}' -p #{options[:port] || "2887"}`
  else
    options[:config] = config_ru_file
    Rack::Server.start(options)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rbbt-util-5.15.1 share/rbbt_commands/app/start
rbbt-util-5.14.39 share/rbbt_commands/app/start