Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/rbs/environment_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
case
when path
dirs << path

# search for manifest.yaml
if path.directory? && (manifest = path.each_entry.find { |s| s.basename.to_s == "manifest.yaml" })

Check failure on line 54 in lib/rbs/environment_loader.rb

View workflow job for this annotation

GitHub Actions / test (head, stdlib_test rubocop)

Rubycw/Rubycw: assigned but unused variable - manifest

Check failure on line 54 in lib/rbs/environment_loader.rb

View workflow job for this annotation

GitHub Actions / test (4.0, rubocop validate test_doc build test_generate_stdlib raap)

Rubycw/Rubycw: assigned but unused variable - manifest
local_lib = RBS::Collection::Sources::Local.new(path: path, base_directory: Pathname.pwd)
local_lib.dependencies_of("", "")&.each do |dep|
add(library: dep['name'], version: nil)
end
end
when library
if libs.add?(Library.new(name: library, version: version)) && resolve_dependencies
resolve_dependencies(library: library, version: version)
Expand Down
16 changes: 16 additions & 0 deletions test/rbs/environment_loader_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ def test_loading_stdlib
end
end

def test_loading_stdlib_via_manifest
mktmpdir do |path|
path.join("manifest.yaml").write(<<-RBS)
dependencies:
- name: uri
RBS
loader = EnvironmentLoader.new
loader.add(path: path)

env = Environment.new
loader.load(env: env)

assert_operator env.class_decls, :key?, RBS::TypeName.parse("::URI")
end
end

def test_loading_library_from_gem_repo
mktmpdir do |path|
(path + "gems").mkdir
Expand Down
Loading