recommendable 1.1.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/recommendable.rb +38 -26
- data/lib/recommendable/configuration.rb +47 -0
- data/lib/recommendable/helpers.rb +3 -9
- data/lib/recommendable/helpers/calculations.rb +150 -0
- data/lib/recommendable/helpers/queriers.rb +23 -0
- data/lib/recommendable/helpers/redis_key_mapper.rb +29 -0
- data/lib/recommendable/orm/active_record.rb +6 -0
- data/lib/recommendable/orm/data_mapper.rb +7 -0
- data/lib/recommendable/orm/mongo_mapper.rb +8 -0
- data/lib/recommendable/orm/mongoid.rb +7 -0
- data/lib/recommendable/ratable.rb +83 -0
- data/lib/recommendable/ratable/dislikable.rb +26 -0
- data/lib/recommendable/ratable/likable.rb +26 -0
- data/lib/recommendable/rater.rb +109 -0
- data/lib/recommendable/rater/bookmarker.rb +120 -0
- data/lib/recommendable/rater/disliker.rb +122 -0
- data/lib/recommendable/rater/hider.rb +120 -0
- data/lib/recommendable/rater/liker.rb +122 -0
- data/lib/recommendable/rater/recommender.rb +68 -0
- data/lib/recommendable/version.rb +5 -4
- data/lib/recommendable/workers/delayed_job.rb +16 -0
- data/lib/recommendable/workers/rails.rb +16 -0
- data/lib/recommendable/workers/resque.rb +13 -0
- data/lib/recommendable/workers/sidekiq.rb +13 -0
- metadata +62 -131
- data/.gitignore +0 -57
- data/.travis.yml +0 -3
- data/CHANGELOG.markdown +0 -159
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -112
- data/LICENSE.txt +0 -22
- data/README.markdown +0 -135
- data/Rakefile +0 -26
- data/TODO +0 -7
- data/app/models/recommendable/dislike.rb +0 -19
- data/app/models/recommendable/ignore.rb +0 -19
- data/app/models/recommendable/like.rb +0 -19
- data/app/models/recommendable/stash.rb +0 -19
- data/app/workers/recommendable/delayed_job_worker.rb +0 -17
- data/app/workers/recommendable/rails_worker.rb +0 -17
- data/app/workers/recommendable/resque_worker.rb +0 -14
- data/app/workers/recommendable/sidekiq_worker.rb +0 -14
- data/config/routes.rb +0 -3
- data/db/migrate/20120124193723_create_likes.rb +0 -17
- data/db/migrate/20120124193728_create_dislikes.rb +0 -17
- data/db/migrate/20120127092558_create_ignores.rb +0 -17
- data/db/migrate/20120131173909_create_stashes.rb +0 -17
- data/lib/generators/recommendable/USAGE +0 -8
- data/lib/generators/recommendable/install_generator.rb +0 -40
- data/lib/generators/recommendable/templates/initializer.rb +0 -28
- data/lib/recommendable/acts_as_recommendable.rb +0 -176
- data/lib/recommendable/acts_as_recommended_to.rb +0 -774
- data/lib/recommendable/engine.rb +0 -14
- data/lib/recommendable/exceptions.rb +0 -4
- data/lib/recommendable/railtie.rb +0 -6
- data/lib/sidekiq/middleware/client/unique_jobs.rb +0 -37
- data/lib/sidekiq/middleware/server/unique_jobs.rb +0 -17
- data/lib/tasks/recommendable_tasks.rake +0 -1
- data/recommendable.gemspec +0 -30
- data/script/rails +0 -8
- data/spec/configuration_spec.rb +0 -9
- data/spec/dummy/README.rdoc +0 -261
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/assets/javascripts/application.js +0 -15
- data/spec/dummy/app/assets/stylesheets/application.css +0 -13
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/bully.rb +0 -2
- data/spec/dummy/app/models/movie.rb +0 -2
- data/spec/dummy/app/models/php_framework.rb +0 -2
- data/spec/dummy/app/models/user.rb +0 -3
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -56
- data/spec/dummy/config/boot.rb +0 -10
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -37
- data/spec/dummy/config/environments/production.rb +0 -67
- data/spec/dummy/config/environments/test.rb +0 -37
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/inflections.rb +0 -15
- data/spec/dummy/config/initializers/mime_types.rb +0 -5
- data/spec/dummy/config/initializers/recommendable.rb +0 -14
- data/spec/dummy/config/initializers/secret_token.rb +0 -7
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -4
- data/spec/dummy/db/migrate/20120128005553_create_likes.recommendable.rb +0 -18
- data/spec/dummy/db/migrate/20120128005554_create_dislikes.recommendable.rb +0 -18
- data/spec/dummy/db/migrate/20120128005555_create_ignores.recommendable.rb +0 -18
- data/spec/dummy/db/migrate/20120128020228_create_users.rb +0 -9
- data/spec/dummy/db/migrate/20120128020413_create_movies.rb +0 -10
- data/spec/dummy/db/migrate/20120128024632_create_php_frameworks.rb +0 -9
- data/spec/dummy/db/migrate/20120128024804_create_bullies.rb +0 -9
- data/spec/dummy/db/migrate/20120131195416_create_stashes.recommendable.rb +0 -19
- data/spec/dummy/db/schema.rb +0 -89
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -25
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/recommendable_dummy_development +0 -0
- data/spec/dummy/recommendable_dummy_test +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/factories.rb +0 -16
- data/spec/models/dislike_spec.rb +0 -41
- data/spec/models/ignore_spec.rb +0 -27
- data/spec/models/like_spec.rb +0 -42
- data/spec/models/movie_spec.rb +0 -82
- data/spec/models/stash_spec.rb +0 -27
- data/spec/models/user_benchmark_spec.rb +0 -49
- data/spec/models/user_spec.rb +0 -443
- data/spec/spec_helper.rb +0 -28
data/.gitignore
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# RVM / rbenv version files
|
|
2
|
-
.rvmrc
|
|
3
|
-
.rbenv-version
|
|
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
|
-
vendor/bundle
|
|
18
|
-
|
|
19
|
-
# jeweler generated
|
|
20
|
-
pkg
|
|
21
|
-
|
|
22
|
-
# logging
|
|
23
|
-
*.log
|
|
24
|
-
|
|
25
|
-
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
|
26
|
-
#
|
|
27
|
-
# * Create a file at ~/.gitignore
|
|
28
|
-
# * Include files you want ignored
|
|
29
|
-
# * Run: git config --global core.excludesfile ~/.gitignore
|
|
30
|
-
#
|
|
31
|
-
# After doing this, these files will be ignored in all your git projects,
|
|
32
|
-
# saving you from having to 'pollute' every project you touch with them
|
|
33
|
-
#
|
|
34
|
-
# 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)
|
|
35
|
-
#
|
|
36
|
-
# For MacOS:
|
|
37
|
-
|
|
38
|
-
.DS_Store
|
|
39
|
-
|
|
40
|
-
# For TextMate
|
|
41
|
-
*.tmproj
|
|
42
|
-
tmtags
|
|
43
|
-
|
|
44
|
-
# For emacs:
|
|
45
|
-
#*~
|
|
46
|
-
#\#*
|
|
47
|
-
#.\#*
|
|
48
|
-
|
|
49
|
-
# For vim:
|
|
50
|
-
*.swp
|
|
51
|
-
|
|
52
|
-
# For redcar:
|
|
53
|
-
#.redcar
|
|
54
|
-
|
|
55
|
-
# For rubinius:
|
|
56
|
-
#*.rbc
|
|
57
|
-
.rake_tasks*
|
data/.travis.yml
DELETED
data/CHANGELOG.markdown
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
Changelog
|
|
2
|
-
=========
|
|
3
|
-
|
|
4
|
-
1.1.7 (Current version)
|
|
5
|
-
-----------------------
|
|
6
|
-
* Fix #50, a method that was forgotten to time during the ignoreable => ignorable typo update
|
|
7
|
-
|
|
8
|
-
1.1.6
|
|
9
|
-
-----
|
|
10
|
-
* Minor code cleanup for my benefit
|
|
11
|
-
|
|
12
|
-
1.1.5
|
|
13
|
-
-----
|
|
14
|
-
* Fix #47, a problem where models could not recommend themselves
|
|
15
|
-
|
|
16
|
-
1.1.4
|
|
17
|
-
-----
|
|
18
|
-
* Fix #41, a problem where Resque rake tasks were required regardless of whether or not it was bundled
|
|
19
|
-
* Fix #46 by adding UniqueJob middleware for Sidekiq.
|
|
20
|
-
* Added caches for an item's number of likes and dislikes received
|
|
21
|
-
|
|
22
|
-
1.1.3
|
|
23
|
-
-----
|
|
24
|
-
* Update Redis.
|
|
25
|
-
|
|
26
|
-
1.1.2
|
|
27
|
-
-----
|
|
28
|
-
* Fix #38, a problem with enqueueing users based on updating the score of a recommendable record
|
|
29
|
-
|
|
30
|
-
1.1.1
|
|
31
|
-
-----
|
|
32
|
-
* Support for Sidekiq, Resque, DelayedJob and Rails::Queueing (issue #28)
|
|
33
|
-
* You must manually bundle Sidekiq, Resque, or DelayedJob. Rails::Queueing is available as a fallback for Rails 4.x
|
|
34
|
-
* Use [apotonick/hooks](https://github.com/apotonick/hooks) to implement callbacks (issue #25). See the [detailed README](http://davidcelis.com/recommendable) for more info on usage.
|
|
35
|
-
|
|
36
|
-
1.0.0
|
|
37
|
-
-----
|
|
38
|
-
* Dynamic finders now return ActiveRecord::Relations! This means you can chain other ActiveRecord query methods like so:
|
|
39
|
-
|
|
40
|
-
```ruby
|
|
41
|
-
current_user.recommended_posts.where(:category => "technology")
|
|
42
|
-
current_user.liked_movies.limit(10)
|
|
43
|
-
current_user.stashed_books.where(:author => "Cormac McCarthy")
|
|
44
|
-
current_user.disliked_shows.joins(:cast_members).where('cast_members.name = Kim Kardashian')
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
* You can now specify a count for `User#recommendations`:
|
|
48
|
-
|
|
49
|
-
```ruby
|
|
50
|
-
current_user.recommendations(10)
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
* Bug fixes
|
|
54
|
-
|
|
55
|
-
0.2.0
|
|
56
|
-
-----
|
|
57
|
-
* NOTE: This release is NOT backwards compatible. Please migrate your databases:
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
rename_column :recommendable_ignores, :ignoreable_id, :ignorable_id
|
|
61
|
-
rename_column :recommendable_ignores, :ignoreable_type, :ignorable_type
|
|
62
|
-
rename_table :recommendable_stashed_items, :recommendable_stashes
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
* Fix an issue with recommendable models implemented via STI
|
|
66
|
-
* Fix a library-wide typo of "ignoreable" to "ignorable"
|
|
67
|
-
|
|
68
|
-
0.1.9
|
|
69
|
-
-----
|
|
70
|
-
* Yanked due to breaking bug
|
|
71
|
-
|
|
72
|
-
0.1.8
|
|
73
|
-
-----
|
|
74
|
-
* Revert changes made in 0.1.7 due to licensing
|
|
75
|
-
|
|
76
|
-
0.1.7
|
|
77
|
-
-----
|
|
78
|
-
* Yanked and no longer available.
|
|
79
|
-
* Attempted switch from Resque to Sidekiq
|
|
80
|
-
|
|
81
|
-
0.1.6
|
|
82
|
-
-----
|
|
83
|
-
* Dynamic finders for your User class:
|
|
84
|
-
|
|
85
|
-
`current_user.liked_movies`
|
|
86
|
-
`current_user.disliked_shows`
|
|
87
|
-
`current_user.recommended_movies`
|
|
88
|
-
|
|
89
|
-
* Implement sorting of recommendable models:
|
|
90
|
-
|
|
91
|
-
``` ruby
|
|
92
|
-
>> Movie.top(5)
|
|
93
|
-
=> [#<Movie id: 14>, #<Movie id: 15>, #<Movie id: 13>, #<Movie id: 12>, #<Movie id: 11>]
|
|
94
|
-
>> Movie.top
|
|
95
|
-
=> #<Movie id: 14>
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
* Bugfix: users/recommendable objects will now be removed from Redis upon being destroyed
|
|
99
|
-
|
|
100
|
-
0.1.5
|
|
101
|
-
-----
|
|
102
|
-
* Major bugfix: similarity values were, incorrectly, being calculated as 0.0 for every user pair. Sorry!
|
|
103
|
-
* The tables for all models are now all prepended with "recommendable_" to avoid possible collision. If upgrading from a previous version, please do the following:
|
|
104
|
-
|
|
105
|
-
``` bash
|
|
106
|
-
$ rails g migration RenameRecommendableTables
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
And paste this into your new migration:
|
|
110
|
-
|
|
111
|
-
``` ruby
|
|
112
|
-
class RenameRecommendableTables < ActiveRecord::Migration
|
|
113
|
-
def up
|
|
114
|
-
rename_table :likes, :recommendable_likes
|
|
115
|
-
rename_table :dislikes, :recommendable_dislikes
|
|
116
|
-
rename_table :ignores, :recommendable_ignores
|
|
117
|
-
rename_table :stashed_items, :recommendable_stashed_items
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def down
|
|
121
|
-
rename_table :recommendable_likes, :likes
|
|
122
|
-
rename_table :recommendable_dislikes, :dislikes
|
|
123
|
-
rename_table :recommendable_ignores, :ignores
|
|
124
|
-
rename_table :recommendable_stashed_items, :stashed_items
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
0.1.4
|
|
130
|
-
-----
|
|
131
|
-
* `acts_as_recommendable` is no longer needed in your models
|
|
132
|
-
* Instead of declaring `acts_as_recommended_to` in your User class, please use `recommends` instead, passing in a list of your recommendable models as a list of symbols (e.g. `recommends :movies, :books`)
|
|
133
|
-
* Your initializer should no longer declare the user class. This is no longer necessary and is deprecated.
|
|
134
|
-
* Fix an issue that caused the unnecessary need for eager loading models in development
|
|
135
|
-
* Removed aliases: `liked_records`, `liked_records_for`, `disliked_records`, and `disliked_records_for`
|
|
136
|
-
* Renamed methods:
|
|
137
|
-
* `has_ignored?` => `ignored?`
|
|
138
|
-
* `has_stashed?` => `stashed?`
|
|
139
|
-
* Code quality tweaks
|
|
140
|
-
|
|
141
|
-
0.1.3 (current version)
|
|
142
|
-
-----------------------
|
|
143
|
-
|
|
144
|
-
* Improvements to speed of similarity calculations.
|
|
145
|
-
* Added an instance method to items that act_as_recommendable, `rated_by`. This returns an array of users that like or dislike the item.
|
|
146
|
-
|
|
147
|
-
0.1.2
|
|
148
|
-
-----
|
|
149
|
-
|
|
150
|
-
* Fix an issue that could cause similarity values between users to be incorrect.
|
|
151
|
-
* `User#common_likes_with` and `User#common_dislikes_with` now return the actual Model instances by default. Accordingly, these methods are no longer private.
|
|
152
|
-
|
|
153
|
-
0.1.1
|
|
154
|
-
-----
|
|
155
|
-
* Introduce the "stashed item" feature. This gives the ability for users to save an item in a list to try later, while at the same time removing it from their list of recommendations. This lets your users keep getting new recommendations without necessarily having to rate what they know they want to try.
|
|
156
|
-
|
|
157
|
-
0.1.0
|
|
158
|
-
-----
|
|
159
|
-
* Welcome to recommendable!
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
recommendable (1.1.6)
|
|
5
|
-
hooks (>= 0.2.1)
|
|
6
|
-
rails (>= 3.0.0)
|
|
7
|
-
redis (>= 2.2.0)
|
|
8
|
-
|
|
9
|
-
GEM
|
|
10
|
-
remote: http://rubygems.org/
|
|
11
|
-
specs:
|
|
12
|
-
actionmailer (3.2.8)
|
|
13
|
-
actionpack (= 3.2.8)
|
|
14
|
-
mail (~> 2.4.4)
|
|
15
|
-
actionpack (3.2.8)
|
|
16
|
-
activemodel (= 3.2.8)
|
|
17
|
-
activesupport (= 3.2.8)
|
|
18
|
-
builder (~> 3.0.0)
|
|
19
|
-
erubis (~> 2.7.0)
|
|
20
|
-
journey (~> 1.0.4)
|
|
21
|
-
rack (~> 1.4.0)
|
|
22
|
-
rack-cache (~> 1.2)
|
|
23
|
-
rack-test (~> 0.6.1)
|
|
24
|
-
sprockets (~> 2.1.3)
|
|
25
|
-
activemodel (3.2.8)
|
|
26
|
-
activesupport (= 3.2.8)
|
|
27
|
-
builder (~> 3.0.0)
|
|
28
|
-
activerecord (3.2.8)
|
|
29
|
-
activemodel (= 3.2.8)
|
|
30
|
-
activesupport (= 3.2.8)
|
|
31
|
-
arel (~> 3.0.2)
|
|
32
|
-
tzinfo (~> 0.3.29)
|
|
33
|
-
activeresource (3.2.8)
|
|
34
|
-
activemodel (= 3.2.8)
|
|
35
|
-
activesupport (= 3.2.8)
|
|
36
|
-
activesupport (3.2.8)
|
|
37
|
-
i18n (~> 0.6)
|
|
38
|
-
multi_json (~> 1.0)
|
|
39
|
-
arel (3.0.2)
|
|
40
|
-
builder (3.0.0)
|
|
41
|
-
erubis (2.7.0)
|
|
42
|
-
hike (1.2.1)
|
|
43
|
-
hooks (0.2.1)
|
|
44
|
-
i18n (0.6.0)
|
|
45
|
-
journey (1.0.4)
|
|
46
|
-
json (1.7.4)
|
|
47
|
-
mail (2.4.4)
|
|
48
|
-
i18n (>= 0.4.0)
|
|
49
|
-
mime-types (~> 1.16)
|
|
50
|
-
treetop (~> 1.4.8)
|
|
51
|
-
mime-types (1.19)
|
|
52
|
-
miniskirt (1.1.1)
|
|
53
|
-
activesupport (>= 2.2)
|
|
54
|
-
minitest (3.3.0)
|
|
55
|
-
multi_json (1.3.6)
|
|
56
|
-
polyglot (0.3.3)
|
|
57
|
-
rack (1.4.1)
|
|
58
|
-
rack-cache (1.2)
|
|
59
|
-
rack (>= 0.4)
|
|
60
|
-
rack-ssl (1.3.2)
|
|
61
|
-
rack
|
|
62
|
-
rack-test (0.6.1)
|
|
63
|
-
rack (>= 1.0)
|
|
64
|
-
rails (3.2.8)
|
|
65
|
-
actionmailer (= 3.2.8)
|
|
66
|
-
actionpack (= 3.2.8)
|
|
67
|
-
activerecord (= 3.2.8)
|
|
68
|
-
activeresource (= 3.2.8)
|
|
69
|
-
activesupport (= 3.2.8)
|
|
70
|
-
bundler (~> 1.0)
|
|
71
|
-
railties (= 3.2.8)
|
|
72
|
-
railties (3.2.8)
|
|
73
|
-
actionpack (= 3.2.8)
|
|
74
|
-
activesupport (= 3.2.8)
|
|
75
|
-
rack-ssl (~> 1.3.2)
|
|
76
|
-
rake (>= 0.8.7)
|
|
77
|
-
rdoc (~> 3.4)
|
|
78
|
-
thor (>= 0.14.6, < 2.0)
|
|
79
|
-
rake (0.9.2.2)
|
|
80
|
-
rdoc (3.12)
|
|
81
|
-
json (~> 1.4)
|
|
82
|
-
redis (3.0.1)
|
|
83
|
-
shoulda (3.1.1)
|
|
84
|
-
shoulda-context (~> 1.0)
|
|
85
|
-
shoulda-matchers (~> 1.2)
|
|
86
|
-
shoulda-context (1.0.0)
|
|
87
|
-
shoulda-matchers (1.2.0)
|
|
88
|
-
activesupport (>= 3.0.0)
|
|
89
|
-
sprockets (2.1.3)
|
|
90
|
-
hike (~> 1.2)
|
|
91
|
-
rack (~> 1.0)
|
|
92
|
-
tilt (~> 1.1, != 1.3.0)
|
|
93
|
-
sqlite3 (1.3.6)
|
|
94
|
-
thor (0.15.4)
|
|
95
|
-
tilt (1.3.3)
|
|
96
|
-
treetop (1.4.10)
|
|
97
|
-
polyglot
|
|
98
|
-
polyglot (>= 0.3.1)
|
|
99
|
-
tzinfo (0.3.33)
|
|
100
|
-
yard (0.6.8)
|
|
101
|
-
|
|
102
|
-
PLATFORMS
|
|
103
|
-
ruby
|
|
104
|
-
|
|
105
|
-
DEPENDENCIES
|
|
106
|
-
bundler
|
|
107
|
-
miniskirt
|
|
108
|
-
minitest
|
|
109
|
-
recommendable!
|
|
110
|
-
shoulda
|
|
111
|
-
sqlite3
|
|
112
|
-
yard (~> 0.6.0)
|
data/LICENSE.txt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2012 David Celis
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# Recommendable [](http://travis-ci.org/davidcelis/recommendable)
|
|
2
|
-
|
|
3
|
-
Recommendable is an engine for Rails 3 applications to quickly add the ability for your users to Like/Dislike items and receive recommendations for new items. It uses Redis to store your recommendations and keep them sorted by how good the recommendation is.
|
|
4
|
-
|
|
5
|
-
Requirements
|
|
6
|
-
------------
|
|
7
|
-
* Ruby 1.9.x
|
|
8
|
-
* Rails 3.x or 4.x
|
|
9
|
-
* Sidekiq or Resque (or DelayedJob)
|
|
10
|
-
|
|
11
|
-
Bundling one of the queueing systems above is highly recommended to avoid having to manually refresh users' recommendations. If running on Rails 4, the built-in queueing system is supported. If you bundle [Sidekiq][sidekiq], [Resque][resque], or [DelayedJob][delayed_job], Recommendable will use your bundled queueing system instead. If bundling Resque, you should also include ['resque-loner'][resque-loner] in your Gemfile to ensure your users only get queued once (Sidekiq does this by default, and there is no current way to avoid duplicate jobs in DelayedJob).
|
|
12
|
-
|
|
13
|
-
Installation
|
|
14
|
-
------------
|
|
15
|
-
|
|
16
|
-
Add the following to your Rails application's `Gemfile`:
|
|
17
|
-
|
|
18
|
-
``` ruby
|
|
19
|
-
gem 'recommendable'
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
After bundling, run the installation generator:
|
|
23
|
-
|
|
24
|
-
``` bash
|
|
25
|
-
$ rails g recommendable:install
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Double check `config/initializers/recommendable.rb` for options on configuring your Redis connection. After a user likes or dislikes something new, they are placed in a queue to have their recommendations updated. If you're using the basic Rails 4.0 queue, you don't need to do anything explicit. If using Sidekiq, Resque, or DelayedJob, start your workers from the command line:
|
|
29
|
-
|
|
30
|
-
``` bash
|
|
31
|
-
# sidekiq
|
|
32
|
-
$ bundle exec sidekiq -q recommendable
|
|
33
|
-
# resque
|
|
34
|
-
$ QUEUE=recommendable rake environment resque:work
|
|
35
|
-
# delayed_job
|
|
36
|
-
$ rake jobs:work
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Usage
|
|
40
|
-
-----
|
|
41
|
-
|
|
42
|
-
In your Rails model that will be receiving recommendations:
|
|
43
|
-
|
|
44
|
-
``` ruby
|
|
45
|
-
class User < ActiveRecord::Base
|
|
46
|
-
recommends :movies, :shows, :other_things
|
|
47
|
-
|
|
48
|
-
# ...
|
|
49
|
-
end
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
That's it! Please note, however, that you may only do this in one model at this time.
|
|
53
|
-
|
|
54
|
-
For more details on how to use Recommendable once it's installed and configured, [check out the more detailed README][recommendable] or see the [documentation][documentation].
|
|
55
|
-
|
|
56
|
-
Installing Redis
|
|
57
|
-
----------------
|
|
58
|
-
|
|
59
|
-
Recommendable requires Redis to deliver recommendations. The collaborative filtering logic is based almost entirely on set math, and Redis is blazing fast for this. _NOTE: Your redis database MUST be persistent._
|
|
60
|
-
|
|
61
|
-
### Mac OS X
|
|
62
|
-
|
|
63
|
-
For Mac OS X users, homebrew is by far the easiest way to install Redis. Make sure to read the caveats after installation!
|
|
64
|
-
|
|
65
|
-
``` bash
|
|
66
|
-
$ brew install redis
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Linux
|
|
70
|
-
|
|
71
|
-
For Linux users, there is a package on apt-get.
|
|
72
|
-
|
|
73
|
-
``` bash
|
|
74
|
-
$ sudo apt-get install redis-server
|
|
75
|
-
$ redis-server
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Redis will now be running on localhost:6379. After a second, you can hit `ctrl-\` to detach and keep Redis running in the background.
|
|
79
|
-
|
|
80
|
-
### Redis problems?
|
|
81
|
-
|
|
82
|
-
Oops, did you kill your Redis database? Not to worry. Likes, Dislikes, Ignores,
|
|
83
|
-
and StashedItems are stored as models in your regular database. As long as these
|
|
84
|
-
still exist, you can regenerate the similarity values and recommendations on the
|
|
85
|
-
fly. But try not to have to do it!
|
|
86
|
-
|
|
87
|
-
``` ruby
|
|
88
|
-
Users.all.each do |user|
|
|
89
|
-
user.send :update_similarities
|
|
90
|
-
user.send :update_recommendations
|
|
91
|
-
end
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Why not stars?
|
|
95
|
-
--------------
|
|
96
|
-
I'll let Randall Munroe of [XKCD](http://xkcd.com/) take this one for me:
|
|
97
|
-
|
|
98
|
-
[](http://xkcd.com/1098/)
|
|
99
|
-
|
|
100
|
-
Contributing to recommendable
|
|
101
|
-
-----------------------------
|
|
102
|
-
|
|
103
|
-
Once you've made your great commits:
|
|
104
|
-
|
|
105
|
-
1. [Fork][forking] recommendable
|
|
106
|
-
2. Create a feature branch
|
|
107
|
-
3. Write your code (and tests please)
|
|
108
|
-
4. Push to your branch's origin
|
|
109
|
-
5. Create a [Pull Request][pull requests] from your branch
|
|
110
|
-
6. That's it!
|
|
111
|
-
|
|
112
|
-
Links
|
|
113
|
-
-----
|
|
114
|
-
* Code: `git clone git://github.com/davidcelis/recommendable.git`
|
|
115
|
-
* Home: <http://github.com/davidcelis/recommendable>
|
|
116
|
-
* Docs: <http://rubydoc.info/gems/recommendable/frames>
|
|
117
|
-
* Bugs: <http://github.com/davidcelis/recommendable/issues>
|
|
118
|
-
* Gems: <http://rubygems.org/gems/recommendable>
|
|
119
|
-
|
|
120
|
-
Copyright
|
|
121
|
-
---------
|
|
122
|
-
|
|
123
|
-
Copyright © 2012 David Celis. See LICENSE.txt for
|
|
124
|
-
further details.
|
|
125
|
-
|
|
126
|
-
[stars]: http://davidcelis.com/blog/2012/02/01/why-i-hate-five-star-ratings/
|
|
127
|
-
[sidekiq]: https://github.com/mperham/sidekiq
|
|
128
|
-
[delayed_job]: https://github.com/tobi/delayed_job
|
|
129
|
-
[resque]: https://github.com/defunkt/resque
|
|
130
|
-
[resque-loner]: https://github.com/jayniz/resque-loner
|
|
131
|
-
[forking]: http://help.github.com/forking/
|
|
132
|
-
[pull requests]: http://help.github.com/pull-requests/
|
|
133
|
-
[collaborative filtering]: http://davidcelis.com/blog/2012/02/07/collaborative-filtering-with-likes-and-dislikes/
|
|
134
|
-
[recommendable]: http://davidcelis.github.com/recommendable/
|
|
135
|
-
[documentation]: http://rubydoc.info/gems/recommendable/frames
|