class Quails::Server
Public Class Methods
new(options = nil)
click to toggle source
Calls superclass method
# File railties/lib/rails/commands/server/server_command.rb, line 19 def initialize(options = nil) @default_options = options || {} super(@default_options) set_environment end
Public Instance Methods
app()
click to toggle source
Calls superclass method
# File railties/lib/rails/commands/server/server_command.rb, line 25 def app @app ||= begin app = super if app.is_a?(Class) ActiveSupport::Deprecation.warn(<<-MSG.squish) Use `Quails::Application` subclass to start the server is deprecated and will be removed in Quails 6.0. Please change `run #{app}` to `run Quails.application` in config.ru. MSG end app.respond_to?(:to_app) ? app.to_app : app end end
default_options()
click to toggle source
Calls superclass method
# File railties/lib/rails/commands/server/server_command.rb, line 64 def default_options super.merge(@default_options) end
middleware()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 60 def middleware Hash.new([]) end
opt_parser()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 38 def opt_parser Options.new end
set_environment()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 42 def set_environment ENV["RAILS_ENV"] ||= options[:environment] end
start()
click to toggle source
Calls superclass method
# File railties/lib/rails/commands/server/server_command.rb, line 46 def start print_boot_information trap(:INT) { exit } create_tmp_directories setup_dev_caching log_to_stdout if options[:log_stdout] super ensure # The '-h' option calls exit before @options is set. # If we call 'options' with it unset, we get double help banners. puts "Exiting" unless @options && options[:daemonize] end
Private Instance Methods
create_tmp_directories()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 82 def create_tmp_directories %w(cache pids sockets).each do |dir_to_make| FileUtils.mkdir_p(File.join(Quails.root, "tmp", dir_to_make)) end end
log_to_stdout()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 88 def log_to_stdout wrapped_app # touch the app so the logger is set up console = ActiveSupport::Logger.new(STDOUT) console.formatter = Quails.logger.formatter console.level = Quails.logger.level unless ActiveSupport::Logger.logger_outputs_to?(Quails.logger, STDOUT) Quails.logger.extend(ActiveSupport::Logger.broadcast(console)) end end
print_boot_information()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 75 def print_boot_information url = "on #{options[:SSLEnable] ? 'https' : 'http'}://#{options[:Host]}:#{options[:Port]}" unless use_puma? puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}" puts "=> Quails #{Quails.version} application starting in #{Quails.env} #{url}" puts "=> Run `quails server -h` for more startup options" end
restart_command()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 100 def restart_command "bin/quails server #{ARGV.join(' ')}" end
setup_dev_caching()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 69 def setup_dev_caching if options[:environment] == "development" Quails::DevCaching.enable_by_argument(options[:caching]) end end
use_puma?()
click to toggle source
# File railties/lib/rails/commands/server/server_command.rb, line 104 def use_puma? server.to_s == "Rack::Handler::Puma" end