mongoid_activity_tracker 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -0
- data/README.md +4 -4
- data/lib/mongoid_activity_tracker/version.rb +2 -2
- data/mongoid_activity_tracker.gemspec +3 -3
- data/test/test_helper.rb +2 -21
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9449f842d58c48896d928ce30a44e8d5fcd2a69
|
4
|
+
data.tar.gz: f4ba42b5635d1e6df11e7975bff69b12f1ef39d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ced9a538eb779784a2bc76cd0662a50d7f63df5fb2984040285e4a4dd208e5ee63d205067de6e628e75213fb8db64615c841d507b9b241ccc6c701c4e310afe3
|
7
|
+
data.tar.gz: 9637a2160e01f9f6377990e898cd8bf697538ba0eebcca4d89237cbd695fb5f52e85cf49397b8dae5c5de182640785ff467f000a5456afd9e5a708e4994f86bf
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/tomasc/mongoid_activity_tracker.svg)](https://travis-ci.org/tomasc/mongoid_activity_tracker) [![Gem Version](https://badge.fury.io/rb/mongoid_activity_tracker.svg)](http://badge.fury.io/rb/mongoid_activity_tracker) [![Coverage Status](https://img.shields.io/coveralls/tomasc/mongoid_activity_tracker.svg)](https://coveralls.io/r/tomasc/mongoid_activity_tracker)
|
4
4
|
|
5
|
-
Module
|
5
|
+
Module to help with tracking activity in your application.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -49,7 +49,7 @@ res.action # => :create
|
|
49
49
|
|
50
50
|
Along the action, it is possible to track any number of related documents.
|
51
51
|
|
52
|
-
First, configure the tracker class using the `.tracks`
|
52
|
+
First, configure the tracker class using the `.tracks` macro:
|
53
53
|
|
54
54
|
```Ruby
|
55
55
|
class MyTracker
|
@@ -68,13 +68,13 @@ res.subject_cache # => { to_s: … }
|
|
68
68
|
res.subject_cache_object.to_s # …
|
69
69
|
```
|
70
70
|
|
71
|
-
By default, the `:cache_methods` parameter is set to
|
71
|
+
By default, the `:cache_methods` parameter is set to store the result of `:to_s` method. This is valuable for example when displaying activity overview (no need for additional query for the related document), or should the related document no longer exist. The list of methods to be cached can be customised as follows:
|
72
72
|
|
73
73
|
```Ruby
|
74
74
|
class MyTracker
|
75
75
|
include MongoidActivityTracker::Tracker
|
76
76
|
tracks :actor, cache_methods: [:to_s, :first_name, :last_name]
|
77
|
-
tracks :subject, cache_methods: [:to_s, :
|
77
|
+
tracks :subject, cache_methods: [:to_s, :some_other_method]
|
78
78
|
end
|
79
79
|
```
|
80
80
|
|
@@ -1,3 +1,3 @@
|
|
1
1
|
module MongoidActivityTracker
|
2
|
-
VERSION = "0.
|
3
|
-
end
|
2
|
+
VERSION = "0.2.0"
|
3
|
+
end
|
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "mongoid", "~>
|
21
|
+
spec.add_dependency "mongoid", "~> 5.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
24
|
spec.add_development_dependency "coveralls"
|
25
|
-
spec.add_development_dependency "database_cleaner"
|
25
|
+
spec.add_development_dependency "database_cleaner", ">= 1.5.1"
|
26
26
|
spec.add_development_dependency "guard"
|
27
27
|
spec.add_development_dependency "guard-minitest"
|
28
28
|
spec.add_development_dependency "minitest"
|
29
29
|
spec.add_development_dependency "rake"
|
30
|
-
end
|
30
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -12,27 +12,8 @@ if ENV["CI"]
|
|
12
12
|
Coveralls.wear!
|
13
13
|
end
|
14
14
|
|
15
|
-
ENV["MONGOID_TEST_HOST"] ||= "localhost"
|
16
|
-
ENV["MONGOID_TEST_PORT"] ||= "27017"
|
17
|
-
|
18
|
-
HOST = ENV["MONGOID_TEST_HOST"]
|
19
|
-
PORT = ENV["MONGOID_TEST_PORT"].to_i
|
20
|
-
|
21
|
-
def database_id
|
22
|
-
"mongoid_activity_tracker_test"
|
23
|
-
end
|
24
|
-
|
25
|
-
CONFIG = {
|
26
|
-
sessions: {
|
27
|
-
default: {
|
28
|
-
database: database_id,
|
29
|
-
hosts: [ "#{HOST}:#{PORT}" ]
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
15
|
Mongoid.configure do |config|
|
35
|
-
config.
|
16
|
+
config.connect_to('mongoid_activity_tracker_test')
|
36
17
|
end
|
37
18
|
|
38
19
|
DatabaseCleaner.orm = :mongoid
|
@@ -55,4 +36,4 @@ end
|
|
55
36
|
|
56
37
|
class TestSubject
|
57
38
|
include Mongoid::Document
|
58
|
-
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_activity_tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.5.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.5.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.4.8
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Minimal set of classes and modules to help with activity tracking.
|