Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gem rbs collection manager #589

Merged
merged 6 commits into from
Aug 31, 2021

Conversation

pocke
Copy link
Member

@pocke pocke commented Feb 8, 2021

This PR introduces rbs collection subcommand to manage 3rd party RBSs.

Usage

See the added document, collection.md.

Example

I tried introducing rbs collection to my repository, rbs_rails. pocke/rbs_rails#187
It works well 😄

Next Steps

This PR is the first step, so there are remaining works. I'll do them in other PRs.

Support this feature by TypeProf and Steep

All rbs sub-command supports this feature, for example, rbs validate automatically loads RBSs from rbs_collection.yaml if the file exists. But TypeProf and Steep don't support it.

I'll do it soon 🚀 I guess it is an easy task.

Resolve stdlib dependencies

Currently rbs collection command resolves dependencies with Gemfile.lock. So it has a limitation that it can't resolve stdlib dependencies.

For example, pathname is a default gem, so we don't write add_runtime_dependency 'pathname' in order to use the library in a gem. Then a Gemfile.lock doesn't contain pathname even if the dependency actually depends on pathname library.

We need another approach to resolve stdlib dependencies.
We, soutaro, mame, and I, discussed the topic in closed meetings. We are considering introducing a meta file to describe stdlib dependencies for RBS repository, like manifest.yaml.

For example:

# ruby/gem_rbs_collection/gems/activesupport/6.0/manifest.yaml
dependencies:
  - name: pathname
  - name: logger
    version: 1.4 # Can specify a version (optional)
  - name: mutex_m
  # ...

Update individual gems

Currenly rbs collection update command only supports updating all gems. But I can easily imagine it is too loose. We'll want to update specific gems like we usually do bundle update rails csv nokogiri in Bundler.
I'll allow rbs collection update to take gem names as arguments, like rbs collection update rails csv nokogiri

Without Gemfile.lock mode

Currently rbs collection command assumes Gemfile.lock existence. I guess it may need no Gemfile.lock mode for a project without Bundler or Gemfile.lock is not committed.

Design document

I wrote a design document at the beginning of this PR. I think there are many differences since the doc. It looks obsolete.
https://pocke.kibe.la/shared/entries/3665a009-e229-4e56-a92b-c0743f7a49fe

@pocke pocke linked an issue Feb 12, 2021 that may be closed by this pull request
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch from a2bca7f to 00dbc86 Compare February 13, 2021 09:43
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch 2 times, most recently from 34ed940 to c2b433f Compare February 21, 2021 07:59
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch 3 times, most recently from b7c6e1b to 8ebfef2 Compare March 6, 2021 09:13
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch from 8ebfef2 to eefdaf0 Compare March 13, 2021 15:14
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch from 089a958 to 57de1c3 Compare June 9, 2021 16:44
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch from 57de1c3 to 508210c Compare June 24, 2021 14:58
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch 3 times, most recently from bd5b71e to 0fa655e Compare June 30, 2021 13:25
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch 3 times, most recently from 0c51b0e to 1fe8a33 Compare July 25, 2021 07:03
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch 2 times, most recently from e39e188 to 9ab5c10 Compare August 9, 2021 04:59
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch from 9cb83fc to 74c16ed Compare August 9, 2021 15:59
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch 2 times, most recently from 8e49277 to 56c849f Compare August 17, 2021 07:33
@pocke pocke marked this pull request as ready for review August 17, 2021 07:51
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch from c5f2993 to 4b4129a Compare August 20, 2021 12:20
@pocke pocke force-pushed the Add_gem_rbs_collection_manager branch from 8c44122 to 1190022 Compare August 23, 2021 13:20
@@ -47,6 +47,16 @@ def add(path: nil, library: nil, version: nil)
end
end

def add_collection(collection_config)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pocke pocke merged commit 1ae8d46 into ruby:master Aug 31, 2021
@pocke pocke deleted the Add_gem_rbs_collection_manager branch August 31, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion: support for describing type-level dependencies
2 participants