qwandry/lib/qwandry/flat_repository.rb
2010-12-29 15:39:11 -07:00

22 lines
554 B
Ruby

module Qwandry
# The FlatRepository assumes that each file or directory in the search path
# is a stand alone Package. For instance:
#
# rails-2.3.2
# rails-3.0.1
# thin
#
class FlatRepository < Qwandry::Repository
# Returns a Package for each matching file or directory.
def scan(pattern)
results = []
all_paths.select do |path|
if File.fnmatch?(pattern, File.basename(path))
results << package(File.basename(path), [path])
end
end
results
end
end
end