Class: Librarian::Puppet::Source::Forge::RepoV1

Inherits:
Repo
  • Object
show all
Defined in:
lib/librarian/puppet/source/forge/repo_v1.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) ⇒ RepoV1

Returns a new instance of RepoV1.



11
12
13
14
15
16
17
18
19
# File 'lib/librarian/puppet/source/forge/repo_v1.rb', line 11

def initialize(source, name)
  super(source, name)
  # API returned data for this module including all versions and dependencies, indexed by module name
  # from http://forge.puppetlabs.com/api/v1/releases.json?module=#{name}
  @api_data = nil
  # API returned data for this module and a specific version, indexed by version
  # from http://forge.puppetlabs.com/api/v1/releases.json?module=#{name}&version=#{version}
  @api_version_data = {}
end

Instance Method Details

#dependencies(version) ⇒ Object



25
26
27
# File 'lib/librarian/puppet/source/forge/repo_v1.rb', line 25

def dependencies(version)
  api_version_data(name, version)['dependencies']
end

#get_versionsObject



21
22
23
# File 'lib/librarian/puppet/source/forge/repo_v1.rb', line 21

def get_versions
  api_data(name).map { |r| r['version'] }.reverse
end

#url(name, version) ⇒ Object



29
30
31
32
# File 'lib/librarian/puppet/source/forge/repo_v1.rb', line 29

def url(name, version)
  info = api_version_data(name, version)
  "#{source}#{info[name].first['file']}"
end