Class: LatestInSpecVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/utils/latest_version.rb

Instance Method Summary collapse

Instance Method Details

#latestObject

fetches the latest version from rubygems server



6
7
8
9
10
11
12
# File 'lib/inspec/utils/latest_version.rb', line 6

def latest
  uri = URI("https://rubygems.org/api/v1/gems/inspec.json")
  inspec_info = JSON.parse(uri.read(open_timeout: 1.5, read_timeout: 1.5))
  inspec_info["version"]
rescue StandardError
  nil
end