Sha256: df7017a4c2912bad9ee91a987d74612a2ffc4354120d215eaa0870fc672394e0

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

module Ey
  module Core
    module Cli
      module Helpers
        module LogStreaming

          def stream_deploy_log(request)
            if request.finished_at
              return finished_request(request)
            end
            unless request.read_channel
              puts "Unable to stream log (streaming not enabled for this deploy)".yellow
              return
            end
            request.subscribe { |m| print m["message"] if m.is_a?(Hash) }
            puts "" # fix console output from stream
            finished_request(request)
          end

          def finished_request(request)
            if request.successful
              if request.resource.successful
                puts "Deploy successful!".green
              else
                puts "Deploy failed!".red
              end
            else
              abort <<-EOF
        Deploy failed!
        Request output:
        #{request.message}
              EOF
              .red
            end
          end

        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ey-core-3.6.6 lib/ey-core/cli/helpers/log_streaming.rb
ey-core-3.4.5 lib/ey-core/cli/helpers/log_streaming.rb
ey-core-3.6.5 lib/ey-core/cli/helpers/log_streaming.rb