Skip to content

Allow passing JSON file to checkver#3481

Closed
r15ch13 wants to merge 4 commits intomasterfrom
feature/checkver-wtih-file
Closed

Allow passing JSON file to checkver#3481
r15ch13 wants to merge 4 commits intomasterfrom
feature/checkver-wtih-file

Conversation

@r15ch13
Copy link
Copy Markdown
Member

@r15ch13 r15ch13 commented May 28, 2019

  • Moved JSON parsing into the queue
    • Removes some loops
  • Allow passing a JSON file path to checkver.ps1
    • Example: > .\bin\checkver.ps1 -App ..\somewhere\bucket\test.json -Force
  • Use proper parameters values for next()
  • Improve event cleanup

@r15ch13 r15ch13 force-pushed the feature/checkver-wtih-file branch from 87d42da to 58e3cda Compare May 28, 2019 15:49
@r15ch13
Copy link
Copy Markdown
Member Author

r15ch13 commented May 29, 2019

ping @Ash258 @niheaven

@Ash258
Copy link
Copy Markdown
Contributor

Ash258 commented May 29, 2019

Looks good by fast static review.

I do not know when i will find time to do proper review. I guess Friday / weekend evenings should be good.

Copy link
Copy Markdown
Member

@niheaven niheaven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Full diff:

diff --git a/bin/checkver.ps1 b/bin/checkver.ps1
index 5d21aff8c..b76f38b70 100644
--- a/bin/checkver.ps1
+++ b/bin/checkver.ps1
@@ -48,7 +48,6 @@
 #>
 param(
     [String] $App = '*',
-    [Parameter(Mandatory = $true)]
     [ValidateScript( {
         if (!(Test-Path $_ -Type Container)) {
             throw "$_ is not a directory!"
@@ -56,7 +55,7 @@ param(
             $true
         }
     })]
-    [String] $Dir,
+    [String] $Dir = '.',
     [Switch] $Update,
     [Switch] $ForceUpdate,
     [Switch] $SkipUpdated,
@@ -75,10 +74,9 @@ param(
 # get apps to check
 $Queue = @()
 if((Test-Path $App) -and $App -ne "*") {
-    $Queue = @(Get-ChildItem $App)
+    $Queue = @(Get-Item -Path (Convert-Path -Path $App))
 } else {
-    $Dir = Resolve-Path $Dir
-    $Queue = @(Get-ChildItem -Path $Dir -Filter "$App.json")
+    $Queue = @(Get-ChildItem -Path (Convert-Path -Path $Dir) -Filter "$App.json")
 }
 
 # clear any existing events
@@ -211,7 +209,7 @@ while ($in_progress -gt 0) {
     }
 
     if (!$regex -and $replace) {
-        next "'replace' requires 're' or 'regex'"
+        next $app "'replace' requires 're' or 'regex'"
         continue
     }
 

Comment thread bin/checkver.ps1
$Queue += , @($_.Name, $json)
}
if((Test-Path $App) -and $App -ne "*") {
$Queue = @(Get-ChildItem $App)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$Queue = @(Get-ChildItem $App)
$Queue = @(Get-Item -Path (Convert-Path -Path $App))

Comment thread bin/checkver.ps1
$Queue = @(Get-ChildItem $App)
} else {
$Dir = Resolve-Path $Dir
$Queue = @(Get-ChildItem -Path $Dir -Filter "$App.json")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$Queue = @(Get-ChildItem -Path $Dir -Filter "$App.json")
$Queue = @(Get-ChildItem -Path (Convert-Path -Path $Dir) -Filter "$App.json")

Also remove above $Dir = Resolve-Path $Dir

Base automatically changed from develop to master November 22, 2021 14:40
@rashil2000
Copy link
Copy Markdown
Member

Superceded by #5019

@rashil2000 rashil2000 closed this Jun 24, 2022
@niheaven niheaven deleted the feature/checkver-wtih-file branch July 7, 2022 10:08
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.

4 participants