Skip to content

Commit

Permalink
Formater and Github pages (#2)
Browse files Browse the repository at this point in the history
* Format and github pages

* Bump Log4NetParse version dependancy

* Switch to GITHUB_TOKEN

* Copy readme to index in github pages
  • Loading branch information
HeyItsGilbert committed Sep 4, 2023
1 parent e566d2b commit 9aa6fe3
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 13 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish docs via GitHub Pages
on:
push:
branches:
- main

jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v2
with:
fetch-depth: 2
- shell: pwsh
# Give an id to the step, so we can reference it later
id: check_file_changed
run: |
# Diff HEAD with the previous commit
$diff = git diff --name-only HEAD^ HEAD
# Check if a file under docs/ or with the .md extension has changed (added, modified, deleted)
$SourceDiff = $diff | Where-Object { $_ -match '^docs/' -or $_ -match '.md$' }
$HasDiff = $SourceDiff.Length -gt 0
# Set the output named "docs_changed"
Write-Host "::set-output name=docs_changed::$HasDiff"
- name: Copy readme
shell: pwsh
run: |
Copy-Item README.md docs/index.md
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
if: steps.check_file_changed.outputs.docs_changed == 'True' || ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.2.0] Formatting

This adds a ChocoLog specific format. The goal is to show relevant info such as
CLI items when just printing the object to the screen.

## [0.1.0] Unreleased

First stab at using Log4NetParse module to parse Chocolatey. First version will
Expand Down
57 changes: 57 additions & 0 deletions ChocoLogParse/ChocoLog.format.ps1xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<ViewDefinitions>
<View>
<Name>Chocolatey Logs</Name>
<ViewSelectedBy>
<TypeName>ChocoLog</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Label>Time</Label>
<Width>18</Width>
</TableColumnHeader>
<TableColumnHeader>
<Label>ID</Label>
<Width>5</Width>
</TableColumnHeader>
<TableColumnHeader>
<Label>Exit Code</Label>
<Width>6</Width>
</TableColumnHeader>
<TableColumnHeader>
<Label>Command Line</Label>
</TableColumnHeader>
<TableColumnHeader>
<Label>Log Lines</Label>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>starttime</PropertyName>
<FormatString>{0:MM/dd hh:mm:ss.fff}</FormatString>
</TableColumnItem>
<TableColumnItem>
<PropertyName>id</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>exitCode</PropertyName>
</TableColumnItem>
<TableColumnItem>
<ScriptBlock>
[String]::Format("{0}", ($_.cli -replace '"C:\\ProgramData\\chocolatey\\choco.exe"', 'choco'))
</ScriptBlock>
</TableColumnItem>
<TableColumnItem>
<PropertyName>logs</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
</ViewDefinitions>
</Configuration>
24 changes: 15 additions & 9 deletions ChocoLogParse/ChocoLogParse.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'ChocoLogParse.psm1'

# Version number of this module.
ModuleVersion = '0.1.0'
ModuleVersion = '0.2.0'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -51,7 +51,7 @@
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName = "Log4NetParse"; ModuleVersion = "0.2.0"; })
RequiredModules = @(@{ModuleName = "Log4NetParse"; ModuleVersion = "0.3.0"; })

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand Down Expand Up @@ -95,25 +95,31 @@
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()
Tags = @(
'PSEdition_Desktop',
'PSEdition_Core',
'Windows',
'Linux',
'MacOS'
)

# A URL to the license for this module.
# LicenseUri = ''
LicenseUri = 'https://github.com/HeyItsGilbert/ChocoLogParse/blob/master/LICENSE'

# A URL to the main website for this project.
# ProjectUri = ''
ProjectUri = 'https://github.com/HeyItsGilbert/ChocoLogParse/'

# A URL to an icon representing this module.
# IconUri = ''
IconUri = 'https://raw.githubusercontent.com/HeyItsGilbert/ChocoLogParse/main/static/'

# ReleaseNotes of this module
# ReleaseNotes = ''
ReleaseNotes = 'https://github.com/HeyItsGilbert/ChocoLogParse/blob/master/CHANGELOG.md'

# Prerelease string of this module
# Prerelease = ''

# Flag to indicate whether the module requires explicit user acceptance for install/update/save
# RequireLicenseAcceptance = $false
RequireLicenseAcceptance = $false

# External dependent modules of this module
ExternalModuleDependencies = @("Log4NetParse")
Expand All @@ -123,7 +129,7 @@
} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''
HelpInfoURI = 'https://heyitsgilbert.github.io/ChocoLogParse/'

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''
Expand Down
4 changes: 4 additions & 0 deletions ChocoLogParse/ChocoLogParse.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ foreach ($import in @($enums + $classes + $public )) {
}
}

# Add our custom formatter that needed classes first
$format = Join-Path -Path $PSScriptRoot -ChildPath 'ChocoLog.format.ps1xml'
Update-FormatData -PrependPath $format

Export-ModuleMember -Function $public.Basename
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
site_name: TODO
repo_url: TODO
site_name: "ChocoLogParse PowerShell Module"
site_url: https://heyitsgilbert.github.io/ChocoLogParse/
repo_url: https://github.com/HeyItsGilbert/ChocoLogParse
theme: readthedocs

2 changes: 1 addition & 1 deletion requirements.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
Version = '1.19.1'
}
'Log4NetParse' = @{
Version = '0.2.0'
Version = '0.3.0'
}
}

0 comments on commit 9aa6fe3

Please sign in to comment.