yast / yast-ruby-bindings

YaST module ruby-bindings
http://en.opensuse.org/Portal:YaST
GNU General Public License v2.0
6 stars 14 forks source link

Added "log.group" method, allow installation via "yupdate" #287

Closed lslezak closed 2 years ago

lslezak commented 2 years ago

Problem

Solution

Added new log.group method, see the example log from TW installation how it will work (click the "Load URL" button to load the example log then scroll to the bottom).

log.group "Description of the group" do
  foo
end

This logs special begin and end marks to the y2log, these might be used when reading/displaying the log.

It returns the block return value, it can be easily used like

# returns the `bar` value
def foo
  log.group "Description of the group" do
    bar
  end
end

Optionally you can describe also the result

  log.group "Description" do |group|
    ret = bar
    group.summary "Installed {ret} packages"
    ret
  end

The code automatically treats values :abort, :cancel and false as failures. But you can explicitly mark a failure

  log.group "Description" do |group|
    ret = bar
    group.failed = true if ret == 0
    ret
  end

yupdate Support

The Rakefile was updated so the Ruby files can be easily updated in the inst-sys with the yupdate command.

Testing

yast-bot commented 2 years ago

:heavy_check_mark: Public Jenkins job #67 successfully finished :heavy_check_mark: Created OBS submit request #1031174

yast-bot commented 2 years ago

:heavy_check_mark: Internal Jenkins job #57 successfully finished :heavy_check_mark: Created IBS submit request #283142