Sha256: 9eee67755d2e72b1d5bdaa3bd6dfcda2ed633c977b565fc78beef00c7003965a

Contents?: true

Size: 1.18 KB

Versions: 41

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require 'singleton'

module RBS
  module Collection
    module Sources
      # Signatures that are inclduded in gem package as sig/ directory.
      class Rubygems
        include Base
        include Singleton

        def has?(name, version)
          gem_sig_path(name, version)
        end

        def versions(name)
          spec, _ = gem_sig_path(name, nil)
          spec or raise
          [spec.version.to_s]
        end

        def install(dest:, name:, version:, stdout:)
          # Do nothing because stdlib RBS is available by default
          _, from = gem_sig_path(name, version)
          stdout.puts "Using #{name}:#{version} (#{from})"
        end

        def manifest_of(name, version)
          _, sig_path = gem_sig_path(name, version)
          sig_path or raise
          manifest_path = sig_path.join('manifest.yaml')
          YAML.safe_load(manifest_path.read) if manifest_path.exist?
        end

        def to_lockfile
          {
            'type' => 'rubygems',
          }
        end

        private def gem_sig_path(name, version)
          RBS::EnvironmentLoader.gem_sig_path(name, version)
        end
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
rbs-3.7.0.dev.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.6.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.6.0 lib/rbs/collection/sources/rubygems.rb
rbs-3.6.0.pre.3 lib/rbs/collection/sources/rubygems.rb
rbs-3.6.0.pre.2 lib/rbs/collection/sources/rubygems.rb
rbs-3.6.0.pre.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.6.0.dev.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.5.3 lib/rbs/collection/sources/rubygems.rb
rbs-3.5.2 lib/rbs/collection/sources/rubygems.rb
rbs-3.5.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.5.1.pre.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.5.0 lib/rbs/collection/sources/rubygems.rb
rbs-3.5.0.pre.2 lib/rbs/collection/sources/rubygems.rb
rbs-3.5.0.pre.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.4.4 lib/rbs/collection/sources/rubygems.rb
rbs-3.4.3 lib/rbs/collection/sources/rubygems.rb
rbs-3.4.2 lib/rbs/collection/sources/rubygems.rb
rbs-3.4.1 lib/rbs/collection/sources/rubygems.rb
rbs-3.4.0 lib/rbs/collection/sources/rubygems.rb
rbs-3.4.0.pre.1 lib/rbs/collection/sources/rubygems.rb