Method: Inspec::InspecCLI#version

Defined in:
lib/inspec/cli.rb

#versionObject



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/inspec/cli.rb', line 383

def version
  if config["format"] == "json"
    v = { version: Inspec::VERSION }
    puts v.to_json
  else
    require "inspec/utils/latest_version"
    puts Inspec::VERSION
    # display outdated version
    # TODO: remove this. Don't notify of update to a gem when they install omnibus
    latest = LatestInSpecVersion.new.latest || Inspec::VERSION
    if Gem::Version.new(Inspec::VERSION) < Gem::Version.new(latest)
      puts "\nYour version of #{Inspec::Dist::PRODUCT_NAME} is out of date! The latest version is #{latest}."
    end
  end
end