Sha256: 0175dc9a0bf819cc1abfe3a423563502774c9d57e1d7cc59a6d635177409d4b0

Contents?: true

Size: 1.42 KB

Versions: 20

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

require 'avm/tools/core_ext'

module Avm
  module Tools
    class Runner
      class AppSrc
        class Info
          SOURCE_PROPERTIES = {
            path: 'Path',
            application: 'Application',
            class: 'Stereotype',
            scm: 'SCM'
          }.freeze

          runner_with :help do
            desc 'Show information about local project instance.'
            bool_opt '-p', '--parent', 'Show the parent source.'
            bool_opt '-t', '--tests', 'Show test commands.'
          end

          def run
            show_source
            show_parent
            show_test_commands
          end

          private

          def show_parent
            return unless parsed.parent?

            infov 'Parent', runner_context.call(:subject).parent
          end

          def show_source
            SOURCE_PROPERTIES.each do |property, label|
              infov label, runner_context.call(:subject).send(property)
            end
          end

          def show_test_commands
            return unless parsed.tests?

            infov 'Test commands', runner_context.call(:subject).test_commands.count
            runner_context.call(:subject).test_commands.each do |name, command|
              infov "  * #{name}", command
            end
          end

          def instance
            runner_context.call(:instance)
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
eac_tools-0.32.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
avm-tools-0.136.2 lib/avm/tools/runner/app_src/info.rb
eac_tools-0.31.1 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
eac_tools-0.31.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
avm-tools-0.136.1 lib/avm/tools/runner/app_src/info.rb
eac_tools-0.30.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
eac_tools-0.29.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
avm-tools-0.136.0 lib/avm/tools/runner/app_src/info.rb
eac_tools-0.28.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
eac_tools-0.27.2 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
eac_tools-0.27.1 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
avm-tools-0.135.0 lib/avm/tools/runner/app_src/info.rb
eac_tools-0.27.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
avm-tools-0.134.0 lib/avm/tools/runner/app_src/info.rb
eac_tools-0.26.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
eac_tools-0.25.1 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
eac_tools-0.25.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
eac_tools-0.24.1 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb
avm-tools-0.133.0 lib/avm/tools/runner/app_src/info.rb
eac_tools-0.24.0 sub/avm-tools/lib/avm/tools/runner/app_src/info.rb