mongoid-history 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.coveralls.yml +1 -0
- data/.document +5 -5
- data/.gitignore +46 -0
- data/.rspec +2 -1
- data/.rubocop.yml +76 -75
- data/.travis.yml +16 -7
- data/CHANGELOG.md +96 -94
- data/CONTRIBUTING.md +118 -0
- data/Gemfile +12 -16
- data/LICENSE.txt +20 -20
- data/README.md +312 -309
- data/Rakefile +25 -37
- data/lib/mongoid-history.rb +11 -9
- data/lib/mongoid/history.rb +25 -25
- data/lib/mongoid/history/mongoid.rb +7 -0
- data/lib/mongoid/history/trackable.rb +353 -337
- data/lib/mongoid/history/tracker.rb +222 -215
- data/lib/mongoid/history/version.rb +5 -0
- data/mongoid-history.gemspec +32 -80
- data/spec/integration/embedded_in_polymorphic_spec.rb +120 -0
- data/spec/integration/integration_spec.rb +883 -788
- data/spec/integration/multi_relation_spec.rb +53 -53
- data/spec/integration/nested_embedded_documents_spec.rb +77 -77
- data/spec/integration/subclasses_spec.rb +29 -29
- data/spec/spec_helper.rb +20 -10
- data/spec/support/mongoid.rb +11 -11
- data/spec/support/mongoid_history.rb +13 -13
- data/spec/{trackable_spec.rb → unit/trackable_spec.rb} +240 -240
- data/spec/{tracker_spec.rb → unit/tracker_spec.rb} +10 -10
- metadata +96 -28
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YzYyODI5Y2I4ODJhZGU5MjdmYmIxZjc2NTY3MzE5YWI0Mjk0MjA5MA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 913a0832973eef07a72d4ea723d6e9fa12285e9b
|
4
|
+
data.tar.gz: f8014e49bc8abd5af67ad229bd6c6a995a24653d
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MGQxMGVlZTFkNWI2M2Q5NjNkYWRhZWRkMjgxNmQxMTllYzg4OWJjNzk2NmU2
|
11
|
-
ZmYwMjI5NzJkNWQzZWY1NzMzNjBjZmRkYmRlNGViMzczYzdlMDk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTBlYzQwMTRmYmViNGRiN2RmOGVjZDVhMWNhYzhjMTBiNTgwYTE4OWU1NDJh
|
14
|
-
MGVjNGI5MGFiNmYyYzJhYmM5Nzc4ZDhlNGRmOWU4Y2E3YTc0NDk2N2UxNGJi
|
15
|
-
ZTg0MDgxYmZlNmRkM2UwZjc3OGE2ODQ5ZjE4ZTM1MDYzNzU3Zjc=
|
6
|
+
metadata.gz: 79e4e82a0b8aa9a25bdbba77060b90921b75d469db982a609404ec3a511f4992b4c9a7a731b38d1509191201fa882ebd03cb13539634dbe01205de3edb5f5c09
|
7
|
+
data.tar.gz: 2bc72da395f9602b5cf7e90e17566b2cc0ce5f51db1b14924c4aeac8d02f40c2fdc81eefda20b774e995364e102cbca10ec1af46b7cca1dba063a963ef1b442f
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
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/.gitignore
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
Gemfile.lock
|
2
|
+
|
3
|
+
.rvmrc
|
4
|
+
|
5
|
+
# rcov generated
|
6
|
+
coverage
|
7
|
+
|
8
|
+
# rdoc generated
|
9
|
+
rdoc
|
10
|
+
|
11
|
+
# yard generated
|
12
|
+
doc
|
13
|
+
.yardoc
|
14
|
+
|
15
|
+
# bundler
|
16
|
+
.bundle
|
17
|
+
|
18
|
+
# jeweler generated
|
19
|
+
pkg
|
20
|
+
|
21
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
22
|
+
#
|
23
|
+
# * Create a file at ~/.gitignore
|
24
|
+
# * Include files you want ignored
|
25
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
26
|
+
#
|
27
|
+
# After doing this, these files will be ignored in all your git projects,
|
28
|
+
# saving you from having to 'pollute' every project you touch with them
|
29
|
+
#
|
30
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
31
|
+
#
|
32
|
+
# For MacOS:
|
33
|
+
#
|
34
|
+
#.DS_Store
|
35
|
+
#
|
36
|
+
# For TextMate
|
37
|
+
#*.tmproj
|
38
|
+
#tmtags
|
39
|
+
#
|
40
|
+
# For emacs:
|
41
|
+
#*~
|
42
|
+
#\#*
|
43
|
+
#.\#*
|
44
|
+
#
|
45
|
+
# For vim:
|
46
|
+
#*.swp
|
data/.rspec
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
--color
|
1
|
+
--color
|
2
|
+
--format=documentation
|
data/.rubocop.yml
CHANGED
@@ -1,75 +1,76 @@
|
|
1
|
-
AllCops:
|
2
|
-
|
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
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
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
|
+
StringLiterals:
|
28
|
+
# use single or double-quoted strings, as you please
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Void:
|
32
|
+
# == operator used in void context in specs
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
SignalException:
|
36
|
+
# prefer raise to fail
|
37
|
+
EnforcedStyle: only_raise
|
38
|
+
|
39
|
+
RaiseArgs:
|
40
|
+
# don't care for what kind of raise
|
41
|
+
Enabled: false
|
42
|
+
|
43
|
+
PerlBackrefs:
|
44
|
+
# TODO: regular expression matching with $1, $2, etc.
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
BlockNesting:
|
48
|
+
# TODO: fix too much nesting
|
49
|
+
Max: 4
|
50
|
+
|
51
|
+
Lambda:
|
52
|
+
# TODO: replace all lambda with -> or Proc
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Blocks:
|
56
|
+
# allow multi-line blocks like expect { }
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
WordArray:
|
60
|
+
# %w vs. [ '', ... ]
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
CyclomaticComplexity:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
HandleExceptions:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
MultilineBlockChain:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
FileName:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
RegexpLiteral:
|
76
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
-
services: mongodb
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
services: mongodb
|
2
|
+
|
3
|
+
language: ruby
|
4
|
+
|
5
|
+
cache: bundler
|
6
|
+
|
7
|
+
rvm:
|
8
|
+
- 2.1.1
|
9
|
+
- 2.0.0
|
10
|
+
- 1.9.3
|
11
|
+
- rbx-2
|
12
|
+
- jruby-19mode
|
13
|
+
|
14
|
+
env:
|
15
|
+
- MONGOID_VERSION=3
|
16
|
+
- MONGOID_VERSION=4
|
data/CHANGELOG.md
CHANGED
@@ -1,94 +1,96 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
*
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
*
|
25
|
-
*
|
26
|
-
*
|
27
|
-
* Support for
|
28
|
-
*
|
29
|
-
*
|
30
|
-
* Add
|
31
|
-
*
|
32
|
-
*
|
33
|
-
*
|
34
|
-
* Tests:
|
35
|
-
* Tests:
|
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
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
* [#
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
*
|
81
|
-
*
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
* Added support for
|
89
|
-
*
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
1
|
+
0.4.2 (7/1/2014)
|
2
|
+
----------------
|
3
|
+
|
4
|
+
* [#106](https://github.com/aq1018/mongoid-history/pull/106) - Added support for polymorphic relationship `scope` - [@adbeelitamar](https://github.com/adbeelitamar).
|
5
|
+
* [#106](https://github.com/aq1018/mongoid-history/pull/106) - Enabled specifying an array of relationships in `scope` - [@adbeelitamar](https://github.com/adbeelitamar).
|
6
|
+
* [#83](https://github.com/aq1018/mongoid-history/pull/83) - Added support for Mongoid 4.x, which removed `attr_accessible` in favor of protected attributes - [@dblock](https://github.com/dblock).
|
7
|
+
* [#103](https://github.com/aq1018/mongoid-history/pull/103) - Fixed compatibility with models using `default_scope` - [@mrjlynch](https://github.com/mrjlynch).
|
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
|
+
* Replace Jeweler with Gem-Release - [@johnnyshields](https://github.com/johnnyshields).
|
19
|
+
* Track version as a Ruby file - [@johnnyshields](https://github.com/johnnyshields).
|
20
|
+
|
21
|
+
0.4.0 (6/12/2013)
|
22
|
+
-----------------
|
23
|
+
|
24
|
+
* Add `Mongoid::History.disable` and `Mongoid::History.enabled?` methods for global tracking disablement - [@johnnyshields](https://github.com/johnnyshields).
|
25
|
+
* Add `:changes_method` that optionally overrides which method to call to collect changes - [@joelnordel](https://github.com/joelnordell).
|
26
|
+
* [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).
|
27
|
+
* Support for polymorphic embedded classes - [@tstepp](https://github.com/tstepp).
|
28
|
+
* Support for Mongoid field aliases, e.g. `field :n, as: :name` - [@johnnyshields](https://github.com/johnnyshields).
|
29
|
+
* Support for Mongoid embedded aliases, e.g. `embeds_many :comments, store_as: :coms` - [@johnnyshields](https://github.com/johnnyshields).
|
30
|
+
* 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).
|
31
|
+
* 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).
|
32
|
+
* Add class-level `#tracked_field?` and `#tracked_fields` methods; refactor logic to determine whether a field is tracked - [@johnnyshields](https://github.com/johnnyshields).
|
33
|
+
* 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).
|
34
|
+
* Tests: Added spec for nested embedded documents - [@matekb](https://github.com/matekb).
|
35
|
+
* 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).
|
36
|
+
* Tests: Remove `database_cleaner` gem in favor of `Mongoid.purge!` - [@johnnyshields](https://github.com/johnnyshields).
|
37
|
+
* Tests: Remove dependency on non-committed file `mongoid.yml` and hardcode collection to `mongoid_history_test` - [@johnnyshields](https://github.com/johnnyshields).
|
38
|
+
|
39
|
+
0.3.3 (4/1/2013)
|
40
|
+
----------------
|
41
|
+
|
42
|
+
* [#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).
|
43
|
+
* [#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).
|
44
|
+
* [#49](https://github.com/aq1018/mongoid-history/issues/49) Fix: now correctly undo/redo localized fields - [@edejong](https://github.com/edejong).
|
45
|
+
|
46
|
+
|
47
|
+
0.3.2 (1/24/2013)
|
48
|
+
-----------------
|
49
|
+
|
50
|
+
* [#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).
|
51
|
+
* [#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).
|
52
|
+
|
53
|
+
0.3.1 (11/16/2012)
|
54
|
+
------------------
|
55
|
+
|
56
|
+
* [#45](https://github.com/aq1018/mongoid-history/pull/45) Fix: intermittent hash ordering issue with `history_tracks` - [@getaroom](https://github.com/getaroom).
|
57
|
+
* [#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).
|
58
|
+
|
59
|
+
0.3.0 (8/21/2012)
|
60
|
+
-----------------
|
61
|
+
|
62
|
+
* [#41](https://github.com/aq1018/mongoid-history/pull/41) Mongoid 3.x support - [@zambot](https://github.com/zambot).
|
63
|
+
|
64
|
+
0.2.4 (8/21/2012)
|
65
|
+
-----------------
|
66
|
+
|
67
|
+
* [#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).
|
68
|
+
* [#35](https://github.com/aq1018/mongoid-history/pull/35) Fix: sweeper references record of change, not the record changed - [@dblock](https://github.com/dblock).
|
69
|
+
|
70
|
+
0.2.3 (4/20/2012)
|
71
|
+
-----------------
|
72
|
+
|
73
|
+
* [#23](https://github.com/aq1018/mongoid-history/pull/34): Updated `Trackable::association_hash` to write through parent - [@tcopple](https://github.com/tcopple).
|
74
|
+
* Fix: `Trackable::association_hash` nil meta value call - [@tcopple](https://github.com/tcopple).
|
75
|
+
* [#27](https://github.com/aq1018/mongoid-history/pull/27): Added support for re-creation of destroyed embedded documents - [@erlingwl](https://github.com/erlingwl)
|
76
|
+
|
77
|
+
0.1.7 (12/9/2011)
|
78
|
+
-----------------
|
79
|
+
|
80
|
+
* Fix: tracking `false` values - [@gottfrois](https://github.com/gottfrois).
|
81
|
+
* Use a mongoid observer and controller `around_filter` to pick up modifying user from controller - [@bensymonds](https://github.com/bensymonds).
|
82
|
+
* More flexible dependency on mongoid - [@sarcilav](https://github.com/sarcilav).
|
83
|
+
* Fix: tracking broken in a multithreaded environment - [@dblock](https://github.com/dblock).
|
84
|
+
|
85
|
+
0.1.0 (5/13/2011)
|
86
|
+
-----------------
|
87
|
+
|
88
|
+
* Added support for `destroy` - [@dblock](https://github.com/dblock).
|
89
|
+
* Added undo and redo - [@aq1018](https://github.com/aq1018).
|
90
|
+
* Added support for temporarily disabling history tracking - [@aq1018](https://github.com/aq1018).
|
91
|
+
* Record modifier for undo and redo actions - [@aq1018](https://github.com/aq1018).
|
92
|
+
|
93
|
+
0.0.1 (3/4/2011)
|
94
|
+
----------------
|
95
|
+
|
96
|
+
* Intial public release - [@aq1018](https://github.com/aq1018).
|