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

Follow-up on development with rbs-inline #493

Merged
merged 3 commits into from
Dec 27, 2024
Merged
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
9 changes: 9 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ jobs:
bundler-cache: true
- run: bundle install
- run: bundle exec rbs collection install
- run: bundle exec rbs-inline --output lib/
- name: Check for uncommitted changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Uncommitted changes detected after running rbs-inline."
echo "Please run 'bundle rake rbs_inline' and commit the changes generated by rbs-inline." >&2
exit 1
fi
shell: bash
Comment on lines +141 to +148
Copy link
Member Author

Choose a reason for hiding this comment

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

If there is an uncommitted sig/generated/lrama type definition, it fails as follows:

error

- run: bundle exec steep check
test-ruby:
runs-on: ubuntu-20.04
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Lrama is LALR (1) parser generator written by Ruby. The first goal of this proje
- [Supported Ruby version](#supported-ruby-version)
- [Development](#development)
- [How to generate parser.rb](#how-to-generate-parserrb)
- [How to Write a Type Signature](#how-to-write-a-type-signature)
- [Test](#test)
- [Call-stack Profiling Lrama](#call-stack-profiling-lrama)
- [1. Create parse.tmp.y in ruby/ruby](#1-create-parsetmpy-in-rubyruby)
Expand Down Expand Up @@ -118,6 +119,14 @@ $ bundle exec rake build:parser
`parser.rb` is generated from `parser.y` by Racc.
Run the rake command when you update `parser.y` then commit changes of both files.

### How to Write a Type Signature

We use [Steep](https://github.com/soutaro/steep) for type checking and [rbs-inline](https://github.com/soutaro/rbs-inline) for type declarations.

Currently, type signatures are declared in the [sig/lrama](https://github.com/ruby/lrama/blob/master/sig/lrama) directory. However, these files will be replaced with `rbs-inline`. This means type signatures should be written directly in the source code.
Copy link
Member Author

Choose a reason for hiding this comment

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

In the future, once the migration is complete, only this section can be erased.


For guidance on writing type signatures, refer to the [Syntax Guide](https://github.com/soutaro/rbs-inline/wiki/Syntax-guide) in the rbs-inline documentation.

### Test

Running tests:
Expand Down
7 changes: 6 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ task :steep do
sh "bundle exec steep check"
end

task default: %i[spec steep]
desc "Run rbs-inline"
task :rbs_inline do
sh "bundle exec rbs-inline --output lib/"
end

task default: %i[spec rbs_inline steep]
Loading