Sha256: d880c37891efb1a30b7e0ab9b291a5a60399e12c05827c6ba8cd06f664dd7178

Contents?: true

Size: 1.07 KB

Versions: 57

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/console/docopt_runner'
require 'eac_ruby_utils/console/speaker'

module EacLauncher
  module Instances
    class RunnerHelper < ::EacRubyUtils::Console::DocoptRunner
      include ::EacRubyUtils::Console::Speaker

      def context
        @context ||= ::EacLauncher::Context.current
      end

      def find_instances(instance_name)
        context.instances.select { |instance| instance_match?(instance, instance_name) }
      end

      def instance_match?(instance, instance_name)
        ::File.fnmatch?(instance_name, instance.name)
      end

      def instances
        if options['--all']
          context.instances
        elsif options['--pending']
          context.pending_instances
        else
          options['<instance_path>'].flat_map { |p| find_instances(p) }
        end
      end

      def instance_stereotypes(instance)
        instance.stereotypes.map(&:label).join(', ')
      end

      def instance_label(instance)
        "#{instance.name} [#{instance_stereotypes(instance)}]"
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
avm-tools-0.95.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.94.3 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.94.2 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.94.1 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.94.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.93.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.92.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.91.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.90.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.89.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.88.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.87.1 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.87.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.86.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.85.1 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.85.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.84.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.83.0 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.82.1 lib/eac_launcher/instances/runner_helper.rb
avm-tools-0.82.0 lib/eac_launcher/instances/runner_helper.rb