Sha256: c6c282142155697acfbe258d7b805fc8adb4b7cef4d853fc7638e6ad0da5bc2b

Contents?: true

Size: 1023 Bytes

Versions: 12

Compression:

Stored size: 1023 Bytes

Contents

require 'singleton'

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

        def has?(config_entry)
          gem_sig_path(config_entry)
        end

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

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

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

        private def gem_sig_path(config_entry)
          RBS::EnvironmentLoader.gem_sig_path(config_entry['name'], config_entry['version'])
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rbs-1.8.1 lib/rbs/collection/sources/rubygems.rb
rbs-1.8.0 lib/rbs/collection/sources/rubygems.rb
rbs-1.7.1 lib/rbs/collection/sources/rubygems.rb
rbs-1.7.0 lib/rbs/collection/sources/rubygems.rb
rbs-1.7.0.beta.5 lib/rbs/collection/sources/rubygems.rb
rbs-1.7.0.beta.4 lib/rbs/collection/sources/rubygems.rb
rbs-1.7.0.beta.3 lib/rbs/collection/sources/rubygems.rb
rbs-1.7.0.beta.2 lib/rbs/collection/sources/rubygems.rb
rbs-1.7.0.beta.1 lib/rbs/collection/sources/rubygems.rb
rbs-1.6.2 lib/rbs/collection/sources/rubygems.rb
rbs-1.6.1 lib/rbs/collection/sources/rubygems.rb
rbs-1.6.0 lib/rbs/collection/sources/rubygems.rb