module MiGA::Project::Hooks

Helper module including specific functions to handle project hooks. Supported events:

Supported hooks:

Internal hooks:

Public Instance Methods

default_hooks() click to toggle source
# File lib/miga/project/hooks.rb, line 22
def default_hooks
  {
    on_result_ready: [[:_pull_result_hooks]]
  }
end
hook__pull_result_hooks(_hook_args, event_args) click to toggle source

Dataset Action :pull_result_hooks([], [res]) Pull the hook specific to the type of result

# File lib/miga/project/hooks.rb, line 45
def hook__pull_result_hooks(_hook_args, event_args)
  pull_hook(:"on_result_ready_#{event_args.first}", *event_args)
  pull_hook(:on_processing_ready) if next_task(nil, false).nil?
end
hook_run_cmd(hook_args, event_args) click to toggle source

Run cmd in the command-line with {{variables}}: project, project_name, miga, object (if defined by the event)

  • hook_args: +[cmd]+

  • event_args: +[object (optional)]+

# File lib/miga/project/hooks.rb, line 33
def hook_run_cmd(hook_args, event_args)
  Process.wait(
    spawn hook_args.first.miga_variables(
      project: path, project_name: name,
      miga: MiGA::MiGA.root_path, object: event_args.first
    )
  )
end