mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
Rename profile_path to path_within_repo
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
3e1d08cafe
commit
9c1fa967fd
3 changed files with 10 additions and 10 deletions
|
@ -222,7 +222,7 @@ depends:
|
|||
tag: desired_version
|
||||
commit: pinned_commit
|
||||
version: semver_via_tags
|
||||
profile_path: optional/path/to/profile
|
||||
path_within_repo: relative/optional/path/to/profile
|
||||
```
|
||||
|
||||
### supermarket
|
||||
|
|
|
@ -42,7 +42,7 @@ module Fetchers
|
|||
@ref = opts[:ref]
|
||||
@remote_url = remote_url
|
||||
@repo_directory = nil
|
||||
@target_profile_path = opts[:profile_path]
|
||||
@path_within_repo = opts[:path_within_repo]
|
||||
end
|
||||
|
||||
def fetch(dir)
|
||||
|
@ -54,11 +54,11 @@ module Fetchers
|
|||
else
|
||||
Dir.mktmpdir do |tmpdir|
|
||||
checkout(tmpdir)
|
||||
if @target_profile_path
|
||||
if @path_within_repo
|
||||
@profile_directory = dir
|
||||
Inspec::Log.debug("Checkout of #{resolved_ref} successful. " \
|
||||
"Moving #{@target_profile_path} to #{dir}")
|
||||
target_profile = File.join(tmpdir, @target_profile_path)
|
||||
"Moving #{@path_within_repo} to #{dir}")
|
||||
target_profile = File.join(tmpdir, @path_within_repo)
|
||||
FileUtils.cp_r(target_profile, dir)
|
||||
else
|
||||
Inspec::Log.debug("Checkout of #{resolved_ref} successful. " \
|
||||
|
@ -71,8 +71,8 @@ module Fetchers
|
|||
end
|
||||
|
||||
def cache_key
|
||||
return resolved_ref unless @target_profile_path
|
||||
OpenSSL::Digest::SHA256.hexdigest(resolved_ref + @target_profile_path)
|
||||
return resolved_ref unless @path_within_repo
|
||||
OpenSSL::Digest::SHA256.hexdigest(resolved_ref + @path_within_repo)
|
||||
end
|
||||
|
||||
def archive_path
|
||||
|
@ -81,7 +81,7 @@ module Fetchers
|
|||
|
||||
def resolved_source
|
||||
source = { git: @remote_url, ref: resolved_ref }
|
||||
source[:profile_path] = @target_profile_path if @target_profile_path
|
||||
source[:path_within_repo] = @path_within_repo if @path_within_repo
|
||||
source
|
||||
end
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ describe "profiles with git-based dependencies" do
|
|||
{
|
||||
'name' => 'deep-git-dep',
|
||||
'git' => @deep_git_dep_dir,
|
||||
'profile_path' => 'profiles/deep-profile'
|
||||
'path_within_repo' => 'profiles/deep-profile'
|
||||
},
|
||||
{
|
||||
'name' => 'another-deep-git-dep',
|
||||
'git' => @deep_git_dep_dir,
|
||||
'profile_path' => 'profiles/another-deep-profile'
|
||||
'path_within_repo' => 'profiles/another-deep-profile'
|
||||
}
|
||||
]
|
||||
File.write(File.join(@profile_dir, 'inspec.yml'), YAML.dump(inspec_yml))
|
||||
|
|
Loading…
Reference in a new issue