Class: RBS::Collection::Sources::Rubygems
- Inherits:
-
Object
- Object
- RBS::Collection::Sources::Rubygems
- Includes:
- Base, Singleton
- Defined in:
- lib/rbs/collection/sources/rubygems.rb
Overview
Signatures that are inclduded in gem package as sig/ directory.
Instance Method Summary collapse
- #has?(config_entry) ⇒ Boolean
- #install(dest:, config_entry:, stdout:) ⇒ Object
- #manifest_of(config_entry) ⇒ Object
- #to_lockfile ⇒ Object
- #versions(config_entry) ⇒ Object
Methods included from Base
Instance Method Details
#has?(config_entry) ⇒ Boolean
13 14 15 |
# File 'lib/rbs/collection/sources/rubygems.rb', line 13 def has?(config_entry) gem_sig_path(config_entry) end |
#install(dest:, config_entry:, stdout:) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rbs/collection/sources/rubygems.rb', line 23 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 |
#manifest_of(config_entry) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/rbs/collection/sources/rubygems.rb', line 31 def manifest_of(config_entry) _, sig_path = gem_sig_path(config_entry) sig_path or raise manifest_path = sig_path.join('manifest.yaml') YAML.safe_load(manifest_path.read) if manifest_path.exist? end |
#to_lockfile ⇒ Object
38 39 40 41 42 |
# File 'lib/rbs/collection/sources/rubygems.rb', line 38 def to_lockfile { 'type' => 'rubygems', } end |
#versions(config_entry) ⇒ Object
17 18 19 20 21 |
# File 'lib/rbs/collection/sources/rubygems.rb', line 17 def versions(config_entry) spec, _ = gem_sig_path(config_entry) spec or raise [spec.version.to_s] end |