Add manual build script (#15)
This commit is contained in:
Родитель
41c04b247d
Коммит
4502f56db8
|
@ -0,0 +1,10 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
|
||||||
|
# Note:
|
||||||
|
# This manually builds the project locally
|
||||||
|
|
||||||
|
. ./.azure-pipelines/pipeline-deps.ps1
|
||||||
|
Invoke-Build Test -AssertStyle Client
|
||||||
|
|
||||||
|
Write-Host "If no build errors occurred. The module has been saved to out/modules/PSRule.Rules.CAF"
|
|
@ -3,7 +3,8 @@
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Windows PowerShell 5.1 with .NET Framework 4.7.2+ or
|
- Windows PowerShell 5.1 with .NET Framework 4.7.2+ or
|
||||||
- PowerShell Core 6.2 or greater on Windows, MacOS and Linux
|
- PowerShell Core 6.2 or greater on Windows, MacOS and Linux or
|
||||||
|
- PowerShell 7.0 or greater on Windows, MacOS and Linux
|
||||||
|
|
||||||
For a list of platforms that PowerShell Core is supported on [see](https://github.com/PowerShell/PowerShell#get-powershell).
|
For a list of platforms that PowerShell Core is supported on [see](https://github.com/PowerShell/PowerShell#get-powershell).
|
||||||
|
|
||||||
|
@ -13,7 +14,6 @@ The following modules are required for `PSRule.Rules.CAF` to work:
|
||||||
- PSRule.Rules.Azure
|
- PSRule.Rules.Azure
|
||||||
- Az.Accounts
|
- Az.Accounts
|
||||||
- Az.Resources
|
- Az.Resources
|
||||||
- Az.Security
|
|
||||||
|
|
||||||
The required version of each module will automatically be installed along-side `PSRule.Rules.CAF` when using `Install-Module` or `Update-Module` cmdlets.
|
The required version of each module will automatically be installed along-side `PSRule.Rules.CAF` when using `Install-Module` or `Update-Module` cmdlets.
|
||||||
|
|
||||||
|
@ -39,13 +39,45 @@ Save for offline use from PowerShell Gallery:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Save module, in the .\modules directory
|
# Save module, in the .\modules directory
|
||||||
Save-Module -Name 'PSRule', 'PSRule.Rules.Azure', 'PSRule.Rules.CAF', 'Az.Accounts', 'Az.Resources', 'Az.Security' -Path '.\modules';
|
Save-Module -Name 'PSRule', 'PSRule.Rules.Azure', 'PSRule.Rules.CAF', 'Az.Accounts', 'Az.Resources' -Path '.\modules';
|
||||||
```
|
```
|
||||||
|
|
||||||
> For pre-release versions the `-AllowPrerelease` switch must be added when calling `Install-Module` or `Save-Module`.
|
> For pre-release versions the `-AllowPrerelease` switch must be added when calling `Install-Module` or `Save-Module`.
|
||||||
>
|
>
|
||||||
> To install pre-release module versions, upgrading to the latest version of _PowerShellGet_ may be required. To do this use:
|
> To install pre-release module versions, upgrading to the latest version of _PowerShellGet_ may be required.
|
||||||
|
To do this use:
|
||||||
>
|
>
|
||||||
> `Install-Module -Name PowerShellGet -Repository PSGallery -Scope CurrentUser -Force`
|
> `Install-Module -Name PowerShellGet -Repository PSGallery -Scope CurrentUser -Force`
|
||||||
|
|
||||||
|
## Building from source
|
||||||
|
|
||||||
|
To build this module from source run `./build.ps1`.
|
||||||
|
This build script will compile the module and documentation then output the result into `out/modules/PSRule.Rules.CAF`.
|
||||||
|
|
||||||
|
The following PowerShell modules will be automatically downloaded if the required versions are not present:
|
||||||
|
|
||||||
|
- PlatyPS
|
||||||
|
- Pester
|
||||||
|
- PSScriptAnalyzer
|
||||||
|
- PowerShellGet
|
||||||
|
- PackageManagement
|
||||||
|
- InvokeBuild
|
||||||
|
|
||||||
|
These additional modules are only required for building PSRule and are not required for running PSRule.
|
||||||
|
|
||||||
|
If you are on a network that does not permit Internet access to the PowerShell Gallery,
|
||||||
|
download these modules on an alternative device that has access.
|
||||||
|
The following script can be used to download the required modules to an alternative device.
|
||||||
|
After downloading the modules copy the module directories to devices with restricted Internet access.
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Save modules, in the .\modules directory
|
||||||
|
Save-Module -Name PlatyPS, Pester, PSScriptAnalyzer, PowerShellGet, PackageManagement, InvokeBuild -Repository PSGallery -Path '.\modules';
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally .NET Core SDK v3.1 is required.
|
||||||
|
.NET Core will not be automatically downloaded and installed.
|
||||||
|
To download and install the latest SDK see [Download .NET Core 3.1][dotnet].
|
||||||
|
|
||||||
[module]: https://www.powershellgallery.com/packages/PSRule.Rules.CAF
|
[module]: https://www.powershellgallery.com/packages/PSRule.Rules.CAF
|
||||||
|
[dotnet]: https://dotnet.microsoft.com/download/dotnet-core/3.1
|
||||||
|
|
Загрузка…
Ссылка в новой задаче