Skip to content

Commit 823aa48

Browse files
committed
Merge pull request #4 from claudiospizzi/dev
Release 1.1.1
2 parents d2ed37c + 24d1c8e commit 823aa48

7 files changed

+93
-5
lines changed

Resources/ScriptLogger.Formats.ps1xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Configuration>
3+
<ViewDefinitions>
4+
5+
<View>
6+
<Name>ScriptLogger.Configuration</Name>
7+
<ViewSelectedBy>
8+
<TypeName>ScriptLogger.Configuration</TypeName>
9+
</ViewSelectedBy>
10+
<TableControl>
11+
<TableHeaders>
12+
<TableColumnHeader>
13+
<Width>10</Width>
14+
</TableColumnHeader>
15+
<TableColumnHeader>
16+
<Width>12</Width>
17+
</TableColumnHeader>
18+
<TableColumnHeader />
19+
<TableColumnHeader>
20+
<Width>10</Width>
21+
</TableColumnHeader>
22+
<TableColumnHeader>
23+
<Width>10</Width>
24+
</TableColumnHeader>
25+
<TableColumnHeader>
26+
<Width>10</Width>
27+
</TableColumnHeader>
28+
</TableHeaders>
29+
<TableRowEntries>
30+
<TableRowEntry>
31+
<TableColumnItems>
32+
<TableColumnItem>
33+
<PropertyName>Enabled</PropertyName>
34+
</TableColumnItem>
35+
<TableColumnItem>
36+
<PropertyName>Level</PropertyName>
37+
</TableColumnItem>
38+
<TableColumnItem>
39+
<PropertyName>Path</PropertyName>
40+
</TableColumnItem>
41+
<TableColumnItem>
42+
<PropertyName>LogFile</PropertyName>
43+
</TableColumnItem>
44+
<TableColumnItem>
45+
<PropertyName>EventLog</PropertyName>
46+
</TableColumnItem>
47+
<TableColumnItem>
48+
<PropertyName>Console</PropertyName>
49+
</TableColumnItem>
50+
</TableColumnItems>
51+
</TableRowEntry>
52+
</TableRowEntries>
53+
</TableControl>
54+
</View>
55+
56+
</ViewDefinitions>
57+
</Configuration>

Resources/ScriptLogger.Types.ps1xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Types>
3+
4+
</Types>

ScriptLogger.psd1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
@{
22
RootModule = 'ScriptLogger.psm1'
3-
ModuleVersion = '1.1.0'
3+
ModuleVersion = '1.1.1'
44
GUID = '0E1AF375-67C1-460A-A247-045C5D2B54AA'
55
Author = 'Claudio Spizzi'
66
Copyright = 'Copyright (c) 2016 by Claudio Spizzi. Licensed under MIT license.'
77
Description = 'PowerShell Module to provide logging capabilities for PowerShell Controller Scripts.'
88
PowerShellVersion = '3.0'
99
ScriptsToProcess = @()
10-
TypesToProcess = @()
11-
FormatsToProcess = @()
10+
TypesToProcess = @(
11+
'Resources/ScriptLogger.Types.ps1xml'
12+
)
13+
FormatsToProcess = @(
14+
'Resources/ScriptLogger.Formats.ps1xml'
15+
)
1216
FunctionsToExport = @(
1317
'Start-ScriptLogger',
1418
'Stop-ScriptLogger',

ScriptLogger.pssproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<Compile Include="ScriptLogger.psd1" />
4242
<Compile Include="ScriptLogger.psm1" />
4343
<Compile Include="Scripts\build.ps1" />
44+
<Compile Include="Scripts\debug.ps1" />
4445
<Compile Include="Scripts\test.ps1" />
4546
<Compile Include="Tests\Get-ScriptLogger.Tests.ps1" />
4647
<Compile Include="Tests\Set-ScriptLogger.Tests.ps1" />
@@ -54,9 +55,14 @@
5455
<ItemGroup>
5556
<Folder Include="Examples\" />
5657
<Folder Include="Functions\" />
58+
<Folder Include="Resources\" />
5759
<Folder Include="Tests\" />
5860
<Folder Include="Scripts\" />
5961
</ItemGroup>
62+
<ItemGroup>
63+
<Content Include="Resources\ScriptLogger.Formats.ps1xml" />
64+
<Content Include="Resources\ScriptLogger.Types.ps1xml" />
65+
</ItemGroup>
6066
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
6167
<Target Name="Build" />
6268
</Project>

Scripts/build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ New-Item -Path $Target -ItemType Directory | Out-Null
1010
# Copy all module items
1111
Copy-Item -Path "$Source\Examples" -Destination $Target -Recurse
1212
Copy-Item -Path "$Source\Functions" -Destination $Target -Recurse
13+
Copy-Item -Path "$Source\Resources" -Destination $Target -Recurse
1314
Copy-Item -Path "$Source\Tests" -Destination $Target -Recurse
1415
Copy-Item -Path "$Source\$Module.psd1" -Destination $Target
1516
Copy-Item -Path "$Source\$Module.psm1" -Destination $Target

Scripts/debug.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
# Import the module for debugging
3+
Import-Module "$PSScriptRoot\..\ScriptLogger.psd1" -Force
4+
5+
# Execute debugging commands
6+
7+

Tests/Write-InformationLog.Tests.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,16 @@ InModuleScope ScriptLogger {
3434

3535
Mock Get-Date -ModuleName ScriptLogger { [DateTime] '2000-12-31 01:02:03' }
3636

37-
Mock Write-Information -ModuleName ScriptLogger -ParameterFilter { $MessageData -eq 'My Information' }
37+
if ($PSVersionTable.PSVersion -lt '5.0')
38+
{
39+
$InformationMockName = 'Write-Host'
40+
Mock $InformationMockName -ModuleName ScriptLogger -ParameterFilter { $Object -eq 'My Information' }
41+
}
42+
else
43+
{
44+
$InformationMockName = 'Write-Information'
45+
Mock $InformationMockName -ModuleName ScriptLogger -ParameterFilter { $MessageData -eq 'My Information' }
46+
}
3847

3948
BeforeAll {
4049

@@ -78,7 +87,7 @@ InModuleScope ScriptLogger {
7887

7988
Write-InformationLog -Message 'My Information'
8089

81-
Assert-MockCalled -CommandName 'Write-Information' -Times 1 -Exactly
90+
Assert-MockCalled -CommandName $InformationMockName -Times 1 -Exactly
8291
}
8392

8493
AfterEach {

0 commit comments

Comments
 (0)