Skip to content

Commit 2af2b22

Browse files
authored
Merge pull request rails#50855 from Shopify/update-console-prompt-color
Display dev & test env in console prompt in blue instead of green
2 parents 80bce4a + 7cbf06c commit 2af2b22

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

railties/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
For example, `MyApp` will displayed as `my-app` in the prompt.
1212
1313
Additionally, the environment name will be colorized when the environment is
14-
`development` (green), `test` (green), or `production` (red), if your
14+
`development` (blue), `test` (blue), or `production` (red), if your
1515
terminal supports it.
1616
1717
*Stan Lo*

railties/lib/rails/commands/console/console_command.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ def start
5353
def colorized_env
5454
case Rails.env
5555
when "development"
56-
IRB::Color.colorize("dev", [:GREEN])
56+
IRB::Color.colorize("dev", [:BLUE])
5757
when "test"
58-
IRB::Color.colorize("test", [:GREEN])
58+
IRB::Color.colorize("test", [:BLUE])
5959
when "production"
6060
IRB::Color.colorize("prod", [:RED])
6161
else

railties/test/commands/console_test.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,17 @@ def test_console_defaults_to_IRB
5959
end
6060

6161
def test_prompt_env_colorization
62-
irb_console = Rails::Console::IRBConsole.new(app)
62+
app = build_app(nil)
63+
irb_console = Rails::Console.new(app).console
6364
red = "\e[31m"
64-
green = "\e[32m"
65+
blue = "\e[34m"
6566
clear = "\e[0m"
6667

6768
Rails.env = "development"
68-
assert_equal("#{green}dev#{clear}", irb_console.colorized_env)
69+
assert_equal("#{blue}dev#{clear}", irb_console.colorized_env)
6970

7071
Rails.env = "test"
71-
assert_equal("#{green}test#{clear}", irb_console.colorized_env)
72+
assert_equal("#{blue}test#{clear}", irb_console.colorized_env)
7273

7374
Rails.env = "production"
7475
assert_equal("#{red}prod#{clear}", irb_console.colorized_env)

0 commit comments

Comments
 (0)