22 lines
567 B
Ruby
Executable File
22 lines
567 B
Ruby
Executable File
#!/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 Mongo
|
|
|
|
host = org_argv[0] || ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
|
|
port = org_argv[1] || ENV['MONGO_RUBY_DRIVER_PORT'] || Connection::DEFAULT_PORT
|
|
dbnm = org_argv[2] || ENV['MONGO_RUBY_DRIVER_DB'] || 'ruby-mongo-console'
|
|
|
|
puts "Connecting to #{host}:#{port} (CONN) on with database #{dbnm} (DB)"
|
|
CONN = Connection.new(host, port)
|
|
DB = CONN.db(dbnm)
|
|
|
|
puts "Starting IRB session..."
|
|
IRB.start(__FILE__)
|