From 4c0260aedd263db5bb08f85a7a3a734b252ba3a2 Mon Sep 17 00:00:00 2001 From: Artem Sidorenko Date: Fri, 24 May 2019 12:41:34 +0200 Subject: [PATCH] Dist branding for plugins/inspec-artifact Signed-off-by: Artem Sidorenko --- lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb | 7 +++++-- lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb b/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb index 437538e32..5a84f484f 100644 --- a/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +++ b/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb @@ -4,10 +4,13 @@ require 'pathname' require 'set' require 'tempfile' require 'yaml' +require 'inspec/dist' module InspecPlugins module Artifact class Base + include Inspec::Dist + KEY_BITS=2048 KEY_ALG=OpenSSL::PKey::RSA @@ -87,7 +90,7 @@ module InspecPlugins p = Pathname.new(path_to_profile) p = p.join('inspec.yml') if not p.exist? - raise "#{path_to_profile} doesn't appear to be a valid InSpec profile" + raise "#{path_to_profile} doesn't appear to be a valid #{PRODUCT_NAME} profile" end yaml = YAML.load_file(p.to_s) yaml = yaml.to_hash @@ -101,7 +104,7 @@ module InspecPlugins end rescue => e # rewrap it and pass it up to the CLI - raise "Error reading InSpec profile metadata: #{e}" + raise "Error reading #{PRODUCT_NAME} profile metadata: #{e}" end yaml diff --git a/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb b/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb index 7ed938fe2..25c23ea6b 100644 --- a/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +++ b/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb @@ -1,4 +1,5 @@ require_relative 'base' +require 'inspec/dist' # # Notes: @@ -72,7 +73,9 @@ require_relative 'base' module InspecPlugins module Artifact class CLI < Inspec.plugin(2, :cli_command) - subcommand_desc 'artifact SUBCOMMAND', 'Manage InSpec Artifacts' + include Inspec::Dist + + subcommand_desc 'artifact SUBCOMMAND', "Manage #{PRODUCT_NAME} Artifacts" desc 'generate', 'Generate a RSA key pair for signing and verification' option :keyname, type: :string, required: true,