Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
abbgrade committed Jul 31, 2022
2 parents 0aa4730 + a295c17 commit 96bc751
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.3.0] - 2022-07-31

### Added

- Install extension command.

## [1.2.0] - 2022-07-30

### Added
Expand Down
72 changes: 72 additions & 0 deletions docs/Install-PsBuildExtension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
external help file: PsBuildTasks-help.xml
Module Name: PsBuildTasks
online version:
schema: 2.0.0
---

# Install-PsBuildExtension

## SYNOPSIS
Installs a PsBuildTasks extension

## SYNTAX

```
Install-PsBuildExtension [-Path] <DirectoryInfo> [-Repository] <String> [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
```

{{ Add example description here }}

## PARAMETERS

### -Path
Path to the tasks directory.

```yaml
Type: DirectoryInfo
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Repository
URL to the git repository.
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
## NOTES
## RELATED LINKS
2 changes: 1 addition & 1 deletion src/PsBuildTasks.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PsBuildTasks.psm1'

# Version number of this module.
ModuleVersion = '1.2.0'
ModuleVersion = '1.3.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
25 changes: 25 additions & 0 deletions src/Public/Install-Extension.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function Install-Extension {

<#
.SYNOPSIS
Installs a PsBuildTasks extension
#>

[CmdletBinding()]
param (
# Path to the tasks directory.
[Parameter( Mandatory )]
[System.IO.DirectoryInfo] $Path,

# URL to the git repository.
[Parameter( Mandatory )]
[string] $Repository
)

Join-Path $Path tasks | Push-Location
git submodule add $Repository
Pop-Location

}
41 changes: 41 additions & 0 deletions test/Install-Extension.Tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#Requires -Modules @{ ModuleName='Pester'; ModuleVersion='5.0.0' }

Describe Install-Extension {

BeforeAll {
Import-Module $PSScriptRoot\..\src\PsBuildTasks.psd1 -Force -ErrorAction Stop -PassThru
}

It exists {
Get-Command -Module PsBuildTasks -Name Install-PsBuildExtension -ErrorAction Stop
}

Context Project {

BeforeAll {
$ProjectPath = "TestDrive:\"
Install-PsBuildTask -Path $ProjectPath -Task PowerShell-Matrix
Push-Location $ProjectPath
git init
Pop-Location
}

It works {
Install-PsBuildExtension `
-Path $ProjectPath `
-Repository 'https://github.com/abbgrade/PsSqlTestTasks.git' `
-ErrorAction Stop

$ExtensionPath = Join-Path $ProjectPath tasks PsSqlTestTasks
$ExtensionPath | Should -Exist

$TaskPath = Join-Path $ExtensionPath WideWorldImporters.Tasks.ps1
$TaskPath | Should -Exist

$GitModules = Join-Path $ProjectPath .gitmodules
$GitModules | Should -Exist
}

}

}

0 comments on commit 96bc751

Please sign in to comment.