Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
joeltimothyoh committed Jan 2, 2020
2 parents c1319f2 + 75fd460 commit ba7ceb7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions src/ScheduledTaskManagement/Public/Setup-ScheduledTask.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@ function Setup-ScheduledTask {
try {
# Import definitions as an array of hashtable definitions
$DefinitionsCollection = New-Object System.Collections.ArrayList
if ($PSBoundParameters['DefinitionFile']) {
$DefinitionFileCollection = Get-Item $PSBoundParameters['DefinitionFile']
}elseif ($PSBoundParameters['DefinitionDirectory']) {
$DefinitionFileCollection = if ($PSBoundParameters['AsJson']) {
Get-ChildItem $PSBoundParameters['DefinitionDirectory'] -File | ? { $_.Extension -eq '.json' }
if ($DefinitionFile) {
$DefinitionFileCollection = Get-Item $DefinitionFile
}elseif ($DefinitionDirectory) {
$DefinitionFileCollection = if ($AsJson) {
Get-ChildItem $DefinitionDirectory -File | ? { $_.Extension -eq '.json' }
}else {
Get-ChildItem $PSBoundParameters['DefinitionDirectory'] -File | ? { $_.Extension -eq '.ps1' }
Get-ChildItem $DefinitionDirectory -File | ? { $_.Extension -eq '.ps1' }
}
}
if (!$PSBoundParameters['DefinitionObject']) {
if (!$DefinitionObject) {
if (!$DefinitionFileCollection) {
"No definitions could be found from the specified definition files or directories." | Write-Error
return
}
}
if (!$PSBoundParameters['DefinitionObject']) {
if (!$DefinitionObject) {
$DefinitionCollectionRaw = $DefinitionFileCollection | % {
if ($PSBoundParameters['AsJson']) {
Get-Content -Path $_.FullName | ConvertFrom-Json
if ($AsJson) {
Get-Content $_.FullName | ConvertFrom-Json
}else {
. $_.FullName
}
}
}elseif ($PSBoundParameters['DefinitionObject']) {
$DefinitionCollectionRaw = $PSBoundParameters['DefinitionObject']
}elseif ($DefinitionObject) {
$DefinitionCollectionRaw = $DefinitionObject
}
$DefinitionCollectionRaw | % {
$definitionHashtable = if ($_.GetType() -ne [hashtable]) { $_ | ConvertTo-Hashtable } else { $_ }
Expand Down
6 changes: 3 additions & 3 deletions src/ScheduledTaskManagement/ScheduledTaskManagement.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ $script:MODULE['PRIVATE_DIR'] = Join-Path $script:MODULE['BASE_DIR'] 'Private'
$script:MODULE['HELPERS_DIR'] = Join-Path $script:MODULE['BASE_DIR'] 'helpers' # Module helpers

# Load vendor, Public, Private, classes, helpers
Get-ChildItem -Path "$($script:MODULE['PUBLIC_DIR'])\*.ps1" | % { . $_.FullName }
Get-ChildItem -Path "$($script:MODULE['PRIVATE_DIR'])\*.ps1" | % { . $_.FullName }
Get-ChildItem -Path "$($script:MODULE['HELPERS_DIR'])\*.ps1" | % { . $_.FullName }
Get-ChildItem "$($script:MODULE['PUBLIC_DIR'])\*.ps1" | % { . $_.FullName }
Get-ChildItem "$($script:MODULE['PRIVATE_DIR'])\*.ps1" | % { . $_.FullName }
Get-ChildItem "$($script:MODULE['HELPERS_DIR'])\*.ps1" | % { . $_.FullName }

# Export Public functions
Export-ModuleMember -Function (Get-ChildItem "$($script:MODULE['PUBLIC_DIR'])\*.ps1" | Select-Object -ExpandProperty BaseName)

0 comments on commit ba7ceb7

Please sign in to comment.