docs/collection.md in rbs-3.2.2 vs docs/collection.md in rbs-3.3.0.pre.1

- old
+ new

@@ -26,15 +26,14 @@ repo_dir: gems # A directory to install the downloaded RBSs path: .gem_rbs_collection -gems: - # Skip loading rbs gem's RBS. - # It's unnecessary if you don't use rbs as a library. - - name: rbs - ignore: true +# gems: +# # If you want to avoid installing rbs files for gems, you can specify them here. +# - name: GEM_NAME +# ignore: true ``` I also recommend updating `.gitignore`. ```console @@ -77,11 +76,11 @@ - name: ruby/gem_rbs_collection remote: https://github.com/ruby/gem_rbs_collection.git revision: main repo_dir: gems - # You can also add a local path as a collection source optionaly. + # You can also add a local path as a collection source optionally. - type: local path: path/to/local/dir # A directory to install the downloaded RBSs path: .gem_rbs_collection @@ -96,9 +95,60 @@ # `rbs collection` avoids to install nokogiri gem's RBS by this change. # It is useful if the nokogiri RBS has a problem, such as compatibility issue with other RBS. - name: nokogiri ignore: true ``` + +### Avoid installing RBS + +There are two ways to avoid RBS installation. + +#### `require: false` in `Gemfile` + +First, you can specify `require: false` in `Gemfile`. It is the recommended way to avoid installing RBS. +For example: + +```ruby +# Gemfile + +gem 'GEM_NAME', require: false +``` + +In this case, `rbs collection` doesn't install the RBS of `GEM_NAME`. +We recommend to specify `require: false` for `rbs` gem itself because `rbs` gem's RBS file is not necessary in most cases. + +#### `ignore: true` in `rbs_collection.yaml` + +Second, you can write `ignore: true` in `rbs_collection.yaml`. It is useful if you want to avoid installing RBS but you need to require the gem. + +```yaml +# rbs_collection.yaml + +gems: + - name: GEM_NAME + ignore: true +``` + +#### Load RBS specified `require: false` + +You can also use `ignore: false` if you want to install RBS for a gem which you specify `require: false` in `Gemfile`. +For example: + +```ruby +# Gemfile + +gem 'GEM_NAME', require: false +``` + +```yaml +# rbs_collection.yaml + +gems: + - name: GEM_NAME + ignore: false +``` + +In this case, `rbs collection` installs the RBS of `GEM_NAME`. ### `manifest.yaml` If you are a gem maintainer, you can write `manifest.yaml`. You need to put the file if the gem has implicit dependencies, which don't appear in `Gemfile.lock`. You have to write standard libraries' dependencies in most cases.