class RuboCop::Server::ClientCommand::Exec
This class is a client command to execute server process. @api private
Public Instance Methods
run()
click to toggle source
# File lib/rubocop/server/client_command/exec.rb, line 18 def run ensure_server! Cache.status_path.delete if Cache.status_path.file? read_stdin = ARGV.include?('-s') || ARGV.include?('--stdin') send_request( command: 'exec', args: ARGV.dup, body: read_stdin ? $stdin.read : '' ) warn stderr unless stderr.empty? status end
Private Instance Methods
ensure_server!()
click to toggle source
# File lib/rubocop/server/client_command/exec.rb, line 33 def ensure_server! if incompatible_version? warn 'RuboCop version incompatibility found, RuboCop server restarting...' ClientCommand::Stop.new.run elsif check_running_server return end ClientCommand::Start.new.run end
incompatible_version?()
click to toggle source
# File lib/rubocop/server/client_command/exec.rb, line 44 def incompatible_version? Cache.version_path.read != RuboCop::Version::STRING end
status()
click to toggle source
# File lib/rubocop/server/client_command/exec.rb, line 52 def status unless Cache.status_path.file? raise "RuboCop server: Could not find status file at: #{Cache.status_path}" end status = Cache.status_path.read raise "RuboCop server: '#{status}' is not a valid status!" if (status =~ /^\d+$/).nil? status.to_i end
stderr()
click to toggle source
# File lib/rubocop/server/client_command/exec.rb, line 48 def stderr Cache.stderr_path.read end