module Signet::VERSION

Constants

MAJOR
MINOR
PRE

Minimum “recommended” Ruby version (normal maintenance) @private

STRING
SUPPORTED_VERSION_THRESHOLD

On March 31, 2019, set supported version to 2.4 and recommended to 2.6. Thereafter, follow the MRI support schedule: supported means non-EOL, and recommended means in normal (rather than security) maintenance. See www.ruby-lang.org/en/downloads/branches/

Minimum “supported” Ruby version (non-EOL) @private

TINY

Public Class Methods

warn_nonrecommended_ruby(cur_version, recommended_version) click to toggle source

Print a warning for a supported but nearing EOL version of Ruby @private

# File lib/signet/version.rb, line 76
def self.warn_nonrecommended_ruby cur_version, recommended_version
  "WARNING: You are running Ruby #{cur_version}, which is nearing" \
    " end-of-life.\n" \
    'Signet works best on supported versions of' \
    " Ruby. Consider upgrading to Ruby #{recommended_version} or later.\n" \
    'See https://www.ruby-lang.org/en/downloads/branches/ for more' \
    " info on the Ruby maintenance schedule.\n" \
    'To suppress this message, set the' \
    ' GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable.'
end
warn_on_old_ruby_version() click to toggle source

Check Ruby version and emit a warning if it is old @private

# File lib/signet/version.rb, line 44
def self.warn_on_old_ruby_version
  return if ENV['GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS']
  cur_version = Gem::Version.new RUBY_VERSION
  if cur_version < Gem::Version.new(SUPPORTED_VERSION_THRESHOLD)
    warn_unsupported_ruby cur_version, RECOMMENDED_VERSION_THRESHOLD
  elsif cur_version < Gem::Version.new(RECOMMENDED_VERSION_THRESHOLD)
    warn_nonrecommended_ruby cur_version, RECOMMENDED_VERSION_THRESHOLD
  end
rescue ArgumentError
  'Unable to determine current Ruby version.'
end
warn_unsupported_ruby(cur_version, recommended_version) click to toggle source

Print a warning for an EOL version of Ruby @private

# File lib/signet/version.rb, line 60
def self.warn_unsupported_ruby cur_version, recommended_version
  "WARNING: You are running Ruby #{cur_version}, which has reached" \
    " end-of-life and is no longer supported by Ruby Core.\n" \
    'Signet works best on supported versions of' \
    ' Ruby. It is strongly recommended that you upgrade to Ruby' \
    " #{recommended_version} or later. \n" \
    'See https://www.ruby-lang.org/en/downloads/branches/ for more' \
    " info on the Ruby maintenance schedule.\n" \
    'To suppress this message, set the' \
    ' GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable.'
end