55 lines
1.9 KiB
PowerShell
55 lines
1.9 KiB
PowerShell
|
<#
|
||
|
.SYNOPSIS
|
||
|
Updates the License.txt file that is part of binary module packages.
|
||
|
|
||
|
#>
|
||
|
|
||
|
$products = @(
|
||
|
@{ Name = 'DSInternals PowerShell Module and Framework';
|
||
|
LicenseUrl = 'https://raw.githubusercontent.com/MichaelGrafnetter/DSInternals/master/LICENSE.md'
|
||
|
}, @{
|
||
|
Name = 'ESENT Managed Interop';
|
||
|
LicenseUrl = 'https://raw.githubusercontent.com/microsoft/ManagedEsent/master/LICENSE.md'
|
||
|
}, @{
|
||
|
Name = 'AutoMapper';
|
||
|
LicenseUrl = 'https://raw.githubusercontent.com/AutoMapper/AutoMapper/master/LICENSE.txt'
|
||
|
}, @{
|
||
|
Name = 'NDceRpc (.NET Distributed Computing Environment Remote Procedure Call)';
|
||
|
LicenseUrl = 'https://raw.githubusercontent.com/OpenSharp/NDceRpc/master/license.txt'
|
||
|
}, @{
|
||
|
Name = 'PBKDF2.NET';
|
||
|
LicenseUrl = 'https://raw.githubusercontent.com/therealmagicmike/PBKDF2.NET/master/License.txt'
|
||
|
}
|
||
|
)
|
||
|
|
||
|
$now = Get-Date
|
||
|
$licenses = New-Object -TypeName System.Text.StringBuilder
|
||
|
|
||
|
$licenses.Append('The binary distribution of the DSInternals PowerShell Module contains the following software products:') > $null
|
||
|
|
||
|
foreach($product in $products)
|
||
|
{
|
||
|
$licenses.AppendLine() > $null
|
||
|
$licenses.AppendLine() > $null
|
||
|
|
||
|
# Product name
|
||
|
$licenses.AppendLine('-' * $product.Name.Length) > $null
|
||
|
$licenses.AppendLine($product.Name) > $null
|
||
|
$licenses.AppendLine('-' * $product.Name.Length) > $null
|
||
|
$licenses.AppendLine() > $null
|
||
|
|
||
|
# Date and URI
|
||
|
$note = '(License updated on {0:d} from {1}.)' -f $now,$product.LicenseUrl
|
||
|
$licenses.AppendLine($note) > $null
|
||
|
$licenses.AppendLine() > $null
|
||
|
|
||
|
# License Text
|
||
|
$license = Invoke-WebRequest -Uri $product.LicenseUrl
|
||
|
$licenses.Append($license) > $null
|
||
|
}
|
||
|
|
||
|
$root = Join-Path $PSScriptRoot ..\
|
||
|
$licenseFilePath = Join-Path $root Src\DSInternals.PowerShell\License.txt
|
||
|
|
||
|
$licenses.ToString() | Out-File -FilePath $licenseFilePath -Encoding ascii
|