Sha256: 9a13149981641c2646c579f128bbf1aa88a6c85f036dddaa9ddd509386dde9dc

Contents?: true

Size: 834 Bytes

Versions: 8

Compression:

Stored size: 834 Bytes

Contents

#!/usr/bin/env ruby

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

options = SOPT.get "-e--environment*:-p--port*:-s--server*:-f--finder"
options[:Port] ||= options[:port]

app = ARGV.shift

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

8 entries across 8 versions & 1 rubygems

Version Path
rbbt-util-5.14.23 share/rbbt_commands/app/start
rbbt-util-5.14.22 share/rbbt_commands/app/start
rbbt-util-5.14.21 share/rbbt_commands/app/start
rbbt-util-5.14.20 share/rbbt_commands/app/start
rbbt-util-5.14.18 share/rbbt_commands/app/start
rbbt-util-5.14.17 share/rbbt_commands/app/start
rbbt-util-5.14.16 share/rbbt_commands/app/start
rbbt-util-5.14.15 share/rbbt_commands/app/start