Skip to content

Commit 3defbe2

Browse files
committed
update descritpion; add update-check; fix tests
1 parent bb1eeba commit 3defbe2

6 files changed

Lines changed: 62 additions & 11 deletions

File tree

Bookmarks/Bookmarks.Tests.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ $DebugPreference = "Continue"
55
Set-StrictMode -version Latest
66

77
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
8-
. $PSScriptRoot\..\Shared-Functions\ModuleLoader.ps1 "$PSScriptRoot"
98

9+
. $PSScriptRoot\Shared-Functions.ps1
10+
11+
. $PSScriptRoot\Functions.ps1
12+
13+
_Initalize
1014

1115
Describe "Remove-AllPSBookmarks" {
1216

Bookmarks/Bookmarks.psd1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# RootModule = ''
1313

1414
# Version number of this module.
15-
ModuleVersion = '2.1.1'
15+
ModuleVersion = '2.1.5'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -115,7 +115,8 @@ PrivateData = @{
115115
Move initation logic to Loader.psm1
116116
Change test environment to StrictMode=Latest
117117
Update icon.
118-
Remove extra hared functions
118+
Remove extra shared functions
119+
Add update checker
119120
'
120121

121122
} # End of PSData hashtable

Bookmarks/Bookmarks.psm1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
. $PSScriptRoot\Functions.ps1
2-
. $PSScriptRoot\Shared-Functions.ps1
1+
. $PSScriptRoot\Shared-Functions.ps1
32

3+
. $PSScriptRoot\Functions.ps1
4+
5+
CheckPsGalleryUpdate Bookmarks "2.1.5"
46

57
_Initalize
68

Bookmarks/Functions.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
function _Initalize() {
3-
3+
44
$script:_marks = @{ }
55
$script:_marksPath = Get-ProfileDataFile bookmarks "Bookmarks"
66

Bookmarks/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,17 @@ Clear bookmarks:
109109

110110
## Changelog
111111

112-
### [v1.2.0](https://github.com/stadub/PowershellScripts/releases/tag/v0.2.2)
112+
### [v2.1.5](https://github.com/stadub/PowershellScripts/tree/Bookmarks-Release-2.1.5)
113113

114-
* Tests added
115-
* Added function `Remove-AllPSBookmarks`
116-
* Fix bookmarks collection access
114+
*Add update checker
115+
116+
### [v2.1.0](https://github.com/stadub/PowershellScripts/tree/Bookmarks-Release-2.1)
117+
118+
*Change %userData% detection logic.
119+
*Move initation logic to Loader.psm1
120+
*Change test environment to StrictMode=Latest
121+
*Update icon.
122+
*Remove extra shared functions
117123

118124

119125
### [v1.1.3](https://github.com/stadub/PowershellScripts/releases/tag/v0.2.0)

Bookmarks/Shared-Functions.ps1

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,43 @@ function Combine-Path {
6969
[IO.Path]::Combine([string[]]$allArgs)
7070
}
7171

72-
$_sharedLoaded = $true
72+
filter Last {
73+
BEGIN
74+
{
75+
$current=$null
76+
}
77+
PROCESS
78+
{
79+
$current=$_
80+
}
81+
END
82+
{
83+
Write-Output $current
84+
}
85+
}
86+
87+
function CheckPsGalleryUpdate {
88+
param (
89+
[string] $moduleName,
90+
[string] $currentVersion
91+
)
92+
93+
Try
94+
{
95+
Write-Output "Update check..."
96+
$feed = Invoke-WebRequest -Uri "https://www.powershellgallery.com/api/v2/FindPackagesById()?id=%27$moduleName%27"
97+
$last=([xml]$feed.Content).feed.entry |Sort-Object -Property updated | Last
7398

99+
$version= $last.properties.Version
100+
101+
if ($version -gt $currentVersion) {
102+
Write-Output "Found a new module version {$version}."
103+
$notes=$last.properties.ReleaseNotes.'#text'
104+
Write-Output "Release notes: {$notes}."
105+
Write-Output "Recomendent to update module with command: Update-Module -Name $moduleName -Force"
106+
}
107+
}
108+
Catch
109+
{
110+
}
111+
}

0 commit comments

Comments
 (0)