lib/rubyfocus/fetchers/local_fetcher.rb in rubyfocus-0.5.14 vs lib/rubyfocus/fetchers/local_fetcher.rb in rubyfocus-0.5.15
- old
+ new
@@ -22,20 +22,25 @@
end
end
# Fetches the ID Of the base file
def base_id
- base_file = File.basename(Dir[File.join(self.location,"*.zip")].sort.first)
+ base_file = File.basename(sorted_files.first)
if base_file =~ /^\d+\=.*\+(.*)\.zip$/
$1
else
raise RuntimeError, "Malformed patch file #{base_file}."
end
end
# Fetches a list of every patch file
def patches
- @patches ||= Dir[File.join(self.location, "*.zip")][1..-1].map{ |f| Rubyfocus::Patch.new(self, File.basename(f)) }
+ @patches ||= sorted_files[1..-1].map{ |f| Rubyfocus::Patch.new(self, File.basename(f)) }
+ end
+
+ # Fetch a sorted list of files from this directory
+ private def sorted_files
+ @sorted_files ||= Dir[File.join(self.location, "*.zip")].sort
end
# Fetches the contents of a given patch file
def patch(file)
filename = File.join(self.location, file)
\ No newline at end of file