Sha256: 273f35f170c19c028552332729d4d60e9a095824e4baeeca993057dfcad4c7c3

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 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] || 'thin'
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
      Rack::Server.start(options.merge(:config => config_ru_file))
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rbbt-util-5.5.53 share/rbbt_commands/app/start
rbbt-util-5.5.52 share/rbbt_commands/app/start
rbbt-util-5.5.51 share/rbbt_commands/app/start
rbbt-util-5.5.50 share/rbbt_commands/app/start
rbbt-util-5.5.49 share/rbbt_commands/app/start