Method: GitReflow::Workflow::ClassMethods#before

Defined in:
lib/git_reflow/workflow.rb

#before(name) { ... } ⇒ Object

Stores a Proc to be called once the command successfully finishes

Procs declared with before are executed sequentially in the order they are defined in a custom Workflow file.

are executed in the context of GitReflow::Workflows::Core

Parameters:

  • name (Symbol)

    the name of the method to create

Yields:

  • A block to be executed before the given command. These blocks



208
209
210
211
212
213
214
215
216
217
# File 'lib/git_reflow/workflow.rb', line 208

def before(name, &block)
  name = name.to_sym
  if commands[name].nil?
    logger.error "Attempted to register (before) callback for non-existing command: #{name}"
  else
    logger.debug "(before) callback registered for: #{name}"
    callbacks[:before][name] ||= []
    callbacks[:before][name] << block
  end
end