Sha256: c57c957d80831b58e0b33003fe25d00f1d86d690113ad83a61c2042fa3a79413

Contents?: true

Size: 1.34 KB

Versions: 52

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

require 'eac_cli/runner'
require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/fs/traversable'
require 'eac_ruby_utils/settings_provider'

module EacRubyBase0
  module RunnerWith
    module FilesystemTraverser
      DEFAULT_DEFAULT_TRAVERSER_RECURSIVE = false

      common_concern do
        include ::EacCli::Runner
        include ::EacRubyUtils::Fs::Traversable
        enable_settings_provider
        include TopMethods
        runner_definition do
          bool_opt '-R', '--recursive', 'Recursive.'
          bool_opt '--no-recursive', 'No recursive.'
          pos_arg :paths, optional: true, repeat: true
        end
      end

      module TopMethods
        def on_none_path_informed
          infom 'Warning: none path informed'
        end

        def paths
          parsed.paths.map(&:to_pathname)
        end

        def run_filesystem_traverser
          if parsed.paths.any?
            parsed.paths.each { |path| traverser_check_path(path) }
          else
            on_none_path_informed
          end
        end

        def traverser_recursive
          return false if parsed.no_recursive?
          return true if parsed.recursive?

          setting_value(:default_traverser_recursive, required: false)
            .if_not_nil(DEFAULT_DEFAULT_TRAVERSER_RECURSIVE)
        end
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 3 rubygems

Version Path
eac_ruby_base0-0.13.0 lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.110.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.109.1 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.109.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.28.2 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
eac_ruby_base0-0.12.0 lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.108.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.28.1 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.107.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
eac_ruby_base0-0.11.0 lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.28.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.106.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.27.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.26.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.105.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.25.1 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.25.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
ehbrs-tools-0.24.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
eac_ruby_base0-0.10.1 lib/eac_ruby_base0/runner_with/filesystem_traverser.rb
avm-tools-0.104.0 vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb