Skip to content
Browse files

Factor out resque config

  • Loading branch information...
1 parent c0c2fe3 commit c6b39dd201aded78a8d76aede10cff253bee2277 @rwdaigle committed Jun 14, 2011
Showing with 7 additions and 11 deletions.
  1. +2 −2 Procfile
  2. +1 −6 Rakefile
  3. +1 −3 config.ru
  4. +3 −0 config/resque.rb
View
4 Procfile
@@ -1,4 +1,4 @@
-web: bundle exec thin start -p $PORT -e $RACK_ENV
+web: bundle exec thin start -p $PORT -e $RACK_ENV
stream: bundle exec rake tweetstream:stream --trace
worker: bundle exec rake resque:work QUEUE=normal --trace
-clock: bundle exec clockwork clock.rb
+clock: bundle exec clockwork clock.rb
View
7 Rakefile
@@ -7,19 +7,14 @@ require "resque"
require 'resque/tasks'
require File.dirname(__FILE__) + "/jobs/index_tweet"
+require File.dirname(__FILE__) + "/config/resque"
STDOUT.sync = true
-#Pusher.app_id = 5700 # Fix this!
-uri = URI.parse(ENV["REDISTOGO_URL"])
-Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
-
task "tweetstream:stream" do
TweetStream::Client.new(ENV["TWITTER_USERNAME"], ENV["TWITTER_PASSWORD"]).track(ENV["TWITTER_KEYWORD"]) do |status|
puts "Processing tweet: #{status[:text]}"
Resque.enqueue(IndexTweet, status[:user][:screen_name], status[:text])
Pusher['tweets'].trigger('tweet', status)
end
end
-
-task "resque:setup"
View
4 config.ru
@@ -4,9 +4,7 @@ require "resque"
require "resque/server"
require File.dirname(__FILE__) + "/app"
-
-uri = URI.parse(ENV["REDISTOGO_URL"])
-Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
+require File.dirname(__FILE__) + "/config/resque"
run Rack::URLMap.new \
"/" => TweetStream::App.new,
View
3 config/resque.rb
@@ -0,0 +1,3 @@
+uri = URI.parse(ENV["REDISTOGO_URL"])
+Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
+

0 comments on commit c6b39dd

Please sign in to comment.
Something went wrong with that request. Please try again.