console_color 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7111e3241567cdacafe00d296e0d9ba72e0310ca
4
- data.tar.gz: df1bf954067cb81680e92850aedbe439e85c135e
2
+ SHA256:
3
+ metadata.gz: 67b46341612448addb41c0766a10c5fba7b7cfdaace2c724e73c0bbba21b79c7
4
+ data.tar.gz: 2433e44b60a0620fbc186085490eaa4a8d8d26b86405462c157c55a7719650b9
5
5
  SHA512:
6
- metadata.gz: eca31a58f7e2c2b62e475b4b2fd91b806f964f87fc70c99e551defbe09bcac16c8fbee79a34a263b3ee8b2ec08e23292642ad8d8741b0541685bc2ea47342557
7
- data.tar.gz: 2aeae2fa559d19610af34c91a9d60d7f47e8cd268918e400626ae0fa0c89956dc98c5bf6cd69c260f7c999810a9c21b099aeb6ce8072e97ed57c0bb4339a308e
6
+ metadata.gz: b6d1e13886fbe4d760e46d44dfbc2c729abfc5564ff6b926ef4edce11f9a94e7c99566319650a35e5e452ea037ee12e29a32ca054c11e55f6a899c6c86179756
7
+ data.tar.gz: fe7934b8ec59c47e0915bf8f772d319e24c5ae7a286eaa66f9ef6c5a844d90f7e067761a85072663da2b07e78170e22cef71cede1fff13c4b1548e1ed41935af
data/README.md CHANGED
@@ -12,6 +12,18 @@ By default, the prompt is green in development, red in production, and yellow el
12
12
 
13
13
  ConsoleColor::COLORS['production'] = "\e[35m" # pink
14
14
 
15
+ Note that one can set the `CONSOLE_COLOR_ENV` var to override the Rails
16
+ environment:
17
+
18
+ ```
19
+ $ CONSOLE_COLOR_ENV=staging RAILS_ENV=production rails console
20
+ app_name:staging>Rails.env
21
+ => "production"
22
+ ```
23
+
24
+ This way you can set your staging Rails env to production to mimic that
25
+ configuration but have your prompt reflect that you're using on the staging
26
+ server.
15
27
 
16
28
  ## Installation
17
29
 
@@ -4,7 +4,12 @@ module ConsoleColor
4
4
  def setup(*)
5
5
  super
6
6
 
7
- prompt = "\001#{ConsoleColor::COLORS[Rails.env]}\002#{Rails.application.class.parent_name.downcase}:#{Rails.env}"
7
+ app_name = Rails.application.class.parent_name.downcase
8
+ environment = ENV.fetch('CONSOLE_COLOR_ENV', Rails.env)
9
+ color = ConsoleColor::COLORS[environment]
10
+
11
+ prompt = "\001#{color}\002#{app_name}:#{environment}"
12
+
8
13
  IRB.conf[:PROMPT][:RAILS_APP] = {
9
14
  PROMPT_I: "#{prompt}>\e[0m ",
10
15
  PROMPT_N: "#{prompt}>\e[0m ",
@@ -13,6 +18,7 @@ module ConsoleColor
13
18
  RETURN: "=> %s\n",
14
19
  AUTO_INDENT: true
15
20
  }
21
+
16
22
  IRB.conf[:PROMPT_MODE] = :RAILS_APP
17
23
  end
18
24
  end
@@ -1,3 +1,3 @@
1
1
  module ConsoleColor
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console_color
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joey Aghion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2020-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.6.11
78
+ rubygems_version: 2.7.6
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Add color-coded app and environment information to the Rails console prompt.