Class: RuboCop::Server::CLI Private

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/server/cli.rb

Overview

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

The CLI is a class responsible of handling server command line interface logic.

Constant Summary collapse

STATUS_SUCCESS =

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.

Same exit status value as ‘RuboCop::CLI`.

0
STATUS_ERROR =

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.

2
SERVER_OPTIONS =

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.

%w[
  --server
  --no-server
  --server-status
  --restart-server
  --start-server
  --stop-server
  --no-detach
].freeze
EXCLUSIVE_OPTIONS =

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.

(SERVER_OPTIONS - %w[--server --no-server]).freeze
NO_DETACH_OPTIONS =

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.

%w[--server --start-server --restart-server].freeze

Instance Method Summary collapse

Constructor Details

#initializeCLI

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 a new instance of CLI.



36
37
38
# File 'lib/rubocop/server/cli.rb', line 36

def initialize
  @exit = false
end

Instance Method Details

#exit?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)


52
53
54
# File 'lib/rubocop/server/cli.rb', line 52

def exit?
  @exit
end

#run(argv = ARGV) ⇒ 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.



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

def run(argv = ARGV)
  unless Server.support_server?
    return error('RuboCop server is not supported by this Ruby.') if use_server_option?(argv)

    return STATUS_SUCCESS
  end

  Cache.cache_root_path = fetch_cache_root_path_from(argv)

  process_arguments(argv)
end