fix cron job scheduler
This commit is contained in:
parent
644fac99da
commit
0633f6012a
8 changed files with 19 additions and 12 deletions
2
Gemfile
2
Gemfile
|
@ -21,7 +21,7 @@ gem 'hoptoad_notifier'
|
||||||
|
|
||||||
gem 'addressable', :require => ['addressable/template', 'addressable/uri']
|
gem 'addressable', :require => ['addressable/template', 'addressable/uri']
|
||||||
|
|
||||||
gem 'whenever', '~> 0.6.2', :require => false
|
gem 'whenever', '~> 0.7.3', :require => false
|
||||||
|
|
||||||
gem 'swf_converter', '~> 0.0.3'
|
gem 'swf_converter', '~> 0.0.3'
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ GEM
|
||||||
Platform (>= 0.4.0)
|
Platform (>= 0.4.0)
|
||||||
open4
|
open4
|
||||||
Platform (0.4.0)
|
Platform (0.4.0)
|
||||||
aaronh-chronic (0.3.9)
|
|
||||||
abstract (1.0.0)
|
abstract (1.0.0)
|
||||||
actionmailer (3.0.5)
|
actionmailer (3.0.5)
|
||||||
actionpack (= 3.0.5)
|
actionpack (= 3.0.5)
|
||||||
|
@ -88,6 +87,7 @@ GEM
|
||||||
bcrypt-ruby (2.1.4)
|
bcrypt-ruby (2.1.4)
|
||||||
builder (2.1.2)
|
builder (2.1.2)
|
||||||
character-encodings (0.4.1)
|
character-encodings (0.4.1)
|
||||||
|
chronic (0.6.7)
|
||||||
closure-compiler (1.1.4)
|
closure-compiler (1.1.4)
|
||||||
compass (0.10.6)
|
compass (0.10.6)
|
||||||
haml (>= 3.0.4)
|
haml (>= 3.0.4)
|
||||||
|
@ -200,9 +200,9 @@ GEM
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
warden (1.0.6)
|
warden (1.0.6)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
whenever (0.6.8)
|
whenever (0.7.3)
|
||||||
aaronh-chronic (>= 0.3.9)
|
|
||||||
activesupport (>= 2.3.4)
|
activesupport (>= 2.3.4)
|
||||||
|
chronic (~> 0.6.3)
|
||||||
will_paginate (3.0.2)
|
will_paginate (3.0.2)
|
||||||
yui-compressor (0.9.6)
|
yui-compressor (0.9.6)
|
||||||
POpen4 (>= 0.1.4)
|
POpen4 (>= 0.1.4)
|
||||||
|
@ -242,5 +242,5 @@ DEPENDENCIES
|
||||||
rspec-rails (~> 2.0.0.beta.22)
|
rspec-rails (~> 2.0.0.beta.22)
|
||||||
sanitize (~> 2.0.3)
|
sanitize (~> 2.0.3)
|
||||||
swf_converter (~> 0.0.3)
|
swf_converter (~> 0.0.3)
|
||||||
whenever (~> 0.6.2)
|
whenever (~> 0.7.3)
|
||||||
will_paginate (~> 3.0.pre2)
|
will_paginate (~> 3.0.pre2)
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
# Learn more: http://github.com/javan/whenever
|
# Learn more: http://github.com/javan/whenever
|
||||||
|
|
||||||
RVM_RUBY = 'ruby-1.9.2@impress'
|
|
||||||
set :job_template, "bash -l -c 'rvm use #{RVM_RUBY} && :job'"
|
|
||||||
job_type :runner, "cd :path && rails runner -e :environment ':task' :output"
|
|
||||||
|
|
||||||
env :MAILTO, 'webmaster@openneo.net'
|
env :MAILTO, 'webmaster@openneo.net'
|
||||||
|
|
||||||
every :day do
|
every :day do
|
||||||
runner "Item.spider_mall\\!"
|
rake 'mall:spider_items'
|
||||||
end
|
end
|
||||||
|
|
||||||
ItemsLimit = 20
|
|
||||||
every :hour do
|
every :hour do
|
||||||
runner "Item.spider_mall_assets\\!\\(#{ItemsLimit}\\)"
|
rake 'mall:spider_assets'
|
||||||
end
|
end
|
||||||
|
|
12
lib/tasks/spider.rake
Normal file
12
lib/tasks/spider.rake
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
namespace :mall do
|
||||||
|
desc 'Spider NC Mall for new items'
|
||||||
|
task :spider_items => :environment do
|
||||||
|
Item.spider_mall!
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Spider NC Mall for item assets'
|
||||||
|
task :spider_assets => :environment do
|
||||||
|
item_limit = ENV['ITEM_LIMIT'] || 20
|
||||||
|
Item.spider_mall_assets!(item_limit)
|
||||||
|
end
|
||||||
|
end
|
BIN
vendor/cache/aaronh-chronic-0.3.9.gem
vendored
BIN
vendor/cache/aaronh-chronic-0.3.9.gem
vendored
Binary file not shown.
BIN
vendor/cache/chronic-0.6.7.gem
vendored
Normal file
BIN
vendor/cache/chronic-0.6.7.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/whenever-0.6.8.gem
vendored
BIN
vendor/cache/whenever-0.6.8.gem
vendored
Binary file not shown.
BIN
vendor/cache/whenever-0.7.3.gem
vendored
Normal file
BIN
vendor/cache/whenever-0.7.3.gem
vendored
Normal file
Binary file not shown.
Loading…
Reference in a new issue