Sha256: 85a6e99337ea38af6f1ac419bf90eb6a8be95b8cafadbd579746bffa9c1138a5

Contents?: true

Size: 614 Bytes

Versions: 24

Compression:

Stored size: 614 Bytes

Contents

ENV['CASSANDRA'] ||= "/usr/local/cassandra/bin/cassandra"

if ENV['CASSANDRA_REQUIRED']
  tmp = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp'))
  config = File.expand_path(File.join(File.dirname(__FILE__), 'config'))

  $pid = fork {
    Dir.chdir(tmp)
    puts "CASSANDRA_INCLUDE=#{config}/cassandra.in.sh #{ENV['CASSANDRA']} -f"
  }

  # Wait for cassandra to boot
  sleep 3
end

puts "Connecting..."
CassandraObject::Base.establish_connection "CassandraObject"

if defined?($pid)
  at_exit do
    puts "Shutting down Cassandra..."
    Process.kill('INT', $pid)
    Process.wait($pid)
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
gotime-cassandra_object-0.7.3 test/connection.rb
gotime-cassandra_object-0.7.2 test/connection.rb
gotime-cassandra_object-0.7.1 test/connection.rb
gotime-cassandra_object-0.6.1 test/connection.rb