Sha256: fb825406d269b6358a8bd1adb7f09a4b25723e645f03ae5120697a857cbff903
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
module Roast class Main include Tinder def self.run(first_msg=nil, room=nil) config_file = YAML.load_file(ENV['HOME'] + '/roast.yml') options = Hash.new options[:room] = (room ? room.to_s : nil) || config_file["default"] opts = OptionParser.new do |opt| opt.banner = "Usage: roast [options] message" opt.separator "" opt.separator "Specific options:" opt.on("-r", "--room [room config]", "Room name from config") do |room| options[:room] = room end end opts.parse!(ARGV) puts options.inspect conf = config_file[options[:room]] msg = first_msg || ARGV[0] || STDIN.read puts "Using #{conf['room']} configuration ..." campfire = Campfire.new(conf['domain'], :ssl => conf['ssl']) puts "Logging in..." campfire.login conf['username'], conf['password'] puts "Logged in!" room = campfire.find_room_by_name conf["room"] puts "Joining #{room.name}..." # room.join(true) puts "Entered room #{room.name}" puts "Saying message..." if msg.split("\n").size > 1 room.paste(msg) else room.speak(msg) end puts "Leaving room..." # room.leave puts "Done." end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kdaigle-roast-0.0.5 | lib/roast/main.rb |