lib/contrast/utils/middleware_utils.rb in contrast-agent-5.3.0 vs lib/contrast/utils/middleware_utils.rb in contrast-agent-6.0.0

- old
+ new

@@ -6,10 +6,17 @@ # helper methods for Contrast::Agent::Middleware # including disclaimers, deprecation notices, error handling, setup module MiddlewareUtils private + # TODO: RUBY-1609 update this part of the method for Ruby Version and Year + LANGUAGE_DEPRECATION_VERSION = '2.7' + LANGUAGE_DEPRECATION_YEAR = '2023' + LANGUAGE_DEPRECATION_WARNING = + "[Contrast Security] [DEPRECATION] Support for Ruby #{ LANGUAGE_DEPRECATION_VERSION } will be removed in "\ + "April #{ LANGUAGE_DEPRECATION_YEAR }. Please contact Customer Support prior if you require continued support." + def setup_agent ::Contrast::SETTINGS.reset_state inform_deprecations telemetry_disclaimer @@ -49,17 +56,11 @@ # As we deprecate support to prepare to remove dead code, we need to inform our users still relying on the now # deprecated and soon to be removed functionality. This method handles doing that by leveraging the standard # Kernel#warn approach def inform_deprecations - # Ruby 2.6 will be dropped in april of 2022. We'll begin the deprecation warnings - # now so that customers have time to reach out if they'll be impacted. - # TODO: RUBY-1188 remove this part of the method, leaving it empty if there are no other deprecations, when we - # drop 2.6 support. - return unless RUBY_VERSION < '2.7.0' - - Kernel.warn('[Contrast Security] [DEPRECATION] Support for Ruby 2.6 will be removed in April 2022. '\ - 'Please contact Customer Support prior if you require continued support.') + # Warn customers that they're on a version that's losing support in the next year. + Kernel.warn(LANGUAGE_DEPRECATION_WARNING) if RUBY_VERSION.start_with?(LANGUAGE_DEPRECATION_VERSION) end # Displays Telemetry disclaimer if Telemetry is enabled. # if .telemetry file doesn't exist we create one and then show the disclaimer. # if the file already exists we do nothing.