Commit 118b85907da2bc93f8beab9c6c127d16b9c4f8a5
1 parent
0f9731a3
Exists in
master
and in
29 other branches
[search-improvements] Add gem whenever to handler cron tasks
Also calculate search_terms scores using it.
Showing
3 changed files
with
34 additions
and
0 deletions
Show diff stats
Gemfile
@@ -16,6 +16,8 @@ gem 'hpricot' | @@ -16,6 +16,8 @@ gem 'hpricot' | ||
16 | gem 'nokogiri' | 16 | gem 'nokogiri' |
17 | gem 'rake', :require => false | 17 | gem 'rake', :require => false |
18 | 18 | ||
19 | +gem 'whenever', :require => false | ||
20 | + | ||
19 | # FIXME list here all actual dependencies (i.e. the ones in debian/control), | 21 | # FIXME list here all actual dependencies (i.e. the ones in debian/control), |
20 | # with their GEM names (not the Debian package names) | 22 | # with their GEM names (not the Debian package names) |
21 | 23 |
Gemfile.lock
@@ -46,6 +46,7 @@ GEM | @@ -46,6 +46,7 @@ GEM | ||
46 | xpath (~> 2.0) | 46 | xpath (~> 2.0) |
47 | childprocess (0.3.3) | 47 | childprocess (0.3.3) |
48 | ffi (~> 1.0.6) | 48 | ffi (~> 1.0.6) |
49 | + chronic (0.10.2) | ||
49 | cucumber (1.0.6) | 50 | cucumber (1.0.6) |
50 | builder (>= 2.1.2) | 51 | builder (>= 2.1.2) |
51 | diff-lcs (>= 1.1.2) | 52 | diff-lcs (>= 1.1.2) |
@@ -146,6 +147,9 @@ GEM | @@ -146,6 +147,9 @@ GEM | ||
146 | polyglot (>= 0.3.1) | 147 | polyglot (>= 0.3.1) |
147 | tzinfo (0.3.33) | 148 | tzinfo (0.3.33) |
148 | websocket (1.0.7) | 149 | websocket (1.0.7) |
150 | + whenever (0.9.2) | ||
151 | + activesupport (>= 2.3.4) | ||
152 | + chronic (>= 0.6.3) | ||
149 | will_paginate (3.0.3) | 153 | will_paginate (3.0.3) |
150 | xpath (2.0.0) | 154 | xpath (2.0.0) |
151 | nokogiri (~> 1.3) | 155 | nokogiri (~> 1.3) |
@@ -177,4 +181,5 @@ DEPENDENCIES | @@ -177,4 +181,5 @@ DEPENDENCIES | ||
177 | ruby-feedparser | 181 | ruby-feedparser |
178 | selenium-webdriver | 182 | selenium-webdriver |
179 | thin | 183 | thin |
184 | + whenever | ||
180 | will_paginate | 185 | will_paginate |
@@ -0,0 +1,27 @@ | @@ -0,0 +1,27 @@ | ||
1 | +# Use this file to easily define all of your cron jobs. | ||
2 | +# | ||
3 | +# It's helpful, but not entirely necessary to understand cron before proceeding. | ||
4 | +# http://en.wikipedia.org/wiki/Cron | ||
5 | + | ||
6 | +# Example: | ||
7 | +# | ||
8 | +# set :output, "/path/to/my/cron_log.log" | ||
9 | +# | ||
10 | +# every 2.hours do | ||
11 | +# command "/usr/bin/some_great_command" | ||
12 | +# runner "MyModel.some_method" | ||
13 | +# rake "some:great:rake:task" | ||
14 | +# end | ||
15 | +# | ||
16 | +# every 4.days do | ||
17 | +# runner "AnotherModel.prune_old_records" | ||
18 | +# end | ||
19 | + | ||
20 | +# Learn more: http://github.com/javan/whenever | ||
21 | +# | ||
22 | +set :environment, 'development' | ||
23 | +set :output, "/home/rodrigo/noosfero/log/cron.log" | ||
24 | + | ||
25 | +every 1.minute do | ||
26 | + runner "SearchTerm.calculate_scores" | ||
27 | +end |