lib/menagerie/collection.rb in menagerie-0.0.4 vs lib/menagerie/collection.rb in menagerie-0.1.0
- old
+ new
@@ -32,9 +32,13 @@
existing.each(&:delete)
keepers.each(&:rotate)
end
def reap
+ keepers = releases.map(&:artifacts).flatten.map(&:path).uniq
+ Dir.glob("#{@paths[:artifacts]}/*/*").each do |artifact|
+ FileUtils.rm_f(artifact) unless keepers.include? artifact
+ end
end
def link_latest
FileUtils.rm_f @paths[:latest]
FileUtils.ln_sf releases.sort.first.path, @paths[:latest]