swh.loader.package.rubygems.loader module#

class swh.loader.package.rubygems.loader.RubyGemsPackageInfo(url: str, filename: str | None, name: str, version: str, built_at: TimestampWithTimezone | None, authors: List[Person], sha256: str, *, directory_extrinsic_metadata: List[RawExtrinsicMetadataCore] = [], checksums: Dict[str, str] = {})[source]#

Bases: BasePackageInfo

Method generated by attrs for class RubyGemsPackageInfo.

name#

Name of the package

version#

Current version

built_at#

Version build date

authors#

Authors

sha256#

Extid as sha256

MANIFEST_FORMAT: Template | None = <string.Template object>#

If not None, used by the default extid() implementation to format a manifest, before hashing it to produce an ExtID.

EXTID_TYPE: str = 'rubygems-manifest-sha256'#
EXTID_VERSION: int = 0#
class swh.loader.package.rubygems.loader.RubyGemsLoader(storage: StorageInterface, url: str, artifacts: List[Dict[str, Any]], rubygem_metadata: List[Dict[str, Any]], max_content_size: int | None = None, **kwargs)[source]#

Bases: PackageLoader[RubyGemsPackageInfo]

Load .gem files from RubyGems.org into the SWH archive.

Loader’s constructor. This raises exception if the minimal required

configuration is missing (cf. fn:check method).

Parameters:
  • storage – Storage instance

  • url – Origin url to load data from

visit_type: str = 'rubygems'#
get_versions() Sequence[str][source]#

Return all versions sorted for the gem being loaded

get_default_version() str[source]#

Get the newest release version of a gem

get_metadata_authority()[source]#

For package loaders that get extrinsic metadata, returns the authority the metadata are coming from.

get_package_info(version: str) Iterator[Tuple[str, RubyGemsPackageInfo]][source]#
Given a release version of a package, retrieve the associated

package information for such version.

Parameters:

version – Package version

Returns:

(branch name, package metadata)

build_release(p_info: RubyGemsPackageInfo, uncompressed_path: str, directory: bytes) Release | None[source]#

Build the release from the archive metadata (extrinsic artifact metadata) and the intrinsic metadata.

Parameters:
  • p_info – Package information

  • uncompressed_path – Artifact uncompressed path on disk