2008-12-05 00:08:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
org_argv = ARGV.dup
|
|
|
|
ARGV.clear
|
|
|
|
|
|
|
|
require 'irb'
|
|
|
|
|
|
|
|
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
|
|
|
|
require 'mongo'
|
|
|
|
|
2009-08-20 14:50:48 +00:00
|
|
|
include Mongo
|
2008-12-05 00:08:23 +00:00
|
|
|
|
2008-12-29 22:16:35 +00:00
|
|
|
host = org_argv[0] || ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
2009-08-20 22:48:09 +00:00
|
|
|
port = org_argv[1] || ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT
|
2008-12-29 22:16:35 +00:00
|
|
|
dbnm = org_argv[2] || ENV['MONGO_RUBY_DRIVER_DB'] || 'ruby-mongo-console'
|
2008-12-05 00:08:23 +00:00
|
|
|
|
2008-12-29 22:16:35 +00:00
|
|
|
puts "Connecting to #{host}:#{port} (CONN) on with database #{dbnm} (DB)"
|
2009-08-20 22:48:09 +00:00
|
|
|
CONN = Connection.new(host, port)
|
2008-12-29 22:16:35 +00:00
|
|
|
DB = CONN.db(dbnm)
|
2008-12-05 00:08:23 +00:00
|
|
|
|
|
|
|
puts "Starting IRB session..."
|
2008-12-08 21:58:16 +00:00
|
|
|
IRB.start(__FILE__)
|