Sha256: 1ae9890064e0c0048d8634411e7cf2e30ba7450f65df04a1a1bb0666f6a7348c

Contents?: true

Size: 966 Bytes

Versions: 9

Compression:

Stored size: 966 Bytes

Contents

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

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

      def find_instance(instance_name)
        context.instances.find { |i| i.name == instance_name }
      end

      def find_instance!(instance_path)
        instance = find_instance(instance_path)
        return instance if instance
        raise "Instance not found in \"#{instance_path}\""
      end

      def instances
        if options['--all']
          context.instances
        else
          options['<instance_path>'].map { |p| find_instance!(p) }
        end
      end

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
eac_launcher-0.4.0 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.3.2 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.3.1 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.3.0 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.2.2 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.2.1 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.2.0 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.1.7 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.1.6 lib/eac_launcher/instances/runner_helper.rb