2015-09-02 18:00:31 -04:00
|
|
|
# Contributing
|
|
|
|
|
2015-10-31 17:20:16 -04:00
|
|
|
Thanks for your interest in PaperTrail!
|
|
|
|
|
|
|
|
Ask usage questions on Stack Overflow:
|
2016-02-23 17:35:00 -05:00
|
|
|
https://stackoverflow.com/tags/paper-trail-gem
|
2015-10-31 17:20:16 -04:00
|
|
|
|
|
|
|
**Please do not use github issues to ask usage questions.**
|
|
|
|
|
|
|
|
On github, we appreciate bug reports, feature
|
2015-09-02 18:00:31 -04:00
|
|
|
suggestions, and especially pull requests.
|
|
|
|
|
2015-10-31 17:20:16 -04:00
|
|
|
Thanks, and happy (paper) trails :)
|
2015-09-02 18:00:31 -04:00
|
|
|
|
2015-11-27 16:33:40 -05:00
|
|
|
## Reporting Bugs
|
|
|
|
|
|
|
|
Please use our [bug report template][1].
|
|
|
|
|
2015-10-31 17:20:16 -04:00
|
|
|
## Development
|
|
|
|
|
2016-12-04 22:19:06 -05:00
|
|
|
Install gems with `bundle exec appraisal install`. This requires ruby >= 2.0.
|
|
|
|
(It is still possible to run the `ar-4.2` gemfile locally on ruby 1.9.3, but
|
|
|
|
not the `ar-5.0` gemfile.)
|
2016-08-09 00:09:15 -04:00
|
|
|
|
2015-10-31 20:29:06 -04:00
|
|
|
Testing is a little awkward because the test suite:
|
|
|
|
|
2016-11-30 12:03:22 -05:00
|
|
|
1. Supports multiple versions of rails
|
2016-01-14 23:45:23 -05:00
|
|
|
1. Contains a "dummy" rails app with three databases (test, foo, and bar)
|
2016-01-04 23:53:52 -05:00
|
|
|
1. Supports three different RDBMS': sqlite, mysql, and postgres
|
|
|
|
|
2016-12-10 13:49:41 -05:00
|
|
|
### Test sqlite, AR 4.2
|
2015-10-31 17:20:16 -04:00
|
|
|
|
|
|
|
```
|
2015-10-31 20:29:06 -04:00
|
|
|
# Create the appropriate database config. file
|
|
|
|
rm test/dummy/config/database.yml
|
|
|
|
DB=sqlite bundle exec rake prepare
|
|
|
|
|
2016-12-10 13:49:41 -05:00
|
|
|
# If this is the first test run ever, create databases.
|
|
|
|
# We can't use `appraisal` inside the test dummy, so we must set `BUNDLE_GEMFILE`.
|
|
|
|
# See test/dummy/config/boot.rb for a complete explanation.
|
2015-10-31 20:29:06 -04:00
|
|
|
cd test/dummy
|
2016-12-10 13:49:41 -05:00
|
|
|
export BUNDLE_GEMFILE=../../gemfiles/ar_4.2.gemfile
|
2015-10-31 20:29:06 -04:00
|
|
|
RAILS_ENV=test bundle exec rake db:setup
|
|
|
|
RAILS_ENV=foo bundle exec rake db:setup
|
|
|
|
RAILS_ENV=bar bundle exec rake db:setup
|
2016-12-10 13:49:41 -05:00
|
|
|
unset BUNDLE_GEMFILE
|
|
|
|
cd ../..
|
|
|
|
|
|
|
|
# Run tests
|
|
|
|
DB=sqlite bundle exec appraisal ar-4.2 rake
|
2017-03-31 21:42:14 -04:00
|
|
|
|
2017-03-31 22:11:08 -04:00
|
|
|
# Run a single test file
|
2017-03-31 21:42:14 -04:00
|
|
|
DB=sqlite bundle exec appraisal ar-4.2 ruby -I test test/unit/associations_test.rb
|
2017-03-31 22:11:08 -04:00
|
|
|
DB=sqlite bundle exec appraisal ar-4.2 rspec spec/paper_trail/serializers/json_spec.rb
|
2016-12-10 13:49:41 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
### Test sqlite, AR 5
|
|
|
|
|
|
|
|
```
|
|
|
|
# Create the appropriate database config. file
|
|
|
|
rm test/dummy/config/database.yml
|
|
|
|
DB=sqlite bundle exec rake prepare
|
|
|
|
|
|
|
|
# If this is the first test run ever, create databases.
|
|
|
|
# We can't use `appraisal` inside the test dummy, so we must set `BUNDLE_GEMFILE`.
|
|
|
|
# See test/dummy/config/boot.rb for a complete explanation.
|
|
|
|
cd test/dummy
|
|
|
|
export BUNDLE_GEMFILE=../../gemfiles/ar_5.0.gemfile
|
|
|
|
RAILS_ENV=test bundle exec rake db:environment:set db:setup
|
|
|
|
RAILS_ENV=foo bundle exec rake db:environment:set db:setup
|
|
|
|
RAILS_ENV=bar bundle exec rake db:environment:set db:setup
|
|
|
|
unset BUNDLE_GEMFILE
|
2015-10-31 20:29:06 -04:00
|
|
|
cd ../..
|
|
|
|
|
|
|
|
# Run tests
|
2016-11-30 12:03:22 -05:00
|
|
|
DB=sqlite bundle exec appraisal ar-5.0 rake
|
2015-10-31 17:20:16 -04:00
|
|
|
```
|
|
|
|
|
2016-12-10 13:49:41 -05:00
|
|
|
### Test mysql, AR 5
|
2015-09-02 18:00:31 -04:00
|
|
|
|
2015-10-31 17:20:16 -04:00
|
|
|
```
|
2015-10-31 20:29:06 -04:00
|
|
|
# Create the appropriate database config. file
|
|
|
|
rm test/dummy/config/database.yml
|
|
|
|
DB=mysql bundle exec rake prepare
|
|
|
|
|
2016-12-10 13:49:41 -05:00
|
|
|
# If this is the first test run ever, create databases.
|
|
|
|
# We can't use `appraisal` inside the test dummy, so we must set `BUNDLE_GEMFILE`.
|
|
|
|
# See test/dummy/config/boot.rb for a complete explanation.
|
2015-10-31 17:20:16 -04:00
|
|
|
cd test/dummy
|
2016-12-10 13:49:41 -05:00
|
|
|
export BUNDLE_GEMFILE=../../gemfiles/ar_5.0.gemfile
|
|
|
|
RAILS_ENV=test bundle exec rake db:environment:set db:setup
|
|
|
|
RAILS_ENV=foo bundle exec rake db:environment:set db:setup
|
|
|
|
RAILS_ENV=bar bundle exec rake db:environment:set db:setup
|
|
|
|
unset BUNDLE_GEMFILE
|
2015-10-31 17:20:16 -04:00
|
|
|
cd ../..
|
2015-10-31 20:29:06 -04:00
|
|
|
|
|
|
|
# Run tests
|
2016-11-30 12:03:22 -05:00
|
|
|
DB=mysql bundle exec appraisal ar-5.0 rake
|
2015-10-31 17:20:16 -04:00
|
|
|
```
|
2015-11-27 16:33:40 -05:00
|
|
|
|
2016-12-10 13:49:41 -05:00
|
|
|
### Test postgres, AR 5
|
2015-12-19 20:53:36 -05:00
|
|
|
|
|
|
|
```
|
|
|
|
# Create the appropriate database config. file
|
|
|
|
rm test/dummy/config/database.yml
|
|
|
|
DB=postgres bundle exec rake prepare
|
|
|
|
|
|
|
|
# If this is the first test run ever, create databases.
|
|
|
|
# Unlike mysql, use create/migrate instead of setup.
|
2016-12-10 13:49:41 -05:00
|
|
|
# We can't use `appraisal` inside the test dummy, so we must set `BUNDLE_GEMFILE`.
|
|
|
|
# See test/dummy/config/boot.rb for a complete explanation.
|
2015-12-19 20:53:36 -05:00
|
|
|
cd test/dummy
|
2016-12-10 13:49:41 -05:00
|
|
|
export BUNDLE_GEMFILE=../../gemfiles/ar_5.0.gemfile
|
2016-09-30 23:44:59 -04:00
|
|
|
DB=postgres RAILS_ENV=test bundle exec rake db:drop db:create db:migrate
|
|
|
|
DB=postgres RAILS_ENV=foo bundle exec rake db:drop db:create db:migrate
|
|
|
|
DB=postgres RAILS_ENV=bar bundle exec rake db:drop db:create db:migrate
|
2016-12-10 13:49:41 -05:00
|
|
|
unset BUNDLE_GEMFILE
|
2015-12-19 20:53:36 -05:00
|
|
|
cd ../..
|
|
|
|
|
|
|
|
# Run tests
|
|
|
|
DB=postgres bundle exec rake
|
2016-11-30 12:03:22 -05:00
|
|
|
DB=postgres bundle exec appraisal ar-5.0 rake
|
2015-12-19 20:53:36 -05:00
|
|
|
```
|
|
|
|
|
2017-02-05 20:57:54 -05:00
|
|
|
## Editing the migration
|
|
|
|
|
|
|
|
After editing `test/dummy/db/migrate/20110208155312_set_up_test_tables.rb` ..
|
|
|
|
|
|
|
|
```
|
|
|
|
cd test/dummy
|
|
|
|
export BUNDLE_GEMFILE=../../gemfiles/ar_5.0.gemfile
|
|
|
|
RAILS_ENV=test bundle exec rake db:environment:set db:drop db:create db:migrate
|
|
|
|
RAILS_ENV=foo bundle exec rake db:environment:set db:drop db:create db:migrate
|
|
|
|
RAILS_ENV=bar bundle exec rake db:environment:set db:drop db:create db:migrate
|
|
|
|
unset BUNDLE_GEMFILE
|
|
|
|
cd ../..
|
|
|
|
```
|
|
|
|
|
|
|
|
Don't forget to commit changes to `schema.rb`.
|
|
|
|
|
2016-11-30 12:03:22 -05:00
|
|
|
## Releases
|
2016-05-02 12:19:18 -04:00
|
|
|
|
|
|
|
1. Set the version in lib/paper_trail/version_number.rb
|
|
|
|
- Set PRE to nil unless it's a pre-release (beta, rc, etc.)
|
2016-06-27 01:22:47 -04:00
|
|
|
1. In the changelog,
|
|
|
|
- Replace "Unreleased" with the date in iso-8601 format
|
|
|
|
- Add a new "Unreleased" section
|
2016-12-04 17:13:20 -05:00
|
|
|
1. In the readme, update references to version number, including
|
|
|
|
- documentation links table
|
|
|
|
- compatability table
|
2016-05-20 19:19:29 -04:00
|
|
|
1. Commit
|
2016-06-27 01:22:47 -04:00
|
|
|
1. git tag -a -m "v5.0.0" "v5.0.0" # or whatever number
|
2016-09-08 12:29:24 -04:00
|
|
|
1. git push --tags origin 5-stable # or whatever branch
|
2016-06-27 01:22:47 -04:00
|
|
|
1. gem build paper_trail.gemspec
|
|
|
|
1. gem push paper_trail-5.0.0.gem
|
2016-05-02 12:19:18 -04:00
|
|
|
|
2015-11-27 16:33:40 -05:00
|
|
|
[1]: https://github.com/airblade/paper_trail/blob/master/doc/bug_report_template.rb
|