Sha256: e4015c129e5ca119bd1140989ce81659c15282bee2f255dffbdfb2e4aead8ce6

Contents?: true

Size: 903 Bytes

Versions: 18

Compression:

Stored size: 903 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/core_ext'
require 'eac_ruby_utils/console/docopt_runner'

module Avm
  module Instances
    class Runner < ::EacRubyUtils::Console::DocoptRunner
      class << self
        def instance_class
          ::Avm.const_get(stereotype_name).const_get('Instance')
        end

        def stereotype_module
          ::Avm.const_get(stereotype_name)
        end

        def stereotype_name
          name.demodulize
        end
      end

      runner_with
      description = "Utilities for #{stereotype_name} instances."
      runner_definition do
        desc description
        pos_arg 'instance-id'
        subcommands
      end

      delegate :instance_class, :stereotype_module, :stereotype_name, to: :class

      private

      def instance_uncached
        self.class.instance_class.by_id(options.fetch('<instance-id>'))
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
avm-tools-0.87.0 lib/avm/instances/runner.rb
avm-tools-0.86.0 lib/avm/instances/runner.rb
avm-tools-0.85.1 lib/avm/instances/runner.rb
avm-tools-0.85.0 lib/avm/instances/runner.rb
avm-tools-0.84.0 lib/avm/instances/runner.rb
avm-tools-0.83.0 lib/avm/instances/runner.rb
avm-tools-0.82.1 lib/avm/instances/runner.rb
avm-tools-0.82.0 lib/avm/instances/runner.rb
avm-tools-0.81.0 lib/avm/instances/runner.rb
avm-tools-0.80.0 lib/avm/instances/runner.rb
avm-tools-0.79.0 lib/avm/instances/runner.rb
avm-tools-0.78.0 lib/avm/instances/runner.rb
avm-tools-0.77.0 lib/avm/instances/runner.rb
avm-tools-0.76.1 lib/avm/instances/runner.rb
avm-tools-0.76.0 lib/avm/instances/runner.rb
avm-tools-0.75.1 lib/avm/instances/runner.rb
avm-tools-0.75.0 lib/avm/instances/runner.rb
avm-tools-0.74.1 lib/avm/instances/runner.rb