-
Notifications
You must be signed in to change notification settings - Fork 9
/
ligershark-helpers.psm1
46 lines (36 loc) · 1.07 KB
/
ligershark-helpers.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$script:scriptDir = ((Get-ScriptDirectory) + "\")
$global:azurejobssettings = New-Object psobject -Property @{
InstallPath = ("$env:APPDATA\ligershark\AzureJobs\v0\")
}
function Optimize-Images{
[cmdletbinding()]
param(
[Parameter(Mandatory=$true)]
$folder,
$logfile
)
process{
$imgoptArgs = @()
$imgoptArgs += '--folder'
$imgoptArgs += $folder
if($logfile){
$imgoptArgs += '--logfile'
$imgoptArgs += $logfile
}
$imgOptPath = ImageOptimizerExe
'Calling image optizer [{0}] with the following args [{1}]' -f $imgOptPath, ($imgoptArgs -join ' ') | Write-Output
& "$imgOptPath" $imgoptArgs
}
}
function Get-ImageOptimizerExe{
[cmdletbinding()]
param()
process{
(resolve-path ('{0}ImageCompressor.Job.exe' -f $global:azurejobssettings.installPath)).ToString()
}
}