Sha256: 95df135807922fb3613e4d5425c1716664678fdfe1bbdf85e270da19d0f3de27

Contents?: true

Size: 1.31 KB

Versions: 211

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require 'avm/tools/core_ext'
require 'eac_config/node'
require 'eac_ruby_utils/recursive_builder'

module Avm
  module Tools
    class Runner
      class Config
        class LoadPath
          runner_with :help do
            desc 'Manipulate include path.'
            arg_opt '-p', '--push', 'Add a path.'
          end

          def run
            config_nodes.each { |config_node| run_show(config_node) }
            run_add
          end

          private

          # @return [[EacCli::Config]]
          def root_config_node
            ::EacConfig::Node.context.current
          end

          def config_nodes
            ::EacRubyUtils::RecursiveBuilder.new(root_config_node, &:self_loaded_nodes).result
          end

          def run_add
            parsed.push.if_present do |v|
              infov 'Path to add', v
              root_config_node.write_node.load_path.push(v)
              success 'Path included'
            end
          end

          def run_show(config_node)
            infov 'Configuration path', config_node.url
            infov 'Paths included', config_node.self_loaded_nodes.count
            config_node.self_loaded_nodes.each do |loaded_node|
              infov '  * ', loaded_node.url
            end
          end
        end
      end
    end
  end
end

Version data entries

211 entries across 211 versions & 2 rubygems

Version Path
avm-tools-0.162.0 lib/avm/tools/runner/config/load_path.rb
eac_tools-0.94.0 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
avm-tools-0.161.0 lib/avm/tools/runner/config/load_path.rb
eac_tools-0.86.5 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
avm-tools-0.160.2 lib/avm/tools/runner/config/load_path.rb
eac_tools-0.86.4 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
eac_tools-0.86.3 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
avm-tools-0.160.1 lib/avm/tools/runner/config/load_path.rb
eac_tools-0.86.2 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
eac_tools-0.86.1 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
avm-tools-0.160.0 lib/avm/tools/runner/config/load_path.rb
eac_tools-0.86.0 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
eac_tools-0.85.1 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
avm-tools-0.159.1 lib/avm/tools/runner/config/load_path.rb
eac_tools-0.85.0 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
eac_tools-0.84.2 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
eac_tools-0.84.1 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
eac_tools-0.84.0 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
eac_tools-0.83.0 sub/avm-tools/lib/avm/tools/runner/config/load_path.rb
avm-tools-0.159.0 lib/avm/tools/runner/config/load_path.rb