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
#configure(server) ⇒ Object
10 11 |
# File 'lib/bundles/inspec-supermarket/cli.rb', line 10 def configure(server) end |
#exec(*tests) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/bundles/inspec-supermarket/cli.rb', line 28 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(opts, tests) end |
#info(profile) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/bundles/inspec-supermarket/cli.rb', line 38 def info(profile) # display profiles in format nathenharvey/tmp-compliance-profile # name: tmp_compliance_profile # owner: nathenharvey # description: ... info = Supermarket::API.info('tmp-compliance-profile') puts "name: #{info['slug']}" puts "owner: #{info['owner']} " puts "url: #{info['source_url']}" puts "\n" puts "description:\n#{info['description']}" end |
#profiles ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/bundles/inspec-supermarket/cli.rb', line 14 def profiles # display profiles in format nathenharvey/tmp_compliance_profile supermarket_profiles = Supermarket::API.profiles supermarket_profiles.each { |p| m = %r{^https://supermarket.chef.io/api/v1/tools/(?<slug>[\w-]+)(/)?$}.match(p['tool']) puts "#{p['tool_owner']}/#{m[:slug]}" } end |