Class: Proscenium::Registry::Package
- Extended by:
- Literal::Properties
- Defined in:
- lib/proscenium/registry/package.rb
Overview
-
Fetch the gem metadata from RubyGems API.
-
Extract any package.json from the gem, and populate the response with it.
-
Create a tarball containing the fetched package.json. This will be downloaded by the npm client, and unpacked into node_modules. Proscenium ignores this, as it will pull contents directly from location of the installed gem.
-
Return a valid npm response listing package details, tarball location, and its dependencies.
Direct Known Subclasses
Instance Method Summary collapse
- #as_json ⇒ Object
- #gem_name ⇒ Object
- #integrity ⇒ Object
- #shasum ⇒ Object
- #validate! ⇒ Object
-
#version ⇒ Object
rubocop:disable Style/TrivialAccessors.
Instance Method Details
#as_json ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/proscenium/registry/package.rb', line 19 def as_json { name:, 'dist-tags': { latest: version }, versions: { version => { name:, version:, dependencies: package_json['dependencies'] || {}, dist: { tarball:, integrity:, shasum: } } } } end |
#gem_name ⇒ Object
46 |
# File 'lib/proscenium/registry/package.rb', line 46 def gem_name = @gem_name ||= name.gsub('@rubygems/', '') |
#integrity ⇒ Object
49 |
# File 'lib/proscenium/registry/package.rb', line 49 def integrity = "sha512-#{Digest::SHA512.file(tarball_path).base64digest}" |
#shasum ⇒ Object
48 |
# File 'lib/proscenium/registry/package.rb', line 48 def shasum = Digest::SHA1.file(tarball_path).hexdigest |
#validate! ⇒ Object
40 41 42 43 44 |
# File 'lib/proscenium/registry/package.rb', line 40 def validate! return self if name.start_with?('@rubygems/') raise PackageUnsupportedError, name end |
#version ⇒ Object
rubocop:disable Style/TrivialAccessors
47 |
# File 'lib/proscenium/registry/package.rb', line 47 def version = @version # rubocop:disable Style/TrivialAccessors |