Sha256: 59162e22b46c37529b79a10a14f40851bb30480fc460bbab2b179b6c3b5df2ab

Contents?: true

Size: 1.62 KB

Versions: 18

Compression:

Stored size: 1.62 KB

Contents

#!/usr/bin/env ruby

require 'drb'
require 'pry'

begin
  begin
    DRb.start_service("druby://localhost:0")
  rescue SocketError, Errno::EADDRNOTAVAIL
    DRb.start_service("druby://:0")
  end
  $spec_server = DRbObject.new_with_uri("druby://127.0.0.1:8989")
rescue DRb::DRbConnError
  err.puts "No DRb server is running. Running in local process instead ..."
end

def rspec(file=nil)
  if file
    $spec_server.run(["--color", "--format", "s", file], STDERR, STDOUT)
  else
    $spec_server.run(["--color", 'spec'], STDERR, STDOUT)
  end
end

$service = nil
def service
  $service ||= com.espertech.esper.client.EPServiceProviderManager.getDefaultProvider
end

$administrator = nil
def administrator
  $administrator ||= service.getEPAdministrator
end

def compileEPL(query_str)
  administrator.compileEPL(query_str)
end

def query_string(model)
  writer = java.io.StringWriter.new
  formatter = com.espertech.esper.client.soda.EPStatementFormatter.new
  if model.respond_to?(:toEPLElement)
    model.toEPLElement(writer)
    writer.toString
  elsif model.respond_to?(:toPrecedenceFreeEPL)
    model.toPrecedenceFreeEPL(writer)
    writer.toString
  elsif model.is_a?(Java::ComEspertechEsperClientSoda::EPStatementObjectModel)
    model.toEPL
  else
    model.toEPL(writer, formatter)
    writer.toString
  end
end

puts <<DESC

Example:
  > rspec 'spec/xxx_spec.rb'
  or (for all tests)
  > rspec

DESC

$LOAD_PATH.push './lib'
$LOAD_PATH.push './esper'

require 'norikra'

require 'java'
require 'esper-4.9.0.jar'
require 'esper/lib/commons-logging-1.1.1.jar'
require 'esper/lib/antlr-runtime-3.2.jar'
require 'esper/lib/cglib-nodep-2.2.jar'

Pry.start

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
norikra-0.1.6-java script/spec_server_pry
norikra-0.1.5-java script/spec_server_pry
norikra-0.1.4-java script/spec_server_pry
norikra-0.1.3-java script/spec_server_pry
norikra-0.1.2-java script/spec_server_pry
norikra-0.1.1-java script/spec_server_pry
norikra-0.1.0-java script/spec_server_pry
norikra-0.0.24-java script/spec_server_pry
norikra-0.0.23-java script/spec_server_pry
norikra-0.0.22-java script/spec_server_pry
norikra-0.0.21-java script/spec_server_pry
norikra-0.0.20-java script/spec_server_pry
norikra-0.0.19-java script/spec_server_pry
norikra-0.0.18-java script/spec_server_pry
norikra-0.0.17-java script/spec_server_pry
norikra-0.0.16-java script/spec_server_pry
norikra-0.0.15-java script/spec_server_pry
norikra-0.0.14-java script/spec_server_pry