class Launchy::Application

class can handle the input.
3. A class method ‘handles?’ that takes a String and returns true if that
hash as the second
2. An instance method ‘open’ taking a string or URI as the first parameter and a
1. A constructor taking no parameters
Every class that inherits from Application must define:
invoke. It essentially defines the public api of the launchy system.
Application is the base class of all the application types that launchy may

def find_executable(bin, *paths)

returns the path to the executable or nil if not found

Find the given executable in the available paths
def find_executable(bin, *paths)
  paths = Launchy.path.split(File::PATH_SEPARATOR) if paths.empty?
  paths.each do |path|
    file = File.join(path, bin)
    if File.executable?(file)
      Launchy.log "#{name} : found executable #{file}"
      return file
    end
  end
  Launchy.log "#{name} : Unable to find `#{bin}' in #{paths.join(', ')}"
  nil
end

def find_executable(bin, *paths)

def find_executable(bin, *paths)
  Application.find_executable(bin, *paths)
end

def for_name(name)

returns the Class that has the given name

Find the application with the given name
def for_name(name)
  klass = find_child(:has_name?, name)
  return klass if klass
  raise ApplicationNotFoundError, "No application found named '#{name}'"
end

def handling(uri)

returns the Class that can handle the uri

Find the application that handles the given uri.
def handling(uri)
  klass = find_child(:handles?, uri)
  return klass if klass
  raise ApplicationNotFoundError, "No application found to handle '#{uri}'"
end

def has_name?(qname)

returns true if the class has the given name

Does this class have the given name-like string?
def has_name?(qname)
  qname.to_s.downcase == name.split("::").last.downcase
end

def initialize

def initialize
  @host_os_family = Launchy::Detect::HostOsFamily.detect
  @runner         = Launchy::Runner.new
end

def run(cmd, *args)

def run(cmd, *args)
  runner.run(cmd, *args)
end