Class: Menagerie::Collection
- Inherits:
-
Object
- Object
- Menagerie::Collection
- Defined in:
- lib/menagerie/collection.rb
Overview
Connection object that contains releases
Instance Method Summary collapse
- #add_release(artifacts) ⇒ Object
-
#initialize(params = {}) ⇒ Collection
constructor
A new instance of Collection.
- #orphans ⇒ Object
- #releases ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Collection
Returns a new instance of Collection.
8 9 10 11 12 13 |
# File 'lib/menagerie/collection.rb', line 8 def initialize(params = {}) params = Cymbal.symbolize(params || {}) @paths = default_paths.merge(params[:paths] || {}) @options = .merge(params[:options] || {}) @logger = Menagerie.get_logger(@options[:verbosity]) end |
Instance Method Details
#add_release(artifacts) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/menagerie/collection.rb', line 28 def add_release(artifacts) rotate Release.new( artifacts: Cymbal.symbolize(artifacts), paths: @paths, logger: @logger ) reap if @options[:reap] link_latest end |
#orphans ⇒ Object
21 22 23 24 25 26 |
# File 'lib/menagerie/collection.rb', line 21 def orphans keepers = releases.map(&:artifacts).flatten.map(&:path).uniq Dir.glob("#{@paths[:artifacts]}/*/*").sort.reject do |artifact| keepers.include? artifact end end |