DeployCube.psm1

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
#handle PS2
    if(-not $PSScriptRoot)
    {
        $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
    }

#Get public and private function definition files.
    $scripts =  Get-ChildItem "$PSScriptRoot\public" -Recurse -Include *.ps1 -Exclude Tests;

#Dot source the files
    Foreach($script in $scripts)
    {
        Try
        {
            $scriptName = (Split-Path -Leaf $script) -replace ".ps1", "";

            if (!($scriptName -like "*Tests")) {
                . $script.fullname
                Write-Verbose "Loading $scriptName"
            }
        }
        Catch
        {
            Write-Error -Message "Failed to import function $($script.fullname): $_"
        }
    }

Export-ModuleMember -Function ($scripts | Select-Object -ExpandProperty Basename);
# export the function aliases
Export-ModuleMember -Alias Deploy-Cube -Function Publish-Cube;
Export-ModuleMember -Alias Drop-Cube -Function Unpublish-Cube;