Sha256: 9b6b57766227e64c66d595da744178f2f15a720e9e761fd54bfcb36b9ed65cb0

Contents?: true

Size: 1.71 KB

Versions: 4

Compression:

Stored size: 1.71 KB

Contents

require_relative "profile"
require "inspec/dist"
require "inspec/feature"

module InspecPlugins
  module Habitat
    class ProfileCLI < Inspec.plugin(2, :cli_command)
      # Override banner method to correct missing subcommand.
      # @see https://github.com/erikhuda/thor/issues/261
      def self.banner(command, _namespace = nil, _subcommand = false)
        "#{basename} habitat profile #{command.usage}"
      end

      desc "create PATH", "Create a Habitat artifact for the profile found at PATH"
      option :output_dir, type: :string, required: false,
        desc: "Output directory for the Habitat artifact. Default: current directory"
      def create(path = ".")
        Inspec.with_feature("inspec-cli-habitat-profile-create") {
          InspecPlugins::Habitat::Profile.new(path, options).create
        }
      end

      desc "setup PATH", "Configure the profile at PATH for Habitat, including a plan and hooks"
      def setup(path = ".")
        Inspec.with_feature("inspec-cli-habitat-profile-setup") {
          InspecPlugins::Habitat::Profile.new(path, options).setup
        }
      end

      desc "upload PATH", "Create then upload a Habitat artifact for the profile found at PATH to the Habitat Builder Depot"
      def upload(path = ".")
        Inspec.with_feature("inspec-cli-habitat-profile-upload") {
          InspecPlugins::Habitat::Profile.new(path, options).upload
        }
      end
    end

    class CLI < Inspec.plugin(2, :cli_command)
      include Inspec::Dist

      subcommand_desc "habitat SUBCOMMAND", "Manage Habitat with #{PRODUCT_NAME}"
      namespace "habitat"

      desc "profile", "Manage #{PRODUCT_NAME} profiles as Habitat artifacts"
      subcommand "profile", ProfileCLI
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inspec-core-6.8.24 lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb
inspec-core-6.8.11 lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb
inspec-core-6.8.1 lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb
inspec-core-6.6.0 lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb