Class: Albacore::PackageRepo

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/albacore/package_repo.rb

Overview

a package repository is a location where the nugets or wraps are stored

Instance Method Summary collapse

Methods included from Logging

#debug, #err, #error, #fatal, #info, #puts, #trace, #warn

Constructor Details

#initialize(path) ⇒ PackageRepo

initialize that package repository with a path to all the packages



11
12
13
# File 'lib/albacore/package_repo.rb', line 11

def initialize path
  @paths = (path.respond_to?(:map) ? path : [ path ]) || []
end

Instance Method Details

#find_latest(pkg_id) ⇒ Object

find the latest package based on the package id



16
17
18
19
20
21
22
23
# File 'lib/albacore/package_repo.rb', line 16

def find_latest pkg_id
  @paths.map do |path|
    trace "finding latest from #{path}, id: #{pkg_id}"
    sorted = Dir.glob(File.join(path, "#{pkg_id}*/**/*.dll")) # find the latest
    path = sorted.first
    Package.new pkg_id, path
  end.compact.first
end