Sha256: 0c9b35809c3cbe9b7ad98ba629b3807e1213d82f488afb5143fd3694e7990132

Contents?: true

Size: 759 Bytes

Versions: 31

Compression:

Stored size: 759 Bytes

Contents

module Shipit
  class TailTaskSerializer < ActiveModel::Serializer
    include ChunksHelper
    include ConditionalAttributes

    attributes :url, :status, :output, :rollback_url

    def url
      return @url if defined? @url
      @url = next_chunks_url(task)
    end

    def include_url?
      !url.blank?
    end

    def output
      task.chunks.tail(context[:last_id]).pluck(:text).join
    end

    def rollback_url
      stack_deploy_path(stack, rollback)
    end

    def include_rollback_url?
      !rollback.nil?
    end

    private

    alias_method :task, :object
    delegate :stack, to: :object

    def rollback
      return @rollback if defined? @rollback
      @rollback = stack.rollbacks.where(parent_id: task.id).last
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
shipit-engine-0.20.1 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.20.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.19.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.18.1 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.18.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.17.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.16.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.15.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.14.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.13.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.12.1 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.12.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.11.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.10.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.9.0 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.8.9 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.8.8 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.8.7 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.8.6 app/serializers/shipit/tail_task_serializer.rb
shipit-engine-0.8.5 app/serializers/shipit/tail_task_serializer.rb