mongoid-history 0.8.3 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -1
- data/.document +5 -5
- data/.github/workflows/test.yml +72 -0
- data/.gitignore +46 -46
- data/.rspec +2 -2
- data/.rubocop.yml +6 -6
- data/.rubocop_todo.yml +99 -99
- data/CHANGELOG.md +173 -163
- data/CONTRIBUTING.md +117 -118
- data/Dangerfile +1 -1
- data/Gemfile +49 -40
- data/LICENSE.txt +20 -20
- data/README.md +609 -608
- data/RELEASING.md +66 -67
- data/Rakefile +24 -24
- data/UPGRADING.md +53 -53
- data/lib/mongoid/history/attributes/base.rb +72 -72
- data/lib/mongoid/history/attributes/create.rb +45 -45
- data/lib/mongoid/history/attributes/destroy.rb +34 -34
- data/lib/mongoid/history/attributes/update.rb +104 -104
- data/lib/mongoid/history/options.rb +177 -177
- data/lib/mongoid/history/trackable.rb +588 -583
- data/lib/mongoid/history/tracker.rb +247 -247
- data/lib/mongoid/history/version.rb +5 -5
- data/lib/mongoid/history.rb +77 -77
- data/lib/mongoid-history.rb +1 -1
- data/mongoid-history.gemspec +25 -25
- data/perf/benchmark_modified_attributes_for_create.rb +65 -65
- data/perf/gc_suite.rb +21 -21
- data/spec/integration/embedded_in_polymorphic_spec.rb +112 -112
- data/spec/integration/integration_spec.rb +976 -976
- data/spec/integration/multi_relation_spec.rb +47 -47
- data/spec/integration/multiple_trackers_spec.rb +68 -68
- data/spec/integration/nested_embedded_documents_spec.rb +64 -64
- data/spec/integration/nested_embedded_documents_tracked_in_parent_spec.rb +124 -124
- data/spec/integration/nested_embedded_polymorphic_documents_spec.rb +115 -115
- data/spec/integration/subclasses_spec.rb +47 -47
- data/spec/integration/track_history_order_spec.rb +84 -84
- data/spec/integration/validation_failure_spec.rb +76 -76
- data/spec/spec_helper.rb +32 -30
- data/spec/support/error_helpers.rb +7 -0
- data/spec/support/mongoid.rb +11 -11
- data/spec/support/mongoid_history.rb +12 -12
- data/spec/unit/attributes/base_spec.rb +141 -141
- data/spec/unit/attributes/create_spec.rb +342 -342
- data/spec/unit/attributes/destroy_spec.rb +228 -228
- data/spec/unit/attributes/update_spec.rb +342 -342
- data/spec/unit/callback_options_spec.rb +165 -165
- data/spec/unit/embedded_methods_spec.rb +87 -87
- data/spec/unit/history_spec.rb +58 -58
- data/spec/unit/my_instance_methods_spec.rb +555 -555
- data/spec/unit/options_spec.rb +365 -365
- data/spec/unit/singleton_methods_spec.rb +406 -406
- data/spec/unit/store/default_store_spec.rb +11 -11
- data/spec/unit/store/request_store_spec.rb +13 -13
- data/spec/unit/trackable_spec.rb +1057 -987
- data/spec/unit/tracker_spec.rb +190 -190
- metadata +9 -7
- data/.travis.yml +0 -36
data/CONTRIBUTING.md
CHANGED
@@ -1,118 +1,117 @@
|
|
1
|
-
Contributing to Mongoid-History
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
git
|
22
|
-
git
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
bundle
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
git config --global user.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
git
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
git
|
89
|
-
git
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
git
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
Please do know that we really appreciate and value your time and work. We love you, really.
|
1
|
+
# Contributing to Mongoid-History
|
2
|
+
|
3
|
+
Mongoid-History is work of [many of contributors](https://github.com/mongoid/mongoid-history/graphs/contributors). You're encouraged to submit [pull requests](https://github.com/mongoid/mongoid-history/pulls), [propose features, ask questions and discuss issues](https://github.com/mongoid/mongoid-history/issues).
|
4
|
+
|
5
|
+
### Fork the Project
|
6
|
+
|
7
|
+
Fork the [project on Github](https://github.com/mongoid/mongoid-history) and check out your copy.
|
8
|
+
|
9
|
+
```
|
10
|
+
git clone https://github.com/contributor/mongoid-history.git
|
11
|
+
cd mongoid-history
|
12
|
+
git remote add upstream https://github.com/mongoid/mongoid-history.git
|
13
|
+
```
|
14
|
+
|
15
|
+
### Create a Topic Branch
|
16
|
+
|
17
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
18
|
+
|
19
|
+
```
|
20
|
+
git checkout master
|
21
|
+
git pull upstream master
|
22
|
+
git checkout -b my-feature-branch
|
23
|
+
```
|
24
|
+
|
25
|
+
### Bundle Install and Test
|
26
|
+
|
27
|
+
Ensure that you can build the project and run tests.
|
28
|
+
|
29
|
+
```
|
30
|
+
bundle install
|
31
|
+
bundle exec rake
|
32
|
+
```
|
33
|
+
|
34
|
+
### Write Tests
|
35
|
+
|
36
|
+
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/mongoid-history](spec/mongoid-history).
|
37
|
+
|
38
|
+
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
|
39
|
+
|
40
|
+
### Write Code
|
41
|
+
|
42
|
+
Implement your feature or bug fix.
|
43
|
+
|
44
|
+
Ruby style is enforced with [Rubocop](https://github.com/bbatsov/rubocop), run `bundle exec rubocop` and fix any style issues highlighted.
|
45
|
+
|
46
|
+
Make sure that `bundle exec rake` completes without errors.
|
47
|
+
|
48
|
+
### Write Documentation
|
49
|
+
|
50
|
+
Document any external behavior in the [README](README.md).
|
51
|
+
|
52
|
+
### Update Changelog
|
53
|
+
|
54
|
+
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.
|
55
|
+
|
56
|
+
### Commit Changes
|
57
|
+
|
58
|
+
Make sure git knows your name and email address:
|
59
|
+
|
60
|
+
```
|
61
|
+
git config --global user.name "Your Name"
|
62
|
+
git config --global user.email "contributor@example.com"
|
63
|
+
```
|
64
|
+
|
65
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
66
|
+
|
67
|
+
```
|
68
|
+
git add ...
|
69
|
+
git commit
|
70
|
+
```
|
71
|
+
|
72
|
+
### Push
|
73
|
+
|
74
|
+
```
|
75
|
+
git push origin my-feature-branch
|
76
|
+
```
|
77
|
+
|
78
|
+
### Make a Pull Request
|
79
|
+
|
80
|
+
Go to https://github.com/contributor/mongoid-history and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
81
|
+
|
82
|
+
### Rebase
|
83
|
+
|
84
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
85
|
+
|
86
|
+
```
|
87
|
+
git fetch upstream
|
88
|
+
git rebase upstream/master
|
89
|
+
git push origin my-feature-branch -f
|
90
|
+
```
|
91
|
+
|
92
|
+
### Update CHANGELOG Again
|
93
|
+
|
94
|
+
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
95
|
+
|
96
|
+
```
|
97
|
+
* [#123](https://github.com/mongoid/mongoid-history/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
98
|
+
```
|
99
|
+
|
100
|
+
Amend your previous commit and force push the changes.
|
101
|
+
|
102
|
+
```
|
103
|
+
git commit --amend
|
104
|
+
git push origin my-feature-branch -f
|
105
|
+
```
|
106
|
+
|
107
|
+
### Check on Your Pull Request
|
108
|
+
|
109
|
+
Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
|
110
|
+
|
111
|
+
### Be Patient
|
112
|
+
|
113
|
+
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!
|
114
|
+
|
115
|
+
### Thank You
|
116
|
+
|
117
|
+
Please do know that we really appreciate and value your time and work. We love you, really.
|
data/Dangerfile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
danger.import_dangerfile(gem: 'mongoid-danger')
|
1
|
+
danger.import_dangerfile(gem: 'mongoid-danger')
|
data/Gemfile
CHANGED
@@ -1,40 +1,49 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
case version = ENV['MONGOID_VERSION'] || '~> 7.0
|
6
|
-
when 'HEAD'
|
7
|
-
gem 'mongoid', github: 'mongodb/mongoid'
|
8
|
-
when
|
9
|
-
gem 'mongoid', '~> 7.
|
10
|
-
when
|
11
|
-
gem 'mongoid', '~>
|
12
|
-
when
|
13
|
-
gem 'mongoid', '~>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
gem 'mongoid
|
18
|
-
when
|
19
|
-
gem 'mongoid', '~>
|
20
|
-
|
21
|
-
gem 'mongoid',
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
gem '
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
gem '
|
36
|
-
gem '
|
37
|
-
gem '
|
38
|
-
|
39
|
-
|
40
|
-
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
case version = ENV['MONGOID_VERSION'] || '~> 7.0'
|
6
|
+
when 'HEAD'
|
7
|
+
gem 'mongoid', github: 'mongodb/mongoid'
|
8
|
+
when '7'
|
9
|
+
gem 'mongoid', '~> 7.3'
|
10
|
+
when '7.3'
|
11
|
+
gem 'mongoid', '~> 7.3.0'
|
12
|
+
when '7.2'
|
13
|
+
gem 'mongoid', '~> 7.2.0'
|
14
|
+
when '7.1'
|
15
|
+
gem 'mongoid', '~> 7.1.0'
|
16
|
+
when '7.0'
|
17
|
+
gem 'mongoid', '~> 7.0.0'
|
18
|
+
when '6'
|
19
|
+
gem 'mongoid', '~> 6.0'
|
20
|
+
when '5'
|
21
|
+
gem 'mongoid', '~> 5.0'
|
22
|
+
gem 'mongoid-observers', '~> 0.2'
|
23
|
+
when '4'
|
24
|
+
gem 'mongoid', '~> 4.0'
|
25
|
+
gem 'mongoid-observers', '~> 0.2'
|
26
|
+
when '3'
|
27
|
+
gem 'mongoid', '~> 3.1'
|
28
|
+
else
|
29
|
+
gem 'mongoid', version
|
30
|
+
end
|
31
|
+
|
32
|
+
gem 'mongoid-compatibility'
|
33
|
+
|
34
|
+
group :development, :test do
|
35
|
+
gem 'bundler'
|
36
|
+
gem 'pry'
|
37
|
+
gem 'rake'
|
38
|
+
end
|
39
|
+
|
40
|
+
group :test do
|
41
|
+
gem 'benchmark-ips', require: false
|
42
|
+
gem 'coveralls'
|
43
|
+
gem 'gem-release'
|
44
|
+
gem 'mongoid-danger', '~> 0.1.0', require: false
|
45
|
+
gem 'request_store'
|
46
|
+
gem 'rspec', '~> 3.1'
|
47
|
+
gem 'rubocop', '0.48.1'
|
48
|
+
gem 'yard'
|
49
|
+
end
|
data/LICENSE.txt
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2011-
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
Copyright (c) 2011-2020 Aaron Qian & Contributors
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|