Sha256: 1a18a9353d68514053e6fb46c49a262ca653fd985e495a3da1cf0da86eb131e2
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
require 'librarian/puppet/source/forge/repo' require 'puppet_forge' require 'librarian/puppet/version' module Librarian module Puppet module Source class Forge class RepoV3 < Librarian::Puppet::Source::Forge::Repo PuppetForge.user_agent = "librarian-puppet/#{Librarian::Puppet::VERSION}" def get_versions get_module.releases.map{|r| r.version} end def dependencies(version) array = get_release(version).metadata[:dependencies].map{|d| [d['name'], d['version_requirement']]} Hash[*array.flatten(1)] end def url(name, version) if name == "#{get_module().owner.username}/#{get_module().name}" release = get_release(version) else # should never get here as we use one repo object for each module (to be changed in the future) debug { "Looking up url for #{name}@#{version}" } release = PuppetForge::Release.find("#{name.sub('/','-')}-#{version}") end "#{source}#{release.file_uri}" end private def get_module @module ||= PuppetForge::Module.find(name.sub('/','-')) raise(Error, "Unable to find module '#{name}' on #{source}") unless @module @module end def get_release(version) release = get_module.releases.find{|r| r.version == version.to_s} if release.nil? versions = get_module.releases.map{|r| r.version} raise Error, "Unable to find version '#{version}' for module '#{name}' on #{source} amongst #{versions}" end release end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems