Skip to content

Instantly share code, notes, and snippets.

@tomlea
Created February 4, 2009 14:34
Show Gist options
  • Select an option

  • Save tomlea/58125 to your computer and use it in GitHub Desktop.

Select an option

Save tomlea/58125 to your computer and use it in GitHub Desktop.
Bean Bandit: Puts beanz on ze queue.
#!/usr/bin/env ruby
require "rubygems"
gem "beanstalk-client"
require "beanstalk-client"
port = ARGV.last or raise "GIVE ME A PORT NEXT TIME!"
beanstalk = Beanstalk::Pool.new(["0.0.0.0:#{port}"])
puts "Hey gringo!¡?¿"
puts "I'll throw some beanz around, just giz me ze YAML¡ Ce¿"
puts "End your YAML with a dot or the deals off!¡! ce?¿"
yaml = ""
while line = STDIN.gets and line !~ /^.$/
yaml += line
end
beanstalk.put(yaml)
puts "So longs and thankz for all zeé beanz?¿?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment