class PuppetForge::V3::Release

Models a specific release version of a Puppet Module on the Forge.

Public Instance Methods

download(file) click to toggle source

Downloads the Release tarball to the specified file path.

@todo Stream the tarball data to disk. @param file [String] the file to create @return [void]

# File lib/puppet_forge/v3/release.rb, line 27
def download(file)
  self.class.get_raw(download_url)[:response].on_complete do |env|
    File.open(file, 'wb') { |file| file.write(env[:body]) }
  end
  nil
end
download_url() click to toggle source

Returns a fully qualified URL for downloading this release from the Forge.

@return [String] fully qualified download URL for release

# File lib/puppet_forge/v3/release.rb, line 14
def download_url
  if URI.parse(file_uri).host.nil?
    PuppetForge.host + file_uri
  else
    file_uri
  end
end