Class: Switchboard::Commands::PubSub::Config
- Inherits:
-
Switchboard::Command
- Object
- Switchboard::Command
- Switchboard::Commands::PubSub::Config
- Defined in:
- lib/switchboard/commands/pubsub/config.rb
Class Method Summary collapse
Methods inherited from Switchboard::Command
description, help, options, to_command, to_command_name
Class Method Details
.run! ⇒ Object
7 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 34 35 36 37 38 |
# File 'lib/switchboard/commands/pubsub/config.rb', line 7 def self.run! switchboard = Switchboard::Client.new do defer :configuration_retrieved do if ARGV.length == 2 key, value = ARGV puts "Setting '#{key}' to '#{value}'" config = Jabber::PubSub::NodeConfig.new(OPTIONS["pubsub.node"], key => value) set_config_for(OPTIONS["pubsub.node"], config) end get_config_from(OPTIONS["pubsub.node"]) end def configuration_retrieved(config) if config puts "Configuration for node '#{config.node}':" config..each do |k,v| puts " " + [k, v] * ": " end else puts "Could not load configuration for node '#{OPTIONS["pubsub.node"]}'." end end end if defined?(OAuth) && OPTIONS["oauth"] switchboard.plug!(OAuthPubSubJack) else switchboard.plug!(PubSubJack) end switchboard.run! end |