Sha256: 6a001cc3962d83b210ac5327381008c1da79a888544353713b6a24d321ba2f3d

Contents?: true

Size: 878 Bytes

Versions: 3

Compression:

Stored size: 878 Bytes

Contents

#!/usr/bin/env ruby

require 'drbqs'
require 'optparse'

Version = '0.0.1'

help_message =<<HELP
Usage: #{File.basename(__FILE__)} <command> <uri>
Manage DRbQS server by sending messages.
<command> is 'exit-signal'.

HELP

begin
  OptionParser.new(help_message) do |opt|
    opt.on('--debug', 'Set $DEBUG true.') do |v|
      $DEBUG = true
    end
    opt.parse!(ARGV)
  end
rescue OptionParser::InvalidOption
  $stderr.print <<MES
error: Invalid Option
#{help_message}
MES
  exit(2)
rescue OptionParser::InvalidArgument
  $stderr.print <<MES
error: Invalid Argument
#{help_message}
MES
  exit(2)
end

if ARGV.size != 2
  raise "Invalid arguments number. Please refer '#{File.basename(__FILE__)} -h'."
end

command = ARGV[0]
uri = ARGV[1]

manage = DRbQS::Manage.new(uri)

case command
when 'exit-signal'
  manage.send_exit_signal
else
  raise "Invalid command: #{command}"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
drbqs-0.0.7 bin/drbqs-manage
drbqs-0.0.6 bin/drbqs-manage
drbqs-0.0.5 bin/drbqs-manage