2014-08-17 18:54:05 +08:00
# Contributing to Grape-Swagger
2014-07-14 21:43:23 +08:00
2015-08-20 00:12:41 +08:00
This project is work of [many contributors ](https://github.com/ruby-grape/grape-swagger/graphs/contributors ).
You're encouraged to submit [pull requests ](https://github.com/ruby-grape/grape-swagger/pulls ),
[propose features and discuss issues ](https://github.com/ruby-grape/grape-swagger/issues ).
2014-08-17 18:54:05 +08:00
When in doubt, ask a question in the [Grape Google Group ](http://groups.google.com/group/ruby-grape ).
2014-07-14 21:43:23 +08:00
2014-08-17 18:54:05 +08:00
In the examples below, substitute your Github username for `contributor` in URLs.
## Fork the Project
2014-07-14 21:43:23 +08:00
2015-08-20 00:12:41 +08:00
Fork the [project on Github ](https://github.com/ruby-grape/grape-swagger ) and check out your copy.
2014-07-14 21:43:23 +08:00
```
git clone https://github.com/contributor/grape-swagger.git
cd grape-swagger
2015-08-20 00:12:41 +08:00
git remote add upstream https://github.com/ruby-grape/grape-swagger.git
2014-07-14 21:43:23 +08:00
```
2014-08-17 18:54:05 +08:00
## Create a Topic Branch
2014-07-14 21:43:23 +08:00
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
```
git checkout master
git pull upstream master
git checkout -b my-feature-branch
```
2014-08-17 18:54:05 +08:00
## Bundle Install and Test
2014-07-14 21:43:23 +08:00
Ensure that you can build the project and run tests.
```
bundle install
bundle exec rake
```
2014-08-17 18:54:05 +08:00
## Write Tests
2014-07-14 21:43:23 +08:00
2014-08-17 18:54:05 +08:00
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build.
Add to [spec ](spec ).
2014-07-14 21:43:23 +08:00
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
2014-08-17 18:54:05 +08:00
## Write Code
2014-07-14 21:43:23 +08:00
Implement your feature or bug fix.
2015-08-20 00:12:41 +08:00
Ruby style is enforced with [RuboCop ](https://github.com/bbatsov/rubocop ).
2014-08-17 18:54:05 +08:00
Run `bundle exec rubocop` and fix any style issues highlighted.
2014-07-14 21:43:23 +08:00
Make sure that `bundle exec rake` completes without errors.
2014-08-17 18:54:05 +08:00
## Write Documentation
2014-07-14 21:43:23 +08:00
Document any external behavior in the [README ](README.md ).
2014-08-17 18:54:05 +08:00
## Update Changelog
2014-07-14 21:43:23 +08:00
2014-08-17 18:54:05 +08:00
Add a line to [CHANGELOG ](CHANGELOG.md ) under *Next Release* .
Make it look like every other line, including your name and link to your Github account.
2014-07-14 21:43:23 +08:00
2014-08-17 18:54:05 +08:00
## Commit Changes
2014-07-14 21:43:23 +08:00
Make sure git knows your name and email address:
```
git config --global user.name "Your Name"
git config --global user.email "contributor@example.com"
```
Writing good commit logs is important. A commit log should describe what changed and why.
```
git add ...
git commit
```
2014-08-17 18:54:05 +08:00
## Push
2014-07-14 21:43:23 +08:00
```
git push origin my-feature-branch
```
2014-08-17 18:54:05 +08:00
## Make a Pull Request
2014-07-14 21:43:23 +08:00
2015-08-20 00:12:41 +08:00
Go to https://github.com/contributor/grape-swagger and select your feature branch.
2014-08-17 18:54:05 +08:00
Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
2014-07-14 21:43:23 +08:00
2014-08-17 18:54:05 +08:00
## Rebase
2014-07-14 21:43:23 +08:00
If you've been working on a change for a while, rebase with upstream/master.
```
git fetch upstream
git rebase upstream/master
git push origin my-feature-branch -f
```
2014-08-17 18:54:05 +08:00
## Update CHANGELOG Again
2014-07-14 21:43:23 +08:00
Update the [CHANGELOG ](CHANGELOG.md ) with the pull request number. A typical entry looks as follows.
```
2015-08-20 00:12:41 +08:00
* [#123 ](https://github.com/ruby-grape/grape-swagger/pull/123 ): Reticulated splines - [@contributor ](https://github.com/contributor ).
2014-07-14 21:43:23 +08:00
```
Amend your previous commit and force push the changes.
```
git commit --amend
git push origin my-feature-branch -f
```
2014-08-17 18:54:05 +08:00
## Check on Your Pull Request
2014-07-14 21:43:23 +08:00
2022-07-26 15:44:42 +08:00
Go back to your pull request after a few minutes and see whether it passed muster with GitHub Actions. Everything should look green, otherwise fix issues and amend your commit as described above.
2014-07-14 21:43:23 +08:00
2014-08-17 18:54:05 +08:00
## Be Patient
2014-07-14 21:43:23 +08:00
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
2014-08-17 18:54:05 +08:00
## Thank You
2014-07-14 21:43:23 +08:00
Please do know that we really appreciate and value your time and work. We love you, really.