lib/inspec/profile.rb in inspec-0.14.8 vs lib/inspec/profile.rb in inspec-0.15.0
- old
+ new
@@ -11,11 +11,11 @@
module Inspec
class Profile # rubocop:disable Metrics/ClassLength
extend Forwardable
attr_reader :path
- def self.for_target(target, opts)
+ def self.resolve_target(target, opts)
# Fetchers retrieve file contents
opts[:target] = target
fetcher = Inspec::Fetcher.resolve(target)
if fetcher.nil?
fail("Could not fetch inspec profile in #{target.inspect}.")
@@ -25,10 +25,14 @@
reader = Inspec::SourceReader.resolve(fetcher.relative_target)
if reader.nil?
fail("Don't understand inspec profile in #{target.inspect}, it "\
"doesn't look like a supported profile structure.")
end
- new(reader, opts)
+ reader
+ end
+
+ def self.for_target(target, opts)
+ new(resolve_target(target, opts), opts)
end
attr_reader :source_reader
def_delegator :@source_reader, :tests
def_delegator :@source_reader, :libraries