Skip to content

Commit

Permalink
Removed lib/inspec/utils/latest_version.rb and associated code.
Browse files Browse the repository at this point in the history
There is no reason why our tests should be failing because we deploy a
new version. That test shouldn't even be hitting the network for real.

Besides, the functionality has no place in our codebase. It's
functionality provided via `gem outdated` so why did we re-implement
it? And we expect most people to be running via omnibus, so they're
pinned to a specific version in the first place. Even if they updated,
they still couldn't run it and that would be more confusing.

Signed-off-by: Ryan Davis <zenspider@chef.io>
  • Loading branch information
zenspider committed Jul 29, 2019
1 parent 6e30779 commit 3d6a414
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 24 deletions.
7 changes: 0 additions & 7 deletions lib/inspec/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,7 @@ def version
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
map %w{-v --version} => :version
Expand Down
13 changes: 0 additions & 13 deletions lib/inspec/utils/latest_version.rb

This file was deleted.

5 changes: 1 addition & 4 deletions test/functional/inspec_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
it "provides the version number on stdout" do
out = inspec("version")

# Tolerate working on an out of date branch
output = out.stdout.split("\n").reject { |l| l.start_with?("Your version of InSpec is out of date!") }.join("\n") + "\n"
output.must_equal Inspec::VERSION + "\n"

out.stdout.must_equal Inspec::VERSION + "\n"
out.stderr.must_equal ""

assert_exit_code 0, out
Expand Down

0 comments on commit 3d6a414

Please sign in to comment.