2015-10-29 00:39:46 +00:00
|
|
|
# Contributing to shoulda-matchers
|
|
|
|
|
2014-10-16 15:59:07 +00:00
|
|
|
We love contributions from the community! Here's a quick guide to making a pull
|
2015-04-03 02:04:18 +00:00
|
|
|
request.
|
2012-03-19 00:39:15 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
1. If you haven't contributed before, please read and understand the [Code of
|
|
|
|
Conduct].
|
|
|
|
|
|
|
|
1. Ensure that you have a [working Ruby environment].
|
|
|
|
|
|
|
|
1. Fork the repo on GitHub, then clone it to your machine.
|
|
|
|
|
|
|
|
1. Now that you've cloned the repo, navigate to it and install dependencies by
|
|
|
|
running:
|
2015-03-15 22:16:18 +00:00
|
|
|
|
2018-01-24 06:02:06 +00:00
|
|
|
bundle install
|
2015-04-15 15:57:03 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
1. All tests should be passing, but it's a good idea to run them anyway
|
|
|
|
before starting any work:
|
2018-01-24 06:02:06 +00:00
|
|
|
|
|
|
|
bundle exec rake
|
2012-03-19 00:39:15 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
1. If you're adding functionality or fixing a bug, you'll want to add a
|
|
|
|
failing test for the issue first.
|
2015-03-15 22:16:18 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
1. Now you can implement the feature or bugfix.
|
2012-03-19 00:39:15 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
1. Since we only accept pull requests with passing tests, it's a good idea to
|
|
|
|
run the tests again. Since you're probably working on a single file, you can
|
|
|
|
run the tests for that file with the following command:
|
2012-03-19 00:39:15 +00:00
|
|
|
|
2018-01-24 06:02:06 +00:00
|
|
|
bundle exec appraisal <Appraisal name> rspec <path of test file to run>
|
|
|
|
|
|
|
|
You can find a list of valid Appraisals by running:
|
|
|
|
|
|
|
|
bundle exec rake appraisal:list
|
2012-03-19 00:39:15 +00:00
|
|
|
|
2018-01-24 06:02:06 +00:00
|
|
|
(If you're familiar with Zeus, you can also run unit tests by running `zeus
|
|
|
|
start` in one shell, and then running the following in another:)
|
2015-11-30 01:57:45 +00:00
|
|
|
|
2018-01-24 06:02:06 +00:00
|
|
|
zeus rspec <path of test file to run>
|
2015-11-30 01:57:45 +00:00
|
|
|
|
2018-01-24 06:02:06 +00:00
|
|
|
In any case, to run the entire test suite again, say:
|
|
|
|
|
|
|
|
bundle exec rake
|
2015-10-29 00:39:46 +00:00
|
|
|
|
|
|
|
1. Finally, push to your fork and submit a pull request.
|
2012-03-19 00:39:15 +00:00
|
|
|
|
2018-01-24 06:02:06 +00:00
|
|
|
At this point, you're waiting on us. We may suggest some changes to make to your
|
|
|
|
code to fit within the project style, or discuss alternate ways of addressing
|
|
|
|
the issue in question. When we're happy with everything, we'll bring your
|
|
|
|
changes into master. Now you're a contributor!
|
2012-03-19 00:39:15 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
## Addendum: Setting up your environment
|
2015-03-15 22:16:18 +00:00
|
|
|
|
2018-01-24 06:02:06 +00:00
|
|
|
### Installing Ruby
|
|
|
|
|
|
|
|
shoulda-matchers is only compatible with Ruby 2.x. A `.ruby-version` is included
|
|
|
|
in the repo, so if you're using one of the Ruby version manager tools, then you
|
|
|
|
should be using (or have been prompted to install) the latest version of Ruby.
|
|
|
|
If not, you'll want to do that.
|
|
|
|
|
|
|
|
[working Ruby environment]: #addendum-setting-up-your-environment
|
|
|
|
[Code of Conduct]: https://thoughtbot.com/open-source-code-of-conduct
|
|
|
|
[execjs]: https://github.com/sstephenson/execjs
|
|
|
|
|
|
|
|
### Linux-specific instructions
|
2015-03-15 22:16:18 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
#### Debian/Ubuntu
|
2015-03-15 22:16:18 +00:00
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
Run this command to install necessary dependencies:
|
2015-03-15 22:16:18 +00:00
|
|
|
|
|
|
|
```
|
2015-10-29 00:39:46 +00:00
|
|
|
sudo apt-get install -y ruby-dev libpq-dev libsqlite3-dev nodejs
|
2015-03-15 22:16:18 +00:00
|
|
|
```
|
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
#### RedHat
|
|
|
|
|
|
|
|
Run this command to install necessary dependencies:
|
2015-03-15 22:16:18 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
sudo yum install -y ruby-devel postgresql-devel sqlite-devel zlib-devel
|
|
|
|
```
|
|
|
|
|
2015-10-29 00:39:46 +00:00
|
|
|
Then, install one of the JavaScript runtimes supported by [execjs]. For
|
2015-03-15 22:16:18 +00:00
|
|
|
instance, to install node.js:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo su
|
|
|
|
curl -sL https://rpm.nodesource.com/setup | bash -
|
|
|
|
yum install -y nodejs
|
|
|
|
```
|