From 0da45ed096df221fbc571dd527f5dbe14d135fd4 Mon Sep 17 00:00:00 2001 From: Petrik Date: Sat, 13 Feb 2021 17:34:58 +0100 Subject: [PATCH] Trim new lines in USAGE ERB tags The USAGE file uses ERB tags for conditionals. The ERB tags should not output new lines. Adding the trim_mode option removes the new lines. --- railties/lib/rails/command/base.rb | 2 +- railties/lib/rails/commands/help/USAGE | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/command/base.rb b/railties/lib/rails/command/base.rb index 0577f51647..8b1874ae80 100644 --- a/railties/lib/rails/command/base.rb +++ b/railties/lib/rails/command/base.rb @@ -32,7 +32,7 @@ module Rails if usage super else - @desc ||= ERB.new(File.read(usage_path)).result(binding) if usage_path + @desc ||= ERB.new(File.read(usage_path), trim_mode: "-").result(binding) if usage_path end end diff --git a/railties/lib/rails/commands/help/USAGE b/railties/lib/rails/commands/help/USAGE index 8eb98319d2..fd3cb47529 100644 --- a/railties/lib/rails/commands/help/USAGE +++ b/railties/lib/rails/commands/help/USAGE @@ -6,10 +6,10 @@ The most common rails commands are: test:system Run system tests dbconsole Start a console for the database specified in config/database.yml (short-cut alias: "db") -<% unless engine? %> +<% unless engine? -%> new Create a new Rails application. "rails new my_app" creates a new application called MyApp in "./my_app" -<% end %> +<% end -%> All commands can be run with -h (or --help) for more information. In addition to those commands, there are: