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'
|
|
|
|
|
|
|
|
include XGen::Mongo::Driver
|
|
|
|
|
|
|
|
host = org_argv[0] || 'localhost'
|
|
|
|
port = org_argv[1] || XGen::Mongo::Driver::Mongo::DEFAULT_PORT
|
2008-12-08 21:58:16 +00:00
|
|
|
db_name = org_argv[2] || 'ruby-mongo-console'
|
2008-12-05 00:08:23 +00:00
|
|
|
|
2008-12-08 21:58:16 +00:00
|
|
|
puts "Connecting to #{host}:#{port} on DB for #{db_name}"
|
|
|
|
DB = Mongo.new(host, port).db(db_name)
|
2008-12-05 00:08:23 +00:00
|
|
|
|
|
|
|
puts "Starting IRB session..."
|
2008-12-08 21:58:16 +00:00
|
|
|
IRB.start(__FILE__)
|