Sha256: 749d80adbc6245b3f1a515b8be3b08f76a8b254332b22344b2b8c1dea54e91f8

Contents?: true

Size: 960 Bytes

Versions: 8

Compression:

Stored size: 960 Bytes

Contents

#!/usr/bin/ruby

unless defined? ADAPTOR_ROOT
  ADAPTOR_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
end

args = ARGV
mom = "druby"
ARGV.each do |arg|
  if arg[0..3] == "MOM="
    mom = arg[4..arg.length]
    args = ARGV.reject{|p| p == "MOM=#{mom}"}
  end
end

require 'yaml'
config = YAML::load(File.open("#{ADAPTOR_ROOT}/config/mom.yml"))[mom]

case mom
  when "druby"
    require 'drb'

    mom_uri = "druby://#{config["mom"]["host"]}:#{config["mom"]["port"]}"

    mom = DRbObject.new(nil, mom_uri)
    mom.publish ARGV[1], ARGV[0]

  when "xmlblaster"
    require "rubygems"
    require "adaptation"
    require "adaptation/xmlblaster/xmlblaster_client"

    xbc = XmlblasterClient.new(config["mom"]["host"], config["mom"]["port"])
    xbc.login( config["mom"]["publish_user"], config["mom"]["publish_password"] )
    puts args
    xbc.publish( "<key oid='#{args[0]}' contentMime='text/xml'/>", args[1] , "<qos></qos>" )
    xbc.logout
end
  

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adaptation-1.0.1 lib/commands/publish.rb
adaptation-0.1.4 lib/commands/publish.rb
adaptation-0.1.5 lib/commands/publish.rb
adaptation-0.1.6 lib/commands/publish.rb
adaptation-0.1.10 lib/commands/publish.rb
adaptation-0.1.8 lib/commands/publish.rb
adaptation-0.1.7 lib/commands/publish.rb
adaptation-0.1.9 lib/commands/publish.rb