def list(search = nil)
      list = {}
      each_file_in_index('.js') do |filename|
        if /lib\/([^\/\-]+)-([\d\w\.\-]+)\/.+/.match filename
          name    = $1
          version = $2
        else
          name, version = Jim::VersionParser.parse_filename(filename)
        end
        if name && version
          list[name] ||= []
          list[name] << [version, filename]
        end
      end
      if search
        search = /#{search}/i
        list = list.find_all {|lib| lib[0] =~ search }
      end
      list.sort
    end
def list(search = nil)
      list = {}
      each_file_in_index('.js') do |filename|
        if /lib\/([^\/\-]+)-([\d\w\.\-]+)\/.+/.match filename
          name    = $1
          version = $2
        else
          name, version = Jim::VersionParser.parse_filename(filename)
        end
        if name && version
          list[name] ||= []
          list[name] << [version, filename]
        end
      end
      if search
        search = /#{search}/i
        list = list.find_all {|lib| lib[0] =~ search }
      end
      list.sort
    end
List all available files in the directories or only those matching `search`.
 Returns a sorted array of arrays.