Class: Supermarket::SupermarketHelper

Inherits:
Inspec::Targets::UrlHelper show all
Defined in:
lib/bundles/inspec-supermarket/target.rb

Instance Method Summary collapse

Methods inherited from Inspec::Targets::UrlHelper

#download_archive, #resolve_archive

Instance Method Details

#handles?(profile) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
18
# File 'lib/bundles/inspec-supermarket/target.rb', line 10

def handles?(profile)
  # check for local scheme supermarket://
  return unless URI(profile).scheme == 'supermarket'

  # verifies that the target e.g base/ssh exists
  Supermarket::API.exist?(profile)
rescue URI::Error => _e
  false
end

#resolve(profile, opts = {}) ⇒ Object

generates proper url



21
22
23
24
# File 'lib/bundles/inspec-supermarket/target.rb', line 21

def resolve(profile, opts = {})
  tool_info = Supermarket::API.find(profile)
  super(tool_info['tool_source_url'], opts)
end

#to_sObject



26
27
28
# File 'lib/bundles/inspec-supermarket/target.rb', line 26

def to_s
  'Chef Compliance Profile Loader'
end