Sha256: 886c89df34662251f46b80b8201c55edbfc3910096766d4ecbae68611d7ae6e7

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

#!/usr/bin/env ruby
$:.push File.join(File.dirname(__FILE__), '..', 'lib')
require 'rubygems'
require 'logger'
require 'optparse'
require 'punchblock/console/cli'
require 'punchblock/version'

options = { :username         => 'usera@127.0.0.1',
            :password         => '1',
            :auto_reconnect   => false,
            :connection_class => Connection::XMPP }

$option_parser = OptionParser.new do |opts|
  opts.banner = "Usage: punchblock-console [-u usera@127.0.0.1] [-p abc123]"
  opts.on("-u", "--username USERNAME", String, "Specify the XMPP JID to connect to") do |u|
    options[:username] = u
  end
  opts.on("-p", "--password PASSWORD", String, "Specify the XMPP password to use") do |p|
    options[:password] = p
  end
  opts.on("-d", "--rayo-domain DOMAIN", String, "Specify the domain Rayo is running on") do |d|
    options[:rayo_domain] = d
  end
  opts.on("--log-file log/punchblock.log", String, "Specify the file to which the log should be written") do |lf|
    options[:log_file] = lf
  end
  opts.on("--asterisk", "Use Asterisk") do |tlf|
    options[:connection_class] = Connection::Asterisk
    options[:host] = '127.0.0.1'
    options[:port] = 5038
  end
  opts.on("--prompt", "Provide a prompt immediately") do |tlf|
    options[:prompt] = true
  end
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
  opts.on_tail("-v", "--version", "Show version") do
    puts "Punchblock Console: v#{PunchblockConsole::VERSION}"
    puts "Punchblock: v#{Punchblock::VERSION}"
    exit
  end
end

begin
  $option_parser.parse!
rescue
  puts $!
  $option_parser.parse '--help'
end

PunchblockConsole::CLI.new(options).run

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
punchblock-console-0.1.5 bin/pbconsole