Sha256: 6dbc6449988cf888caf7e1f6b1d3061acf4ef701f1e43bb2840abc1a95931b90

Contents?: true

Size: 1.04 KB

Versions: 106

Compression:

Stored size: 1.04 KB

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*:--views*"
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)
  ENV["RBBT_VIEWS_DIR"] = options[:views] if options.include?(:views)

  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

106 entries across 106 versions & 1 rubygems

Version Path
rbbt-util-5.19.11 share/rbbt_commands/app/start
rbbt-util-5.19.10 share/rbbt_commands/app/start
rbbt-util-5.19.9 share/rbbt_commands/app/start
rbbt-util-5.19.8 share/rbbt_commands/app/start
rbbt-util-5.19.7 share/rbbt_commands/app/start
rbbt-util-5.19.6 share/rbbt_commands/app/start
rbbt-util-5.19.5 share/rbbt_commands/app/start
rbbt-util-5.19.4 share/rbbt_commands/app/start
rbbt-util-5.19.3 share/rbbt_commands/app/start
rbbt-util-5.19.2 share/rbbt_commands/app/start
rbbt-util-5.19.1 share/rbbt_commands/app/start
rbbt-util-5.19.0 share/rbbt_commands/app/start
rbbt-util-5.18.1 share/rbbt_commands/app/start
rbbt-util-5.18.0 share/rbbt_commands/app/start
rbbt-util-5.17.89 share/rbbt_commands/app/start
rbbt-util-5.17.88 share/rbbt_commands/app/start
rbbt-util-5.17.87 share/rbbt_commands/app/start
rbbt-util-5.17.86 share/rbbt_commands/app/start
rbbt-util-5.17.85 share/rbbt_commands/app/start
rbbt-util-5.17.84 share/rbbt_commands/app/start