Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 32 additions & 32 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if ($IsLinux) {
}

#
# At the moment, we just support x64 builds. When we support x86 builds, this
# At the moment, we just support x64 builds. When we support x86 builds, this
# check may need to verify the SDK for the specified architecture.
#
function Get-Win10SDKBinDir {
Expand Down Expand Up @@ -120,7 +120,7 @@ function Start-PSBuild {
Push-Location $PSScriptRoot
try {
git clean -fdX
# Extra cleaning is required to delete the CMake temporary files.
# Extra cleaning is required to delete the CMake temporary files.
# These are not cleaned when using "X" and cause CMake to retain state, leading to
# mis-configured environment issues when switching between x86 and x64 compilation
# environments.
Expand Down Expand Up @@ -318,7 +318,7 @@ cmd.exe /C cd /d "$currentLocation" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeH
# Describes wither it should build the CoreCLR or FullCLR version
[ValidateSet("ON", "OFF")]
[string]$OneCoreValue,

# Array of file names to copy from the local build directory to the packaging directory
[string[]]$FilesToCopy
)
Expand Down Expand Up @@ -348,19 +348,19 @@ cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch
Copy-Item $srcPath $dstPath
}
}

if ($FullCLR) {
$fullBinaries = @(
$fullBinaries = @(
'powershell.exe',
'powershell.pdb',
'pwrshplugin.dll',
'pwrshplugin.pdb'
)
Build-NativeWindowsBinaries "OFF" $fullBinaries
Build-NativeWindowsBinaries "OFF" $fullBinaries
}
else
{
$coreClrBinaries = @(
$coreClrBinaries = @(
'pwrshplugin.dll',
'pwrshplugin.pdb'
)
Expand Down Expand Up @@ -405,7 +405,7 @@ cmd.exe /C cd /d "$location" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch
# $Options.Output is pointing to something like "...\src\powershell-win-core\bin\Debug\netcoreapp1.1\win10-x64\publish\powershell.exe",
# so we need to get its parent directory
$publishPath = Split-Path $Options.Output -Parent
log "Restore PowerShell modules to $publishPath"
log "Restore PowerShell modules to $publishPath"
# PowerShellGet depends on PackageManagement module, so PackageManagement module will be installed with the PowerShellGet module.
Restore-PSModule -Name @('PowerShellGet') -Destination (Join-Path -Path $publishPath -ChildPath "Modules")
}
Expand All @@ -417,11 +417,11 @@ function Compress-TestContent {
$Destination
)

$powerShellTestRoot = Join-Path $PSScriptRoot 'test\powershell'
$powerShellTestRoot = Join-Path $PSScriptRoot 'test\powershell'
Add-Type -AssemblyName System.IO.Compression.FileSystem

$resolvedPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Destination)
[System.IO.Compression.ZipFile]::CreateFromDirectory($powerShellTestRoot, $resolvedPath)
[System.IO.Compression.ZipFile]::CreateFromDirectory($powerShellTestRoot, $resolvedPath)
}

