Sha256: 86b1d3b8ce8c94a7734a87fb79eccb129f587b2e64abd71ff69e57d04883dd21
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
Contents
require 'socket' module Redcar # attempt to load via drb if available def self.try_to_load_via_drb return if ARGV.find{|arg| arg == "--multiple-instance" || arg == '--help' || arg == '-h'} port = 9999 begin begin TCPSocket.new('127.0.0.1', port).close rescue Errno::ECONNREFUSED # no other instance is currently running... return end puts 'attempting to start via running instance' if $VERBOSE require 'drb' # late require to avoid loadup time drb = DRbObject.new(nil, "druby://127.0.0.1:#{port}") if ARGV.any? ARGV.each do |arg| next if arg[0..0] == "-" if drb.open_item_drb(File.expand_path(arg)) != 'ok' return end end else return unless drb.open_item_drb('just_bring_to_front') end puts 'Success' if $VERBOSE true rescue Exception => e puts e.class.to_s + ": " + e.message puts e.backtrace false end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
redcar-0.3.4.3 | lib/redcar_quick_start.rb |
redcar-0.3.4.2 | lib/redcar_quick_start.rb |
redcar-0.3.4.1 | lib/redcar_quick_start.rb |
redcar-0.3.4 | lib/redcar_quick_start.rb |