class Chef::Resource::PowershellPackageSource

Public Instance Methods

build_package_source_command(cmdlet_type, new_resource) click to toggle source
# File lib/chef/resource/powershell_package_source.rb, line 137
def build_package_source_command(cmdlet_type, new_resource)
  cmd = "#{cmdlet_type}-PackageSource -Name '#{new_resource.source_name}'"
  cmd << " -Location '#{new_resource.url}'" if new_resource.url
  cmd << " -Trusted:#{new_resource.trusted ? "$true" : "$false"}"
  cmd << " -ProviderName '#{new_resource.provider_name}'" if new_resource.provider_name
  cmd
end
build_ps_repository_command(cmdlet_type, new_resource) click to toggle source
# File lib/chef/resource/powershell_package_source.rb, line 127
def build_ps_repository_command(cmdlet_type, new_resource)
  cmd = "#{cmdlet_type}-PSRepository -Name '#{new_resource.source_name}'"
  cmd << " -SourceLocation '#{new_resource.url}'" if new_resource.url
  cmd << " -InstallationPolicy '#{new_resource.trusted ? "Trusted" : "Untrusted"}'"
  cmd << " -PublishLocation '#{new_resource.publish_location}'" if new_resource.publish_location
  cmd << " -ScriptSourceLocation '#{new_resource.script_source_location}'" if new_resource.script_source_location
  cmd << " -ScriptPublishLocation '#{new_resource.script_publish_location}'" if new_resource.script_publish_location
  cmd
end
package_source_exists?() click to toggle source
# File lib/chef/resource/powershell_package_source.rb, line 118
def package_source_exists?
  cmd = powershell_out!("(Get-PackageSource -Name '#{new_resource.source_name}' -WarningAction SilentlyContinue).Name")
  cmd.stdout.downcase.strip == new_resource.source_name.downcase
end
psrepository_cmdlet_appropriate?() click to toggle source
# File lib/chef/resource/powershell_package_source.rb, line 123
def psrepository_cmdlet_appropriate?
  new_resource.provider_name == "PowerShellGet"
end