Sha256: bec4ff2d0b3e2a1fcf130953a10baa99bff17ef9626161d655c4a3c4d3b3b1b7

Contents?: true

Size: 713 Bytes

Versions: 9

Compression:

Stored size: 713 Bytes

Contents

require 'pe_build/archive'

module PEBuild

class ArchiveCollection

  #ARCHIVE_REGEX = %r[puppet-enterprise-([\d.])-(.*?)\.(?:tar\.gz|msi)]

  attr_reader :path

  def initialize(path, env)
    @path, @env = path, env
    @archives = []

    load_archives
  end

  def archives
    @archives
  end

  include Enumerable
  def each(&blk)
    @archives.each { |archive| yield archive }
  end

  def display
    @archives.each do |archive|
      @env.ui.info "  - #{archive.filename}"
    end
  end

  private

  def load_archives
    dir = File.join(path, '*')
    Dir.glob(dir).sort.each do |path|
      basename = File.basename(path)
      @archives << PEBuild::Archive.new(basename, @env)
    end
  end
end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vagrant-pe_build-0.6.0 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.5.0 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.4.3 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.4.2 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.4.1 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.4.0 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.3.0 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.2.0 lib/pe_build/archive_collection.rb
vagrant-pe_build-0.1.0 lib/pe_build/archive_collection.rb