Sha256: 5f9e5418e0da7b18f6c6a2ab6808638054098b36af36ac996023d9c0e6b29ebb

Contents?: true

Size: 625 Bytes

Versions: 4

Compression:

Stored size: 625 Bytes

Contents

require 'json'

module TestR
module Server

  def quit
    throw :testr_server_quit
  end

  def loop
    (@upstream = STDOUT.dup).sync = true
    STDOUT.reopen(STDERR).sync = true

    catch :testr_server_quit do
      while line = STDIN.gets
        warn "#{caller[2]} RECV #{line.chomp}" if $DEBUG

        command = JSON.load(line)
        method = command.first

        if respond_to? method and method != __method__ # prevent loops
          @command, @command_line = command, line
          __send__(*command)
        else
          warn "#{self}: bad command: #{method}"
        end
      end
    end
  end

end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
testr-14.0.3 lib/testr/server.rb
testr-14.0.2 lib/testr/server.rb
testr-14.0.1 lib/testr/server.rb
testr-14.0.0 lib/testr/server.rb