Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added proxy parameter to Install-CUDiagramPrerequisites #24

Merged
merged 3 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions Functions/Public/Install-CUDiagramPrerequisites.ps1
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
function Install-CUDiagramPrerequisites {
<#
.SYNOPSIS
This function installs the prerequisites for PSClassUtils.
.DESCRIPTION
Installation of PSGraph
.EXAMPLE
Istall-CUDiagramPrerequisites
.EXAMPLE
Istall-CUDiagramPrerequisites -proxy "10.10.10.10"
.NOTES
Author: Stephanevg
Version: 2.0
#>

[CmdletBinding()]
param (

[String]$Proxy
)

if(!(Get-Module -Name PSGraph)){
#Module is not loaded
if(!(get-module -listavailable -name psgraph )){
write-verbose "Install PSGraph"
Install-Module psgraph -Verbose
Import-Module psgraph -Force

if($proxy){
write-verbose "Install PSGraph"
Install-Module psgraph -Verbose -proxy $proxy
Import-Module psgraph -Force
}else{
write-verbose "Install PSGraph"
Install-Module psgraph -Verbose
Import-Module psgraph -Force
}
}else{
Import-Module psgraph -Force
}

Install-GraphViz
}
}
}
12 changes: 12 additions & 0 deletions Tests/ClassUtils.Install-CUDiagramPrerequisites.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Import-Module -Force $PSScriptRoot\..\PSClassUtils.psm1

InModuleScope PSClassUtils -ScriptBlock {

Describe "Testing Function: 'Install-CUDiagramPrerequisites'" {
it '[Function][Parameter] The proxy parameter should be available.' {

(Get-Command Install-CUDiagramPrerequisites).Parameters.keys -contains "proxy"

}
}
}