Class: RubyDep::Warning
- Inherits:
-
Object
- Object
- RubyDep::Warning
- Defined in:
- lib/ruby_dep/warning.rb
Constant Summary collapse
- DISABLING_ENVIRONMENT_VAR =
'RUBY_DEP_GEM_SILENCE_WARNINGS'.freeze
- PREFIX =
'RubyDep: WARNING: '.freeze
- WARNING =
{ insecure: 'Your Ruby has security vulnerabilities!'.freeze, buggy: 'Your Ruby is outdated/buggy.'.freeze, untracked: 'Your Ruby may not be supported.'.freeze }.freeze
- NOTICE_RECOMMENDATION =
'Your Ruby is: %s (%s).'\ ' Recommendation: upgrade to %s.'.freeze
- NOTICE_BUGGY_ALTERNATIVE =
'(Or, at least to %s)'.freeze
- NOTICE_HOW_TO_DISABLE =
'(To disable warnings, see:'\ "#{PROJECT_URL}/wiki/Disabling-warnings )".freeze
- NOTICE_OPEN_ISSUE =
'If you need this version supported,'\ " please open an issue at #{PROJECT_URL}".freeze
Instance Method Summary collapse
-
#initialize ⇒ Warning
constructor
A new instance of Warning.
- #show_warnings ⇒ Object
- #silence! ⇒ Object
Constructor Details
#initialize ⇒ Warning
Returns a new instance of Warning.
28 29 30 |
# File 'lib/ruby_dep/warning.rb', line 28 def initialize @version = RubyVersion.new(RUBY_VERSION, RUBY_ENGINE) end |
Instance Method Details
#show_warnings ⇒ Object
32 33 34 35 36 37 |
# File 'lib/ruby_dep/warning.rb', line 32 def show_warnings return if silenced? return warn_ruby(WARNING[status]) if WARNING.key?(status) return if status == :unknown raise "Unknown problem type: #{problem.inspect}" end |
#silence! ⇒ Object
39 40 41 |
# File 'lib/ruby_dep/warning.rb', line 39 def silence! ENV[DISABLING_ENVIRONMENT_VAR] = '1' end |