Sha256: 727a2b86febf7dd3a95b37904744b135516bafe360c4ee1d5e6ad9ab543388ee

Contents?: true

Size: 697 Bytes

Versions: 128

Compression:

Stored size: 697 Bytes

Contents

module Actions
  module Middleware
    class InheritTaskGroups < Dynflow::Middleware
      def delay(*args)
        pass(*args)
      end

      def plan(*args)
        inherit_task_groups
        pass(*args)
      end

      def run(*args)
        pass(*args)
        collect_children_task_groups
      end

      def finalize
        pass
      end

      private

      def inherit_task_groups
        task.add_missing_task_groups(task.parent_task.task_groups) if task.parent_task
      end

      def collect_children_task_groups
        task.add_missing_task_groups task.sub_tasks.map(&:task_groups).flatten
      end

      def task
        @task ||= action.task
      end
    end
  end
end

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
foreman-tasks-0.10.1 app/lib/actions/middleware/inherit_task_groups.rb
foreman-tasks-0.9.5 app/lib/actions/middleware/inherit_task_groups.rb
foreman-tasks-0.10.0 app/lib/actions/middleware/inherit_task_groups.rb
foreman-tasks-0.9.4 app/lib/actions/middleware/inherit_task_groups.rb
foreman-tasks-0.9.3 app/lib/actions/middleware/inherit_task_groups.rb
foreman-tasks-0.9.2 app/lib/actions/middleware/inherit_task_groups.rb
foreman-tasks-0.9.1 app/lib/actions/middleware/inherit_task_groups.rb
foreman-tasks-0.9.0 app/lib/actions/middleware/inherit_task_groups.rb