From e2ba9a379f90092fdf5775495196701d50dce5d5 Mon Sep 17 00:00:00 2001 From: Brandon Olin Date: Mon, 15 Oct 2018 21:18:05 -0700 Subject: [PATCH] Reference global variable explicitly Reference `$global:PoshBotContext` instead of `PoshBotContext` so it's clear what variable we're using. --- CHANGELOG.md | 6 ++++++ PoshBot/PoshBot.psd1 | 2 +- PoshBot/Public/Get-PoshBotStatefulData.ps1 | 8 ++++---- PoshBot/Public/Remove-PoshbotStatefulData.ps1 | 6 +++--- PoshBot/Public/Set-PoshBotStatefulData.ps1 | 4 ++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7f79d0e..48bf70ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ 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.11.3] Unreleased + +### Changes + +- Reference `$global:PoshBotContext` instead of `PoshBotContext` so it's clear what variable we're using. + ## [0.11.2] 2018-10-11 ### Added diff --git a/PoshBot/PoshBot.psd1 b/PoshBot/PoshBot.psd1 index 4dbe61af..4c4991b0 100644 --- a/PoshBot/PoshBot.psd1 +++ b/PoshBot/PoshBot.psd1 @@ -12,7 +12,7 @@ RootModule = 'PoshBot.psm1' # Version number of this module. -ModuleVersion = '0.11.2' +ModuleVersion = '0.11.3' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PoshBot/Public/Get-PoshBotStatefulData.ps1 b/PoshBot/Public/Get-PoshBotStatefulData.ps1 index 8ee618f5..aa613e76 100644 --- a/PoshBot/Public/Get-PoshBotStatefulData.ps1 +++ b/PoshBot/Public/Get-PoshBotStatefulData.ps1 @@ -13,7 +13,7 @@ function Get-PoshBotStatefulData { If specified, return only the value of the specified property Name .PARAMETER Scope Get stateful data from this scope: - Module: Data scoped to this plugin + Module: Data scoped to this plugin Global: Data available to any Poshbot plugin .EXAMPLE $ModuleData = Get-PoshBotStatefulData @@ -41,11 +41,11 @@ function Get-PoshBotStatefulData { ) process { if($Scope -eq 'Module') { - $FileName = "$($PoshBotContext.Plugin).state" + $FileName = "$($global:PoshBotContext.Plugin).state" } else { $FileName = "PoshbotGlobal.state" } - $Path = Join-Path $PoshBotContext.ConfigurationDirectory $FileName + $Path = Join-Path $global:PoshBotContext.ConfigurationDirectory $FileName if(-not (Test-Path $Path)) { Write-Verbose "Requested stateful data file not found: [$Path]" @@ -61,4 +61,4 @@ function Get-PoshBotStatefulData { } } -Export-ModuleMember -Function 'Get-PoshBotStatefulData' \ No newline at end of file +Export-ModuleMember -Function 'Get-PoshBotStatefulData' diff --git a/PoshBot/Public/Remove-PoshbotStatefulData.ps1 b/PoshBot/Public/Remove-PoshbotStatefulData.ps1 index a45690fb..930415e9 100644 --- a/PoshBot/Public/Remove-PoshbotStatefulData.ps1 +++ b/PoshBot/Public/Remove-PoshbotStatefulData.ps1 @@ -40,11 +40,11 @@ function Remove-PoshBotStatefulData { ) process { if($Scope -eq 'Module') { - $FileName = "$($PoshBotContext.Plugin).state" + $FileName = "$($global:PoshBotContext.Plugin).state" } else { $FileName = "PoshbotGlobal.state" } - $Path = Join-Path $PoshBotContext.ConfigurationDirectory $FileName + $Path = Join-Path $global:PoshBotContext.ConfigurationDirectory $FileName if(-not (Test-Path $Path)) { @@ -60,4 +60,4 @@ function Remove-PoshBotStatefulData { } } -Export-ModuleMember -Function 'Remove-PoshBotStatefulData' \ No newline at end of file +Export-ModuleMember -Function 'Remove-PoshBotStatefulData' diff --git a/PoshBot/Public/Set-PoshBotStatefulData.ps1 b/PoshBot/Public/Set-PoshBotStatefulData.ps1 index 99743c98..0131f13a 100644 --- a/PoshBot/Public/Set-PoshBotStatefulData.ps1 +++ b/PoshBot/Public/Set-PoshBotStatefulData.ps1 @@ -55,11 +55,11 @@ function Set-PoshBotStatefulData { } if($Scope -eq 'Module') { - $FileName = "$($PoshBotContext.Plugin).state" + $FileName = "$($global:PoshBotContext.Plugin).state" } else { $FileName = "PoshbotGlobal.state" } - $Path = Join-Path $PoshBotContext.ConfigurationDirectory $FileName + $Path = Join-Path $global:PoshBotContext.ConfigurationDirectory $FileName if(-not (Test-Path $Path)) { $ToWrite = [pscustomobject]@{