Skip to content

[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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sangeeths03
Copy link
Contributor

@sangeeths03 sangeeths03 commented May 21, 2025

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

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated

@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 04:20
@sangeeths03 sangeeths03 changed the title Add ripgrep all mac os [macOS] Add ripgrep to all macOS May 21, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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
Copy link
Preview

Copilot AI May 21, 2025

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.

Suggested change
$versionLine = & rg --version | Select-Object -First 1
$versionLine = Run-Command "rg --version" | Select-Object -First 1

Copilot uses AI. Check for mistakes.

Comment on lines +198 to +207
# 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"
Copy link
Preview

Copilot AI May 21, 2025

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.

Suggested change
# 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.

@sangeeths03 sangeeths03 changed the title [macOS] Add ripgrep to all macOS [macOS] Add ripgrep to all macOS images May 21, 2025
@sangeeths03 sangeeths03 force-pushed the Add-ripgrep-all-macOS branch from e507fb7 to d02376d Compare May 21, 2025 11:22
@sangeeths03 sangeeths03 requested a review from erik-bershel May 21, 2025 12:02
@sangeeths03 sangeeths03 force-pushed the Add-ripgrep-all-macOS branch from 086375e to d1d50a3 Compare May 21, 2025 12:24
- Add ripgrep to all macOS image versions
- Validate installation via version check and keyword search in temp file
@sangeeths03 sangeeths03 force-pushed the Add-ripgrep-all-macOS branch from d1d50a3 to ec2b347 Compare May 21, 2025 12:36
@sangeeths03 sangeeths03 requested a review from ijunaidm1 May 21, 2025 12:42
@sangeeths03 sangeeths03 marked this pull request as draft May 21, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant