Class: Supermarket::SupermarketCLI
- Inherits:
-
Inspec::BaseCLI
- Object
- Thor
- Inspec::BaseCLI
- Supermarket::SupermarketCLI
- Defined in:
- lib/bundles/inspec-supermarket/cli.rb
Instance Method Summary collapse
Methods inherited from Inspec::BaseCLI
Instance Method Details
#exec(*tests) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/bundles/inspec-supermarket/cli.rb', line 25 def exec(*tests) # iterate over tests and add compliance scheme tests = tests.map { |t| 'supermarket://' + t } # execute profile from inspec exec implementation diagnose run_tests(tests, opts) end |
#info(profile) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bundles/inspec-supermarket/cli.rb', line 35 def info(profile) # check that the profile is available supermarket_profiles = Supermarket::API.profiles found = supermarket_profiles.select { |p| "#{p['tool_owner']}/#{p['slug']}" == profile } if found.length == 0 puts "#{mark_text(profile)} is not available on Supermarket" return end # load details for the specific profile info = Supermarket::API.info(profile) puts "#{mark_text('name: ')} #{info['slug']}" puts "#{mark_text('owner:')} #{info['owner']}" puts "#{mark_text('url: ')} #{info['source_url']}" puts puts "#{mark_text('description: ')} #{info['description']}" end |
#profiles ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/bundles/inspec-supermarket/cli.rb', line 10 def profiles # display profiles in format user/profile supermarket_profiles = Supermarket::API.profiles headline('Available profiles:') supermarket_profiles.each { |p| li("#{p['tool_owner']}/#{p['slug']}") } end |