Module: RuboCop::Server Private

Defined in:
lib/rubocop/server.rb,
lib/rubocop/server/cli.rb,
lib/rubocop/server/core.rb,
lib/rubocop/server/cache.rb,
lib/rubocop/server/errors.rb,
lib/rubocop/server/helper.rb,
lib/rubocop/server/socket_reader.rb,
lib/rubocop/server/client_command.rb,
lib/rubocop/server/server_command.rb,
lib/rubocop/server/client_command/base.rb,
lib/rubocop/server/client_command/exec.rb,
lib/rubocop/server/client_command/stop.rb,
lib/rubocop/server/server_command/base.rb,
lib/rubocop/server/server_command/exec.rb,
lib/rubocop/server/server_command/stop.rb,
lib/rubocop/server/client_command/start.rb,
lib/rubocop/server/client_command/status.rb,
lib/rubocop/server/client_command/restart.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

The bootstrap module for server.

Defined Under Namespace

Modules: ClientCommand, Helper, ServerCommand Classes: CLI, Cache, Core, InvalidTokenError, ServerStopRequest, SocketReader, UnknownServerCommandError

Constant Summary collapse

TIMEOUT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

20

Class Method Summary collapse

Class Method Details

.running?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


33
34
35
36
37
# File 'lib/rubocop/server.rb', line 33

def running?
  return false unless support_server? # Never running.

  Cache.pid_running?
end

.support_server?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


29
30
31
# File 'lib/rubocop/server.rb', line 29

def support_server?
  RUBY_ENGINE == 'ruby' && !RuboCop::Platform.windows?
end

.wait_for_running_status!(expected) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



39
40
41
42
43
44
45
46
47
48
# File 'lib/rubocop/server.rb', line 39

def wait_for_running_status!(expected)
  start_time = Time.now
  while Server.running? != expected
    sleep 0.1
    next unless Time.now - start_time > TIMEOUT

    warn "running? was not #{expected} after #{TIMEOUT} seconds!"
    exit 1
  end
end