console_color 0.0.1 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YWYxYWZkMTcwMTk3OTU1NTVkMjRkMWQ2OTA3ZGQ1MWZkNDNlMjQxOQ==
5
- data.tar.gz: !binary |-
6
- ODJjMTdhZWM0YWVhZWFkYWUyZmMwNGQyNDI2ZmNhYjc1YTA5NGJjNg==
2
+ SHA256:
3
+ metadata.gz: 918b40a729feb55c2684d4de01064ffa9b107e7ee7dab10b49d1478521a7513e
4
+ data.tar.gz: 69664ed3d49efe9f91568d7f00f56c9230391004c04dc457cda3374014f37167
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- OTNlOTI0MDVkYjg0MzcxMmM0MWQ4YWVmZGI3MjM2ZmRlOWRlN2RiYTViMzE2
10
- MWJiYTlhMDk2OWM5M2Y3MDA4ZDc0NDM2NDhlNDU3Y2JmOGM5OGFkNTAyYzE3
11
- NDc3OWUyN2ZkOTgxOWE4NDQ2YjI1Mzk5ZTI3YjE4OTAwM2NlYjM=
12
- data.tar.gz: !binary |-
13
- MjM2NTM0ZDhlN2ZlMDQwMDkyNGI5OWRhNDNiNzUzMDk0NmQyNTQ0MDZlNzM2
14
- YjE2YjA5YTgyYWFkZTBmNTU1Y2U1ZThlMGJkOTBjYTgwNTE0M2EzYWVkNmZj
15
- NjBlNjQwYzA1Yjg3OTU3ZWE3MGQ2MzY0NmY2ODg0NGVmNzQzYjE=
6
+ metadata.gz: 35a0b0c3d3879b4b64e51a459822dc3284a837783fcda1a9587bd3c413680b317ccc391846267c6b4f798a544d0c0417e899d61abd894c1b0c9d616a808a1ade
7
+ data.tar.gz: 1f33661fa923a828a180615d69ca12111a36d57d1612caf7affbf6d9702333bcd4c075408665b56a7c80cddbc280513e430dbf6e9326ee92cc82630170556c79
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Joey Aghion, Artsy
1
+ Copyright (c) 2013 Joey Aghion
2
2
 
3
3
  MIT License
4
4
 
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
 
@@ -37,6 +49,6 @@ Or install it yourself as:
37
49
  5. Create new Pull Request
38
50
 
39
51
 
40
- © Joey Aghion, Artsy
52
+ © Joey Aghion
41
53
 
42
54
  [LICENSE](LICENSE.txt)
@@ -1,28 +1,36 @@
1
1
  module ConsoleColor
2
2
  class Railtie < Rails::Railtie
3
+ module IRBSetup
4
+ def setup(*)
5
+ super
3
6
 
4
- config.after_initialize do
5
-
6
- class << IRB
7
-
8
- def setup_with_custom_prompt(ap_path)
9
- setup_without_custom_prompt(ap_path)
10
- prompt = "#{ConsoleColor::COLORS[Rails.env]}#{Rails.application.class.parent_name.downcase}:#{Rails.env}"
11
- IRB.conf[:PROMPT][:RAILS_APP] = {
12
- PROMPT_I: "\001#{prompt}> \e[0m\002",
13
- PROMPT_N: "\001#{prompt}> \e[0m\002",
14
- PROMPT_S: "\001#{prompt}%l \e[0m\002",
15
- PROMPT_C: "\001#{prompt}* \e[0m\002",
16
- RETURN: "=> %s\n"
17
- }
18
- IRB.conf[:PROMPT_MODE] = :RAILS_APP
7
+ app_name = if Rails.application.class.respond_to?(:module_parent_name)
8
+ Rails.application.class.module_parent_name
9
+ else
10
+ Rails.application.class.parent_name
19
11
  end
12
+ environment = ENV.fetch('CONSOLE_COLOR_ENV', Rails.env)
13
+ color = ConsoleColor::COLORS[environment]
20
14
 
21
- alias_method_chain :setup, :custom_prompt
15
+ prompt = "\001#{color}\002#{app_name.downcase}:#{environment}"
22
16
 
23
- end
17
+ IRB.conf[:PROMPT][:RAILS_APP] = {
18
+ PROMPT_I: "#{prompt}>\e[0m ",
19
+ PROMPT_N: "#{prompt}>\e[0m ",
20
+ PROMPT_S: "#{prompt}%l\e[0m ",
21
+ PROMPT_C: "#{prompt}*\e[0m ",
22
+ RETURN: "=> %s\n",
23
+ AUTO_INDENT: true
24
+ }
24
25
 
26
+ IRB.conf[:PROMPT_MODE] = :RAILS_APP
27
+ end
25
28
  end
26
29
 
30
+ config.after_initialize do
31
+ class << IRB
32
+ prepend IRBSetup
33
+ end
34
+ end
27
35
  end
28
36
  end
@@ -1,3 +1,3 @@
1
1
  module ConsoleColor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console_color
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joey Aghion
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-22 00:00:00.000000000 Z
11
+ date: 2021-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Add color-coded app and environment information to the Rails console
@@ -46,7 +46,7 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - .gitignore
49
+ - ".gitignore"
50
50
  - Gemfile
51
51
  - LICENSE.txt
52
52
  - README.md
@@ -59,24 +59,24 @@ homepage: https://github.com/joeyAghion/console_color
59
59
  licenses:
60
60
  - MIT
61
61
  metadata: {}
62
- post_install_message:
62
+ post_install_message:
63
63
  rdoc_options: []
64
64
  require_paths:
65
65
  - lib
66
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ! '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubyforge_project:
78
- rubygems_version: 2.1.11
79
- signing_key:
77
+ rubyforge_project:
78
+ rubygems_version: 2.7.6
79
+ signing_key:
80
80
  specification_version: 4
81
81
  summary: Add color-coded app and environment information to the Rails console prompt.
82
82
  test_files: []