Class: PoiseLanguages::System::Resource Private

Inherits:
Chef::Resource
  • Object
show all
Includes:
Poise
Defined in:
lib/poise_languages/system/resource.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A ‘poise_language_system` resource to manage installing a language from system packages. This is an internal implementation detail of poise-languages.

Since:

  • 1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dev_packageString, false

Name of the development headers package, or false to disable installing headers. By default computed from #package_name.

Returns:

  • (String, false)


47
# File 'lib/poise_languages/system/resource.rb', line 47

attribute(:dev_package, kind_of: [String, FalseClass], default: lazy { default_dev_package })

#dev_package_overridesHash<String, String>

A hash of override names for dev packages that don’t match the normal naming scheme.

Returns:

  • (Hash<String, String>)


52
# File 'lib/poise_languages/system/resource.rb', line 52

attribute(:dev_package_overrides, kind_of: Hash, default: lazy { {} })

#package_nameString

Name of the main package for the language.

Returns:

  • (String)


42
# File 'lib/poise_languages/system/resource.rb', line 42

attribute(:package_name, kind_of: String, name_attribute: true)

#package_versionString?

Version of the package(s) to install. This is distinct from version, and is the specific version package version, not the language version. By default this is unset meaning the latest version will be used.

Returns:

  • (String, nil)


58
# File 'lib/poise_languages/system/resource.rb', line 58

attribute(:package_version, kind_of: [String, NilClass])

#parentChef::Resource

Resource for the language runtime. Used only for messages.

Returns:

  • (Chef::Resource)


62
# File 'lib/poise_languages/system/resource.rb', line 62

attribute(:parent, kind_of: Chef::Resource, required: true)

Instance Method Details

#default_dev_packageString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Compute the default package name for the development headers.

Returns:

  • (String)

Since:

  • 1.0



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/poise_languages/system/resource.rb', line 72

def default_dev_package
  # Check for an override.
  return dev_package_overrides[package_name] if dev_package_overrides.include?(package_name)
  suffix = node.value_for_platform_family(debian: '-dev', rhel: '-devel', fedora: '-devel')
  # Platforms like Arch and Gentoo don't need this anyway. I've got no
  # clue how Amazon Linux does this.
  if suffix
    package_name + suffix
  else
    nil
  end
end