From d4020d7a735b4b4286cfa669443c2126f6b292fa Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 13 Jul 2016 15:32:26 +0200 Subject: [PATCH] Don't make pry a gem dependency --- bin/mongo_console | 23 +++++++++++++++++++---- mongo.gemspec | 1 - 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bin/mongo_console b/bin/mongo_console index e1e47f2169..ea2aa22840 100755 --- a/bin/mongo_console +++ b/bin/mongo_console @@ -1,11 +1,26 @@ #!/usr/bin/env ruby $LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib') -require 'pry' -require 'mongo' +require 'mongo' # include the mongo namespace include Mongo -Pry.config.prompt_name = 'mongo' -Pry.start +begin + require 'pry' +rescue LoadError +end + +begin + require 'irb' +rescue LoadError +end + +if defined?(Pry) + Pry.config.prompt_name = 'mongo' + Pry.start +elsif defined?(IRB) + IRB.start +else + abort 'LoadError: mongo_console requires Pry or IRB' +end diff --git a/mongo.gemspec b/mongo.gemspec index a41ffb5a46..24feca809b 100644 --- a/mongo.gemspec +++ b/mongo.gemspec @@ -31,5 +31,4 @@ Gem::Specification.new do |s| s.bindir = 'bin' s.add_dependency 'bson', '~> 4.0' - s.add_dependency 'pry' end