Sha256: 84b4c07af370b75db048b425adeecfb9db626d44d0337bebf7e1411afbbf4eef

Contents?: true

Size: 946 Bytes

Versions: 1

Compression:

Stored size: 946 Bytes

Contents

require 'eac_launcher/context'
require 'eac_launcher/instances/runner_helper'

module EacLauncher
  class Runner < ::EacRubyUtils::Console::DocoptRunner
    class Projects < ::EacLauncher::Instances::RunnerHelper
      DOC = <<DOCOPT.freeze
Shows available projects.

Usage:
  __PROGRAM__ [options]
  __PROGRAM__ -h | --help

Options:
  -h --help        Show this screen.
  -i --instances   Show instances.
  --recache        Rewrite instances cache.

DOCOPT

      def run
        ::EacLauncher::Context.current.recache = options['--recache']
        ::EacLauncher::Context.current.projects.each do |p|
          show_project(p)
        end
      end

      private

      def show_project(p)
        puts project_label(p)
        return unless options['--instances']
        p.instances.each do |i|
          puts "  * #{instance_label(i)}"
        end
      end

      def project_label(p)
        p.to_s.cyan.to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eac_launcher-0.6.0 lib/eac_launcher/runner/projects.rb