Sha256: 7917328e1c83b21005ddc731f721dab617b6898afe2a5f3c3c16dfcdda7f00be

Contents?: true

Size: 852 Bytes

Versions: 44

Compression:

Stored size: 852 Bytes

Contents

require 'socket'

module Itamae
  module Handler
    class Base
      attr_reader :recipes, :resources, :actions

      def initialize(options)
        @options = options

        @recipes = []
        @resources = []
        @actions = []
      end

      def event(type, payload = {})
        case type
        when :recipe_started
          @recipes << payload
        when :recipe_completed, :recipe_failed
          @recipes.pop
        when :resource_started
          @resources << payload
        when :resource_completed, :resource_failed
          @resources.pop
        when :action_started
          @actions << payload
        when :action_completed, :action_failed
          @actions.pop
        end
      end

      private

      def hostname
        @hostname ||= @options['hostname'] || Socket.gethostname
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
itamae-1.9.3 lib/itamae/handler/base.rb
itamae-1.9.2 lib/itamae/handler/base.rb
itamae-1.9.1 lib/itamae/handler/base.rb
itamae-1.9.0 lib/itamae/handler/base.rb