Skip to content

Commit ce8bdec

Browse files
Merge pull request #20 from PowerShellWeb/Initialize-WebSocket
WebSocket 0.1
2 parents d41bf53 + 3794b3f commit ce8bdec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4353
-0
lines changed

.github/workflows/BuildWebSocket.yml

+552
Large diffs are not rendered by default.

Assets/WebSocket-Animated.svg

+38
Loading

Assets/WebSocket.svg

+26
Loading

Build/GitHub/Jobs/BuildWebSocket.psd1

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
@{
2+
"runs-on" = "ubuntu-latest"
3+
if = '${{ success() }}'
4+
steps = @(
5+
@{
6+
name = 'Check out repository'
7+
uses = 'actions/checkout@v2'
8+
},
9+
@{
10+
name = 'GitLogger'
11+
uses = 'GitLogging/GitLoggerAction@main'
12+
id = 'GitLogger'
13+
},
14+
@{
15+
name = 'Use PSSVG Action'
16+
uses = 'StartAutomating/PSSVG@main'
17+
id = 'PSSVG'
18+
},
19+
@{
20+
name = 'Use PipeScript Action'
21+
uses = 'StartAutomating/PipeScript@main'
22+
id = 'PipeScript'
23+
},
24+
'RunEZOut',
25+
'RunHelpOut',
26+
@{
27+
name = 'Use PSJekyll Action'
28+
uses = 'PowerShellWeb/PSJekyll@main'
29+
id = 'PSJekyll'
30+
},
31+
<#@{
32+
name = 'Run WebSocket (on branch)'
33+
if = '${{github.ref_name != ''main''}}'
34+
uses = './'
35+
id = 'WebSocketAction'
36+
},#>
37+
'BuildAndPublishContainer'
38+
)
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
@{
2+
'name'='Log in to ghcr.io'
3+
'uses'='docker/login-action@master'
4+
'with'=@{
5+
'registry'='${{ env.REGISTRY }}'
6+
'username'='${{ github.actor }}'
7+
'password'='${{ secrets.GITHUB_TOKEN }}'
8+
}
9+
env = @{
10+
'REGISTRY'='ghcr.io'
11+
}
12+
}
13+
@{
14+
name = 'Extract Docker Metadata (for branch)'
15+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
16+
id = 'meta'
17+
uses = 'docker/metadata-action@master'
18+
with = @{
19+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
20+
}
21+
env = @{
22+
REGISTRY = 'ghcr.io'
23+
IMAGE_NAME = '${{ github.repository }}'
24+
}
25+
}
26+
@{
27+
name = 'Extract Docker Metadata (for main)'
28+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
29+
id = 'metaMain'
30+
uses = 'docker/metadata-action@master'
31+
with = @{
32+
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
33+
'flavor'='latest=true'
34+
}
35+
}
36+
@{
37+
name = 'Build and push Docker image (from main)'
38+
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
39+
uses = 'docker/build-push-action@master'
40+
with = @{
41+
'context'='.'
42+
'push'='true'
43+
'tags'='${{ steps.metaMain.outputs.tags }}'
44+
'labels'='${{ steps.metaMain.outputs.labels }}'
45+
}
46+
}
47+
@{
48+
name = 'Build and push Docker image (from branch)'
49+
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
50+
uses = 'docker/build-push-action@master'
51+
with = @{
52+
'context'='.'
53+
'push'='true'
54+
'tags'='${{ steps.meta.outputs.tags }}'
55+
'labels'='${{ steps.meta.outputs.labels }}'
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#requires -Module PSDevOps
2+
Import-BuildStep -SourcePath (
3+
Join-Path $PSScriptRoot 'GitHub'
4+
) -BuildSystem GitHubWorkflow
5+
6+
Push-Location ($PSScriptRoot | Split-Path)
7+
New-GitHubWorkflow -Name "Build WebSocket Module" -On Push,
8+
PullRequest,
9+
Demand -Job TestPowerShellOnLinux,
10+
TagReleaseAndPublish, BuildWebSocket -Environment ([Ordered]@{
11+
REGISTRY = 'ghcr.io'
12+
IMAGE_NAME = '${{ github.repository }}'
13+
}) -OutputPath .\.github\workflows\BuildWebSocket.yml
14+
15+
Pop-Location

Build/WebSocket.HelpOut.ps1

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#requires -Module HelpOut
2+
3+
#region Load the Module
4+
$ModuleName = 'WebSocket'
5+
Push-Location ($PSScriptRoot | Split-Path)
6+
if (-not (Get-Module $ModuleName)) {
7+
Import-Module .\ -Global -PassThru | Out-Host
8+
}
9+
#endregion Load the Module
10+
11+
# This will save the MarkdownHelp to the docs folder, and output all of the files created.
12+
Save-MarkdownHelp -PassThru -Module $ModuleName -ExcludeCommandType Alias
13+
14+
Pop-Location

Build/WebSocket.PSJekyll.ps1

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
$sitePath = Join-Path ($PSScriptRoot | Split-Path) 'docs'
2+
3+
$sourceModule = Get-Module PSJekyll
4+
if (-not $sourceModule) {
5+
$sourceModule = Import-Module ($PSScriptRoot | Split-Path) -PassThru
6+
}
7+
8+
9+
Push-Location $sitePath
10+
$PSJekyll.CurrentSite.Domain = "websocket.powershellweb.com"
11+
$PSJekyll.CurrentSite.Data = @{LastDateBuilt = [datetime]::UtcNow.Date.ToString('yyyy-MM-dd')}
12+
$PSJekyll.CurrentSite.Data = @{
13+
"PSModule/Info" = $sourceModule |
14+
Select-Object -Property Name,
15+
Version,
16+
Description,
17+
Copyright,
18+
CompanyName,
19+
Author,
20+
@{
21+
Name = 'Tags'
22+
Expression = { @($_.PrivateData.PSData.Tags | Select-Object -Unique)}
23+
}
24+
"PSModule/Exports" = @(
25+
foreach ($command in $sourceModule.ExportedCommands.Values) {
26+
[Ordered]@{
27+
Name = $command.Name
28+
CommandType = $command.CommandType
29+
Definition = $command.Definition
30+
ParameterName = $command.Parameters.Keys
31+
Parameter = @(
32+
$command.Parameters.Values |
33+
Select-Object -Property Name,
34+
@{
35+
Name='ParameterType'
36+
Expression = { $_.ParameterType.ToString() }
37+
},
38+
Position,
39+
Mandatory,
40+
ValueFromPipeline,
41+
ValueFromPipelineByPropertyName,
42+
ValueFromRemainingArguments,
43+
HelpMessage
44+
)
45+
}
46+
}
47+
)
48+
49+
"PSModule/FunctionNames" = $sourceModule.ExportedFunctions.Keys
50+
"PSModule/CmdletNames" = $sourceModule.ExportedCmdlets.Keys
51+
"PSModule/AliasNames" = $sourceModule.ExportedAliases.Keys
52+
"PSModule/Aliases" = @($sourceModule.ExportedAliases.Values |
53+
ForEach-Object { [Ordered]@{Name=$_.Name;Definition=$_.Definition} })
54+
55+
"PSModule/VariableNames" = $sourceModule.ExportedVariables.Keys
56+
"PSModule/TypeNames" = $sourceModule.ExportedTypeFiles |
57+
ForEach-Object { (Select-Xml -XPath //Types/Type -Path $_).Node.Name }
58+
59+
}
60+
$PSJekyll.CurrentSite.Data
61+
# It is important to use [Ordered], otherwise, the order of the keys will be random.
62+
# (this will generate more changes than necessary in the git repository, and will be noisier than desired)
63+
$PSJekyll.CurrentSite.Config = [Ordered]@{
64+
title = "WebSocket"
65+
description = "Work with WebSockets in PowerShell"
66+
url = "https://websocket.powershellweb.com"
67+
permalink = 'pretty'
68+
palette = 'Konsolas'
69+
analyticsId = 'G-R5C30737B2'
70+
googleFont = 'Noto Sans'
71+
stylesheet = 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css'
72+
defaults = @([Ordered]@{
73+
values = @{layout='Default'}
74+
})
75+
}
76+
$PSJekyll.CurrentSite.Config
77+
78+
foreach ($templateMember in $PSJekyll.Template.psobject.Members) {
79+
if ($templateMember.Name -notmatch '^(?>layout|include)\p{P}{0,}') {
80+
continue
81+
}
82+
$templateFileType = $matches.0 -replace '\p{P}{0,}$'
83+
$templateFileName = $templateMember.Name -replace "^$([Regex]::Escape($templateFileType))\p{P}{0,}"
84+
85+
if ($templateMember.Name -notmatch '\.([^\.]+?)$') {
86+
$templateFileName += '.html'
87+
}
88+
$templateOut =
89+
if ($templateMember.Invoke) {
90+
$templateMember.Invoke()
91+
} else {
92+
$templateMember.Value
93+
}
94+
try {
95+
$PSJekyll.CurrentSite.$templateFileType = $templateFileName, $templateOut
96+
} catch {
97+
$err = $_
98+
Write-Error -Message "Failed to set $templateFileName of $templateFileType : $err"
99+
}
100+
}
101+
102+
$PSJekyll.CurrentSite.Page = 'Tree', "{% include SiteTree.html %}"
103+
$PSJekyll.CurrentSite.Page = 'Repos', "{% include Repos.md %}"
104+
$PSJekyll.CurrentSite.Page = 'Releases', "{% include Releases.md %}"
105+
$PSJekyll.CurrentSite.Page = 'Contibutors', "{% include Contributor.md %}"
106+
$PSJekyll.CurrentSite.Page = 'Members', "{% include OrgMember.md %}"
107+
$PSJekyll.CurrentSite.Page = 'Function', "{% include PSFunctions.md %}"
108+
$PSJekyll.CurrentSite.Page = 'Functions', "{% include PSFunctions.md %}"
109+
$PSJekyll.CurrentSite.Page = 'Alias', "{% include PSAlias.md %}"
110+
$PSJekyll.CurrentSite.Page = 'Aliases', "{% include PSAlias.md %}"
111+
$PSJekyll.CurrentSite.Page = 'Cmdlet', "{% include PSCmdlet.md %}"
112+
$PSJekyll.CurrentSite.Page = 'Cmdlets', "{% include PSCmdlet.md %}"
113+
$PSJekyll.CurrentSite.Page = 'PSTag', "{% include PSTag.md %}"
114+
$PSJekyll.CurrentSite.Page = 'PSTypeName', "{% include PSTypeName.md %}"
115+
$PSJekyll.CurrentSite.Layout
116+
$PSJekyll.CurrentSite.Include
117+
$PSJekyll.CurrentSite.Page
118+
119+
Pop-Location

0 commit comments

Comments
 (0)