Class: Terraspace::Hooks::Runner
- Inherits:
-
Object
- Object
- Terraspace::Hooks::Runner
- Includes:
- Util
- Defined in:
- lib/terraspace/hooks/runner.rb
Instance Method Summary collapse
-
#initialize(mod, hook) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Methods included from Util::Pretty
Methods included from Util::Sure
Methods included from Util::Logging
Constructor Details
#initialize(mod, hook) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 |
# File 'lib/terraspace/hooks/runner.rb', line 5 def initialize(mod, hook) @mod, @hook = mod, hook @execute = @hook["execute"] end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/terraspace/hooks/runner.rb', line 10 def run case @execute when String Terraspace::Shell.new(@mod, @execute, exit_on_fail: @hook["exit_on_fail"]).run when -> (e) { e.respond_to?(:public_instance_methods) && e.public_instance_methods.include?(:call) } @execute.new.call when -> (e) { e.respond_to?(:call) } @execute.call else logger.warn "WARN: execute option not set for hook: #{@hook.inspect}" end end |