Sha256: 56ddd91d70b9a3e69d4c476ae8bfc6fdae9d4985c5d5d25e8afa4898f4a3dd2f

Contents?: true

Size: 625 Bytes

Versions: 25

Compression:

Stored size: 625 Bytes

Contents

module Terraspace::Hooks
  class Runner
    include Terraspace::Util

    def initialize(mod, hook)
      @mod, @hook = mod, hook
      @execute = @hook["execute"]
    end

    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
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
terraspace-0.6.6 lib/terraspace/hooks/runner.rb
terraspace-0.6.5 lib/terraspace/hooks/runner.rb
terraspace-0.6.4 lib/terraspace/hooks/runner.rb
terraspace-0.6.3 lib/terraspace/hooks/runner.rb
terraspace-0.6.2 lib/terraspace/hooks/runner.rb
terraspace-0.6.1 lib/terraspace/hooks/runner.rb
terraspace-0.6.0 lib/terraspace/hooks/runner.rb
terraspace-0.5.12 lib/terraspace/hooks/runner.rb
terraspace-0.5.11 lib/terraspace/hooks/runner.rb
terraspace-0.5.10 lib/terraspace/hooks/runner.rb
terraspace-0.5.9 lib/terraspace/hooks/runner.rb
terraspace-0.5.8 lib/terraspace/hooks/runner.rb
terraspace-0.5.7 lib/terraspace/hooks/runner.rb
terraspace-0.5.6 lib/terraspace/hooks/runner.rb
terraspace-0.5.5 lib/terraspace/hooks/runner.rb
terraspace-0.5.4 lib/terraspace/hooks/runner.rb
terraspace-0.5.3 lib/terraspace/hooks/runner.rb
terraspace-0.5.2 lib/terraspace/hooks/runner.rb
terraspace-0.5.1 lib/terraspace/hooks/runner.rb
terraspace-0.5.0 lib/terraspace/hooks/runner.rb