From 8cb2a3a79a742e2f2efe583b5d303c0a8360c1a1 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Fri, 26 Nov 2010 13:23:27 -0500 Subject: [PATCH] resque init, config, gemfile --- Gemfile | 4 ++++ Gemfile.lock | 17 +++++++++++++++++ config/initializers/resque.rb | 5 +++++ config/redis.yml | 10 ++++++++++ lib/tasks/resque.rake | 3 +++ 5 files changed, 39 insertions(+) create mode 100644 config/initializers/resque.rb create mode 100644 config/redis.yml create mode 100644 lib/tasks/resque.rake diff --git a/Gemfile b/Gemfile index ed6fea191..ef543e334 100644 --- a/Gemfile +++ b/Gemfile @@ -52,6 +52,10 @@ gem 'rest-client' #Backups gem "cloudfiles", :require => false +#Queue +gem 'resque' +gem 'SystemTimer' + group :test, :development do gem 'factory_girl_rails' gem 'ruby-debug19' if RUBY_VERSION.include? "1.9" diff --git a/Gemfile.lock b/Gemfile.lock index 72308358f..02e6b2566 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,6 +77,7 @@ PATH GEM remote: http://rubygems.org/ specs: + SystemTimer (1.2.1) abstract (1.0.0) actionmailer (3.0.1) actionpack (= 3.0.1) @@ -296,6 +297,14 @@ GEM rake (>= 0.8.4) thor (~> 0.14.0) rake (0.8.7) + redis (2.1.1) + redis-namespace (0.8.0) + redis (< 3.0.0) + resque (1.10.0) + json (~> 1.4.6) + redis-namespace (~> 0.8.0) + sinatra (>= 0.9.2) + vegas (~> 0.1.2) rest-client (1.6.1) mime-types (>= 1.16) rspec (2.2.0) @@ -330,6 +339,9 @@ GEM ffi (~> 0.6.3) json_pure rubyzip + sinatra (1.1.0) + rack (~> 1.1) + tilt (~> 1.1) subexec (0.0.4) systemu (1.2.0) term-ansicolor (1.0.5) @@ -338,6 +350,7 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.14.6) + tilt (1.1) treetop (1.4.9) polyglot (>= 0.3.1) twitter (0.9.12) @@ -347,6 +360,8 @@ GEM oauth (~> 0.4.3) tzinfo (0.3.23) uuidtools (2.1.1) + vegas (0.1.8) + rack (>= 1.0.0) warden (0.10.7) rack (>= 1.0.0) webmock (1.6.1) @@ -360,6 +375,7 @@ PLATFORMS ruby DEPENDENCIES + SystemTimer addressable aws bson (= 1.1) @@ -393,6 +409,7 @@ DEPENDENCIES omniauth pubsubhubbub rails (= 3.0.1) + resque rest-client roxml! rspec (>= 2.0.0) diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb new file mode 100644 index 000000000..9d946b09c --- /dev/null +++ b/config/initializers/resque.rb @@ -0,0 +1,5 @@ +Dir[File.join(Rails.root, 'app', 'jobs', '*.rb')].each { |file| require file } + +config = YAML::load(File.open("#{Rails.root}/config/redis.yml")) +Resque.redis = Redis.new(:host => config['host'], :port => config['port']) + diff --git a/config/redis.yml b/config/redis.yml new file mode 100644 index 000000000..b8d3e3626 --- /dev/null +++ b/config/redis.yml @@ -0,0 +1,10 @@ +--- +default: + host: localhost + port: 6379 + +development: +test: +staging: +production: + diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake new file mode 100644 index 000000000..9f413d6c6 --- /dev/null +++ b/lib/tasks/resque.rake @@ -0,0 +1,3 @@ +require 'resque/tasks' +task "resque:setup" => :environment +