Module: PoiseLanguages::System::Mixin::ClassMethods

Included in:
PoiseLanguages::System::Mixin
Defined in:
lib/poise_languages/system/mixin.rb

Instance Method Summary collapse

Instance Method Details

#default_inversion_options(node, resource) ⇒ Object

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.

Set some default inversion provider options. Package name can’t get a default value here because that would complicate the handling of PoiseLanguages::System::Mixin#system_package_candidates.



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/poise_languages/system/mixin.rb', line 111

def default_inversion_options(node, resource)
  super.merge({
    # Install dev headers?
    dev_package: true,
    # Manual overrides for package name and/or version.
    package_name: nil,
    package_version: nil,
    # Set to true to use action :upgrade on system packages.
    package_upgrade: false,
  })
end

#default_packageString #default_package(name) ⇒ String

Overloads:

  • #default_packageString

    Return the default package name for platforms not otherwise defined.

    Returns:

    • (String)
  • #default_package(name) ⇒ String

    Set the default package name for platforms not defined in #packages.

    Parameters:

    • name (String)

      Package name.

    Returns:

    • (String)


150
151
152
153
154
155
# File 'lib/poise_languages/system/mixin.rb', line 150

def default_package(name=nil)
  if name
    @default_package = name
  end
  @default_package
end

#included(klass) ⇒ Object

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.



158
159
160
161
# File 'lib/poise_languages/system/mixin.rb', line 158

def included(klass)
  super
  klass.extend(ClassMethods)
end

#packagesHash #packages(default_package, packages) ⇒ Hash

Overloads:

  • #packagesHash

    Return a hash formatted for value_for_platform returning an Array of package names.

    Returns:

    • (Hash)
  • #packages(default_package, packages) ⇒ Hash

    Define what system packages are available for this language on each platform.

    Parameters:

    • default_package (String)

      Default package name for platforms not otherwise defined.

    • Hash (Hash)

      formatted for value_for_platform returning an Array of package names.

    Returns:

    • (Hash)


135
136
137
138
139
140
141
# File 'lib/poise_languages/system/mixin.rb', line 135

def packages(default_package=nil, packages=nil)
  self.default_package(default_package) if default_package
  if packages
    @packages = packages
  end
  @packages
end

#provides_auto?(node, resource) ⇒ Boolean

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.

Install this as a default provider if nothing else matched. Might not work, but worth a try at least for unknown platforms. Windows is a whole different story, and OS X might work sometimes so at least try.

Returns:

  • (Boolean)


102
103
104
# File 'lib/poise_languages/system/mixin.rb', line 102

def provides_auto?(node, resource)
  !node.platform_family?('windows')
end