Skip to content

Commit

Permalink
Merge pull request #12 from net-daemon/add-update-script
Browse files Browse the repository at this point in the history
Add update script
  • Loading branch information
helto4real authored Jun 6, 2022
2 parents 5fbf7a8 + 0c0d729 commit 2308f99
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Update the codegen
dotnet tool update joysoftware.netdaemon.hassmodel.codegen

# Update all nugets to latest versions
$regex = 'PackageReference Include="([^"]*)" Version="([^"]*)"'

ForEach ($file in get-childitem . -recurse | where { $_.extension -like "*proj" }) {
$packages = Get-Content $file.FullName |
select-string -pattern $regex -AllMatches |
ForEach-Object { $_.Matches } |
ForEach-Object { $_.Groups[1].Value.ToString() } |
sort -Unique

ForEach ($package in $packages) {
write-host "Update $file package :$package" -foreground 'magenta'
$fullName = $file.FullName
iex "dotnet add $fullName package $package"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Update the codegen
dotnet tool update joysoftware.netdaemon.hassmodel.codegen

# Update all nugets to latest versions
$regex = 'PackageReference Include="([^"]*)" Version="([^"]*)"'

ForEach ($file in get-childitem . -recurse | where { $_.extension -like "*proj" }) {
$packages = Get-Content $file.FullName |
select-string -pattern $regex -AllMatches |
ForEach-Object { $_.Matches } |
ForEach-Object { $_.Groups[1].Value.ToString() } |
sort -Unique

ForEach ($package in $packages) {
write-host "Update $file package :$package" -foreground 'magenta'
$fullName = $file.FullName
iex "dotnet add $fullName package $package"
}
}

0 comments on commit 2308f99

Please sign in to comment.