diff --git a/bin/console b/bin/console index 5941210..d278be5 100755 --- a/bin/console +++ b/bin/console @@ -2,7 +2,7 @@ # frozen_string_literal: true require "bundler/setup" -require "tracer/irb" +require "tracer" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. diff --git a/lib/tracer/irb.rb b/lib/tracer/irb.rb index fd50b81..3d7a855 100644 --- a/lib/tracer/irb.rb +++ b/lib/tracer/irb.rb @@ -1,7 +1,15 @@ -require_relative "../tracer" require "irb/cmd/nop" require "irb" +if Gem::Version.new(IRB::VERSION) < Gem::Version.new("1.6.0") + warn <<~MSG + Your version of IRB is too old so Tracer cannot register its commands. + Please upgrade IRB by adding `gem "irb", "~> 1.6.0"` to your Gemfile. + MSG + + return +end + module Tracer def self.register_irb_commands ec = IRB::ExtendCommandBundle.instance_variable_get(:@EXTEND_COMMANDS)