Skip to content
This repository has been archived by the owner on Jun 22, 2020. It is now read-only.

Commit

Permalink
Extract TweetStream configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
pootsbook committed Jan 29, 2013
1 parent 5fec075 commit b617012
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
20 changes: 20 additions & 0 deletions config/tweetstream.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'tweetstream'

# Patch TweetStream Daemon for Heroku
# See https://github.com/heroku-examples/tweetstream-example
class TweetStream::Daemon
def start(path, query_parameters = {}, &block)
startmethod = super.start
Daemons.run_proc(@app_name || 'tweetstream', :multiple => true, :no_pidfiles => true) do
startmethod(path, query_parameters, &block)
end
end
end

TweetStream.configure do |config|
config.consumer_key = ENV['CONSUMER_KEY']
config.consumer_secret = ENV['CONSUMER_SECRET']
config.oauth_token = ENV['OAUTH_TOKEN']
config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']
config.auth_method = :oauth
end
20 changes: 1 addition & 19 deletions sentinel.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
require 'rubygems'
require 'bundler/setup'
require 'tweetstream'
require File.dirname(__FILE__) + '/models/tweet'

# Patch TweetStream Daemon for Heroku
# See https://github.com/heroku-examples/tweetstream-example
class TweetStream::Daemon
def start(path, query_parameters = {}, &block)
startmethod = super.start
Daemons.run_proc(@app_name || 'tweetstream', :multiple => true, :no_pidfiles => true) do
startmethod(path, query_parameters, &block)
end
end
end

TweetStream.configure do |config|
config.consumer_key = ENV['CONSUMER_KEY']
config.consumer_secret = ENV['CONSUMER_SECRET']
config.oauth_token = ENV['OAUTH_TOKEN']
config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']
config.auth_method = :oauth
end
require File.dirname(__FILE__) + '/config/tweetstream'

TweetStream::Daemon.new.track('#emberjs', "ember.js") do |status|
status.urls.each do |url|
Expand Down

0 comments on commit b617012

Please sign in to comment.