-
Notifications
You must be signed in to change notification settings - Fork 14
/
Get-PipeworksManifest.ps1
62 lines (54 loc) · 4.33 KB
/
Get-PipeworksManifest.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function Get-PipeworksManifest
{
<#
.Synopsis
Gets the Pipeworks manifest for a module
.Description
Gets the Pipeworks manifest for a PowerShell module.
The pipeworks manifest is a .psd1 file that describes how the module will be published as a web service.
.Example
Get-PipeworksManifest -Module Pipeworks
.Example
Get-Module Pipeworks | Get-PipeworksManifest
.Example
Get-Module | Get-PipeworksManifest
.Link
New-PipeworksManifest
#>
[OutputType([Hashtable])]
param(
# The name of the module
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)]
[Alias('Name')]
[string]
$ModuleName
)
process {
$realModule = Get-Module $moduleName
if (-not $realModule) {
Write-Error "$moduleName not found"
return
}
if (-not $realModule.Path) { return }
# Import pipeworks manifest
$moduleRoot = Split-Path $realModule.Path
#region Initialize Pipeworks Manifest
$pipeworksManifestPath = Join-Path $moduleRoot "$($realmodule.Name).Pipeworks.psd1"
if (Test-Path $pipeworksManifestPath) {
try {
$result = & ([ScriptBlock]::Create(
"data -SupportedCommand Add-Member, New-WebPage, New-Region, Write-CSS, Write-Ajax, Out-Html, Write-Link { $(
[ScriptBlock]::Create([IO.File]::ReadAllText($pipeworksManifestPath))
)}"))
$result.Name = $moduleName
$result.Module = $realModule
$result |
Add-Member NoteProperty Name $ModuleName -Force -PassThru |
Add-Member NoteProperty Module $RealModule -Force -PassThru
} catch {
# Write-Error "Could not read pipeworks manifest for $ModuleName"
return
}
}
}
}