mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
Merge pull request #1351 from jaxxstorm/archive_versioning
Add profile version to archive
This commit is contained in:
commit
d9186f30f2
3 changed files with 7 additions and 4 deletions
|
@ -399,9 +399,12 @@ module Inspec
|
|||
name = params[:name] ||
|
||||
fail('Cannot create an archive without a profile name! Please '\
|
||||
'specify the name in metadata or use --output to create the archive.')
|
||||
version = params[:version] ||
|
||||
fail('Cannot create an archive without a profile version! Please '\
|
||||
'specify the version in metadata or use --output to create the archive.')
|
||||
ext = opts[:zip] ? 'zip' : 'tar.gz'
|
||||
slug = name.downcase.strip.tr(' ', '-').gsub(/[^\w-]/, '_')
|
||||
Pathname.new(Dir.pwd).join("#{slug}.#{ext}")
|
||||
Pathname.new(Dir.pwd).join("#{slug}-#{version}.#{ext}")
|
||||
end
|
||||
|
||||
def load_params
|
||||
|
|
|
@ -11,7 +11,7 @@ describe 'inspec archive' do
|
|||
it 'archive is successful' do
|
||||
out = inspec('archive ' + example_profile + ' --overwrite')
|
||||
out.exit_status.must_equal 0
|
||||
out.stdout.must_match(/Generate archive [^ ]*profile.tar.gz/)
|
||||
out.stdout.must_match(/Generate archive [^ ]*profile-1.0.0.tar.gz/)
|
||||
out.stdout.must_include 'Finished archive generation.'
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ describe 'inspec archive' do
|
|||
end
|
||||
|
||||
it 'auto-archives when no --output is given' do
|
||||
auto_dst = File.join(repo_path, 'profile.tar.gz')
|
||||
auto_dst = File.join(repo_path, 'profile-1.0.0.tar.gz')
|
||||
out = inspec('archive ' + example_profile + ' --overwrite')
|
||||
out.stderr.must_equal ''
|
||||
out.stdout.must_include 'Generate archive '+auto_dst
|
||||
|
|
|
@ -129,7 +129,7 @@ describe 'example inheritance profile' do
|
|||
out.exit_status.must_equal 0
|
||||
|
||||
# execute json command
|
||||
out = inspec(' meta-profile.tar.gz -l debug')
|
||||
out = inspec(' meta-profile-1.0.0.tar.gz -l debug')
|
||||
out.exit_status.must_equal 0
|
||||
|
||||
length = out.stdout.scan(/Fetching URL:/).length
|
||||
|
|
Loading…
Add table
Reference in a new issue