class GhostAdapter::VersionChecker

Constants

ALLOWED_RANGE

Public Class Methods

validate_executable!() click to toggle source
# File lib/ghost_adapter/version_checker.rb, line 18
def validate_executable!
  found_version = fetch_version
  raise IncompatibleVersion, found_version unless ALLOWED_RANGE.satisfied_by? found_version
end

Private Class Methods

fetch_version() click to toggle source
# File lib/ghost_adapter/version_checker.rb, line 25
def fetch_version
  stdout, status = Open3.capture2('gh-ost', '--version')
  raise IncompatibleVersion unless status.success?

  begin
    Gem::Version.new(stdout)
  rescue ArgumentError
    raise IncompatibleVersion
  end
end