aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/commands
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2017-08-20 21:40:20 -0400
committerGitHub <noreply@github.com>2017-08-20 21:40:20 -0400
commitb2ad4e1e2c4cac8003ba2a5292c1f57bbfd2a40f (patch)
treec25515afd60a43a3be9ab0f9e56b5ae1481f0563 /railties/lib/rails/commands
parent79a046f4652e155ab4c1a3b2e778e8283043820b (diff)
parent2904ee23bfc1a442b801f0d35e8e49d51a6d47b6 (diff)
downloadrails-b2ad4e1e2c4cac8003ba2a5292c1f57bbfd2a40f.tar.gz
rails-b2ad4e1e2c4cac8003ba2a5292c1f57bbfd2a40f.tar.bz2
rails-b2ad4e1e2c4cac8003ba2a5292c1f57bbfd2a40f.zip
Merge pull request #30332 from y-yagi/fix_29306
Make `restart` and `dev:cache` tasks work when customizing pid file path
Diffstat (limited to 'railties/lib/rails/commands')
-rw-r--r--railties/lib/rails/commands/server/server_command.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/railties/lib/rails/commands/server/server_command.rb b/railties/lib/rails/commands/server/server_command.rb
index 88e5698714..785265d766 100644
--- a/railties/lib/rails/commands/server/server_command.rb
+++ b/railties/lib/rails/commands/server/server_command.rb
@@ -126,6 +126,7 @@ module Rails
desc: "Specifies the PID file."
class_option "dev-caching", aliases: "-C", type: :boolean, default: nil,
desc: "Specifies whether to perform caching in development."
+ class_option "restart", type: :boolean, default: nil, hide: true
def initialize(args = [], local_options = {}, config = {})
@original_options = local_options
@@ -136,6 +137,7 @@ module Rails
def perform
set_application_directory!
+ prepare_restart
Rails::Server.new(server_options).tap do |server|
# Require application after server sets environment to propagate
# the --environment option.
@@ -222,7 +224,7 @@ module Rails
end
def restart_command
- "bin/rails server #{@server} #{@original_options.join(" ")}"
+ "bin/rails server #{@server} #{@original_options.join(" ")} --restart"
end
def pid
@@ -232,6 +234,10 @@ module Rails
def self.banner(*)
"rails server [puma, thin etc] [options]"
end
+
+ def prepare_restart
+ FileUtils.rm_f(options[:pid]) if options[:restart]
+ end
end
end
end