Method: Inspec::Lockfile.validate_lockfile_version!

Defined in:
lib/inspec/dependencies/lockfile.rb

.validate_lockfile_version!(version) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/inspec/dependencies/lockfile.rb', line 31

def self.validate_lockfile_version!(version)
  if version < MINIMUM_SUPPORTED_VERSION
    raise <<~EOF
      This lockfile specifies a lockfile_version of #{version} which is
      lower than the minimum supported version #{MINIMUM_SUPPORTED_VERSION}.

      Please create a new lockfile for this project by running:

          inspec vendor
    EOF
  elsif version > CURRENT_LOCKFILE_VERSION
    raise <<~EOF
      This lockfile claims to be version #{version} which is greater than
      the most recent lockfile version(#{CURRENT_LOCKFILE_VERSION}).

      This may happen if you are using an older version of inspec than was
      used to create the lockfile.
    EOF
  end
end