Sha256: 2cbd432d26e9461963c0b751d2159793177f2bcc9d45a8c30238bd6da1bdb830
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
require "#{File.dirname(__FILE__)}/../lib/tunecore-announcer" require 'pp' class AnnouncerLauncher def self.parse_options(args) mandatory_opts = %w(name_prefix jabber_server jabber_password admin_jids) options = OpenStruct.new options.jabber_port = 5222 opts = OptionParser.new do |opts| opts.banner = "Usage: announcer arguments" opts.separator "" opts.separator "Mandatory arguments:" opts.on "-s", "--jabber-server=HOSTNAME", "Jabber server hostname" do |server| options.jabber_server = server end opts.on("-n", "--name=NAME", "Jabber username will be NAME-hostname") do |name| options.name_prefix = name end opts.on("-p", "--password=PASSWORD", "This can be anything, the Announcer will create an account on the Jabber server") do |password| options.jabber_password = password end opts.on("-a", "--admin-jids JID,JID,JID", Array, "List ofJabber IDs of the users that will control the announcer daemon") do |admin_jids| options.admin_jids = admin_jids end opts.separator "" opts.separator "Optional arguments:" opts.on "--jabber-port=[PORT]", "Jabber server port (default is 5222)" do |port| options.jabber_port = port end opts.on "--hello-mesg=[HELLO]", "Message to send to the admin ex: \"Reporting for duty!\" " do |hello_mesg| options.hello_mesg = hello_mesg end opts.on "--avatar-file=[AVATAR]", "Avatar image in png format" do |avatar_file| options.avatar_file = avatar_file end end opts.parse!(args) mandatory_opts.each do |opt| if options.send(opt).nil? puts opts exit end end return options end end options = AnnouncerLauncher.parse_options(ARGV) jabber = TunecoreAnnouncer::XmppConnection.instance jabber.connect(options) trap("INT") do jabber.disconnect exit end while true do jabber.status(:chat, "#{`ps -ef | wc -l`} processes running") sleep 60 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tunecore-announcer-0.0.1 | bin/announcer |