Sha256: bb75eec826fcd9eea5864bac9f3e6afb00277a55135e07114ad60a7691302ab3

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

=begin rdoc
  The connection to the messenger from poolparty, the client
=end
module PoolParty
  module Messenger
    
    # TODO: Fix cookie setting
    def self.erl_command(hostname, extra="")
      command_line_opts = "-pa #{append_dir}/ebin -kernel inet_dist_listen_min 7000 inet_dist_listen_max 7050 -sname #{hostname} -setcookie poolparty"
      
      "erl #{command_line_opts} #{extra} 2>&1"
    end
    
    def self.append_dir
      ::File.expand_path(::File.join( ::File.dirname(__FILE__), "..", "..", "erlang/messenger" ))
    end
    
    def self.messenger_send!(cmd="", testing=false)
      command = Messenger.erl_command("client#{Time.now.to_i}", "-s pm_client -run pm_client #{cmd} -s erlang halt -noshell")
      testing ? command : %x[#{command}]
    end
    
    # Helper methods
    def self.startup_remote_messenger(hostname, testing=false)
      messenger_send!("")
      testing ? command : %x[#{command}]
    end
    
  end
end

module PoolParty
  module Cloud
    class Cloud
      include PoolParty::Messenger
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
auser-poolparty-0.2.39 lib/poolparty/net/messenger.rb
auser-poolparty-0.2.40 lib/poolparty/net/messenger.rb
auser-poolparty-0.2.41 lib/poolparty/net/messenger.rb
auser-poolparty-0.2.42 lib/poolparty/net/messenger.rb
auser-poolparty-0.2.44 lib/poolparty/net/messenger.rb