mongoid-history 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -5
- data/.rspec +1 -1
- data/.rubocop.yml +75 -0
- data/.travis.yml +7 -5
- data/CHANGELOG.md +94 -76
- data/Gemfile +16 -12
- data/LICENSE.txt +20 -20
- data/README.md +309 -307
- data/Rakefile +37 -37
- data/VERSION +1 -1
- data/lib/mongoid/history/trackable.rb +337 -338
- data/lib/mongoid/history/tracker.rb +215 -220
- data/lib/mongoid/history.rb +25 -27
- data/lib/mongoid-history.rb +9 -10
- data/mongoid-history.gemspec +80 -68
- data/spec/integration/integration_spec.rb +788 -754
- data/spec/integration/multi_relation_spec.rb +53 -50
- data/spec/integration/nested_embedded_documents_spec.rb +77 -77
- data/spec/integration/subclasses_spec.rb +29 -0
- data/spec/spec_helper.rb +10 -11
- data/spec/support/mongoid.rb +11 -15
- data/spec/support/mongoid_history.rb +13 -15
- data/spec/trackable_spec.rb +240 -240
- data/spec/tracker_spec.rb +10 -10
- metadata +65 -30
- data/lib/mongoid/history/sweeper.rb +0 -44
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YWI0Y2U4OTJkZGNjZDE3NjNmYzAxNmFjNWE1NDc0ZmNhOTcxOWJiZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzYyODI5Y2I4ODJhZGU5MjdmYmIxZjc2NTY3MzE5YWI0Mjk0MjA5MA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Mjk5ZGI3MjRhMzQ1YzZhZTUxOTFjMThhYWE0ZjZiNTNhOWE4NzkzYjJjOWFl
|
10
|
+
MGQxMGVlZTFkNWI2M2Q5NjNkYWRhZWRkMjgxNmQxMTllYzg4OWJjNzk2NmU2
|
11
|
+
ZmYwMjI5NzJkNWQzZWY1NzMzNjBjZmRkYmRlNGViMzczYzdlMDk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTBlYzQwMTRmYmViNGRiN2RmOGVjZDVhMWNhYzhjMTBiNTgwYTE4OWU1NDJh
|
14
|
+
MGVjNGI5MGFiNmYyYzJhYmM5Nzc4ZDhlNGRmOWU4Y2E3YTc0NDk2N2UxNGJi
|
15
|
+
ZTg0MDgxYmZlNmRkM2UwZjc3OGE2ODQ5ZjE4ZTM1MDYzNzU3Zjc=
|
data/.document
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
lib/**/*.rb
|
2
|
-
bin/*
|
3
|
-
-
|
4
|
-
features/**/*.feature
|
5
|
-
LICENSE.txt
|
1
|
+
lib/**/*.rb
|
2
|
+
bin/*
|
3
|
+
-
|
4
|
+
features/**/*.feature
|
5
|
+
LICENSE.txt
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--color
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
AllCops:
|
2
|
+
Excludes:
|
3
|
+
- vendor/**
|
4
|
+
- bin/**
|
5
|
+
|
6
|
+
LineLength:
|
7
|
+
Enabled: false
|
8
|
+
|
9
|
+
MethodLength:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
ClassLength:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Documentation:
|
16
|
+
# don't require classes to be documented
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
CollectionMethods:
|
20
|
+
# don't prefer map to collect, recuce to inject
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Encoding:
|
24
|
+
# no need to always specify encoding
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
HashMethods:
|
28
|
+
# key? instead of has_key?
|
29
|
+
# value? instead of has_value?
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
StringLiterals:
|
33
|
+
# use single or double-quoted strings, as you please
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Void:
|
37
|
+
# == operator used in void context in specs
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
SignalException:
|
41
|
+
# prefer raise to fail
|
42
|
+
EnforcedStyle: only_raise
|
43
|
+
|
44
|
+
RaiseArgs:
|
45
|
+
# don't care for what kind of raise
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
PerlBackrefs:
|
49
|
+
# TODO: regular expression matching with $1, $2, etc.
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
BlockNesting:
|
53
|
+
# TODO: fix too much nesting
|
54
|
+
Max: 4
|
55
|
+
|
56
|
+
Lambda:
|
57
|
+
# TODO: replace all lambda with -> or Proc
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Blocks:
|
61
|
+
# allow multi-line blocks like expect { }
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
WordArray:
|
65
|
+
# %w vs. [ '', ... ]
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
CyclomaticComplexity:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
HandleExceptions:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
MultilineBlockChain:
|
75
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,76 +1,94 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
*
|
13
|
-
*
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
|
19
|
-
0.
|
20
|
-
|
21
|
-
|
22
|
-
*
|
23
|
-
*
|
24
|
-
* [
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
*
|
31
|
-
*
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
* [#
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
* [#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
* Fix:
|
55
|
-
* [#
|
56
|
-
|
57
|
-
0.
|
58
|
-
-----------------
|
59
|
-
|
60
|
-
*
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
*
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
1
|
+
Next Release
|
2
|
+
------------
|
3
|
+
|
4
|
+
Next Release
|
5
|
+
------------
|
6
|
+
|
7
|
+
* Your contribution here.
|
8
|
+
|
9
|
+
0.4.1 (1/11/2014)
|
10
|
+
-----------------
|
11
|
+
|
12
|
+
* Fixed compatibility with Mongoid 4.x - [@dblock](https://github.com/dblock).
|
13
|
+
* `Mongoid::History::Sweeper` has been removed, in accorance with Mongoid 4.x (see [#3108](https://github.com/mongoid/mongoid/issues/3108)) and Rails 4.x observer deprecation - [@dblock](https://github.com/dblock).
|
14
|
+
* Default modifier parameter to `nil` in `undo!` and `redo!` - [@dblock](https://github.com/dblock).
|
15
|
+
* Fixed `undo!` and `redo!` for mass-assignment protected attributes - [@mati0090](https://github.com/mati0090).
|
16
|
+
* Implemented Rubocop, Ruby style linter - [@dblock](https://github.com/dblock).
|
17
|
+
* Remove unneeded coma from README - [@matsprea](https://github.com/matsprea).
|
18
|
+
|
19
|
+
0.4.0 (6/12/2013)
|
20
|
+
-----------------
|
21
|
+
|
22
|
+
* Add `Mongoid::History.disable` and `Mongoid::History.enabled?` methods for global tracking disablement - [@johnnyshields](https://github.com/johnnyshields).
|
23
|
+
* Add `:changes_method` that optionally overrides which method to call to collect changes - [@joelnordel](https://github.com/joelnordell).
|
24
|
+
* [API Change] The `:destroy` action now stores trackers in the format `original=value, modified=nil` (previously it was the reverse) - [@johnnyshields](https://github.com/johnnyshields).
|
25
|
+
* Support for polymorphic embedded classes - [@tstepp](https://github.com/tstepp).
|
26
|
+
* Support for Mongoid field aliases, e.g. `field :n, as: :name` - [@johnnyshields](https://github.com/johnnyshields).
|
27
|
+
* Support for Mongoid embedded aliases, e.g. `embeds_many :comments, store_as: :coms` - [@johnnyshields](https://github.com/johnnyshields).
|
28
|
+
* Add `#tracked_changes` and `#tracked_edits` methods to `Tracker` class for nicer change summaries - [@johnnyshields](https://github.com/johnnyshields) and [@tstepp](https://github.com/tstepp).
|
29
|
+
* Refactored and exposed `#trackable_parent_class` in `Tracker`, which returns the class of the trackable regardless of whether the trackable itself has been destroyed - [@johnnyshields](https://github.com/johnnyshields).
|
30
|
+
* Add class-level `#tracked_field?` and `#tracked_fields` methods; refactor logic to determine whether a field is tracked - [@johnnyshields](https://github.com/johnnyshields).
|
31
|
+
* Fix bug in Trackable#track_update where `return` condition at beginning of method caused a short-circuit where memoization would not be cleared properly. - [@johnnyshields](https://github.com/johnnyshields).
|
32
|
+
* Tests: Added spec for nested embedded documents - [@matekb](https://github.com/matekb).
|
33
|
+
* Tests: Test run time cut in half (~2.5s versus ~5s) by using `#let` helper and removing class initialization before each test - [@johnnyshields](https://github.com/johnnyshields).
|
34
|
+
* Tests: Remove `database_cleaner` gem in favor of `Mongoid.purge!` - [@johnnyshields](https://github.com/johnnyshields).
|
35
|
+
* Tests: Remove dependency on non-committed file `mongoid.yml` and hardcode collection to `mongoid_history_test` - [@johnnyshields](https://github.com/johnnyshields).
|
36
|
+
|
37
|
+
0.3.3 (4/1/2013)
|
38
|
+
----------------
|
39
|
+
|
40
|
+
* [#42](https://github.com/aq1018/mongoid-history/issues/42) Fix: corrected creation of association chain when using nested embedded documents - [@matekb](https://github.com/matekb).
|
41
|
+
* [#56](https://github.com/aq1018/mongoid-history/issues/56) Fix: now possible to undo setting (creating) attributes that was previously unset - [@matekb](https://github.com/matekb).
|
42
|
+
* [#49](https://github.com/aq1018/mongoid-history/issues/49) Fix: now correctly undo/redo localized fields - [@edejong](https://github.com/edejong).
|
43
|
+
|
44
|
+
|
45
|
+
0.3.2 (1/24/2013)
|
46
|
+
-----------------
|
47
|
+
|
48
|
+
* [#54](https://github.com/aq1018/mongoid-history/pull/54) Use an index instead of the `$elemMatch` selector in `history_tracks` - [@vecio](https://github.com/vecio).
|
49
|
+
* [#11](https://github.com/aq1018/mongoid-history/issues/11) Added `:modifier_field_inverse_of` on `track_history` that defines the `:inverse_of` relationship of the modifier class - [@matekb](https://github.com/matekb), [@dblock](https://github.com/dblock).
|
50
|
+
|
51
|
+
0.3.1 (11/16/2012)
|
52
|
+
------------------
|
53
|
+
|
54
|
+
* [#45](https://github.com/aq1018/mongoid-history/pull/45) Fix: intermittent hash ordering issue with `history_tracks` - [@getaroom](https://github.com/getaroom).
|
55
|
+
* [#50](https://github.com/aq1018/mongoid-history/pull/50) Fix: tracking of array changes, undo and redo of field changes on non-embedded objects - [@dblock](https://github.com/dblock).
|
56
|
+
|
57
|
+
0.3.0 (8/21/2012)
|
58
|
+
-----------------
|
59
|
+
|
60
|
+
* [#41](https://github.com/aq1018/mongoid-history/pull/41) Mongoid 3.x support - [@zambot](https://github.com/zambot).
|
61
|
+
|
62
|
+
0.2.4 (8/21/2012)
|
63
|
+
-----------------
|
64
|
+
|
65
|
+
* [#38](https://github.com/aq1018/mongoid-history/pull/38) Fix: allow sub-models to be tracked by using `collection_name` as the scope - [@acant](https://github.com/acant).
|
66
|
+
* [#35](https://github.com/aq1018/mongoid-history/pull/35) Fix: sweeper references record of change, not the record changed - [@dblock](https://github.com/dblock).
|
67
|
+
|
68
|
+
0.2.3 (4/20/2012)
|
69
|
+
-----------------
|
70
|
+
|
71
|
+
* [#23](https://github.com/aq1018/mongoid-history/pull/34): Updated `Trackable::association_hash` to write through parent - [@tcopple](https://github.com/tcopple).
|
72
|
+
* Fix: `Trackable::association_hash` nil meta value call - [@tcopple](https://github.com/tcopple).
|
73
|
+
* [#27](https://github.com/aq1018/mongoid-history/pull/27): Added support for re-creation of destroyed embedded documents - [@erlingwl](https://github.com/erlingwl)
|
74
|
+
|
75
|
+
0.1.7 (12/9/2011)
|
76
|
+
-----------------
|
77
|
+
|
78
|
+
* Fix: tracking `false` values - [@gottfrois](https://github.com/gottfrois).
|
79
|
+
* Use a mongoid observer and controller `around_filter` to pick up modifying user from controller - [@bensymonds](https://github.com/bensymonds).
|
80
|
+
* More flexible dependency on mongoid - [@sarcilav](https://github.com/sarcilav).
|
81
|
+
* Fix: tracking broken in a multithreaded environment - [@dblock](https://github.com/dblock).
|
82
|
+
|
83
|
+
0.1.0 (5/13/2011)
|
84
|
+
-----------------
|
85
|
+
|
86
|
+
* Added support for `destroy` - [@dblock](https://github.com/dblock).
|
87
|
+
* Added undo and redo - [@aq1018](https://github.com/aq1018).
|
88
|
+
* Added support for temporarily disabling history tracking - [@aq1018](https://github.com/aq1018).
|
89
|
+
* Record modifier for undo and redo actions - [@aq1018](https://github.com/aq1018).
|
90
|
+
|
91
|
+
0.0.1 (3/4/2011)
|
92
|
+
----------------
|
93
|
+
|
94
|
+
* Intial public release - [@aq1018](https://github.com/aq1018).
|
data/Gemfile
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
gem "easy_diff"
|
4
|
-
gem "mongoid", "
|
5
|
-
gem "activesupport"
|
6
|
-
|
7
|
-
group :test do
|
8
|
-
gem "rspec", ">= 2.11.0"
|
9
|
-
gem "
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem "easy_diff"
|
4
|
+
gem "mongoid", ">= 3.0"
|
5
|
+
gem "activesupport"
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem "rspec", ">= 2.11.0"
|
9
|
+
gem "bundler", ">= 1.0.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem 'rubocop', '~> 0.15.0'
|
14
|
+
gem "yard"
|
15
|
+
gem "jeweler"
|
16
|
+
end
|
data/LICENSE.txt
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Copyright (c) 2011 Aaron Qian
|
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 Aaron Qian
|
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.
|