mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
Bump lockfile version to 1.0
Signed-off-by: Steven Danna <steve@chef.io>
This commit is contained in:
parent
3072c4c91d
commit
f23a0d1098
2 changed files with 9 additions and 17 deletions
|
@ -4,8 +4,8 @@ require 'yaml'
|
||||||
module Inspec
|
module Inspec
|
||||||
class Lockfile
|
class Lockfile
|
||||||
# When we finalize this feature, we should set these to 1
|
# When we finalize this feature, we should set these to 1
|
||||||
MINIMUM_SUPPORTED_VERSION = 0
|
MINIMUM_SUPPORTED_VERSION = 1
|
||||||
CURRENT_LOCKFILE_VERSION = 0
|
CURRENT_LOCKFILE_VERSION = 1
|
||||||
|
|
||||||
def self.from_dependency_set(dep_set)
|
def self.from_dependency_set(dep_set)
|
||||||
lockfile_content = {
|
lockfile_content = {
|
||||||
|
@ -32,14 +32,6 @@ lower than the minimum supported version #{MINIMUM_SUPPORTED_VERSION}.
|
||||||
Please create a new lockfile for this project by running:
|
Please create a new lockfile for this project by running:
|
||||||
|
|
||||||
inspec vendor
|
inspec vendor
|
||||||
EOF
|
|
||||||
elsif version == 0
|
|
||||||
# Remove this case once this feature stablizes
|
|
||||||
$stderr.puts <<EOF
|
|
||||||
WARNING: This is a version 0 lockfile. Thank you for trying the
|
|
||||||
experimental dependency management feature. Please be aware you may
|
|
||||||
need to regenerate this lockfile in future versions as the feature is
|
|
||||||
currently in development.
|
|
||||||
EOF
|
EOF
|
||||||
elsif version > CURRENT_LOCKFILE_VERSION
|
elsif version > CURRENT_LOCKFILE_VERSION
|
||||||
fail <<EOF
|
fail <<EOF
|
||||||
|
@ -78,8 +70,8 @@ EOF
|
||||||
# different entry points of the API.
|
# different entry points of the API.
|
||||||
def parse_content_hash(lockfile_content_hash)
|
def parse_content_hash(lockfile_content_hash)
|
||||||
case version
|
case version
|
||||||
when 0
|
when 1
|
||||||
parse_content_hash_0(lockfile_content_hash)
|
parse_content_hash_1(lockfile_content_hash)
|
||||||
else
|
else
|
||||||
# If we've gotten here, there is likely a mistake in the
|
# If we've gotten here, there is likely a mistake in the
|
||||||
# lockfile version validation in the constructor.
|
# lockfile version validation in the constructor.
|
||||||
|
@ -87,7 +79,7 @@ EOF
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_content_hash_0(lockfile_content_hash)
|
def parse_content_hash_1(lockfile_content_hash)
|
||||||
@deps = if lockfile_content_hash['depends']
|
@deps = if lockfile_content_hash['depends']
|
||||||
lockfile_content_hash['depends'].map { |i| symbolize_keys(i) }
|
lockfile_content_hash['depends'].map { |i| symbolize_keys(i) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe Inspec::Lockfile do
|
||||||
let(:lockfile_content) {
|
let(:lockfile_content) {
|
||||||
<<EOF
|
<<EOF
|
||||||
---
|
---
|
||||||
lockfile_version: 0
|
lockfile_version: 1
|
||||||
depends:
|
depends:
|
||||||
- name: foo
|
- name: foo
|
||||||
resolved_source:
|
resolved_source:
|
||||||
|
@ -23,7 +23,7 @@ EOF
|
||||||
let(:lockfile_content) {
|
let(:lockfile_content) {
|
||||||
<<EOF
|
<<EOF
|
||||||
---
|
---
|
||||||
lockfile_version: 0
|
lockfile_version: 1
|
||||||
depends:
|
depends:
|
||||||
- name: foo
|
- name: foo
|
||||||
resolved_source:
|
resolved_source:
|
||||||
|
@ -39,7 +39,7 @@ EOF
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:lockfile_hash) {
|
let(:lockfile_hash) {
|
||||||
{ 'lockfile_version' => 0,
|
{ 'lockfile_version' => 1,
|
||||||
'depends' => [
|
'depends' => [
|
||||||
{ 'name' => "foo", 'resolved_source' => {'url' => "http://foo"}, 'version_constraints' => ">= 0",
|
{ 'name' => "foo", 'resolved_source' => {'url' => "http://foo"}, 'version_constraints' => ">= 0",
|
||||||
'dependencies' => [{ 'name' => 'bar', 'resolved_source' => {'url' => 'http://bar' }, 'version_constraints' => ">= 0"}]
|
'dependencies' => [{ 'name' => 'bar', 'resolved_source' => {'url' => 'http://bar' }, 'version_constraints' => ">= 0"}]
|
||||||
|
@ -47,7 +47,7 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:lockfile_hash_with_symbols) {
|
let(:lockfile_hash_with_symbols) {
|
||||||
{ 'lockfile_version' => 0,
|
{ 'lockfile_version' => 1,
|
||||||
'depends' => [
|
'depends' => [
|
||||||
{ name: "foo", resolved_source: {url: "http://foo"}, version_constraints: ">= 0",
|
{ name: "foo", resolved_source: {url: "http://foo"}, version_constraints: ">= 0",
|
||||||
dependencies: [{ name: 'bar', resolved_source: {url: 'http://bar' }, version_constraints: ">= 0"}]
|
dependencies: [{ name: 'bar', resolved_source: {url: 'http://bar' }, version_constraints: ">= 0"}]
|
||||||
|
|
Loading…
Reference in a new issue