Sha256: e62ce3500b55c67006eb4e94cb223c829166175f301f15cc338cd6f556b2de1a

Contents?: true

Size: 909 Bytes

Versions: 8

Compression:

Stored size: 909 Bytes

Contents

#!/usr/bin/ruby 

require 'rubygems'
require 'adaptation'
require 'adaptation/mom'

DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = "8080"

# search mom configuration file.
#   - first by specified parameter
#   - second in /etc/adaptation (*nix systems)
#   - third in the gem itself

if File.exists?(File.dirname(__FILE__) + '/../configs/mom.yml')
  file = File.dirname(__FILE__) + '/../configs/mom.yml'
end

if File.exists?('/etc/adaptation/mom.yml')
  file = '/etc/adaptation/mom.yml'
end

if %w(--file -f).include? ARGV.first
  file = ARGV[1]
end

mom = "druby"

if file.nil?
  config = {"mom" => {"host" => DEFAULT_HOST, "port" => DEFAULT_PORT, "topics" => "all"}}
else
  config = YAML::load(File.open(file))[mom]
end

Signal.trap("INT") { puts "Shutting down MOM server (#{mom})"; exit }

mom_uri = "druby://#{config["mom"]["host"]}:#{config["mom"]["port"]}"
mom = Adaptation::Mom::Mom.new mom_uri
mom.start

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adaptation-1.0.1 bin/mom
adaptation-0.1.6 bin/mom
adaptation-0.1.10 bin/mom
adaptation-0.1.5 bin/mom
adaptation-0.1.4 bin/mom
adaptation-0.1.8 bin/mom
adaptation-0.1.7 bin/mom
adaptation-0.1.9 bin/mom