Class: Switchboard::Commands::PubSub::Nodes
- Inherits:
-
Switchboard::Command
- Object
- Switchboard::Command
- Switchboard::Commands::PubSub::Nodes
- Defined in:
- lib/switchboard/commands/pubsub/nodes.rb
Class Method Summary collapse
Methods inherited from Switchboard::Command
description, help, options, to_command, to_command_name
Class Method Details
.run! ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/switchboard/commands/pubsub/nodes.rb', line 8 def self.run! switchboard = Switchboard::Client.new do defer :nodes_retrieved do browser = Jabber::PubSub::NodeBrowser.new(client) browser.nodes(OPTIONS["pubsub.server"]) end def nodes_retrieved(nodes) if nodes && nodes.compact! && nodes.any? puts "Nodes available on '#{OPTIONS["pubsub.server"]}':" nodes.each do |node| puts " #{node.to_s}" end else puts "No nodes are available on '#{OPTIONS["pubsub.server"]}'." end end end if defined?(OAuth) && OPTIONS["oauth"] switchboard.plug!(OAuthPubSubJack) else switchboard.plug!(PubSubJack) end switchboard.run! end |