Module: Spinoff::Client

Defined in:
lib/spinoff/client.rb

Class Method Summary collapse

Class Method Details

.start(argv) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/spinoff/client.rb', line 6

def self.start(argv)
  files = argv.select {|f| File.exist?(f) }.uniq.join(File::PATH_SEPARATOR)

  return if files.empty?

  socket = UNIXSocket.open(Spinoff.socket_path)
  socket.puts files

  while line = socket.gets
    break if line == "\0"
    print line
  end
rescue Errno::ECONNREFUSED
  abort "Connection to spinoff server was refused."
end