Skip to content

Commit

Permalink
Merge pull request #4 from claudiospizzi/dev
Browse files Browse the repository at this point in the history
Release 1.1.1
  • Loading branch information
claudiospizzi committed Feb 9, 2016
2 parents d2ed37c + 24d1c8e commit 823aa48
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 5 deletions.
57 changes: 57 additions & 0 deletions Resources/ScriptLogger.Formats.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>ScriptLogger.Configuration</Name>
<ViewSelectedBy>
<TypeName>ScriptLogger.Configuration</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Width>10</Width>
</TableColumnHeader>
<TableColumnHeader>
<Width>12</Width>
</TableColumnHeader>
<TableColumnHeader />
<TableColumnHeader>
<Width>10</Width>
</TableColumnHeader>
<TableColumnHeader>
<Width>10</Width>
</TableColumnHeader>
<TableColumnHeader>
<Width>10</Width>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>Enabled</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Level</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Path</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>LogFile</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>EventLog</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Console</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>

</ViewDefinitions>
</Configuration>
4 changes: 4 additions & 0 deletions Resources/ScriptLogger.Types.ps1xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<Types>

</Types>
10 changes: 7 additions & 3 deletions ScriptLogger.psd1
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
@{
RootModule = 'ScriptLogger.psm1'
ModuleVersion = '1.1.0'
ModuleVersion = '1.1.1'
GUID = '0E1AF375-67C1-460A-A247-045C5D2B54AA'
Author = 'Claudio Spizzi'
Copyright = 'Copyright (c) 2016 by Claudio Spizzi. Licensed under MIT license.'
Description = 'PowerShell Module to provide logging capabilities for PowerShell Controller Scripts.'
PowerShellVersion = '3.0'
ScriptsToProcess = @()
TypesToProcess = @()
FormatsToProcess = @()
TypesToProcess = @(
'Resources/ScriptLogger.Types.ps1xml'
)
FormatsToProcess = @(
'Resources/ScriptLogger.Formats.ps1xml'
)
FunctionsToExport = @(
'Start-ScriptLogger',
'Stop-ScriptLogger',
Expand Down
6 changes: 6 additions & 0 deletions ScriptLogger.pssproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<Compile Include="ScriptLogger.psd1" />
<Compile Include="ScriptLogger.psm1" />
<Compile Include="Scripts\build.ps1" />
<Compile Include="Scripts\debug.ps1" />
<Compile Include="Scripts\test.ps1" />
<Compile Include="Tests\Get-ScriptLogger.Tests.ps1" />
<Compile Include="Tests\Set-ScriptLogger.Tests.ps1" />
Expand All @@ -54,9 +55,14 @@
<ItemGroup>
<Folder Include="Examples\" />
<Folder Include="Functions\" />
<Folder Include="Resources\" />
<Folder Include="Tests\" />
<Folder Include="Scripts\" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\ScriptLogger.Formats.ps1xml" />
<Content Include="Resources\ScriptLogger.Types.ps1xml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="Build" />
</Project>
1 change: 1 addition & 0 deletions Scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ New-Item -Path $Target -ItemType Directory | Out-Null
# Copy all module items
Copy-Item -Path "$Source\Examples" -Destination $Target -Recurse
Copy-Item -Path "$Source\Functions" -Destination $Target -Recurse
Copy-Item -Path "$Source\Resources" -Destination $Target -Recurse
Copy-Item -Path "$Source\Tests" -Destination $Target -Recurse
Copy-Item -Path "$Source\$Module.psd1" -Destination $Target
Copy-Item -Path "$Source\$Module.psm1" -Destination $Target
Expand Down
7 changes: 7 additions & 0 deletions Scripts/debug.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# Import the module for debugging
Import-Module "$PSScriptRoot\..\ScriptLogger.psd1" -Force

# Execute debugging commands


13 changes: 11 additions & 2 deletions Tests/Write-InformationLog.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ InModuleScope ScriptLogger {

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

Mock Write-Information -ModuleName ScriptLogger -ParameterFilter { $MessageData -eq 'My Information' }
if ($PSVersionTable.PSVersion -lt '5.0')
{
$InformationMockName = 'Write-Host'
Mock $InformationMockName -ModuleName ScriptLogger -ParameterFilter { $Object -eq 'My Information' }
}
else
{
$InformationMockName = 'Write-Information'
Mock $InformationMockName -ModuleName ScriptLogger -ParameterFilter { $MessageData -eq 'My Information' }
}

BeforeAll {

Expand Down Expand Up @@ -78,7 +87,7 @@ InModuleScope ScriptLogger {

Write-InformationLog -Message 'My Information'

Assert-MockCalled -CommandName 'Write-Information' -Times 1 -Exactly
Assert-MockCalled -CommandName $InformationMockName -Times 1 -Exactly
}

AfterEach {
Expand Down

0 comments on commit 823aa48

Please sign in to comment.