Guest User

Untitled

a guest
Feb 28th, 2018
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. # USAGE
  4. # Put this in your path.
  5. # echo "hello cf" | to_campfire
  6.  
  7. require 'rubygems'
  8. require 'tinder'
  9. require 'yaml'
  10.  
  11. # private should look like:
  12. # campfire:
  13. # username: foo@gmail.com
  14. # password: password
  15. # account: subdomain
  16.  
  17. file_path = File.expand_path('~/.private')
  18.  
  19. if File.exists?(file_path)
  20. config = YAML::load(IO.read(file_path))
  21.  
  22. return unless cf = config.delete('campfire');
  23.  
  24. instance = Tinder::Campfire.new(cf['account'])
  25. instance.login(cf['username'], cf['password'])
  26.  
  27. room = instance.rooms.first # store a key in .private for room
  28. room.speak(data = STDIN.read)
  29.  
  30. puts "I just said to #{room.name},"
  31. puts data
  32. end
Add Comment
Please, Sign In to add comment