-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #720 from kenhys/support-check_is_installed_by_gem
Windows: support check_is_installed_by_gem
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
lib/specinfra/backend/powershell/support/find_installed_gem.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function FindInstalledGem | ||
{ | ||
param($gemName, $gemVersion) | ||
|
||
$nameVer = $(Invoke-Expression "gem list --local" | Select-String "$gemName").Line | ||
if ($nameVer.StartsWith($gemName)) { | ||
if ($gemVersion) { | ||
if ($nameVer.EndsWith("$gemVersion)")) { | ||
$true | ||
} else { | ||
$false | ||
} | ||
} else { | ||
$true | ||
} | ||
} else { | ||
$false | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters