diff --git a/src/Puppet.Dsc/functions/New-PuppetDscModule.ps1 b/src/Puppet.Dsc/functions/New-PuppetDscModule.ps1 index bc3f4712..d8a557d6 100644 --- a/src/Puppet.Dsc/functions/New-PuppetDscModule.ps1 +++ b/src/Puppet.Dsc/functions/New-PuppetDscModule.ps1 @@ -169,7 +169,8 @@ Function New-PuppetDscModule { # Generate REFERENCE.md file for the Puppet module from the auto-generated types for each DSC resource Write-PSFMessage -Message 'Writing the reference documentation for the Puppet module' Set-PSModulePath -Path $InitialPsModulePath - Add-PuppetReferenceDocumentation -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -verbose + Install-Gems -Verbose + Add-PuppetReferenceDocumentation -PuppetModuleFolderPath $PuppetModuleRootFolderDirectory -Verbose If ($PassThru) { # Return the folder containing the puppetized module diff --git a/src/Puppet.Dsc/internal/functions/Install-Gems.ps1 b/src/Puppet.Dsc/internal/functions/Install-Gems.ps1 new file mode 100644 index 00000000..520edbca --- /dev/null +++ b/src/Puppet.Dsc/internal/functions/Install-Gems.ps1 @@ -0,0 +1,24 @@ +function Install-Gems { + <# + .SYNOPSIS + Install required gems + .DESCRIPTION + Installs required gems as specified in the Gemfile. + #> + # verify required gems installed + begin { + $PuppetModuleFolderPath = Resolve-Path -Path $PuppetModuleFolderPath -ErrorAction Stop + $Command = 'pdk bundle install' + } + process { + Try { + $ErrorActionPreference = 'Stop' + Invoke-PdkCommand -Path $PuppetModuleFolderPath -Command $Command -SuccessFilterScript { + $_ -match 'gems now installed' + } + } Catch { + $PSCmdlet.ThrowTerminatingError($PSItem) + } + } + end {} +}