Sha256: 325959e78dedd41aa1b046c0b35994df9aaf1a3e530e82787297cbc20ea93fe0

Contents?: true

Size: 1006 Bytes

Versions: 2

Compression:

Stored size: 1006 Bytes

Contents

__END__
#!/usr/bin/env ruby

require 'rubygems'
require 'applix'

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'gom-sensor-ports'

#Thread.abort_on_exception = true
$stderr.sync = true
$stdout.sync = true

class Usage < ArgumentError; end

def main argv
  options = Hash.from_argv argv
  args = (options.delete :args)
  #options[:callback_port] ||= 32119

  sensor_url = args.shift
  sensor_url or (raise Usage, "no <sensor_url>")
  puts " -- starting gom-sensor-port daemon: #{Time.now}"

  Gom::Remote::Daemon.new(sensor_url, options) do |daemon, path|
    sp = Gom::SensorPorts.new path, options
    daemon.sensor_loop do
      begin
        sp.listen 
      rescue SignalException => e
        Gom::Log.ex e, "shutting down on <#{e.class}>"
        :stop
      end
    end
  end

rescue Usage => e
  puts <<-TXT

usage: #{__FILE__} <sensor port URL>

 ## #{e}
  TXT
rescue => e
  Gom::Log.ex e
  #puts " ## #{e}\n -> #{e.backtrace.join "\n    "}"
end

main ARGV
# vim: syntax=ruby

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gom-sensor-ports-0.2.4 bin/gom-sensor-ports
gom-sensor-ports-0.2.3 bin/gom-sensor-ports