Class: SpecForge::Forge::Hooks
- Inherits:
-
Object
- Object
- SpecForge::Forge::Hooks
- Defined in:
- lib/spec_forge/forge/hooks.rb
Overview
Executes lifecycle hooks at various points during forge execution
Provides class methods for triggering before/after hooks at the forge, blueprint, and step levels.
Class Method Summary collapse
-
.after_blueprint(forge, blueprint) ⇒ void
Executes after-blueprint hooks.
-
.after_forge(forge) ⇒ void
Executes after-forge hooks.
-
.after_step(forge, blueprint, step, error: nil) ⇒ void
Executes after-step hooks.
-
.before_blueprint(forge, blueprint) ⇒ void
Executes before-blueprint hooks.
-
.before_forge(forge) ⇒ void
Executes before-forge hooks.
-
.before_step(forge, blueprint, step) ⇒ void
Executes before-step hooks.
Class Method Details
.after_blueprint(forge, blueprint) ⇒ void
This method returns an undefined value.
Executes after-blueprint hooks
85 86 87 88 89 90 91 |
# File 'lib/spec_forge/forge/hooks.rb', line 85 def after_blueprint(forge, blueprint) hooks = blueprint.hooks[:after] return if hooks.blank? context = SpecForge::Forge.context.with(forge:, blueprint:) run(forge, context, hooks) end |
.after_forge(forge) ⇒ void
This method returns an undefined value.
Executes after-forge hooks
100 101 102 103 104 105 106 |
# File 'lib/spec_forge/forge/hooks.rb', line 100 def after_forge(forge) hooks = forge.hooks[:after] return if hooks.blank? context = SpecForge::Forge.context.with(forge:) run(forge, context, hooks) end |
.after_step(forge, blueprint, step, error: nil) ⇒ void
This method returns an undefined value.
Executes after-step hooks
69 70 71 72 73 74 75 |
# File 'lib/spec_forge/forge/hooks.rb', line 69 def after_step(forge, blueprint, step, error: nil) hooks = step.hooks[:after] return if hooks.blank? context = SpecForge::Forge.context.with(forge:, blueprint:, step:, error:) run(forge, context, hooks, leading_newline: true) end |
.before_blueprint(forge, blueprint) ⇒ void
This method returns an undefined value.
Executes before-blueprint hooks
36 37 38 39 40 41 42 |
# File 'lib/spec_forge/forge/hooks.rb', line 36 def before_blueprint(forge, blueprint) hooks = blueprint.hooks[:before] return if hooks.blank? context = SpecForge::Forge.context.with(forge:, blueprint:) run(forge, context, hooks, trailing_newline: true) end |
.before_forge(forge) ⇒ void
This method returns an undefined value.
Executes before-forge hooks
20 21 22 23 24 25 26 |
# File 'lib/spec_forge/forge/hooks.rb', line 20 def before_forge(forge) hooks = forge.hooks[:before] return if hooks.blank? context = SpecForge::Forge.context.with(forge:) run(forge, context, hooks) end |
.before_step(forge, blueprint, step) ⇒ void
This method returns an undefined value.
Executes before-step hooks
52 53 54 55 56 57 58 |
# File 'lib/spec_forge/forge/hooks.rb', line 52 def before_step(forge, blueprint, step) hooks = step.hooks[:before] return if hooks.blank? context = SpecForge::Forge.context.with(forge:, blueprint:, step:) run(forge, context, hooks, trailing_newline: true) end |