Class: Fastlane::SocketServer

Inherits:
Object
  • Object
show all
Defined in:
fastlane/lib/fastlane/server/socket_server.rb

Constant Summary collapse

COMMAND_EXECUTION_STATE =
{
  ready: :ready,
  already_shutdown: :already_shutdown,
  error: :error
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_executor: nil, return_value_processor: nil, connection_timeout: 5, stay_alive: false, port: 2000) ⇒ SocketServer

Returns a new instance of SocketServer.


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'fastlane/lib/fastlane/server/socket_server.rb', line 18

def initialize(
  command_executor: nil,
  return_value_processor: nil,
  connection_timeout: 5,
  stay_alive: false,
  port: 2000
)
  if return_value_processor.nil?
    return_value_processor = JSONReturnValueProcessor.new
  end

  @command_executor = command_executor
  @return_value_processor = return_value_processor
  @connection_timeout = connection_timeout.to_i
  @stay_alive = stay_alive
  @port = port.to_i
end

Instance Attribute Details

#command_executorObject

Returns the value of attribute command_executor


15
16
17
# File 'fastlane/lib/fastlane/server/socket_server.rb', line 15

def command_executor
  @command_executor
end

#return_value_processorObject

Returns the value of attribute return_value_processor


16
17
18
# File 'fastlane/lib/fastlane/server/socket_server.rb', line 16

def return_value_processor
  @return_value_processor
end

Instance Method Details

#startObject

this is the public API, don't call anything else


37
38
39
40
41
42
43
44
# File 'fastlane/lib/fastlane/server/socket_server.rb', line 37

def start
  listen

  while @stay_alive
    UI.important("stay_alive is set to true, restarting server")
    listen
  end
end