diff --git a/.gitignore b/.gitignore
index 03227a6..918dba7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-PesterTestResults.xml
\ No newline at end of file
+PesterTestResults.xml
+en-US/InstallModuleFromGit-help.xml
\ No newline at end of file
diff --git a/ChangeLog.md b/ChangeLog.md
index 9ad1f0d..c9f71b5 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -2,9 +2,10 @@
Date: TBA
-## new features in 1.0.1
+## new features in 1.1.0
+- new command Update-GitModule which installs module only if local version exists and if older than remote
-## bug fixes in 1.0.1
+## bug fixes in 1.1.0
# v.1.0.1
diff --git a/Docs/Get-GitModule.md b/Docs/Get-GitModule.md
index 413d875..a7b0300 100644
--- a/Docs/Get-GitModule.md
+++ b/Docs/Get-GitModule.md
@@ -24,8 +24,7 @@ Cmdlet requires \`git\` client tool to work.
It will download (\`git clone\`) specified repository to temporary directory and analyze it.
By default, it will delete this temporary copy, but if needed, it can be kept.
-Cmdlet searches for module manifest ( .psd1) file only.
-Modules with only .psm1 files are not supported at the moment.
+Cmdlet searches for module manifest ( .psd1) file or if that is not found for module (.psm1) file itself.
## EXAMPLES
diff --git a/Docs/Install-GitModule.md b/Docs/Install-GitModule.md
index 4d67103..8171d30 100644
--- a/Docs/Install-GitModule.md
+++ b/Docs/Install-GitModule.md
@@ -27,8 +27,7 @@ Cmdlet will actually download specified repository to user's default install dir
It does not support functionality \`-Scope AllUsers\`, but it is possible to specify \`-DestinationPath\` argument which will provide the same result.
-Cmdlet searches for module manifest ( .psd1) file only.
-Modules with only .psm1 files are not supported at the moment.
+Cmdlet searches for module manifest ( .psd1) file or if that is not found for module (.psm1) file itself.
Note that this will not import module, only install it (the same as built-in cmdlet \`Install-Module\`).
You can rely on PowerShell's automatic import of modules into user session when needed.
diff --git a/Docs/InstallModuleFromGit-help.xml b/Docs/InstallModuleFromGit-help.xml
index 852c4f8..d02c042 100644
--- a/Docs/InstallModuleFromGit-help.xml
+++ b/Docs/InstallModuleFromGit-help.xml
@@ -12,7 +12,7 @@
This cmdlet will check for existence of PowerShell module in given repository and return its version. You can also specify desired git branch.
Cmdlet requires `git` client tool to work. It will download (`git clone`) specified repository to temporary directory and analyze it. By default, it will delete this temporary copy, but if needed, it can be kept.
- Cmdlet searches for module manifest ( .psd1) file only. Modules with only .psm1 files are not supported at the moment.
+ Cmdlet searches for module manifest ( .psd1) file or if that is not found for module (.psm1) file itself.
@@ -162,7 +162,7 @@ Git : https://github.com/iricigor/FIFA2018
You can also specify desired git branch.
Cmdlet internally uses `Get-GitModule` cmdlet, so it requires `git` client tool to work. Cmdlet will actually download specified repository to user's default install directory for PowerShell modules.
It does not support functionality `-Scope AllUsers`, but it is possible to specify `-DestinationPath` argument which will provide the same result.
- Cmdlet searches for module manifest ( .psd1) file only. Modules with only .psm1 files are not supported at the moment.
+ Cmdlet searches for module manifest ( .psd1) file or if that is not found for module (.psm1) file itself.
Note that this will not import module, only install it (the same as built-in cmdlet `Install-Module`). You can rely on PowerShell's automatic import of modules into user session when needed.
@@ -305,4 +305,166 @@ Git : https://github.com/iricigor/FIFA2018
+
+
+ Update-GitModule
+ Update
+ GitModule
+
+ This cmdlet updates previously installed PowerShell module specified by its git repository URL if repository contains newer version than installed one.
+
+
+
+ This cmdlet updates previously installed PowerShell module specified by its git repository URL if repository contains newer version than installed one.
+ You can also specify desired git branch.
+ Cmdlet internally uses `Get-GitModule` cmdlet, so it requires `git` client tool to work. Cmdlet will actually download specified repository to user's default install directory for PowerShell modules.
+ Cmdlet searches for module manifest ( .psd1) file or if that is not found for module (.psm1) file itself.
+ If you do not have the same module already installed, commandlet will throw an error.
+ Note that this will not import module, only install it (the same as built-in cmdlet `Update-Module`). You can rely on PowerShell's automatic import of modules into user session when needed.
+
+
+
+ Update-GitModule
+
+ ProjectUri
+
+ Mandatory parameter specifying URL or the repository. Multiple values are supported. Parameter is passed to `git` client, so whatever works there is good value. For example, in GitHub URLs you can specify parameter both with or without `.git` at the end of URL.
+ You can pass this parameter also via pipeline, for example via `Find-Module` built-in cmdlet.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+ Branch
+
+ Optional parameter that specifies which branch should be cloned. If omitted, `master` branch will be used.
+
+ String
+
+ String
+
+
+ None
+
+
+ DestinationPath
+
+ If you have a specific setup, you can override default install location with this parameter. As cmdlet always installs to user specific location, this can be useful to perform system wide installation (requires also elevated prompt).
+
+ String
+
+ String
+
+
+ None
+
+
+ Force
+
+ If DestinationPath location is not empty, commandlet will not install newer version there. This behavior can be overridden with -Force switch.
+
+
+ SwitchParameter
+
+
+ False
+
+
+
+
+
+ Branch
+
+ Optional parameter that specifies which branch should be cloned. If omitted, `master` branch will be used.
+
+ String
+
+ String
+
+
+ None
+
+
+ DestinationPath
+
+ If you have a specific setup, you can override default install location with this parameter. As cmdlet always installs to user specific location, this can be useful to perform system wide installation (requires also elevated prompt).
+
+ String
+
+ String
+
+
+ None
+
+
+ Force
+
+ If DestinationPath location is not empty, commandlet will not install newer version there. This behavior can be overridden with -Force switch.
+
+ SwitchParameter
+
+ SwitchParameter
+
+
+ False
+
+
+ ProjectUri
+
+ Mandatory parameter specifying URL or the repository. Multiple values are supported. Parameter is passed to `git` client, so whatever works there is good value. For example, in GitHub URLs you can specify parameter both with or without `.git` at the end of URL.
+ You can pass this parameter also via pipeline, for example via `Find-Module` built-in cmdlet.
+
+ String[]
+
+ String[]
+
+
+ None
+
+
+
+
+
+ System.String[]
+
+
+
+
+
+
+
+
+
+ System.Object
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -------------------------- Example 1 --------------------------
+ PS C:\> Update-GitModule https://github.com/microsoft/SpeculationControl
+
+ Updates the most downloadable PowerShell module directly from GitHub. If you do not have it installed, it will throw an error.
+
+
+
+
+
+ https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md
+ https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md
+
+
+
\ No newline at end of file
diff --git a/Docs/Update-GitModule.md b/Docs/Update-GitModule.md
new file mode 100644
index 0000000..a810e41
--- /dev/null
+++ b/Docs/Update-GitModule.md
@@ -0,0 +1,130 @@
+---
+external help file: InstallModuleFromGit-help.xml
+Module Name: InstallModuleFromGit
+online version: https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md
+schema: 2.0.0
+---
+
+# Update-GitModule
+
+## SYNOPSIS
+This cmdlet updates previously installed PowerShell module specified by its git repository URL if repository contains newer version than installed one.
+
+## SYNTAX
+
+```
+Update-GitModule [-ProjectUri] [-Branch ] [-DestinationPath ] [-Force]
+ []
+```
+
+## DESCRIPTION
+
+This cmdlet updates previously installed PowerShell module specified by its git repository URL if repository contains newer version than installed one.
+
+You can also specify desired git branch.
+
+Cmdlet internally uses \`Get-GitModule\` cmdlet, so it requires \`git\` client tool to work.
+Cmdlet will actually download specified repository to user's default install directory for PowerShell modules.
+
+Cmdlet searches for module manifest ( .psd1) file or if that is not found for module (.psm1) file itself.
+
+If you do not have the same module already installed, commandlet will throw an error.
+
+Note that this will not import module, only install it (the same as built-in cmdlet \`Update-Module\`).
+You can rely on PowerShell's automatic import of modules into user session when needed.
+
+## EXAMPLES
+
+### Example 1
+```powershell
+PS C:\> Update-GitModule https://github.com/microsoft/SpeculationControl
+```
+
+Updates the most downloadable PowerShell module directly from GitHub. If you do not have it installed, it will throw an error.
+
+## PARAMETERS
+
+### -Branch
+Optional parameter that specifies which branch should be cloned.
+If omitted, \`master\` branch will be used.
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -DestinationPath
+If you have a specific setup, you can override default install location with this parameter.
+As cmdlet always installs to user specific location, this can be useful to perform system wide installation (requires also elevated prompt).
+
+```yaml
+Type: String
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -Force
+If DestinationPath location is not empty, commandlet will not install newer version there.
+This behavior can be overridden with -Force switch.
+
+```yaml
+Type: SwitchParameter
+Parameter Sets: (All)
+Aliases:
+
+Required: False
+Position: Named
+Default value: None
+Accept pipeline input: False
+Accept wildcard characters: False
+```
+
+### -ProjectUri
+Mandatory parameter specifying URL or the repository.
+Multiple values are supported.
+Parameter is passed to \`git\` client, so whatever works there is good value.
+For example, in GitHub URLs you can specify parameter both with or without \`.git\` at the end of URL.
+
+You can pass this parameter also via pipeline, for example via \`Find-Module\` built-in cmdlet.
+
+```yaml
+Type: String[]
+Parameter Sets: (All)
+Aliases:
+
+Required: True
+Position: 0
+Default value: None
+Accept pipeline input: True (ByPropertyName)
+Accept wildcard characters: False
+```
+
+### CommonParameters
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
+
+## INPUTS
+
+### System.String[]
+
+## OUTPUTS
+
+### System.Object
+## NOTES
+
+## RELATED LINKS
+
+[https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md](https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md)
+
diff --git a/InstallModuleFromGit.psd1 b/InstallModuleFromGit.psd1
index 7e82279..3f23b3f 100644
--- a/InstallModuleFromGit.psd1
+++ b/InstallModuleFromGit.psd1
@@ -69,7 +69,7 @@ Description = 'Installs module from Git repository (i.e. GitHUb or Azure DevOps)
# NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
-FunctionsToExport = @('Get-GitModule','Install-GitModule')
+FunctionsToExport = @('Get-GitModule','Install-GitModule','Update-GitModule')
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
diff --git a/Private/Get-InstallPath.ps1 b/Private/Get-InstallPath.ps1
index 5a2102f..386a21f 100644
--- a/Private/Get-InstallPath.ps1
+++ b/Private/Get-InstallPath.ps1
@@ -2,7 +2,9 @@ function Get-InstallPath {
# returns OS specific path for module installation, it support only -Scope CurrentUser
if ($IsLinux -or $IsOSX) {
- "$HOME/.local/share/powershell/Modules"
+ #"$HOME/.local/share/powershell/Modules"
+ # https://github.com/PowerShell/PowerShellGet/blob/d4dfebbbec4dfbe73392719a8a331541ed75d508/src/PowerShellGet/private/modulefile/PartOne.ps1#L71
+ Join-Path (Split-Path -Path ([System.Management.Automation.Platform]::SelectProductNameForDirectory('USER_MODULES')) -Parent) 'Modules'
} else {
# https://github.com/PowerShell/PowerShellGet/blob/8004c304a2fa8ad32b92c6c2ba7efe116df3c862/src/PowerShellGet/private/modulefile/PartOne.ps1#L46
try {
diff --git a/Private/Install-ModuleInfo.ps1 b/Private/Install-ModuleInfo.ps1
new file mode 100644
index 0000000..66faad1
--- /dev/null
+++ b/Private/Install-ModuleInfo.ps1
@@ -0,0 +1,39 @@
+function Install-ModuleInfo {
+
+ param(
+ [PSObject]$ModuleInfo,
+ [string]$DestinationPath,
+ [switch]$Force
+ )
+
+ # verify properties
+ if (!$ModuleInfo.Root) {
+ Write-Warning -Message "$FunctionName installing module with manifest not located in module root directory"
+ }
+ if (!$ModuleInfo.SameName) {
+ Write-Warning -Message "$FunctionName installing module with module name not the same as its directory name"
+ }
+
+ # check target directory
+ $TargetDir = Join-Path (Join-Path $DestinationPath $ModuleInfo.Name) $ModuleInfo.Version
+ if (!(Test-Path $TargetDir)) {
+ New-Item $TargetDir -ItemType Directory -Force | Out-Null
+ } elseif ((Get-ChildItem $TargetDir) -and (!$Force)) {
+ Write-Error "$FunctionName cannot install into non-empty directory $TargetDir, use different -Destination or -Force to override it"
+ continue
+ }
+
+ # copy module
+ Write-Verbose -Message "$(Get-Date -f T) installing module to $TargetDir"
+ Copy-Item "$($ModuleInfo.LocalPath)/*" $TargetDir -Force -Recurse | Out-Null
+
+ # clean up
+ $gitDir = Join-Path $TargetDir '.git'
+ if (Test-Path $gitDir) {Remove-Item $gitDir -Recurse -Force}
+ Remove-Item $ModuleInfo.LocalPath -Recurse -Force | Out-Null
+ Write-Verbose -Message "$(Get-Date -f T) module $ModuleName installation completed"
+
+ # return value
+ $ModuleInfo.LocalPath = $TargetDir
+ $ModuleInfo
+}
\ No newline at end of file
diff --git a/Public/Get-GitModule.ps1 b/Public/Get-GitModule.ps1
index d145f02..df017c1 100644
--- a/Public/Get-GitModule.ps1
+++ b/Public/Get-GitModule.ps1
@@ -75,7 +75,7 @@ function Get-GitModule {
Write-Verbose -Message "$(Get-Date -f T) not deleting temp copy"
} else {
Write-Verbose -Message "$(Get-Date -f T) deleting temp copy"
- Remove-Item $tempDir -Force -Recurse | Out-Null
+ Remove-Item $tempDir -Force -Recurse -ea 0 | Out-Null
}
if ($errorText) {
diff --git a/Public/Install-GitModule.ps1 b/Public/Install-GitModule.ps1
index 2b65bec..4b821b5 100644
--- a/Public/Install-GitModule.ps1
+++ b/Public/Install-GitModule.ps1
@@ -27,8 +27,8 @@ function Install-GitModule {
$tmpRoot = [System.IO.Path]::GetTempPath()
- # TODO: Check if this is inside of $env:PSModulePath
- if ($DestinationPath -notin ($env:PSModulePath -split ';')) {
+ $PSModulePaths = $env:PSModulePath -split (';:'[[int]($IsLinux -or $IsMacOS)])
+ if ($DestinationPath -notin $PSModulePaths) {
Write-Warning -Message "$FunctionName using path which is not in `$Env:PSModulePath ($DestinationPath)"
}
@@ -44,36 +44,7 @@ function Install-GitModule {
$ModuleInfo = Get-GitModule -ProjectUri $P1 -KeepTempCopy
if (!$ModuleInfo -or ($ModuleInfo.Count -gt 1)) {continue} # we have the error in get-gitmodule
- # verify properties
- if (!$ModuleInfo.Root) {
- Write-Warning -Message "$FunctionName installing module with manifest not located in module root directory"
- }
- if (!$ModuleInfo.SameName) {
- Write-Warning -Message "$FunctionName installing module with module name not the same as its directory name"
- }
-
- # check target directory
- $TargetDir = Join-Path (Join-Path $DestinationPath $ModuleInfo.Name) $ModuleInfo.Version
- if (!(Test-Path $TargetDir)) {
- New-Item $TargetDir -ItemType Directory -Force | Out-Null
- } elseif ((Get-ChildItem $TargetDir) -and (!$Force)) {
- Write-Error "$FunctionName cannot install into non-empty directory $TargetDir, use different -Destination or -Force to override it"
- continue
- }
-
- # copy module
- Write-Verbose -Message "$(Get-Date -f T) installing module to $TargetDir"
- Copy-Item "$($ModuleInfo.LocalPath)/*" $TargetDir -Force -Recurse | Out-Null
-
- # clean up
- $gitDir = Join-Path $TargetDir '.git'
- if (Test-Path $gitDir) {Remove-Item $gitDir -Recurse -Force}
- Remove-Item $ModuleInfo.LocalPath -Recurse -Force | Out-Null
- Write-Verbose -Message "$(Get-Date -f T) module $ModuleName installation completed"
-
- # return value
- $ModuleInfo.LocalPath = $TargetDir
- $ModuleInfo
+ Install-ModuleInfo -ModuleInfo $ModuleInfo -DestinationPath $DestinationPath -Force:$Force
}
}
diff --git a/Public/Update-GitModule.ps1 b/Public/Update-GitModule.ps1
new file mode 100644
index 0000000..f3e02a1
--- /dev/null
+++ b/Public/Update-GitModule.ps1
@@ -0,0 +1,68 @@
+function Update-GitModule {
+
+ [CmdletBinding(HelpUri='https://github.com/iricigor/InstallModuleFromGit/blob/master/Docs/Update-GitModule.md')]
+
+ param (
+
+
+ [Parameter(Mandatory,ValueFromPipelineByPropertyName,Position=0)]
+ [string[]]$ProjectUri,
+ # https://github.com/dfinke/InstallModuleFromGitHub
+ # https://github.com/iricigor/FIFA2018
+
+ [string]$Branch = "master",
+ [string]$DestinationPath = (Get-InstallPath),
+ [switch]$Force
+
+ )
+
+ BEGIN {
+ $FunctionName = $MyInvocation.MyCommand.Name
+ Write-Verbose -Message "$(Get-Date -f G) $FunctionName starting"
+
+ if (!(Test-Prerequisites)) {
+ throw "$FunctionName prerequisites not met"
+ # TODO: Add more details
+ }
+
+ if ($env:AGENT_TEMPDIRECTORY) {
+ $tmpRoot = $env:AGENT_TEMPDIRECTORY
+ } else {
+ $tmpRoot = [System.IO.Path]::GetTempPath()
+ }
+
+ }
+
+ PROCESS {
+
+ foreach ($P1 in $ProjectUri) {
+
+ Write-Verbose -Message "$(Get-Date -f T) processing $P1"
+
+ $RemoteModuleInfo = Get-GitModule -ProjectUri $P1 -KeepTempCopy
+ if (!$RemoteModuleInfo -or ($RemoteModuleInfo.Count -gt 1)) {continue} # we have the error in get-gitmodule
+ $ModuleName = $RemoteModuleInfo.Name
+
+ # TODO: continue only after cleanup!
+
+ # Check version, and if higher install it
+ $AllModules = @((Get-Module -Name $ModuleName -ListAvailable),(Get-InstalledModule -Name $ModuleName)) | Select Name, Version
+ $LocalModuleInfo = $AllModules | Sort-Object Version -Descending | Select -First 1
+ if (!$LocalModuleInfo) {
+ Write-Error "$FunctionName cannot find local module '$ModuleName'"
+ continue
+ }
+ if ($LocalModuleInfo.Version -ge $RemoteModuleInfo.Version) {
+ Write-Verbose "$(Get-Date -f T) not updating module '$ModuleName', local version $($LocalModuleInfo.Version), remote version $($RemoteModuleInfo.Version)"
+ } else {
+ Install-ModuleInfo -ModuleInfo $RemoteModuleInfo -DestinationPath $DestinationPath -Force:$Force
+ }
+
+ }
+ }
+
+ END {
+ Write-Verbose -Message "$(Get-Date -f G) $FunctionName completed"
+ }
+
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 18c5240..942baec 100644
--- a/README.md
+++ b/README.md
@@ -57,12 +57,6 @@ PS:\> (Install-GitModule 'https://github.com/iricigor/psaptgetupdate').Name | Im
The module Install Module From Git exposes two new commandlets. More info on module [here](/Docs/InstallModuleFromGit.md).
-Module provides updatable help system, though it is working currently only on Windows PowerShell. Tracking issue is [here](https://github.com/iricigor/InstallModuleFromGit/issues/3).
-
-```PowerShell
-Update-Help -Module InstallModuleFromGit -Force
-```
-
### Get-GitModule
Checks for module existence and returns its version. More info [here](/Docs/Get-GitModule.md).
@@ -71,6 +65,18 @@ Checks for module existence and returns its version. More info [here](/Docs/Get-
Installs PowerShell module to user's default install folder. More info [here](/Docs/Install-GitModule.md).
+### Update-GitModule
+
+Updates previously installed PowerShell module if Git repository contains newer version. More info [here](/Docs/Update-GitModule.md).
+
+### Commands Help System
+
+Module provides updatable help system, though it is working currently only on Windows PowerShell. Tracking issue is [here](https://github.com/iricigor/InstallModuleFromGit/issues/3).
+
+```PowerShell
+Update-Help -Module InstallModuleFromGit -Force
+```
+
## Tests
:smirk: Module has testing against two platforms - Linux and Windows. Code is verified before and after merging to master branch. Tests results are available on the Tests tab ([example here](/img/TestResults-AzureDevops.png)).
diff --git a/Tests/functions/Update-GitModule.Tests.ps1 b/Tests/functions/Update-GitModule.Tests.ps1
new file mode 100644
index 0000000..7caec89
--- /dev/null
+++ b/Tests/functions/Update-GitModule.Tests.ps1
@@ -0,0 +1,49 @@
+#
+# This is a PowerShell Unit Test file.
+# You need a unit test framework such as Pester to run PowerShell Unit tests.
+# You can download Pester from http://go.microsoft.com/fwlink/?LinkID=534084
+#
+
+$CommandName = 'Update-GitModule'
+
+Describe "$CommandName basic testing" -Tag 'Functionality' {
+
+
+ $moduleName = 'FIFA2018'
+ $moduleURL = 'https://github.com/iricigor/' + $moduleName
+
+ $ExistingModule = Get-InstalledModule $moduleName -ea 0
+ It 'Should uninstall module if installed' -Skip:($ExistingModule -eq $null) {
+ {Uninstall-Module $moduleName} | Should -Not -Throw
+ }
+
+ # its not so easy to remove PowerShell module
+ $ExistingModule = Get-Module $moduleName -ListAvailable
+ It 'Should delete module if still found' -Skip:($ExistingModule -eq $null) {
+ {Split-Path ($ExistingModule.Path) -Parent | Remove-Item -Force -Recurse} | Should -Not -Throw
+ }
+
+ It 'Should install module from PSGallery' {
+ $OldProgressPreference = $ProgressPreference
+ $ProgressPreference = 'SilentlyContinue'
+ {Install-Module $moduleName -Repository PSGallery -Scope CurrentUser -Force} | Should -Not -Throw
+ $ProgressPreference = $OldProgressPreference
+ }
+
+ It 'Should update module to newer version' {
+ Update-GitModule -ProjectUri $moduleURL -Force | Should -Not -Be $null
+ }
+
+}
+
+
+Describe "$CommandName error handling" -Tag 'Functionality' {
+
+ $moduleName = 'dbatools'
+ $moduleURL = 'https://github.com/sqlcollaborative/' + $moduleName
+
+ It "Should not update non existing module" -Skip:((Get-Module $moduleName -ListAvailable) -ne $null) {
+ {Update-GitModule -ProjectUri $moduleURL -ea Stop} | Should -Throw
+ }
+
+}
\ No newline at end of file
diff --git a/Tests/module/InstallModuleFromGit.Tests.ps1 b/Tests/module/InstallModuleFromGit.Tests.ps1
index 86264b1..d191773 100644
--- a/Tests/module/InstallModuleFromGit.Tests.ps1
+++ b/Tests/module/InstallModuleFromGit.Tests.ps1
@@ -49,16 +49,17 @@ Describe 'Proper Module Declaration' -Tag 'Documentation' {
#
-# Module should import two functions
+# Module should import three functions
#
Describe 'Proper Functions Declaration' -Tag 'Other' {
It 'Checks for existence of functions' {
- @(Get-Command -Module $ModuleName -CommandType Function).Count | Should -Be 2 -Because 'We should have two functions defined'
+ @(Get-Command -Module $ModuleName -CommandType Function).Count | Should -Be 3 -Because 'We should have two functions defined'
Get-Command NonExistingCommand -ea 0 | Should -Be $Null
Get-Command Get-GitModule -ea 0 | Should -Not -Be $Null
+ Get-Command Update-GitModule -ea 0 | Should -Not -Be $Null
Get-Command Install-GitModule -ea 0 | Should -Not -Be $Null
}
}
@@ -82,7 +83,15 @@ Describe 'Proper Documentation' -Tag 'Documentation' {
$diff = git diff --ignore-space-change .\Docs .\en-US
Pop-Location
$diff | Should -Be $null
- }
+ }
+
+ $Blank = '{{ Fill .+}}'
+ foreach ($File in (Get-ChildItem .\Docs)) {
+ It "Documentation for $($File.Name) should not have blanks" {
+ Get-Content $File.FullName | Select-String -Pattern $Blank | Should -Be $null
+ }
+ }
+
}
diff --git a/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_HelpInfo.xml b/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_HelpInfo.xml
index ea4ad23..0a15476 100644
--- a/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_HelpInfo.xml
+++ b/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_HelpInfo.xml
@@ -7,4 +7,4 @@
1.0.0.0
-
+
\ No newline at end of file
diff --git a/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.cab b/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.cab
index aee5e3d..79a3d5e 100644
Binary files a/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.cab and b/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.cab differ
diff --git a/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.zip b/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.zip
index 1f1a76c..1693375 100644
Binary files a/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.zip and b/cab/InstallModuleFromGit_d6a1577c-e3b5-48f2-a698-f08ab4865a58_en-US_HelpContent.zip differ
diff --git a/tools/InvokeTests.ps1 b/tools/InvokeTests.ps1
index 9c53f23..4483fc2 100644
--- a/tools/InvokeTests.ps1
+++ b/tools/InvokeTests.ps1
@@ -24,6 +24,7 @@ function InstallModule ([string]$Name,[version]$Version){
if ($env:TF_BUILD) {
$PSVersionTable
Get-ChildItem Env:\
+ $Env:PSModulePath -split (';:'[[int]($IsLinux -or $IsMacOS)])
Get-Module -ListAvailable | Format-Table -Property ModuleType, Name, Version
}