-
Notifications
You must be signed in to change notification settings - Fork 135
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
Handle multiple annotations repositories #955
Conversation
lib/tapioca/cli.rb
Outdated
@@ -302,9 +302,9 @@ def check_shims | |||
end | |||
|
|||
desc "annotations", "Pull gem annotations from a central RBI repository" | |||
option :repo_uri, type: :string, desc: "Repository URI to pull annotations from", default: CENTRAL_REPO_ROOT_URI | |||
option :repo_uri, type: :array, desc: "Repository URI to pull annotations from", default: [CENTRAL_REPO_ROOT_URI] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it accepts an array, could we change the option name to plural (repo_uris) and also update the description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed it as --repos
(98663d1) let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I changed it to --sources
(8cf24a0)
98663d1
to
47539bd
Compare
I also added some documentation for the command: 47539bd. |
lib/tapioca/commands/annotations.rb
Outdated
fetchable_gems = T.let(gem_names.each_with_object({}) do |gem_name, hash| | ||
@indexes.each do |uri, index| | ||
if index.has_gem?(gem_name) | ||
hash[gem_name] ||= [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: you can use a hash with a default of an array to avoid this line and possibly simplify the loop.
Hash.new { |h, k| h[k] = [] }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I also simplified the loop 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think allowing multiple repos will hinder contributions to rbi-central
?
From that perspective I wasn't sure if it's a necessary feature without support for private repos.
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
I think it may actually be the opposite. With only one repo, as soon as you have private things you'll want a private repo and be forced to use just this one meaning no contribution to the community one. Even without private things, if for some reason you want to use your own repo for something custom that shouldn't be in the community one (let's say some annotations for a kind of static DSL you use) you'll also depend on your own repo and not contribute to the community one. By allowing people to use multiple repo we give them the opportunity to use and contribute to the community repo while at the same time maintaining their own annotations. So enabling multiple (public) repos seemed to be the next logical step before adding support to private repos. |
Motivation
Allow user to use multiple sources for annotations:
Implementation
In case one of the annotation files contains a parse error, we tell so to the user and skip the gem.
In case one of annotations files can't be merged because of conflicts, we tell so to the user and skip the gem.
Tests
See automated tests.