Skip to content

Commit af3028f

Browse files
authored
Merge pull request #779 from estolfo/mongo-console-pry
Don't make pry a gem dependency
2 parents 18be08d + d4020d7 commit af3028f

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

bin/mongo_console

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
#!/usr/bin/env ruby
22

33
$LOAD_PATH[0, 0] = File.join(File.dirname(__FILE__), '..', 'lib')
4-
require 'pry'
5-
require 'mongo'
64

5+
require 'mongo'
76
# include the mongo namespace
87
include Mongo
98

10-
Pry.config.prompt_name = 'mongo'
11-
Pry.start
9+
begin
10+
require 'pry'
11+
rescue LoadError
12+
end
13+
14+
begin
15+
require 'irb'
16+
rescue LoadError
17+
end
18+
19+
if defined?(Pry)
20+
Pry.config.prompt_name = 'mongo'
21+
Pry.start
22+
elsif defined?(IRB)
23+
IRB.start
24+
else
25+
abort 'LoadError: mongo_console requires Pry or IRB'
26+
end

mongo.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ Gem::Specification.new do |s|
3131
s.bindir = 'bin'
3232

3333
s.add_dependency 'bson', '~> 4.0'
34-
s.add_dependency 'pry'
3534
end

0 commit comments

Comments
 (0)