Class: Rails::Command::ServerCommand

Inherits:
Base
  • Object
show all
Defined in:
lib/rails/commands/server/server_command.rb

Overview

:nodoc:

Constant Summary collapse

DEFAULT_PID_PATH =
"tmp/pids/server.pid".freeze

Instance Method Summary collapse

Methods inherited from Base

base_name, command_name, default_command_root, desc, engine?, executable, #help, hide_command!, inherited, namespace, perform, printing_commands, usage_path

Methods included from Actions

#load_generators, #load_tasks, #require_application_and_environment!, #set_application_directory!

Constructor Details

#initialize(args = [], local_options = {}, config = {}) ⇒ ServerCommand

Returns a new instance of ServerCommand.



116
117
118
119
120
121
# File 'lib/rails/commands/server/server_command.rb', line 116

def initialize(args = [], local_options = {}, config = {})
  @original_options = local_options
  super
  @server = self.args.shift
  @log_stdout = options[:daemon].blank? && (options[:environment] || Rails.env) == "development"
end

Instance Method Details

#performObject



123
124
125
126
127
128
129
130
131
132
# File 'lib/rails/commands/server/server_command.rb', line 123

def perform
  set_application_directory!
  Rails::Server.new(server_options).tap do |server|
    # Require application after server sets environment to propagate
    # the --environment option.
    require APP_PATH
    Dir.chdir(Rails.application.root)
    server.start
  end
end