-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSJekyll.ps.psm1
28 lines (22 loc) · 1.18 KB
/
PSJekyll.ps.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$commandsPath = Join-Path $PSScriptRoot Commands
[include('*-*')]$commandsPath
$myModule = $MyInvocation.MyCommand.ScriptBlock.Module
$ExecutionContext.SessionState.PSVariable.Set($myModule.Name, $myModule)
$myModule.pstypenames.insert(0, $myModule.Name)
New-PSDrive -Name $MyModule.Name -PSProvider FileSystem -Scope Global -Root $PSScriptRoot -ErrorAction Ignore
if ($home) {
$MyModuleProfileDirectory = Join-Path ([Environment]::GetFolderPath("LocalApplicationData")) $MyModule.Name
if (-not (Test-Path $MyModuleProfileDirectory)) {
$null = New-Item -ItemType Directory -Path $MyModuleProfileDirectory -Force
}
New-PSDrive -Name "My$($MyModule.Name)" -PSProvider FileSystem -Scope Global -Root $MyModuleProfileDirectory -ErrorAction Ignore
}
# Set a script variable of this, set to the module
# (so all scripts in this scope default to the correct `$this`)
$script:this = $myModule
Export-ModuleMember -Alias * -Function * -Variable $myModule.Name
$script:ModuleApp = $ExecutionContext.SessionState.InvokeCommand.GetCommand('jekyll','Application')
if (-not $script:ModuleApp) {
Write-Warning "jekyll is not installed, or not in the path. Please install"
return
}