Class: RailsAiBridge::Doctor::Checkers::RipgrepChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/rails_ai_bridge/doctor/checkers/ripgrep_checker.rb

Overview

Verifies +rg+ is available on +PATH+ for fast code search.

Instance Attribute Summary

Attributes inherited from BaseChecker

#app

Instance Method Summary collapse

Methods inherited from BaseChecker

#initialize

Constructor Details

This class inherits a constructor from RailsAiBridge::Doctor::Checkers::BaseChecker

Instance Method Details

#callDoctor::Check

Returns +:pass+ when +rg+ is found; +:warn+ otherwise.

Returns:

  • (Doctor::Check)

    +:pass+ when +rg+ is found; +:warn+ otherwise



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rails_ai_bridge/doctor/checkers/ripgrep_checker.rb', line 11

def call
  available = begin
    Open3.capture2('rg', '--version').last.success?
  rescue Errno::ENOENT
    false
  end

  check(
    'ripgrep',
    available,
    pass: { message: 'rg available for code search' },
    fail: { status: :warn, message: 'ripgrep not installed (code search will use slower Ruby fallback)',
            fix: 'Install with `brew install ripgrep` or `apt install ripgrep`' }
  )
end