Sha256: 6829e5aaef6300acad87424acb3ae2de5c99782a3f7123d491bd320f4fa29417

Contents?: true

Size: 665 Bytes

Versions: 21

Compression:

Stored size: 665 Bytes

Contents

module CapistranoSentinel
  # class used to hook into the output stream
  class OutputStream
    def self.hook(stringio)
      $stdout = new($stdout, stringio)
    end

    def self.unhook
      $stdout.finish if $stdout.is_a? CapistranoSentinel::OutputStream
      $stdout = STDOUT
    end

    attr_accessor :real, :stringio

    def initialize(real_stdout, stringio)
      self.real = real_stdout
      self.stringio = stringio
    end

    def write(*args)
      @stringio.write(*args)
      @real.write(*args)
      @real.flush
    end

    def finish
    end

    def method_missing(name, *args, &block)
      @real.send name, *args, &block
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
capistrano_sentinel-0.2.3 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.2.2 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.2.1 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.2.0 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.1.1 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.1.0 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.18 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.17 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.16 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.15 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.14 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.12 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.10 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.9 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.8 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.7 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.6 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.5 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.3 lib/capistrano_sentinel/classes/output_stream.rb
capistrano_sentinel-0.0.2 lib/capistrano_sentinel/classes/output_stream.rb