forked from treestryder/powershell_module_workdayapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstall.ps1
More file actions
34 lines (27 loc) · 885 Bytes
/
Install.ps1
File metadata and controls
34 lines (27 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[CmdletBinding()]
param (
[string]$InstallPath = $(
If (($env:OS -eq 'Windows_NT') -Or ($PSVersionTable.platform -eq 'Win32NT')){
Join-Path $env:ProgramFiles 'WindowsPowerShell\Modules\WorkdayApi'
}ElseIf(($PSVersionTable.platform -eq 'Unix')){
Join-Path ~/.local/share/ 'powershell/Modules/WorkdayApi'
}),
[switch]$Force
)
$sourceFiles = @(
'.\source\*'
)
if (Test-Path $InstallPath) {
if ($Force) {
Remove-Item -Path $InstallPath\* -Recurse
} else {
Write-Warning "Module already installed at `"$InstallPath`" use -Force to overwrite installation."
return
}
} else {
New-Item -Path $InstallPath -ItemType Directory | Out-Null
}
Push-Location $PSScriptRoot
Copy-Item -Path $sourceFiles -Destination $InstallPath -Recurse
Pop-Location
Import-Module -Name WorkdayApi -Verbose