How to contribute to LINE Bot SDK for Ruby project
First of all, thank you so much for taking your time to contribute! LINE Bot SDK for Ruby is not very different from any other open source projects you are aware of. It will be amazing if you could help us by doing any of the following:
- File an issue in the issue tracker to report bugs and propose new features and improvements.
- Ask a question using the issue tracker.
- Contribute your work by sending a pull request.
Development
Install dependencies
Run bundle install
to install all dependencies for development.
Understand the project structure
The project structure is as follows:
lib
: The main library code.sig
: The RBS code.sig-vendor
: The RBS code outside this repository.spec
: The test code.examples
: Example projects that use the library.generator
: The code generator for the library.
Edit pebble template
Almost all code are generated with pebble template, based on line-openapi's yaml.
Thus, you can't edit almost all code under lib/line/bot/v2/<dir>.rb
and sig/line/bot/v2/<dir>.rbs
directly.
You need to edit the pebble template under resources instead.
After editing the templates, run generate-code.py
to generate the code, and then commit all affected files.
If not, CI status will be red.
When you update code, be sure to check consistencies between lib/**.rb
and sig/**.rbs
.
Add unit tests
We use RSpec for unit tests.
Please add tests to the spec
directory to verify your changes continuously.
Especially for bug fixes, please follow this flow for testing and development:
- Write a test before making changes to the library and confirm that the test fails.
- Modify the code of the library.
- Run the test again and confirm that it passes thanks to (2).
Run your code in your local
Example projects depend on this repository directly. You can use new or fixed gem in example projects before submitting a pull request.
Run all CI tasks in your local
Rakefile
defines almost all tasks.
You can run all tasks in your local by running bundle exec rake ci
command.
Upgrade dependencies
The libraries that the library itself depends on are listed in the line-bot-api.gemspec
file.
Those needed only for development are written in the Gemfile
.
The versions in the gemspec file are set as low as possible, allowing users to specify higher versions in their application's Gemfile.
For files related to RBS, refer to rbs_collections.yaml
and the Steepfile
.
You can update by running rbs collection update <LIB_NAME>
.
YARD
We use YARD to generate and maintain our code documentation. Please make sure your new or modified code is also covered by proper YARD doc comments. Good documentation ensures that contributors and users can easily read and understand how the methods and classes work.
How to generate and view documentation locally
1. Start a local documentation server
Run the following command to start a local YARD server that will automatically reload when files change:
bundle exec yard server --reload
Then open the printed URL in your browser (e.g., http://localhost:8808).
2. Validate your documentation
Before pushing your changes, run the following command to check YARD documentation coverage and warnings:
bundle exec yard stats ./lib/line/bot/v2 --fail-on-warning
This will fail if there are missing doc comments or any YARD-specific warnings. Make sure to fix any issues before creating a pull request.
For more details on how to write YARD doc comments, refer to YARD’s official Getting Started guide.
Contributor license agreement
When you send a pull request and it's a non-trivial change beyond fixing typos, please make sure to sign the ICLA (individual contributor license agreement). Please contact us if you need the CCLA (corporate contributor license agreement).