safer_rails_console 0.4.0 → 0.4.1

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
2
  SHA256:
3
- metadata.gz: 5f61723272246766a45a0702be74e266718e55035ce8ccfa8a1c4eaab6618d28
4
- data.tar.gz: d5d421c94e15b1fb9bfbd8d532d24ed95c9f76c8250e8620257bb95071f5e801
3
+ metadata.gz: aa38df80bc34ac51afa200a586bfefe0795b2dd69057b0ca1bc03c71ac15d133
4
+ data.tar.gz: 2ca8d07ece23d035ac20f7a4efa6506e44a573642336dd63b3918c12cef9ca87
5
5
  SHA512:
6
- metadata.gz: 8da50a1178203391fcc23bdd42f9970aa1ebe140cc5be1f3916a7b71ab1eaef44189d37fcb0cb6345b00960a566d01f907a226fdd4392c649c59840b95029af1
7
- data.tar.gz: 2a97efb1bfba5e451a5cee1cf23bf9a2a6ac8d9898c164f5f58c890bb80acd0dbacb1fdb332f69c7be2eee632f3343f96247bde00ab0057b15e8526a5ad89f0d
6
+ metadata.gz: b2384f5f7e310411ed41d8d9448201fb4d6d408e5c558089848d38e7532d540e6aa3bd81c31f4c6df78cb4e651cba2b1a07bce91a6e26d6b9da60e0133fee76c
7
+ data.tar.gz: '019e4acd21560cf9f6f4f0c88f919aa2319655c3ce96463717e4352ab8d0e52434984e2f57e630b384c11136e0aecf86374417191b1799aee91e2ab8f25827cb'
@@ -1,5 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.4.0](https://github.com/salsify/safer_rails_console/tree/v0.4.0) (2019-09-19)
4
+ [Full Changelog](https://github.com/salsify/safer_rails_console/compare/v0.3.0...v0.4.0)
5
+
6
+ **Closed issues:**
7
+
8
+ - safer\_rails\_console breaks newrelic reporting [\#23](https://github.com/salsify/safer_rails_console/issues/23)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Use Postgres for local development too [\#28](https://github.com/salsify/safer_rails_console/pull/28) ([jturkel](https://github.com/jturkel))
13
+ - Rails 6.0 support [\#26](https://github.com/salsify/safer_rails_console/pull/27) ([jturkel](https://github.com/jturkel))
14
+ - Drop Rails 4.2 support [\#26](https://github.com/salsify/safer_rails_console/pull/26) ([jturkel](https://github.com/jturkel))
15
+
3
16
  ## [v0.3.0](https://github.com/salsify/safer_rails_console/tree/v0.3.0) (2018-04-16)
4
17
  [Full Changelog](https://github.com/salsify/safer_rails_console/compare/v0.2.0...v0.3.0)
5
18
 
@@ -70,4 +83,4 @@
70
83
 
71
84
 
72
85
 
73
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
86
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/README.md CHANGED
@@ -73,6 +73,24 @@ config.safer_rails_console.warn_text = "WARNING: YOU ARE USING RAILS CONSOLE IN
73
73
  'Make sure you know what you\'re doing.'
74
74
  ```
75
75
 
76
+ configuration settings can also be overridden using ENV variables. The following ENV vars can be used:
77
+ ```
78
+ # Set the color prompt to a new color. See colors.rb for a listing of supported colors.
79
+ SAFER_RAILS_CONSOLE_PROMPT_COLOR=red/yellow/green
80
+
81
+ # Set the short name for the rails console prompt
82
+ SAFER_RAILS_CONSOLE_ENVIRONMENT_NAME=short-name
83
+
84
+ # Set the warning text to be displayed when warning for the environments rails consoled is enabled
85
+ SAFER_RAILS_CONSOLE_WARN_TEXT=New warning prompt text
86
+
87
+ # Enable or disable sandboxing of the rails console
88
+ SAFER_RAILS_CONSOLE_SANDBOX_ENVIRONMENT=true/false
89
+
90
+ # Enable or disable warning prompt of the rails console
91
+ SAFER_RAILS_CONSOLE_WARN_ENVIRONMENT=true/false
92
+ ```
93
+
76
94
  ## Development
77
95
 
78
96
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `wwtd` to simulate the entire build matrix (ruby version / rails version) or `appraisal` to test against each supported rails version with your active ruby version. Run `rubocop` to check for style.
@@ -3,23 +3,48 @@ require 'safer_rails_console/railtie'
3
3
  require 'safer_rails_console/colors'
4
4
  require 'safer_rails_console/rails_version'
5
5
  require 'safer_rails_console/console'
6
+ require 'active_model/type'
6
7
 
7
8
  module SaferRailsConsole
8
9
  class << self
9
10
  def environment_name
10
- config.environment_names.key?(::Rails.env.downcase) ? config.environment_names[::Rails.env.downcase] : 'unknown env'
11
+ if ENV.key?('SAFER_RAILS_CONSOLE_ENVIRONMENT_NAME')
12
+ ENV['SAFER_RAILS_CONSOLE_ENVIRONMENT_NAME']
13
+ else
14
+ config.environment_names.key?(::Rails.env.downcase) ? config.environment_names[::Rails.env.downcase] : 'unknown env'
15
+ end
11
16
  end
12
17
 
13
18
  def prompt_color
14
- config.environment_prompt_colors.key?(::Rails.env.downcase) ? config.environment_prompt_colors[::Rails.env.downcase] : SaferRailsConsole::Colors::NONE
19
+ if ENV.key?('SAFER_RAILS_CONSOLE_PROMPT_COLOR')
20
+ SaferRailsConsole::Colors.const_get(ENV['SAFER_RAILS_CONSOLE_PROMPT_COLOR'].upcase)
21
+ else
22
+ config.environment_prompt_colors.key?(::Rails.env.downcase) ? config.environment_prompt_colors[::Rails.env.downcase] : SaferRailsConsole::Colors::NONE
23
+ end
15
24
  end
16
25
 
17
26
  def sandbox_environment?
18
- config.sandbox_environments.include?(::Rails.env.downcase)
27
+ if ENV.key?('SAFER_RAILS_CONSOLE_SANDBOX_ENVIRONMENT')
28
+ ActiveModel::Type::Boolean.new.cast(ENV['SAFER_RAILS_CONSOLE_SANDBOX_ENVIRONMENT'])
29
+ else
30
+ config.sandbox_environments.include?(::Rails.env.downcase)
31
+ end
19
32
  end
20
33
 
21
34
  def warn_environment?
22
- config.warn_environments.include?(::Rails.env.downcase)
35
+ if ENV.key?('SAFER_RAILS_CONSOLE_WARN_ENVIRONMENT')
36
+ ActiveModel::Type::Boolean.new.cast(ENV['SAFER_RAILS_CONSOLE_WARN_ENVIRONMENT'])
37
+ else
38
+ config.warn_environments.include?(::Rails.env.downcase)
39
+ end
40
+ end
41
+
42
+ def warn_text
43
+ if ENV.key?('SAFER_RAILS_CONSOLE_WARN_TEXT')
44
+ ENV['SAFER_RAILS_CONSOLE_WARN_TEXT']
45
+ else
46
+ config.warn_text
47
+ end
23
48
  end
24
49
 
25
50
  def config
@@ -8,7 +8,7 @@ module SaferRailsConsole
8
8
  end
9
9
 
10
10
  def print_warning
11
- puts color_text(SaferRailsConsole.config.warn_text, SaferRailsConsole.prompt_color) # rubocop:disable Rails/Output
11
+ puts color_text(SaferRailsConsole.warn_text, SaferRailsConsole.prompt_color) # rubocop:disable Rails/Output
12
12
  end
13
13
 
14
14
  def load_config
@@ -1,3 +1,3 @@
1
1
  module SaferRailsConsole
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.4.1'.freeze
3
3
  end
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_development_dependency 'appraisal', '~> 2.2'
34
34
  spec.add_development_dependency 'bundler', '~> 2.0'
35
+ spec.add_development_dependency 'climate_control', '~> 0.2.0'
35
36
  spec.add_development_dependency 'mixlib-shellout', '~> 2.2'
36
37
  spec.add_development_dependency 'overcommit', '~> 0.39.0'
37
38
  spec.add_development_dependency 'pg', '~> 1.1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safer_rails_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-19 00:00:00.000000000 Z
11
+ date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: climate_control
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.2.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: mixlib-shellout
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -202,7 +216,7 @@ licenses:
202
216
  - MIT
203
217
  metadata:
204
218
  allowed_push_host: https://rubygems.org
205
- post_install_message:
219
+ post_install_message:
206
220
  rdoc_options: []
207
221
  require_paths:
208
222
  - lib
@@ -217,8 +231,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
231
  - !ruby/object:Gem::Version
218
232
  version: '0'
219
233
  requirements: []
220
- rubygems_version: 3.0.3
221
- signing_key:
234
+ rubygems_version: 3.1.2
235
+ signing_key:
222
236
  specification_version: 4
223
237
  summary: Make rails console less dangerous!
224
238
  test_files: []