Sha256: 8c916f9af1da4e4455171bc56711a8d2c8fc2d6a7c51d1a5cb2b2abe9c928d2d

Contents?: true

Size: 982 Bytes

Versions: 6

Compression:

Stored size: 982 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_path)
        context.instances.find { |i| i.to_root_path == instance_path }
      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.to_root_path} [#{instance_stereotypes(instance)}]"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
eac_launcher-0.1.5 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.1.3 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.1.4 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.1.2 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.1.1 lib/eac_launcher/instances/runner_helper.rb
eac_launcher-0.1.0 lib/eac_launcher/instances/runner_helper.rb