mongoid_rateable 0.3.3 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.github/FUNDING.yml +13 -0
- data/.ruby-version +1 -0
- data/.travis.yml +24 -1
- data/Appraisals +23 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +9 -8
- data/{README.rdoc → README.md} +49 -35
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/gemfiles/mongoid_3.gemfile +16 -0
- data/gemfiles/mongoid_3.gemfile.lock +116 -0
- data/gemfiles/mongoid_4.gemfile +16 -0
- data/gemfiles/mongoid_4.gemfile.lock +127 -0
- data/gemfiles/mongoid_5.gemfile +16 -0
- data/gemfiles/mongoid_5.gemfile.lock +129 -0
- data/gemfiles/mongoid_6.gemfile +16 -0
- data/gemfiles/mongoid_6.gemfile.lock +125 -0
- data/gemfiles/mongoid_7.gemfile +16 -0
- data/gemfiles/mongoid_7.gemfile.lock +125 -0
- data/gemfiles/mongoid_8.gemfile +16 -0
- data/gemfiles/mongoid_8.gemfile.lock +139 -0
- data/lib/mongoid_rateable/rateable.rb +21 -12
- data/lib/mongoid_rateable/rating.rb +1 -1
- data/lib/mongoid_rateable.rb +0 -1
- data/mongoid_rateable.gemspec +43 -47
- data/spec/models/post.rb +1 -0
- data/spec/models/user.rb +1 -0
- data/spec/rateable_spec.rb +40 -36
- data/spec/spec_helper.rb +21 -13
- data/spec/support/database_cleaner.rb +36 -0
- metadata +90 -43
- data/.rvmrc +0 -2
- data/Gemfile.lock +0 -85
- data/lib/mongoid_rateable/version.rb +0 -3
@@ -0,0 +1,129 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (4.2.11.1)
|
5
|
+
activesupport (= 4.2.11.1)
|
6
|
+
builder (~> 3.1)
|
7
|
+
activesupport (4.2.11.1)
|
8
|
+
i18n (~> 0.7)
|
9
|
+
minitest (~> 5.1)
|
10
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
11
|
+
tzinfo (~> 1.1)
|
12
|
+
addressable (2.7.0)
|
13
|
+
public_suffix (>= 2.0.2, < 5.0)
|
14
|
+
appraisal (2.2.0)
|
15
|
+
bundler
|
16
|
+
rake
|
17
|
+
thor (>= 0.14.0)
|
18
|
+
bson (4.7.0)
|
19
|
+
builder (3.2.4)
|
20
|
+
concurrent-ruby (1.1.5)
|
21
|
+
coveralls (0.7.2)
|
22
|
+
multi_json (~> 1.3)
|
23
|
+
rest-client (= 1.6.7)
|
24
|
+
simplecov (>= 0.7)
|
25
|
+
term-ansicolor (= 1.2.2)
|
26
|
+
thor (= 0.18.1)
|
27
|
+
database_cleaner (1.7.0)
|
28
|
+
descendants_tracker (0.0.4)
|
29
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
30
|
+
diff-lcs (1.3)
|
31
|
+
docile (1.3.2)
|
32
|
+
faraday (0.9.2)
|
33
|
+
multipart-post (>= 1.2, < 3)
|
34
|
+
git (1.5.0)
|
35
|
+
github_api (0.11.3)
|
36
|
+
addressable (~> 2.3)
|
37
|
+
descendants_tracker (~> 0.0.1)
|
38
|
+
faraday (~> 0.8, < 0.10)
|
39
|
+
hashie (>= 1.2)
|
40
|
+
multi_json (>= 1.7.5, < 2.0)
|
41
|
+
nokogiri (~> 1.6.0)
|
42
|
+
oauth2
|
43
|
+
hashie (4.0.0)
|
44
|
+
highline (2.0.3)
|
45
|
+
i18n (0.9.5)
|
46
|
+
concurrent-ruby (~> 1.0)
|
47
|
+
jeweler (2.1.2)
|
48
|
+
builder
|
49
|
+
bundler (>= 1.0)
|
50
|
+
git (>= 1.2.5)
|
51
|
+
github_api (~> 0.11.0)
|
52
|
+
highline (>= 1.6.15)
|
53
|
+
nokogiri (>= 1.5.10)
|
54
|
+
rake
|
55
|
+
rdoc
|
56
|
+
semver
|
57
|
+
json (2.3.0)
|
58
|
+
jwt (2.2.1)
|
59
|
+
mime-types (3.3)
|
60
|
+
mime-types-data (~> 3.2015)
|
61
|
+
mime-types-data (3.2019.1009)
|
62
|
+
mini_portile2 (2.1.0)
|
63
|
+
minitest (5.13.0)
|
64
|
+
mongo (2.11.2)
|
65
|
+
bson (>= 4.6.0, < 5.0.0)
|
66
|
+
mongoid (5.2.0)
|
67
|
+
activemodel (~> 4.0)
|
68
|
+
mongo (>= 2.4.1, < 3.0.0)
|
69
|
+
origin (~> 2.3)
|
70
|
+
tzinfo (>= 0.3.37)
|
71
|
+
multi_json (1.14.1)
|
72
|
+
multi_xml (0.6.0)
|
73
|
+
multipart-post (2.1.1)
|
74
|
+
nokogiri (1.6.8.1)
|
75
|
+
mini_portile2 (~> 2.1.0)
|
76
|
+
oauth2 (1.4.2)
|
77
|
+
faraday (>= 0.8, < 2.0)
|
78
|
+
jwt (>= 1.0, < 3.0)
|
79
|
+
multi_json (~> 1.3)
|
80
|
+
multi_xml (~> 0.5)
|
81
|
+
rack (>= 1.2, < 3)
|
82
|
+
origin (2.3.1)
|
83
|
+
public_suffix (4.0.1)
|
84
|
+
rack (2.0.8)
|
85
|
+
rake (13.0.1)
|
86
|
+
rdoc (6.2.0)
|
87
|
+
rest-client (1.6.7)
|
88
|
+
mime-types (>= 1.16)
|
89
|
+
rspec (3.9.0)
|
90
|
+
rspec-core (~> 3.9.0)
|
91
|
+
rspec-expectations (~> 3.9.0)
|
92
|
+
rspec-mocks (~> 3.9.0)
|
93
|
+
rspec-core (3.9.0)
|
94
|
+
rspec-support (~> 3.9.0)
|
95
|
+
rspec-expectations (3.9.0)
|
96
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
+
rspec-support (~> 3.9.0)
|
98
|
+
rspec-mocks (3.9.0)
|
99
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
100
|
+
rspec-support (~> 3.9.0)
|
101
|
+
rspec-support (3.9.0)
|
102
|
+
semver (1.0.1)
|
103
|
+
simplecov (0.17.1)
|
104
|
+
docile (~> 1.1)
|
105
|
+
json (>= 1.8, < 3)
|
106
|
+
simplecov-html (~> 0.10.0)
|
107
|
+
simplecov-html (0.10.2)
|
108
|
+
term-ansicolor (1.2.2)
|
109
|
+
tins (~> 0.8)
|
110
|
+
thor (0.18.1)
|
111
|
+
thread_safe (0.3.6)
|
112
|
+
tins (0.13.2)
|
113
|
+
tzinfo (1.2.5)
|
114
|
+
thread_safe (~> 0.1)
|
115
|
+
yard (0.9.20)
|
116
|
+
|
117
|
+
PLATFORMS
|
118
|
+
ruby
|
119
|
+
|
120
|
+
DEPENDENCIES
|
121
|
+
appraisal
|
122
|
+
bundler
|
123
|
+
coveralls
|
124
|
+
database_cleaner (>= 0.8.0)
|
125
|
+
jeweler (~> 2.1.1)
|
126
|
+
mongoid (= 5.2.0)
|
127
|
+
rspec (>= 3.0.0)
|
128
|
+
simplecov (~> 0.7)
|
129
|
+
yard
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "mongoid", "6.1.0"
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "bundler"
|
9
|
+
gem "jeweler", "~> 2.1.1"
|
10
|
+
gem "simplecov", "~> 0.7", require: false
|
11
|
+
gem "yard"
|
12
|
+
gem "rspec", ">= 3.0.0"
|
13
|
+
gem "appraisal"
|
14
|
+
gem "coveralls", require: false
|
15
|
+
gem "database_cleaner-mongoid", "~> 2.0", ">= 2.0.1"
|
16
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (5.2.4.1)
|
5
|
+
activesupport (= 5.2.4.1)
|
6
|
+
activesupport (5.2.4.1)
|
7
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
8
|
+
i18n (>= 0.7, < 2)
|
9
|
+
minitest (~> 5.1)
|
10
|
+
tzinfo (~> 1.1)
|
11
|
+
addressable (2.7.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
13
|
+
appraisal (2.2.0)
|
14
|
+
bundler
|
15
|
+
rake
|
16
|
+
thor (>= 0.14.0)
|
17
|
+
bson (4.7.0)
|
18
|
+
builder (3.2.4)
|
19
|
+
concurrent-ruby (1.1.5)
|
20
|
+
coveralls (0.7.2)
|
21
|
+
multi_json (~> 1.3)
|
22
|
+
rest-client (= 1.6.7)
|
23
|
+
simplecov (>= 0.7)
|
24
|
+
term-ansicolor (= 1.2.2)
|
25
|
+
thor (= 0.18.1)
|
26
|
+
database_cleaner (1.7.0)
|
27
|
+
descendants_tracker (0.0.4)
|
28
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
29
|
+
diff-lcs (1.3)
|
30
|
+
docile (1.3.2)
|
31
|
+
faraday (0.9.2)
|
32
|
+
multipart-post (>= 1.2, < 3)
|
33
|
+
git (1.5.0)
|
34
|
+
github_api (0.11.3)
|
35
|
+
addressable (~> 2.3)
|
36
|
+
descendants_tracker (~> 0.0.1)
|
37
|
+
faraday (~> 0.8, < 0.10)
|
38
|
+
hashie (>= 1.2)
|
39
|
+
multi_json (>= 1.7.5, < 2.0)
|
40
|
+
nokogiri (~> 1.6.0)
|
41
|
+
oauth2
|
42
|
+
hashie (4.0.0)
|
43
|
+
highline (2.0.3)
|
44
|
+
i18n (1.7.0)
|
45
|
+
concurrent-ruby (~> 1.0)
|
46
|
+
jeweler (2.1.2)
|
47
|
+
builder
|
48
|
+
bundler (>= 1.0)
|
49
|
+
git (>= 1.2.5)
|
50
|
+
github_api (~> 0.11.0)
|
51
|
+
highline (>= 1.6.15)
|
52
|
+
nokogiri (>= 1.5.10)
|
53
|
+
rake
|
54
|
+
rdoc
|
55
|
+
semver
|
56
|
+
json (2.3.0)
|
57
|
+
jwt (2.2.1)
|
58
|
+
mime-types (3.3)
|
59
|
+
mime-types-data (~> 3.2015)
|
60
|
+
mime-types-data (3.2019.1009)
|
61
|
+
mini_portile2 (2.1.0)
|
62
|
+
minitest (5.13.0)
|
63
|
+
mongo (2.11.2)
|
64
|
+
bson (>= 4.6.0, < 5.0.0)
|
65
|
+
mongoid (6.1.0)
|
66
|
+
activemodel (~> 5.0)
|
67
|
+
mongo (>= 2.4.1, < 3.0.0)
|
68
|
+
multi_json (1.14.1)
|
69
|
+
multi_xml (0.6.0)
|
70
|
+
multipart-post (2.1.1)
|
71
|
+
nokogiri (1.6.8.1)
|
72
|
+
mini_portile2 (~> 2.1.0)
|
73
|
+
oauth2 (1.4.2)
|
74
|
+
faraday (>= 0.8, < 2.0)
|
75
|
+
jwt (>= 1.0, < 3.0)
|
76
|
+
multi_json (~> 1.3)
|
77
|
+
multi_xml (~> 0.5)
|
78
|
+
rack (>= 1.2, < 3)
|
79
|
+
public_suffix (4.0.1)
|
80
|
+
rack (2.0.8)
|
81
|
+
rake (13.0.1)
|
82
|
+
rdoc (6.2.0)
|
83
|
+
rest-client (1.6.7)
|
84
|
+
mime-types (>= 1.16)
|
85
|
+
rspec (3.9.0)
|
86
|
+
rspec-core (~> 3.9.0)
|
87
|
+
rspec-expectations (~> 3.9.0)
|
88
|
+
rspec-mocks (~> 3.9.0)
|
89
|
+
rspec-core (3.9.0)
|
90
|
+
rspec-support (~> 3.9.0)
|
91
|
+
rspec-expectations (3.9.0)
|
92
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
93
|
+
rspec-support (~> 3.9.0)
|
94
|
+
rspec-mocks (3.9.0)
|
95
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
+
rspec-support (~> 3.9.0)
|
97
|
+
rspec-support (3.9.0)
|
98
|
+
semver (1.0.1)
|
99
|
+
simplecov (0.17.1)
|
100
|
+
docile (~> 1.1)
|
101
|
+
json (>= 1.8, < 3)
|
102
|
+
simplecov-html (~> 0.10.0)
|
103
|
+
simplecov-html (0.10.2)
|
104
|
+
term-ansicolor (1.2.2)
|
105
|
+
tins (~> 0.8)
|
106
|
+
thor (0.18.1)
|
107
|
+
thread_safe (0.3.6)
|
108
|
+
tins (0.13.2)
|
109
|
+
tzinfo (1.2.5)
|
110
|
+
thread_safe (~> 0.1)
|
111
|
+
yard (0.9.20)
|
112
|
+
|
113
|
+
PLATFORMS
|
114
|
+
ruby
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
appraisal
|
118
|
+
bundler
|
119
|
+
coveralls
|
120
|
+
database_cleaner (>= 0.8.0)
|
121
|
+
jeweler (~> 2.1.1)
|
122
|
+
mongoid (= 6.1.0)
|
123
|
+
rspec (>= 3.0.0)
|
124
|
+
simplecov (~> 0.7)
|
125
|
+
yard
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "mongoid", "7.5.2"
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "bundler"
|
9
|
+
gem "jeweler", "~> 2.1.1"
|
10
|
+
gem "simplecov", "~> 0.7", require: false
|
11
|
+
gem "yard"
|
12
|
+
gem "rspec", ">= 3.0.0"
|
13
|
+
gem "appraisal"
|
14
|
+
gem "coveralls", require: false
|
15
|
+
gem "database_cleaner-mongoid", "~> 2.0", ">= 2.0.1"
|
16
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (5.2.4.1)
|
5
|
+
activesupport (= 5.2.4.1)
|
6
|
+
activesupport (5.2.4.1)
|
7
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
8
|
+
i18n (>= 0.7, < 2)
|
9
|
+
minitest (~> 5.1)
|
10
|
+
tzinfo (~> 1.1)
|
11
|
+
addressable (2.7.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
13
|
+
appraisal (2.2.0)
|
14
|
+
bundler
|
15
|
+
rake
|
16
|
+
thor (>= 0.14.0)
|
17
|
+
bson (4.7.0)
|
18
|
+
builder (3.2.4)
|
19
|
+
concurrent-ruby (1.1.5)
|
20
|
+
coveralls (0.7.2)
|
21
|
+
multi_json (~> 1.3)
|
22
|
+
rest-client (= 1.6.7)
|
23
|
+
simplecov (>= 0.7)
|
24
|
+
term-ansicolor (= 1.2.2)
|
25
|
+
thor (= 0.18.1)
|
26
|
+
database_cleaner (1.7.0)
|
27
|
+
descendants_tracker (0.0.4)
|
28
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
29
|
+
diff-lcs (1.3)
|
30
|
+
docile (1.3.2)
|
31
|
+
faraday (0.9.2)
|
32
|
+
multipart-post (>= 1.2, < 3)
|
33
|
+
git (1.5.0)
|
34
|
+
github_api (0.11.3)
|
35
|
+
addressable (~> 2.3)
|
36
|
+
descendants_tracker (~> 0.0.1)
|
37
|
+
faraday (~> 0.8, < 0.10)
|
38
|
+
hashie (>= 1.2)
|
39
|
+
multi_json (>= 1.7.5, < 2.0)
|
40
|
+
nokogiri (~> 1.6.0)
|
41
|
+
oauth2
|
42
|
+
hashie (4.0.0)
|
43
|
+
highline (2.0.3)
|
44
|
+
i18n (1.7.0)
|
45
|
+
concurrent-ruby (~> 1.0)
|
46
|
+
jeweler (2.1.2)
|
47
|
+
builder
|
48
|
+
bundler (>= 1.0)
|
49
|
+
git (>= 1.2.5)
|
50
|
+
github_api (~> 0.11.0)
|
51
|
+
highline (>= 1.6.15)
|
52
|
+
nokogiri (>= 1.5.10)
|
53
|
+
rake
|
54
|
+
rdoc
|
55
|
+
semver
|
56
|
+
json (2.3.0)
|
57
|
+
jwt (2.2.1)
|
58
|
+
mime-types (3.3)
|
59
|
+
mime-types-data (~> 3.2015)
|
60
|
+
mime-types-data (3.2019.1009)
|
61
|
+
mini_portile2 (2.1.0)
|
62
|
+
minitest (5.13.0)
|
63
|
+
mongo (2.11.2)
|
64
|
+
bson (>= 4.6.0, < 5.0.0)
|
65
|
+
mongoid (7.0.0)
|
66
|
+
activemodel (>= 5.1, < 6.0.0)
|
67
|
+
mongo (>= 2.5.1, < 3.0.0)
|
68
|
+
multi_json (1.14.1)
|
69
|
+
multi_xml (0.6.0)
|
70
|
+
multipart-post (2.1.1)
|
71
|
+
nokogiri (1.6.8.1)
|
72
|
+
mini_portile2 (~> 2.1.0)
|
73
|
+
oauth2 (1.4.2)
|
74
|
+
faraday (>= 0.8, < 2.0)
|
75
|
+
jwt (>= 1.0, < 3.0)
|
76
|
+
multi_json (~> 1.3)
|
77
|
+
multi_xml (~> 0.5)
|
78
|
+
rack (>= 1.2, < 3)
|
79
|
+
public_suffix (4.0.1)
|
80
|
+
rack (2.0.8)
|
81
|
+
rake (13.0.1)
|
82
|
+
rdoc (6.2.0)
|
83
|
+
rest-client (1.6.7)
|
84
|
+
mime-types (>= 1.16)
|
85
|
+
rspec (3.9.0)
|
86
|
+
rspec-core (~> 3.9.0)
|
87
|
+
rspec-expectations (~> 3.9.0)
|
88
|
+
rspec-mocks (~> 3.9.0)
|
89
|
+
rspec-core (3.9.0)
|
90
|
+
rspec-support (~> 3.9.0)
|
91
|
+
rspec-expectations (3.9.0)
|
92
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
93
|
+
rspec-support (~> 3.9.0)
|
94
|
+
rspec-mocks (3.9.0)
|
95
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
+
rspec-support (~> 3.9.0)
|
97
|
+
rspec-support (3.9.0)
|
98
|
+
semver (1.0.1)
|
99
|
+
simplecov (0.17.1)
|
100
|
+
docile (~> 1.1)
|
101
|
+
json (>= 1.8, < 3)
|
102
|
+
simplecov-html (~> 0.10.0)
|
103
|
+
simplecov-html (0.10.2)
|
104
|
+
term-ansicolor (1.2.2)
|
105
|
+
tins (~> 0.8)
|
106
|
+
thor (0.18.1)
|
107
|
+
thread_safe (0.3.6)
|
108
|
+
tins (0.13.2)
|
109
|
+
tzinfo (1.2.5)
|
110
|
+
thread_safe (~> 0.1)
|
111
|
+
yard (0.9.20)
|
112
|
+
|
113
|
+
PLATFORMS
|
114
|
+
ruby
|
115
|
+
|
116
|
+
DEPENDENCIES
|
117
|
+
appraisal
|
118
|
+
bundler
|
119
|
+
coveralls
|
120
|
+
database_cleaner (>= 0.8.0)
|
121
|
+
jeweler (~> 2.1.1)
|
122
|
+
mongoid (= 7.0.0)
|
123
|
+
rspec (>= 3.0.0)
|
124
|
+
simplecov (~> 0.7)
|
125
|
+
yard
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "mongoid", "8.0.3"
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "bundler"
|
9
|
+
gem "jeweler", "~> 2.1.1"
|
10
|
+
gem "simplecov", "~> 0.7", require: false
|
11
|
+
gem "yard"
|
12
|
+
gem "rspec", ">= 3.0.0"
|
13
|
+
gem "appraisal"
|
14
|
+
gem "coveralls", require: false
|
15
|
+
gem "database_cleaner-mongoid", "~> 2.0", ">= 2.0.1"
|
16
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activemodel (7.0.4.2)
|
5
|
+
activesupport (= 7.0.4.2)
|
6
|
+
activesupport (7.0.4.2)
|
7
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
8
|
+
i18n (>= 1.6, < 2)
|
9
|
+
minitest (>= 5.1)
|
10
|
+
tzinfo (~> 2.0)
|
11
|
+
addressable (2.8.1)
|
12
|
+
public_suffix (>= 2.0.2, < 6.0)
|
13
|
+
appraisal (2.4.1)
|
14
|
+
bundler
|
15
|
+
rake
|
16
|
+
thor (>= 0.14.0)
|
17
|
+
bson (4.15.0)
|
18
|
+
builder (3.2.4)
|
19
|
+
concurrent-ruby (1.2.2)
|
20
|
+
coveralls (0.8.23)
|
21
|
+
json (>= 1.8, < 3)
|
22
|
+
simplecov (~> 0.16.1)
|
23
|
+
term-ansicolor (~> 1.3)
|
24
|
+
thor (>= 0.19.4, < 2.0)
|
25
|
+
tins (~> 1.6)
|
26
|
+
database_cleaner-core (2.0.1)
|
27
|
+
database_cleaner-mongoid (2.0.1)
|
28
|
+
database_cleaner-core (~> 2.0.0)
|
29
|
+
mongoid
|
30
|
+
descendants_tracker (0.0.4)
|
31
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
32
|
+
diff-lcs (1.5.0)
|
33
|
+
docile (1.4.0)
|
34
|
+
faraday (0.9.2)
|
35
|
+
multipart-post (>= 1.2, < 3)
|
36
|
+
git (1.17.1)
|
37
|
+
addressable (~> 2.8)
|
38
|
+
rchardet (~> 1.8)
|
39
|
+
github_api (0.11.3)
|
40
|
+
addressable (~> 2.3)
|
41
|
+
descendants_tracker (~> 0.0.1)
|
42
|
+
faraday (~> 0.8, < 0.10)
|
43
|
+
hashie (>= 1.2)
|
44
|
+
multi_json (>= 1.7.5, < 2.0)
|
45
|
+
nokogiri (~> 1.6.0)
|
46
|
+
oauth2
|
47
|
+
hashie (5.0.0)
|
48
|
+
highline (2.1.0)
|
49
|
+
i18n (1.12.0)
|
50
|
+
concurrent-ruby (~> 1.0)
|
51
|
+
jeweler (2.1.2)
|
52
|
+
builder
|
53
|
+
bundler (>= 1.0)
|
54
|
+
git (>= 1.2.5)
|
55
|
+
github_api (~> 0.11.0)
|
56
|
+
highline (>= 1.6.15)
|
57
|
+
nokogiri (>= 1.5.10)
|
58
|
+
rake
|
59
|
+
rdoc
|
60
|
+
semver
|
61
|
+
json (2.6.3)
|
62
|
+
jwt (2.7.0)
|
63
|
+
mini_portile2 (2.1.0)
|
64
|
+
minitest (5.18.0)
|
65
|
+
mongo (2.18.2)
|
66
|
+
bson (>= 4.14.1, < 5.0.0)
|
67
|
+
mongoid (8.0.3)
|
68
|
+
activemodel (>= 5.1, < 7.1, != 7.0.0)
|
69
|
+
mongo (>= 2.18.0, < 3.0.0)
|
70
|
+
ruby2_keywords (~> 0.0.5)
|
71
|
+
multi_json (1.15.0)
|
72
|
+
multi_xml (0.6.0)
|
73
|
+
multipart-post (2.3.0)
|
74
|
+
nokogiri (1.6.8.1)
|
75
|
+
mini_portile2 (~> 2.1.0)
|
76
|
+
oauth2 (1.4.8)
|
77
|
+
faraday (>= 0.8, < 3.0)
|
78
|
+
jwt (>= 1.0, < 3.0)
|
79
|
+
multi_json (~> 1.3)
|
80
|
+
multi_xml (~> 0.5)
|
81
|
+
rack (>= 1.2, < 3)
|
82
|
+
psych (5.1.0)
|
83
|
+
stringio
|
84
|
+
public_suffix (5.0.1)
|
85
|
+
rack (2.2.6.3)
|
86
|
+
rake (13.0.6)
|
87
|
+
rchardet (1.8.0)
|
88
|
+
rdoc (6.5.0)
|
89
|
+
psych (>= 4.0.0)
|
90
|
+
rspec (3.12.0)
|
91
|
+
rspec-core (~> 3.12.0)
|
92
|
+
rspec-expectations (~> 3.12.0)
|
93
|
+
rspec-mocks (~> 3.12.0)
|
94
|
+
rspec-core (3.12.1)
|
95
|
+
rspec-support (~> 3.12.0)
|
96
|
+
rspec-expectations (3.12.2)
|
97
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
98
|
+
rspec-support (~> 3.12.0)
|
99
|
+
rspec-mocks (3.12.3)
|
100
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
101
|
+
rspec-support (~> 3.12.0)
|
102
|
+
rspec-support (3.12.0)
|
103
|
+
ruby2_keywords (0.0.5)
|
104
|
+
semver (1.0.1)
|
105
|
+
simplecov (0.16.1)
|
106
|
+
docile (~> 1.1)
|
107
|
+
json (>= 1.8, < 3)
|
108
|
+
simplecov-html (~> 0.10.0)
|
109
|
+
simplecov-html (0.10.2)
|
110
|
+
stringio (3.0.5)
|
111
|
+
sync (0.5.0)
|
112
|
+
term-ansicolor (1.7.1)
|
113
|
+
tins (~> 1.0)
|
114
|
+
thor (1.2.1)
|
115
|
+
thread_safe (0.3.6)
|
116
|
+
tins (1.32.1)
|
117
|
+
sync
|
118
|
+
tzinfo (2.0.6)
|
119
|
+
concurrent-ruby (~> 1.0)
|
120
|
+
webrick (1.7.0)
|
121
|
+
yard (0.9.28)
|
122
|
+
webrick (~> 1.7.0)
|
123
|
+
|
124
|
+
PLATFORMS
|
125
|
+
x86_64-darwin-21
|
126
|
+
|
127
|
+
DEPENDENCIES
|
128
|
+
appraisal
|
129
|
+
bundler
|
130
|
+
coveralls
|
131
|
+
database_cleaner-mongoid (~> 2.0, >= 2.0.1)
|
132
|
+
jeweler (~> 2.1.1)
|
133
|
+
mongoid (= 8.0.3)
|
134
|
+
rspec (>= 3.0.0)
|
135
|
+
simplecov (~> 0.7)
|
136
|
+
yard
|
137
|
+
|
138
|
+
BUNDLED WITH
|
139
|
+
2.4.6
|
@@ -7,7 +7,7 @@ module Mongoid
|
|
7
7
|
|
8
8
|
module ClassMethods
|
9
9
|
def rateable options = {}
|
10
|
-
class_eval do
|
10
|
+
class_eval do
|
11
11
|
self.send :include, Mongoid::Rateable
|
12
12
|
self.rate_config options
|
13
13
|
end
|
@@ -26,8 +26,8 @@ module Mongoid
|
|
26
26
|
|
27
27
|
index({"rating_marks.rater_id" => 1, "rating_marks.rater_class" => 1})
|
28
28
|
|
29
|
-
scope :unrated, where(:rating.exists => false)
|
30
|
-
scope :rated, where(:rating.exists => true)
|
29
|
+
scope :unrated, -> { where(:rating.exists => false) }
|
30
|
+
scope :rated, -> { where(:rating.exists => true) }
|
31
31
|
scope :rated_by, ->(rater) { where("rating_marks.rater_id" => rater.id, "rating_marks.rater_class" => rater.class.to_s) }
|
32
32
|
scope :with_rating, ->(range) { where(:rating.gte => range.begin, :rating.lte => range.end) }
|
33
33
|
scope :highest_rated, ->(limit=10) { order_by([:rating, :desc]).limit(limit) }
|
@@ -46,7 +46,7 @@ module Mongoid
|
|
46
46
|
def in_rating_range?(value)
|
47
47
|
range = rating_range if respond_to?(:rating_range)
|
48
48
|
range ? range.include?(value.to_i) : true
|
49
|
-
end
|
49
|
+
end
|
50
50
|
|
51
51
|
# macro to create dynamic :rating_range class method!
|
52
52
|
# can now even take an Array and find the range of values!
|
@@ -95,7 +95,7 @@ module Mongoid
|
|
95
95
|
self.instance_eval(&block)
|
96
96
|
end
|
97
97
|
else
|
98
|
-
raise ArgumentError, "Must take symbol or block argument"
|
98
|
+
raise ArgumentError, "Must take symbol or block argument"
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end # class methods
|
@@ -104,12 +104,12 @@ module Mongoid
|
|
104
104
|
case rater
|
105
105
|
when Array
|
106
106
|
rater.each{|rater| rate(mark, rater, weight)}
|
107
|
-
else
|
107
|
+
else
|
108
108
|
if !rater
|
109
109
|
unless respond_to?(:default_rater)
|
110
110
|
raise ArgumentError, "No rater argument and no default_rater specified"
|
111
111
|
end
|
112
|
-
rater = default_rater
|
112
|
+
rater = default_rater
|
113
113
|
end
|
114
114
|
validate_rater!(rater)
|
115
115
|
validate_rating!(mark)
|
@@ -126,7 +126,7 @@ module Mongoid
|
|
126
126
|
case rater
|
127
127
|
when Array
|
128
128
|
rater.each{|rater| unrate(mark, rater, weight)}
|
129
|
-
else
|
129
|
+
else
|
130
130
|
unrate_without_rating_update(rater)
|
131
131
|
update_rating
|
132
132
|
end
|
@@ -136,7 +136,7 @@ module Mongoid
|
|
136
136
|
case rater
|
137
137
|
when Array
|
138
138
|
rater.each{|rater| rate_and_save(mark, rater, weight)}
|
139
|
-
else
|
139
|
+
else
|
140
140
|
rate(mark, rater, weight)
|
141
141
|
save
|
142
142
|
end
|
@@ -146,7 +146,7 @@ module Mongoid
|
|
146
146
|
case rater
|
147
147
|
when Array
|
148
148
|
rater.each{|rater| unrate_and_save(mark, rater, weight)}
|
149
|
-
else
|
149
|
+
else
|
150
150
|
unrate(rater)
|
151
151
|
save
|
152
152
|
end
|
@@ -160,7 +160,7 @@ module Mongoid
|
|
160
160
|
case rater
|
161
161
|
when Array
|
162
162
|
rater.each{|rater| rated_by(mark, rater, weight)}
|
163
|
-
else
|
163
|
+
else
|
164
164
|
self.rating_marks.where(:rater_id => rater.id, :rater_class => rater.class.to_s).count == 1
|
165
165
|
end
|
166
166
|
end
|
@@ -197,6 +197,15 @@ module Mongoid
|
|
197
197
|
r ? r.mark : nil
|
198
198
|
end
|
199
199
|
|
200
|
+
def user_marks(raters)
|
201
|
+
if raters.map{|x| x.class}.uniq.count > 1
|
202
|
+
raise ArgumentError, "Raters all must be of same class."
|
203
|
+
return
|
204
|
+
end
|
205
|
+
r = self.rating_marks.in(:rater_id => raters.map(&:id), :rater_class => raters.first.class.to_s)
|
206
|
+
r ? r.inject(Hash.new(0)) { |h, e| h[e.rater_id] = e.mark ; h } : nil
|
207
|
+
end
|
208
|
+
|
200
209
|
protected
|
201
210
|
|
202
211
|
def validate_rater!(rater)
|
@@ -228,7 +237,7 @@ module Mongoid
|
|
228
237
|
rt = (self.rates.to_f / self.weighted_rate_count.to_f) unless self.rating_marks.blank?
|
229
238
|
write_attribute(:rating, rt)
|
230
239
|
delta = (self.rating && self.previous_rating) ? rating-previous_rating : 0.0
|
231
|
-
write_attribute(:rating_delta, delta)
|
240
|
+
write_attribute(:rating_delta, delta)
|
232
241
|
end
|
233
242
|
|
234
243
|
def check_weighted_rate_count
|
@@ -5,6 +5,6 @@ class RatingMark
|
|
5
5
|
embedded_in :rateable, :polymorphic => true
|
6
6
|
field :mark, :type => Integer
|
7
7
|
field :rater_class, :type => String
|
8
|
-
field :rater_id, :type => Moped::BSON::ObjectId
|
8
|
+
field :rater_id, :type => Mongoid::VERSION.start_with?('3') ? Moped::BSON::ObjectId : BSON::ObjectId
|
9
9
|
field :weight, :type => Integer, :default => 1
|
10
10
|
end
|
data/lib/mongoid_rateable.rb
CHANGED