Class: Yast::ProductPatterns

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
src/lib/packager/product_patterns.rb

Overview

Evaluate the default patterns for the currently selected products

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(src: nil) ⇒ ProductPatterns

optionally evaluate only the products in the specified repository (by default use all repositories)

Parameters:

  • src (Integer, nil) (defaults to: nil)

    repository id


28
29
30
31
# File 'src/lib/packager/product_patterns.rb', line 28

def initialize(src: nil)
  Yast.import "Pkg"
  @src = src
end

Instance Attribute Details

#srcObject (readonly)

Returns the value of attribute src


23
24
25
# File 'src/lib/packager/product_patterns.rb', line 23

def src
  @src
end

Instance Method Details

#namesArray<String>

Note:

The package management and the products needs to be initialized and selected before using this method.

Find the default patterns for all selected products.

Returns:

  • (Array<String>)

    pattern names


37
38
39
# File 'src/lib/packager/product_patterns.rb', line 37

def names
  @names ||= find
end

#selectBoolean

Note:

The package management and the products needs to be initialized and selected before using this method.

Select the default patterns to installation

Returns:

  • (Boolean)

    true if all patterns were successfuly selected, false otherwise


46
47
48
49
50
# File 'src/lib/packager/product_patterns.rb', line 46

def select  # use map + all? to try installing *all* patterns, plain all? would stop
  # at the first failure

  names.map { |p| Yast::Pkg.ResolvableInstall(p, :pattern) }.all?
end