Skip to content

Commit

Permalink
Reference global variable explicitly
Browse files Browse the repository at this point in the history
Reference `$global:PoshBotContext` instead of `PoshBotContext` so it's clear
what variable we're using.
  • Loading branch information
devblackops committed Oct 16, 2018
1 parent 45da649 commit e2ba9a3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion PoshBot/PoshBot.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PoshBot.psm1'

# Version number of this module.
ModuleVersion = '0.11.2'
ModuleVersion = '0.11.3'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
8 changes: 4 additions & 4 deletions PoshBot/Public/Get-PoshBotStatefulData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]"
Expand All @@ -61,4 +61,4 @@ function Get-PoshBotStatefulData {
}
}

Export-ModuleMember -Function 'Get-PoshBotStatefulData'
Export-ModuleMember -Function 'Get-PoshBotStatefulData'
6 changes: 3 additions & 3 deletions PoshBot/Public/Remove-PoshbotStatefulData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -60,4 +60,4 @@ function Remove-PoshBotStatefulData {
}
}

Export-ModuleMember -Function 'Remove-PoshBotStatefulData'
Export-ModuleMember -Function 'Remove-PoshBotStatefulData'
4 changes: 2 additions & 2 deletions PoshBot/Public/Set-PoshBotStatefulData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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]@{
Expand Down

0 comments on commit e2ba9a3

Please # to comment.