param
(
[string] $ProductName
, [string] $OutputPath
, [switch] $Link
)
$utilPath = Split-Path $MyInvocation.MyCommand.Path
$repoPath = Split-Path $utilPath
$srcPath = Join-Path $repoPath "src"
$srcProductPath = Join-Path $srcPath $ProductName
if(Get-Module -ListAvailable -Name "Kyzog")
{
Import-Module Kyzog
}
else
{
$mklinkPath = Join-Path $srcProductPath "Invoke-MKLINK.ps1"
. $mklinkPath
$symbolicLinkPath = Join-Path $srcProductPath "New-SymbolicLink.ps1"
. $symbolicLinkPath
}
if(-not (Test-Path $OutputPath))
{
New-Item -ItemType Directory $OutputPath | Out-Null
}
if ($Link)
{
Get-ChildItem "$srcProductPath/*" -Include "*.ps1", "*.psm1", "*psd1", "*.json" | ForEach-Object { New-SymbolicLink -Path (Join-Path $OutputPath $_.Name) -Target ($_.FullName) }
}
else
{
Get-ChildItem "$srcProductPath/*" -Include "*.ps1", "*.psm1", "*psd1", "*.json" | Copy-Item -Destination $OutputPath
}