Sha256: 32294a0f01c3a6360b32966d9ae9a0585a4937569064126ad05de7d8e8943461

Contents?: true

Size: 1.07 KB

Versions: 24

Compression:

Stored size: 1.07 KB

Contents

require 'ansi'

module CI
  module Queue
    module OutputHelpers
      include ANSI::Code

      private

      def step(*args)
        ci_provider.step(*args)
      end

      def reopen_previous_step
        ci_provider.reopen_previous_step
      end

      def close_previous_step
        ci_provider.close_previous_step
      end

      def ci_provider
        @ci_provider ||= if ENV['BUILDKITE']
          BuildkiteOutput
        else
          DefaultOutput
        end
      end

      module DefaultOutput
        extend self

        def step(title, collapsed: true)
          puts title
        end

        def reopen_previous_step
          # noop
        end

        def close_previous_step
          # noop
        end
      end

      module BuildkiteOutput
        extend self

        def step(title, collapsed: true)
          prefix = collapsed ? '---' : '+++'
          puts "#{prefix} #{title}"
        end

        def reopen_previous_step
          puts '^^^ +++'
        end

        def close_previous_step
          puts '^^^ ---'
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
ci-queue-0.16.0 lib/ci/queue/output_helpers.rb
ci-queue-0.15.1 lib/ci/queue/output_helpers.rb
ci-queue-0.15.0 lib/ci/queue/output_helpers.rb
ci-queue-0.15.0.beta1 lib/ci/queue/output_helpers.rb
ci-queue-0.14.1 lib/ci/queue/output_helpers.rb
ci-queue-0.14.0 lib/ci/queue/output_helpers.rb
ci-queue-0.13.6 lib/ci/queue/output_helpers.rb
ci-queue-0.13.5 lib/ci/queue/output_helpers.rb
ci-queue-0.13.4 lib/ci/queue/output_helpers.rb
ci-queue-0.13.3 lib/ci/queue/output_helpers.rb
ci-queue-0.13.2 lib/ci/queue/output_helpers.rb
ci-queue-0.13.1 lib/ci/queue/output_helpers.rb
ci-queue-0.13.0 lib/ci/queue/output_helpers.rb
ci-queue-0.12.1 lib/ci/queue/output_helpers.rb
ci-queue-0.12.0 lib/ci/queue/output_helpers.rb
ci-queue-0.11.1 lib/ci/queue/output_helpers.rb
ci-queue-0.11.0 lib/ci/queue/output_helpers.rb
ci-queue-0.10.1 lib/ci/queue/output_helpers.rb
ci-queue-0.10.0 lib/ci/queue/output_helpers.rb
ci-queue-0.9.2 lib/ci/queue/output_helpers.rb