-
Notifications
You must be signed in to change notification settings - Fork 6
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 #12 from net-daemon/add-update-script
Add update script
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/NetDaemon.Templates.Project/templates/netdaemon/update_all_dependencies.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,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" | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/NetDaemon.Templates.Project/templates/netdaemon_src/update_all_dependencies.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,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" | ||
} | ||
} |