Class: Legion::CLI::Doctor::RubyVersionCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/cli/doctor/ruby_version_check.rb

Constant Summary collapse

MINIMUM_VERSION =
'3.4'

Instance Method Summary collapse

Instance Method Details

#nameObject



9
10
11
# File 'lib/legion/cli/doctor/ruby_version_check.rb', line 9

def name
  'Ruby version'
end

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/legion/cli/doctor/ruby_version_check.rb', line 13

def run
  current = RUBY_VERSION
  if Gem::Version.new(current) >= Gem::Version.new(MINIMUM_VERSION)
    Result.new(name: name, status: :pass, message: "Ruby #{current}")
  else
    Result.new(
      name:         name,
      status:       :fail,
      message:      "Ruby #{current} is below minimum #{MINIMUM_VERSION}",
      prescription: "Upgrade Ruby to >= #{MINIMUM_VERSION} (current: #{current})"
    )
  end
end