-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[macOS] Add ripgrep to all macOS images #12224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds ripgrep to macOS images, wiring it into installation toolsets, documentation, and basic tests
- Inserts
"ripgrep"
into toolset JSON files for versions 13, 14, and 15 so Homebrew installs it - Implements
Get-RipgrepVersion
in the docs generator and registers Ripgrep in the software report - Adds basic PowerShell tests to verify
rg --version
and a simple search operation
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
images/macos/toolsets/toolset-13.json | Include ripgrep in the package list |
images/macos/toolsets/toolset-14.json | Include ripgrep in the package list |
images/macos/toolsets/toolset-15.json | Include ripgrep in the package list |
images/macos/scripts/docs-gen/SoftwareReport.Common.psm1 | Add Get-RipgrepVersion function |
images/macos/scripts/docs-gen/Generate-SoftwareReport.ps1 | Register Ripgrep in the generated software report |
images/macos/scripts/tests/BasicTools.Tests.ps1 | Add tests for Ripgrep version output and search behavior |
Comments suppressed due to low confidence (1)
images/macos/scripts/tests/BasicTools.Tests.ps1:180
- Enhance the version check by asserting the output matches a semantic version pattern (e.g.,
Should -Match '\\d+\\.\\d+\\.\\d+'
) to verify the version string format.
$result = & rg --version
@@ -399,7 +399,11 @@ function Get-XcbeautifyVersion { | |||
$XcbeautifyVersion = Run-Command "xcbeautify --version" | |||
return $XcbeautifyVersion | |||
} | |||
|
|||
function Get-RipgrepVersion { | |||
$versionLine = & rg --version | Select-Object -First 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invoke ripgrep via the existing Run-Command helper (e.g., Run-Command "rg --version"
) for consistency with other version-fetching functions and centralized error handling.
$versionLine = & rg --version | Select-Object -First 1 | |
$versionLine = Run-Command "rg --version" | Select-Object -First 1 |
Copilot uses AI. Check for mistakes.
# Run ripgrep to search for "testing" | ||
$output = & rg "testing" $testFile | ||
|
||
# Show search result | ||
Write-Host "`n ripgrep search output:`n$output" | ||
|
||
# Assert that the result contains the keyword | ||
$output | Should -Match "testing" | ||
|
||
Write-Host "ripgrep search in file completed and matched" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Add cleanup logic (e.g., Remove-Item $testFile
) after the test to prevent leftover temporary files from accumulating.
# Run ripgrep to search for "testing" | |
$output = & rg "testing" $testFile | |
# Show search result | |
Write-Host "`n ripgrep search output:`n$output" | |
# Assert that the result contains the keyword | |
$output | Should -Match "testing" | |
Write-Host "ripgrep search in file completed and matched" | |
try { | |
# Run ripgrep to search for "testing" | |
$output = & rg "testing" $testFile | |
# Show search result | |
Write-Host "`n ripgrep search output:`n$output" | |
# Assert that the result contains the keyword | |
$output | Should -Match "testing" | |
Write-Host "ripgrep search in file completed and matched" | |
} finally { | |
# Cleanup: Remove the test file | |
if (Test-Path $testFile) { | |
Remove-Item -Path $testFile -Force | |
} | |
} |
Copilot uses AI. Check for mistakes.
e507fb7
to
d02376d
Compare
086375e
to
d1d50a3
Compare
- Add ripgrep to all macOS image versions - Validate installation via version check and keyword search in temp file
d1d50a3
to
ec2b347
Compare
Description
Adding new tool - Ripgrep to all macOS images
Added a test in basictools.test.ps1 to verify ripgrep functionality by creating a temporary file containing the word "testing", searching for it using ripgrep, and asserting that the output contains the expected keyword, confirming ripgrep works as intended.
**Total size-- 6MB **
Related issue: #12179
Check list