Sha256: fef5660a862b0954ccf782cbe99f6516327d98898e69f2305d70369d9bb6d5cb
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require 'boned/server' require 'pp' class Boned::CLI < Drydock::Command attr_accessor :exit_code def init Boned.load_config Dir.pwd, :development Boned.connect end def start if Boned.service_available?('127.0.0.1', server_opts[:port]) raise Boned::Server::ServerRunning, server_opts[:port] end Boned::Controllers::Controller.new(server_opts).start end def stop if not Boned.service_available?('127.0.0.1', server_opts[:port]) raise Boned::Server::ServerNotRunning, server_opts[:port] end Boned::Controllers::Controller.new(server_opts).stop end def info require 'yaml' if Boned.service_available?('127.0.0.1', server_opts[:port]) puts "boned is running on port #{server_opts[:port]}" else puts "No boned" end puts "Options:", server_opts.to_yaml if @global.verbose > 0 end private def server_opts port = @global.port || Boned::Server::DEFAULT_PORT config = @global.rackup || File.join(Dir.pwd, "config.ru") @server_opts ||= { :chdir => Dir.pwd, :environment => @global.environment || 'development', :address => '0.0.0.0', :port => port, :timeout => 30, :log => "log/boned-#{port}.log", :pid => "tmp/pids/boned-#{port}.pid", :max_conns => Thin::Server::DEFAULT_MAXIMUM_CONNECTIONS, :max_persistent_conns => Thin::Server::DEFAULT_MAXIMUM_PERSISTENT_CONNECTIONS, :require => [], :wait => Thin::Controllers::Cluster::DEFAULT_WAIT_TIME, :backend => "Boned::Server", :rackup => config, :daemonize => @global.daemon || false } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
boned-0.2.0 | lib/boned/cli.rb |