yast/yast-yast2 — pull request #148 by vmoravec (2013-11-19 13:22:07+00:00)
Title: Hooks module | First draft | FATE#315992

The purpose of the hooks is to execute a third party code within the workflow of installation, system update or others. Hook files must be executable files written in bash, ruby, anything available in inst-sys.

The ```Hooks``` module provides method ```run``` which creates a hook and executes it instantly. Execution of a hook means:
* register the hook into the hooks collection (every hook can be registered only once, otherwise error is raised)
* search for the files belonging to this hook by pattern matching
* execute the files
* store the results for further inspection if needed (mostly if some of the files has failed)

If a hook file execution returns non-zero result, the whole hook is considered as failed.

## Example
```ruby
module Yast
import 'Hooks'

class SomeClient < Client
def main
Hooks.run :before_some_client_action
puts Hooks.last.failed?
puts Hooks.find(:before_some_client_action).succeeded?
puts Hooks.last.files
end
end
end
```
## TODO
* pass the status of the installation/update process to the hook file (e.g. via ENV variable)
* integrate with UI (view registered hooks, hook files, results, content etc)
* adapt for installation and wagon needs
* adapt documentation from Wagon