Skip to content

Commit

Permalink
Merge pull request #898 from Badgerati/develop
Browse files Browse the repository at this point in the history
v2.5.2
  • Loading branch information
Badgerati authored Jan 4, 2022
2 parents cc45830 + c558ee9 commit b4c0b07
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) [2017-2021] [Matthew Kelly (Badgerati)]
Copyright (c) [2017-2022] [Matthew Kelly (Badgerati)]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 7 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## v2.5.2

```plain
### Bugs
* #892: Fixes a bug with importing modules, where the wrong file was being used
```

## v2.5.1

```plain
Expand Down
2 changes: 1 addition & 1 deletion packers/choco/pode.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Pode is a Cross-Platform framework for creating web servers to host REST APIs an
<docsUrl>https://badgerati.github.io/Pode</docsUrl>
<bugTrackerUrl>https://github.com/Badgerati/Pode/issues</bugTrackerUrl>
<tags>powershell web server rest api http tcp smtp listener unix cross-platform file-monitoring multithreaded schedule middleware session authentication active-directory csrf lambda aws azure functions websockets openapi swagger redoc</tags>
<copyright>Copyright 2017-2021</copyright>
<copyright>Copyright 2017-2022</copyright>
<licenseUrl>https://github.com/Badgerati/Pode/blob/master/LICENSE.txt</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<iconUrl>https://raw.githubusercontent.com/Badgerati/Pode/master/images/icon.png</iconUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/Pode.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Author = 'Matthew Kelly (Badgerati)'

# Copyright statement for this module
Copyright = 'Copyright (c) 2017-2021 Matthew Kelly (Badgerati), licensed under the MIT License.'
Copyright = 'Copyright (c) 2017-2022 Matthew Kelly (Badgerati), licensed under the MIT License.'

# Description of the functionality provided by this module
Description = 'A Cross-Platform PowerShell framework for creating web servers to host REST APIs and Websites. Pode also has support for being used in Azure Functions and AWS Lambda.'
Expand Down
3 changes: 2 additions & 1 deletion src/Private/Context.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ function Import-PodeModulesIntoRunspaceState
continue
}

$path = (Get-Module -Name $module | Sort-Object -Property Version -Descending | Select-Object -First 1 -ExpandProperty Path)
# import the module
$path = Find-PodeModuleFile -Name $module
$PodeContext.RunspaceState.ImportPSModule($path)
}
}
Expand Down
23 changes: 23 additions & 0 deletions src/Private/Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2612,4 +2612,27 @@ function Use-PodeFolder
Get-ChildItem -Path $Path -Filter *.ps1 -Force -Recurse | ForEach-Object {
Use-PodeScript -Path $_.FullName
}
}

function Find-PodeModuleFile
{
param(
[Parameter(Mandatory=$true)]
[string]
$Name,

[switch]
$ListAvailable
)

# get module and check psd1, then psm1
$mod = (Get-Module -Name $Name -ListAvailable:$ListAvailable | Sort-Object -Property Version -Descending | Select-Object -First 1)

# if the path isn't already a psd1 do this
$path = Join-Path $mod.ModuleBase "$($mod.Name).psd1"
if (!(Test-Path $path)) {
$path = $mod.Path
}

return $path
}
2 changes: 1 addition & 1 deletion src/Public/Utilities.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ function Import-PodeModule
$Path = (Get-ChildItem ([System.IO.Path]::Combine($modulePath, '*', "$($Name).ps*1")) -Recurse -Force | Select-Object -First 1).FullName
}
else {
$Path = (Get-Module -Name $Name -ListAvailable | Select-Object -First 1).Path
$Path = Find-PodeModuleFile -Name $Name -ListAvailable
}
}

Expand Down

0 comments on commit b4c0b07

Please sign in to comment.