Sha256: 3b8262661fadfde1d1057de2987ab91edd3b3a4c337152ec1d121792afcfa764

Contents?: true

Size: 714 Bytes

Versions: 13

Compression:

Stored size: 714 Bytes

Contents

# == ShellManager::WhichBase
#
# Provides abstract helper methods for other drivers implementing the +which+.
class AutomateIt::ShellManager::WhichBase < AutomateIt::ShellManager::BaseDriver
  abstract_driver

  def suitability(method, *args) # :nodoc:
    # Level must be higher than Portable
    return available? ? 2 : 0
  end

  # See ShellManager#which!
  def which!(command)
    result = which(command)
    if result.nil?
      raise ArgumentError.new("command not found: #{command}")
    else
      true
    end
  end

protected

  def _which_helper(&block)
    data = block.call
    data.strip! if data
    return (! data.blank? && File.exists?(data)) ? data : nil
  end

end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
automate-it-0.9.2 lib/automateit/shell_manager/which_base.rb
automate-it-0.9.1 lib/automateit/shell_manager/which_base.rb
automate-it-0.9.0 lib/automateit/shell_manager/which_base.rb
automateit-0.71221 lib/automateit/shell_manager/which_base.rb
automateit-0.71111 lib/automateit/shell_manager/which_base.rb
automateit-0.71112 lib/automateit/shell_manager/which_base.rb
automateit-0.71219 lib/automateit/shell_manager/which_base.rb
automateit-0.71220 lib/automateit/shell_manager/which_base.rb
automateit-0.71226.1 lib/automateit/shell_manager/which_base.rb
automateit-0.80116 lib/automateit/shell_manager/which_base.rb
automateit-0.80624 lib/automateit/shell_manager/which_base.rb
automateit-0.71230 lib/automateit/shell_manager/which_base.rb
automateit-0.71226 lib/automateit/shell_manager/which_base.rb