Class: Librarian::Puppet::Source::Forge::RepoV3

Inherits:
Repo
  • Object
show all
Defined in:
lib/librarian/puppet/source/forge/repo_v3.rb

Instance Attribute Summary

Attributes inherited from Repo

#name, #source

Instance Method Summary collapse

Methods inherited from Repo

#cache_version_unpacked!, #check_puppet_module_options, #install_version!, #manifests, #vendor_cache, #versions

Methods included from Util

#clean_uri, #cp_r, #debug, #info, #module_name, #normalize_name, #rsync?, #warn

Methods inherited from Repo

#cache_path, #environment, #vendored?, #vendored_path, #version_unpacked_cache_path

Constructor Details

#initialize(source, name) ⇒ RepoV3

Returns a new instance of RepoV3.



13
14
15
16
# File 'lib/librarian/puppet/source/forge/repo_v3.rb', line 13

def initialize(source, name)
  PuppetForge.host = source.uri.clone
  super(source, name)
end

Instance Method Details

#dependencies(version) ⇒ Object



22
23
24
25
# File 'lib/librarian/puppet/source/forge/repo_v3.rb', line 22

def dependencies(version)
  array = get_release(version).[:dependencies].map{|d| [d['name'], d['version_requirement']]}
  Hash[*array.flatten(1)]
end

#get_versionsObject



18
19
20
# File 'lib/librarian/puppet/source/forge/repo_v3.rb', line 18

def get_versions
  get_module.releases.select{|r| r.deleted_at.nil?}.map{|r| r.version}
end

#url(name, version) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/librarian/puppet/source/forge/repo_v3.rb', line 27

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}-#{version}")
  end
  "#{source}#{release.file_uri}"
end