function New-PSOptions {
Expand Down Expand Up @@ -718,7 +718,7 @@ function Start-PSPester {
{
$outputBufferFilePath = [System.IO.Path]::GetTempFileName()
}

$Command += "Invoke-Pester "

$Command += "-OutputFormat ${OutputFormat} -OutputFile ${OutputFile} "
Expand Down Expand Up @@ -784,7 +784,7 @@ function Start-PSPester {
{
Remove-Item $outputBufferFilePath
}
}
}
}
if($ThrowOnFailure)
{
Expand Down Expand Up @@ -819,7 +819,7 @@ function Show-PSPesterError

#
# Read the test result file and
# Throw if a test failed
# Throw if a test failed
function Test-PSPesterResults
{
param(
Expand All @@ -830,7 +830,7 @@ function Test-PSPesterResults
if(!(Test-Path $TestResultsFile))
{
throw "Test result file '$testResultsFile' not found for $TestArea."
}
}

$x = [xml](Get-Content -raw $testResultsFile)
if ([int]$x.'test-results'.failures -gt 0)
Expand Down Expand Up @@ -1204,7 +1204,7 @@ function Start-PSPackage {
[ValidateSet("deb", "osxpkg", "rpm", "msi", "appx", "zip")]
[string[]]$Type,

# Generate windows downlevel package
# Generate windows downlevel package
[ValidateSet("win81-x64", "win7-x86", "win7-x64")]
[ValidateScript({$IsWindows})]
[string]$WindowsDownLevel
Expand Down Expand Up @@ -1733,7 +1733,7 @@ function Start-DevPowerShell {
{
Remove-Item env:DEVPATH
}

if ($ZapDisable) {
Remove-Item env:COMPLUS_ZapDisable
}
Expand Down Expand Up @@ -2305,7 +2305,7 @@ function New-MSIPackage
{
[CmdletBinding()]
param (

# Name of the Product
[ValidateNotNullOrEmpty()]
[string] $ProductName = 'PowerShell',
Expand Down Expand Up @@ -2334,7 +2334,7 @@ function New-MSIPackage
# Path to Assets folder containing artifacts such as icons, images
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $AssetsPath,
[string] $AssetsPath,

# Path to license.rtf file - for the EULA
[Parameter(Mandatory = $true)]
Expand Down Expand Up @@ -2364,16 +2364,16 @@ function New-MSIPackage

$ProductSemanticVersion = Get-PackageSemanticVersion -Version $ProductVersion
$ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $ProductVersion

$assetsInSourcePath = Join-Path $ProductSourcePath 'assets'
New-Item $assetsInSourcePath -type directory -Force | Write-Verbose

Write-Verbose "Place dependencies such as icons to $assetsInSourcePath"
Write-Verbose "Place dependencies such as icons to $assetsInSourcePath"
Copy-Item "$AssetsPath\*.ico" $assetsInSourcePath -Force

$productVersionWithName = $ProductName + "_" + $ProductVersion
$productSemanticVersionWithName = $ProductName + "_" + $ProductSemanticVersion

Write-Verbose "Create MSI for Product $productSemanticVersionWithName"

[Environment]::SetEnvironmentVariable("ProductSourcePath", $ProductSourcePath, "Process")
Expand All @@ -2398,13 +2398,13 @@ function New-MSIPackage
if ($ProductNameSuffix) {
$packageName += "-$ProductNameSuffix"
}
$msiLocationPath = Join-Path $pwd "$packageName.msi"
$msiLocationPath = Join-Path $pwd "$packageName.msi"
Remove-Item -ErrorAction SilentlyContinue $msiLocationPath -Force

& $wixHeatExePath dir $ProductSourcePath -dr $productVersionWithName -cg $productVersionWithName -gg -sfrag -srd -scom -sreg -out $wixFragmentPath -var env.ProductSourcePath -v | Write-Verbose
& $wixCandleExePath "$ProductWxsPath" "$wixFragmentPath" -out (Join-Path "$env:Temp" "\\") -arch x64 -v | Write-Verbose
& $wixLightExePath -out $msiLocationPath $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -dWixUILicenseRtf="$LicenseFilePath" -v | Write-Verbose

Remove-Item -ErrorAction SilentlyContinue *.wixpdb -Force

Write-Verbose "You can find the MSI @ $msiLocationPath" -Verbose
Expand Down Expand Up @@ -2439,8 +2439,8 @@ function New-AppxPackage
[ValidateNotNullOrEmpty()]
[string] $AssetsPath
)
$PackageSemanticVersion = Get-PackageSemanticVersion -Version $PackageVersion

$PackageSemanticVersion = Get-PackageSemanticVersion -Version $PackageVersion

$PackageVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $PackageVersion
Write-Verbose "Package Version is $PackageVersion"
Expand Down Expand Up @@ -2527,7 +2527,7 @@ function New-ZipPackage
{
[CmdletBinding()]
param (

# Name of the Product
[ValidateNotNullOrEmpty()]
[string] $PackageName = 'PowerShell',
Expand All @@ -2547,12 +2547,12 @@ function New-ZipPackage
)

$ProductSemanticVersion = Get-PackageSemanticVersion -Version $PackageVersion

$zipPackageName = $PackageName + "_" + $ProductSemanticVersion
if ($PackageNameSuffix) {
$zipPackageName = $zipPackageName, $PackageNameSuffix -join "-"
}

Write-Verbose "Create Zip for Product $zipPackageName"

$zipLocationPath = Join-Path $PWD "$zipPackageName.zip"
Expand All @@ -2565,7 +2565,7 @@ function New-ZipPackage
$zipLocationPath

}
#TODO: Use .NET Api to do compresss-archive equivalent if the cmdlet is not present
#TODO: Use .NET Api to do compresss-archive equivalent if the cmdlet is not present
else
{
Write-Error -Message "Compress-Archive cmdlet is missing in this PowerShell version"
Expand Down Expand Up @@ -2755,7 +2755,7 @@ function Clear-PSRepo
[switch] $IncludePackages
)
Get-ChildItem $PSScriptRoot\* -Directory -Exclude 'Packages' | ForEach-Object {
Write-Verbose "Cleaning $_ ..."
Write-Verbose "Cleaning $_ ..."
git clean -fdX $_
}

Expand Down Expand Up @@ -2846,7 +2846,7 @@ function Restore-PSModule
# pull down the module
log "running save-module $_"
PowerShellGet\Save-Module @command -Force

# Remove PSGetModuleInfo.xml file
Find-Module -Name $_ -Repository $RepositoryName -IncludeDependencies | ForEach-Object {
Remove-Item -Path $Destination\$($_.Name)\*\PSGetModuleInfo.xml -Force
Expand Down
2 changes: 1 addition & 1 deletion demos/Apache/Apache/Apache.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Class ApacheVirtualHost{
$vHostDef += "</VirtualHost>"
$filName = $ConfigurationFile
$VhostDef | Out-File "/tmp/${filName}" -Force -Encoding:ascii
& $global:sudocmd "mv" "/tmp/${filName}" "${VhostsDirectory}/${filName}"
& $global:sudocmd "mv" "/tmp/${filName}" "${VhostsDirectory}/${filName}"
Write-Information "Restarting Apache HTTP Server"
Restart-ApacheHTTPServer
}
Expand Down
14 changes: 7 additions & 7 deletions demos/Azure/Azure-Demo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ Login-AzureRmAccount
$resourceGroupName = "PSAzDemo" + (New-Guid | % guid) -replace "-",""
$resourceGroupName

### Create a new Azure Resource Group
### Create a new Azure Resource Group
New-AzureRmResourceGroup -Name $resourceGroupName -Location "West US"

### Deploy an Ubuntu 14.04 VM using Resource Manager cmdlets
### Template is available at
### Template is available at
### http://armviz.io/#/?load=https:%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-vm-simple-linux%2Fazuredeploy.json
$dnsLabelPrefix = $resourceGroupName | % tolower
$dnsLabelPrefix
$password = ConvertTo-SecureString -String "PowerShellRocks!" -AsPlainText -Force
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile ./Compute-Linux.json -adminUserName psuser -adminPassword $password -dnsLabelPrefix $dnsLabelPrefix

### Monitor the status of the deployment
Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName
Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName

### Discover the resources we created by the previous deployment
Find-AzureRmResource -ResourceGroupName $resourceGroupName | select Name,ResourceType,Location
Expand All @@ -46,20 +46,20 @@ Get-AzureRmResource -ResourceName MyUbuntuVM -ResourceType Microsoft.Compute/vir
Get-AzureRmProviderOperation -OperationSearchString Microsoft.Compute/* | select OperationName,Operation

### Power Off the Virtual Machine we created
Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -ResourceType Microsoft.Compute/virtualMachines -ResourceName MyUbuntuVM -Action poweroff
Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -ResourceType Microsoft.Compute/virtualMachines -ResourceName MyUbuntuVM -Action poweroff

### Check the VM state again. It should be stopped now.
Get-AzureRmResource -ResourceName MyUbuntuVM -ResourceType Microsoft.Compute/virtualMachines -ResourceGroupName $resourceGroupName -ODataQuery '$expand=instanceView' | % properties | % instanceview | % statuses

### As you know, you may still be incurring charges even if the VM is in stopped state
### Deallocate the resource to avoid this charge
Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -ResourceType Microsoft.Compute/virtualMachines -ResourceName MyUbuntuVM -Action deallocate
Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -ResourceType Microsoft.Compute/virtualMachines -ResourceName MyUbuntuVM -Action deallocate

### The following command removes the Virtual Machine
Remove-AzureRmResource -ResourceName MyUbuntuVM -ResourceType Microsoft.Compute/virtualMachines -ResourceGroupName $resourceGroupName
Remove-AzureRmResource -ResourceName MyUbuntuVM -ResourceType Microsoft.Compute/virtualMachines -ResourceGroupName $resourceGroupName

### Look at the resources that still exists
Find-AzureRmResource -ResourceGroupName $resourceGroupName | select Name,ResourceType,Location

### Remove the resource group and its resources
Remove-AzureRmResourceGroup -Name $resourceGroupName
Remove-AzureRmResourceGroup -Name $resourceGroupName
10 changes: 5 additions & 5 deletions demos/DSC/dsc-demo.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#Get Distro type and set distro-specific variables
$OSname = Get-Content "/etc/os-release" |Select-String -Pattern "^Name="
$OSname = Get-Content "/etc/os-release" |Select-String -Pattern "^Name="
$OSName = $OSName.tostring().split("=")[1].Replace('"','')
if ($OSName -like "Ubuntu*"){
$distro = "Ubuntu"
Expand Down Expand Up @@ -56,12 +56,12 @@ Configuration ApacheServer{

nxFile Welcome.conf{
DestinationPath = "${VhostDir}/welcome.conf"
Ensure = "Absent"
Ensure = "Absent"
}

nxFile UserDir.conf{
DestinationPath = "${VhostDir}/userdir.conf"
Ensure = "Absent"
Ensure = "Absent"
}

#Ensure website is defined
Expand Down Expand Up @@ -107,8 +107,8 @@ ServerName $hostname
Controller = $ServiceCtl
DependsOn = "[nxFile]DefaultSite.conf"
}
}

}
}

ApacheServer -OutputPath "/tmp"
Expand Down
2 changes: 1 addition & 1 deletion demos/crontab/CronTab/CronTab.ps1xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>

<Configuration>
<Configuration>
<ViewDefinitions>
<View>
<Name>Default</Name>
Expand Down
Loading