Sha256: 41a7bb8dd692a46034c6e7f5a47a143d930f19dd05ac4dfe8e52586c525c8528

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

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

#if %w(--environment -e).include? ARGV.first
#  environment = ARGV[1]
#end
environment = "development"

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

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

case config["mom"]["type"]
  when "druby"
    mom_uri = "druby://#{config["mom"]["host"]}:#{config["mom"]["port"]}"
    mom = Adaptation::Mom::Mom.new mom_uri
    mom.start
  #when "xmlblaster"
  else
    puts "Unknown MOM server type: #{config["mom"]["type"]}"
end

Version data entries

6 entries across 5 versions & 1 rubygems

Version Path
adaptation-0.0.7 bin/mom
adaptation-0.0.3 bin/mom~
adaptation-0.0.3 bin/mom
adaptation-0.0.4 bin/mom
adaptation-0.0.5 bin/mom
adaptation-0.0.6 bin/mom