class Miniflow::Tool

Burrow-Wheeler Aligner for short-read alignment.

Public Instance Methods

[](key) click to toggle source

Get tool options

# File lib/miniflow/tool.rb, line 35
def [](key)
  @options[key]
end
available?(command) click to toggle source

Use the version options to check if the command is available

# File lib/miniflow/tool.rb, line 12
def available?(command)
  # puts Pastel.new.magenta("Check #{self.class.name}")
  pastel = Pastel.new
  class_name = self.class.name.split('::').last
  begin
    result = cmd.run!(command)
  rescue Errno::ENOENT => e
    pastel = Pastel.new
    msg = "\n" \
          "Please make sure that the #{class_name} is available.\n\n"
    e.message << msg
    raise e
  end
  if result.failure?
    msg = "The exit status of #{command} is not zero.\n" \
          "Please make sure that the #{command} is available.\n\n"
    raise Errno::ENOENT, msg # FIXME
  else
    puts pastel.green.bold("✔ #{class_name}")
  end
end
cmd() click to toggle source
# File lib/miniflow/tool.rb, line 39
def cmd
  TTYCMD
end
method_missing(name, *args) click to toggle source

Calling the Ruby method executes a subcommand with the same name. Since the Ruby methods are called first, care must be taken to avoid name collisions. For example, subcommands such as `call` need to be redefined.

# File lib/miniflow/tool.rb, line 47
def method_missing(name, *args)
  cmd.run2(@command, name, *args)
end