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

Start generating .gitattributes file for generated and vendored RBI files #1604

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

paracycle
Copy link
Member

Motivation

Fixes https://github.com/Shopify/ruby-dev-exp-issues/issues/651

The linguist gem added support for detecting generated and vendored RBI files in github-linguist/linguist#6143, but it parses the RBI file header comments to understand that, which is quite brittle.

Tapioca can do a better job of this, since it already knows that dsl and gem commands will create "generated" RBI files in the output directory and the annotations command will create "vendored" RBI files. So, Tapioca should be generating the appropriate .gitattributes files in the relevant output directories to signal that the RBI files contained are generated/vendored.

Implementation

  1. Added a GitAttributes helper module that knows how to create .gitattributes files that state the **/*.rbi files in the folder are either generated or vendored RBI files.
  2. Uses the helper module in DslGenerate, GemGenerate, GemSync and Annotations commands to create appropriate .gitattributes files in the output folder.

Tests

Added extra test cases for checking generated .gitattributes files.

This commit adds a `.gitattributes` file to the output folder that marks all RBI files as `generated` for `dsl` and `gem` RBI generation commands. It also add a `.gitattributes` file to the output folder that marks all RBI files as `vendored` for `annotations` command.
@paracycle paracycle requested a review from a team as a code owner August 14, 2023 21:24
@paracycle paracycle merged commit 4201c89 into main Sep 8, 2023
30 checks passed
@paracycle paracycle deleted the uk-add-gitattributes branch September 8, 2023 17:31
@shopify-shipit shopify-shipit bot temporarily deployed to production September 13, 2023 22:55 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants