-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.ps1
73 lines (58 loc) · 2 KB
/
Build.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
63
64
65
66
67
68
69
70
71
72
73
#
# Lethean Binary API
# Functionality to simplify using LTHN
# Version: 1.2.2
# Contact: contact@lethean.io
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
function Get-FunctionsToExport {
[CmdletBinding()]
Param (
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)]
[ValidateNotNullOrEmpty()]
[Alias('FullName')]
$Path
)
Process {
$Token = $null
$ParserErr = $null
$Ast = [System.Management.Automation.Language.Parser]::ParseFile(
$Path,
[ref]$Token,
[ref]$ParserErr
)
if ($ParserErr) {
throw $ParserErr
} else {
foreach ($name in 'Begin', 'Process', 'End') {
foreach ($Statement in $Ast."${name}Block".Statements) {
if (
[String]::IsNullOrWhiteSpace($Statement.Name) -or
$Statement.Extent.ToString() -notmatch
('function\W+{0}' -f $Statement.Name)
) {
continue
}
$Statement.Name
}
}
}
}
}
$ScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
$FunctionPath = 'Api', 'Model', 'Client' | ForEach-Object {Join-Path "$ScriptDir\src\letheanSDP\" $_}
$Manifest = @{
Path = "$ScriptDir\src\letheanSDP\letheanSDP.psd1"
Author = 'OpenAPI Generator Team'
CompanyName = 'openapitools.org'
Description = 'letheanSDP - the PowerShell module for Lethean Binary API'
ModuleVersion = '1.0.0'
RootModule = 'letheanSDP.psm1'
Guid = '{1E8ABC27-2568-4A45-866C-5E49897D41EE}' # Has to be static, otherwise each new build will be considered different module
PowerShellVersion = '6.2'
FunctionsToExport = $FunctionPath | Get-ChildItem -Filter *.ps1 | Get-FunctionsToExport
VariablesToExport = @()
AliasesToExport = @()
CmdletsToExport = @()
}
New-ModuleManifest @Manifest