Based on their example, I got this to work: ---------- start code ---------- require 'rubygems' require 'tweetstream' require 'ruby-growl'
username = 'blinkdev' password = **secret** tracks = ['#ROCKPIC'] puts "Starting a GrowlTweet to track: #{tracks.inspect}" TweetStream::Daemon.new(username,password).track(*tracks) do |status| g = Growl.new 'localhost', 'growltweet', ['tweet'] g.notify 'tweet', status.user.screen_name, status.text end ---------- end code ---------- And run it from the command line like $ruby test.rb start $ruby test.rb stop So I want to pull that into my rails app, I wrote this file to load the environment, and save the statuses ---------- start code ---------- # file: RAILS_ROOT/jobs/twitter_stream.rb ENV['RAILS_ENV'] = ARGV.shift require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'rubygems' require 'tweetstream' username = 'blinkdev' password = **secret** tracks = ['#ROCKPIC'] TweetStream::Daemon.new(username,password).track(*tracks) do |status| Rockpic.new( :message => "[#{status.created_at}-#{status.user.screen_name}] #{status.text}" ).save! end ---------- end code ---------- and then to load it, I created ---------- start code ---------- # file: RAILS_ROOT/config/initializers/twitter_stream.rb puts 'pre' system "#{%x(which ruby).chomp} #{File.join(RAILS_ROOT,'jobs','twitter_stream.rb')} #{ENV['RAILS_ENV']} restart" puts 'post' ---------- end code ---------- But it never finishes that command, when I start my server it just keeps writing 'pre' over and over, implying to me that it is recursively calling itself. ie the initializer starts the daemon, which requires the environment, which runs the initializer, which starts the daemon, etc. I figure if I can get it to realize that it is already running, then I should be good, but I'm not very experienced with this, and don't know how to check for that. Api doesn't look like it offers a way, but looking at the code shows that it uses Daemons underneath of it. Not sure how to do it, still, though. Any help is appreciated. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.