byebug 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +5 -0
  3. data/CHANGELOG.md +10 -0
  4. data/GUIDE.md +235 -9
  5. data/bin/byebug +12 -16
  6. data/byebug.gemspec +0 -1
  7. data/ext/byebug/byebug.c +5 -6
  8. data/lib/byebug.rb +17 -8
  9. data/lib/byebug/command.rb +12 -21
  10. data/lib/byebug/commands/breakpoints.rb +5 -9
  11. data/lib/byebug/commands/catchpoint.rb +2 -4
  12. data/lib/byebug/commands/condition.rb +4 -6
  13. data/lib/byebug/commands/continue.rb +2 -4
  14. data/lib/byebug/commands/control.rb +2 -4
  15. data/lib/byebug/commands/display.rb +4 -10
  16. data/lib/byebug/commands/edit.rb +2 -4
  17. data/lib/byebug/commands/enable.rb +6 -10
  18. data/lib/byebug/commands/eval.rb +12 -13
  19. data/lib/byebug/commands/finish.rb +2 -4
  20. data/lib/byebug/commands/frame.rb +6 -15
  21. data/lib/byebug/commands/help.rb +2 -3
  22. data/lib/byebug/commands/info.rb +5 -7
  23. data/lib/byebug/commands/jump.rb +2 -4
  24. data/lib/byebug/commands/kill.rb +2 -4
  25. data/lib/byebug/commands/list.rb +2 -4
  26. data/lib/byebug/commands/method.rb +4 -10
  27. data/lib/byebug/commands/quit.rb +2 -4
  28. data/lib/byebug/commands/reload.rb +1 -3
  29. data/lib/byebug/commands/repl.rb +3 -7
  30. data/lib/byebug/commands/save.rb +2 -4
  31. data/lib/byebug/commands/set.rb +4 -8
  32. data/lib/byebug/commands/show.rb +2 -4
  33. data/lib/byebug/commands/skip.rb +2 -4
  34. data/lib/byebug/commands/source.rb +1 -3
  35. data/lib/byebug/commands/stepping.rb +2 -4
  36. data/lib/byebug/commands/trace.rb +2 -4
  37. data/lib/byebug/commands/variables.rb +6 -18
  38. data/lib/byebug/version.rb +1 -1
  39. data/old_doc/byebug.texi +1 -9
  40. data/test/breakpoints_test.rb +1 -2
  41. data/test/examples/info.rb +5 -5
  42. data/test/examples/list.rb +21 -21
  43. data/test/examples/reload.rb +5 -5
  44. data/test/examples/repl.rb +6 -0
  45. data/test/examples/save.rb +2 -2
  46. data/test/examples/set.rb +2 -2
  47. data/test/examples/source.rb +2 -2
  48. data/test/finish_test.rb +1 -1
  49. data/test/help_test.rb +31 -15
  50. data/test/list_test.rb +27 -25
  51. data/test/reload_test.rb +3 -3
  52. data/test/repl_test.rb +8 -8
  53. data/test/set_test.rb +2 -12
  54. data/test/support/test_dsl.rb +25 -39
  55. data/test/variables_test.rb +0 -2
  56. metadata +4 -18
  57. data/test/examples/irb.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2380cd5fcec35d3f595370d2616036b95d6431a9
4
- data.tar.gz: c4d94d6eaf87f359546b4b0d490a17a6e7f436cf
3
+ metadata.gz: 929419c640bdf958d5322f770be797f1d8bfd0c0
4
+ data.tar.gz: 6697013f9ff97a9e453cf777041f4108c3274c65
5
5
  SHA512:
6
- metadata.gz: c84394861f16b1ddffd011f93665e4c8a11234c50c697ce9abafd7fee41e992d363e38026083f6f9ef16d4ca8578b1f7705e630c82d9694b45c5f0c47797c94c
7
- data.tar.gz: 5fe396fa9105f429a5da215e14507a0160376a0a36c29dc788fcd9e467ab24d84b57022b8914acf7a52305cfc4cf87eb65add335fb2825d48cb180ddc7c02b21
6
+ metadata.gz: 62ad75b1a082c60a1cfe65c13fd654c538006cfcb0c02fc751658994a838b8e365ce659428e3381a4a4393feab58f62dec9268afd040bf1c4ebcc21f46a41f56
7
+ data.tar.gz: 21a6754ad1fa31fda1564c44fb1786c55de5d2f30e13c82fe8a8319ec70b62df8ec43499df3d1e95fd126a4c00aacb597e555c6ff488b711471ad1cd2f39c12c
@@ -1,3 +1,8 @@
1
+ before_install: gem install bundler
1
2
  before_script: rake compile
2
3
  rvm:
3
4
  - 2.0.0
5
+ - ruby-head
6
+ matrix:
7
+ allow_failures:
8
+ - rvm: ruby-head
@@ -1,6 +1,16 @@
1
+ ## 1.4.2
2
+
3
+ * Fixes crash when using "help command subcommand"
4
+ * Byebug now works with Rails Console debugging flag
5
+ * Fix post-mortem mode when running byebug from the outset
6
+ * Fix --no-quit flag when running byebug from the outset
7
+
8
+
1
9
  ## 1.4.1
2
10
 
3
11
  * Fixes crash when printing some filenames in backtraces
12
+ * Allows byebug developers to easily use compilers different from gcc (thanks
13
+ @GarthSnyder!)
4
14
 
5
15
 
6
16
  ## 1.4.0
data/GUIDE.md CHANGED
@@ -669,9 +669,9 @@ Options:
669
669
  -d, --debug Set $DEBUG=true
670
670
  -I, --include PATH Add PATH (single or multiple:path:list) to $LOAD_PATH
671
671
  --no-quit Do not quit when script finishes
672
- --no-rewrite-program Don't set $0 to the program debugged
673
672
  --no-stop Do not stop when script is loaded
674
- -nx Don't run any byebug initialization files
673
+ --nx Don't run any byebug initialization files
674
+ --post-mortem Enable post-mortem mode for uncaught exceptions
675
675
  -r, --require SCRIPT Require library before script
676
676
  --restart-script FILE Name of the script file to run. Erased after read
677
677
  --script FILE Name of the script file to run
@@ -697,13 +697,10 @@ information without having to poll for it.
697
697
  * **-d | --debug**. Set `$DEBUG` to `true`. Compatible with Ruby's.
698
698
  * **-I | --include <path>**. Add `path` to load path. `path` can be a single
699
699
  path ar a colon separated path list.
700
- * **-m | --post-mortem**. If your program raises an exception that isn't caught
701
- you can enter byebug for inspection of what went wrong. You may also want to use
700
+ * **--post-mortem**. If your program raises an exception that isn't caught you
701
+ can enter byebug for inspection of what went wrong. You may also want to use
702
702
  this option in conjunction with `--no-stop`. See also [Post-Mortem Debugging]().
703
703
  * **--no-quit**. Restart `byebug` when your program terminates normally.
704
- * **--no-rewrite-program**. Normally `byebug` will reset the program's name `$0`
705
- from its name to the debugged program, and set the name in variable
706
- `$BYEBUG_SCRIPT`. In the unlikely event you don't want to use this option.
707
704
  * **--no-stop**. Normally `byebug` stops before executing the first statement.
708
705
  If instead you want it to start running initially and perhaps break it later in
709
706
  the execution, use this option.
@@ -753,6 +750,235 @@ puts "rocky's byebugrc run"
753
750
  Here are the default values in `options`
754
751
 
755
752
  ```ruby
756
- #<OpenStruct annotate=nil, no_rewrite_program=false, nx=false, quit=true,
757
- restart_script=nil, script=nil, stop=true, tracing=false, verbose_long=false>
753
+ #<OpenStruct annotate=nil, nx=false, quit=true, restart_script=nil, script=nil,
754
+ stop=true, tracing=false, verbose_long=false>
755
+ ```
756
+
757
+ ## Command Files
758
+
759
+ A command file is a file of lines that are `byebug` commands. Comments (lines
760
+ starting with `#`) may also be included. An empty line in a command file does
761
+ nothing; it does not mean to repeat the last command, as it would from the
762
+ terminal.
763
+
764
+ When you start `byebug`, it automatically executes commands from its
765
+ _init file_, called `.byebugrc`. During startup, `byebug` does the following:
766
+
767
+ * __Processes command line options and operands.__ Reads the init file in your
768
+ current directory, if any, and then checks your home directory. The home
769
+ directory is the directory named in the `$HOME` or `$HOMEPATH` environment
770
+ variable. Thus, you can have more than one init file, one generic in your home
771
+ directory, and another, specific to the program you are debugging, in the
772
+ directory where you invoke `byebug`.
773
+
774
+ * __Reads command files specified by the `--script` option.__
775
+
776
+ You can also request the execution of a command file with the `source` command
777
+ (see [Source]()).
778
+
779
+ ## Quitting byebug
780
+
781
+ Inside a byebug interpreter, use `quit` command to finish execution. Another way
782
+ to terminate byebug is to use the `kill` command. This does the more forceful
783
+ `kill -9`. It can be used in cases where `quit` doesn't work (I haven't seen it
784
+ yet).
785
+
786
+ ## Calling byebug from inside your program
787
+
788
+ Running a program from byebug adds a bit of overhead and slows it down a little.
789
+ Furthermore, by necessity, debuggers change the operation of the program they
790
+ are debugging. And this can lead to unexpected and unwanted differences. It has
791
+ happened so often that the term
792
+ [Heisenbugs](http://en.wikipedia.org/wiki/Heisenbug}) was coined to describe the
793
+ situation where using a debugger (among other possibilities) changes the
794
+ behavior of the program so that the bug doesn't manifest itself anymore.
795
+
796
+ There is another way to get into byebug which adds no overhead or slowdown until
797
+ you reach the point at which you want to start debugging. However here you must
798
+ change the script and make an explicit call to byebug. Because byebug isn't
799
+ involved before the first call, there is no overhead and the script will run
800
+ at the same speed as if there were no byebug.
801
+
802
+ There are three parts to calling byebug from inside the script, ``requiring''
803
+ the gem, telling byebug to start tracking things and then making an explicit
804
+ breakpoints.
805
+
806
+ Unless you're using bundler, do this to get byebug class accessible from your
807
+ Ruby program
808
+
809
+ ```ruby
810
+ require 'byebug'
811
+ ```
812
+
813
+ To tell byebug to start tracking things, do
814
+
815
+ ```ruby
816
+ Byebug.start
817
+ ```
818
+
819
+ There is also a `Byebug.stop` to turn off byebug tracking. If speed is crucial,
820
+ you may want to start and stop this around certain sections of code.
821
+ Alternatively, instead of issuing an explicit `Byebug.stop` you can add a block
822
+ to the `Byebug.start` and debugging is turned on for that block. If the block of
823
+ code raises an uncaught exception that would cause the block to terminate, the
824
+ `stop` will occur. See [here](Byebug.start with a block).
825
+
826
+ And finally to enter byebug
827
+
828
+ ```ruby
829
+ byebug
830
+ ```
831
+
832
+ When `byebug`is run, `.byebugrc` is read.
833
+
834
+ You may want to enter byebug at several points in the program where there is a
835
+ problem you want to investigate. And since `byebug` is just a method call it's
836
+ possible to enclose it in a conditional expression, for example
837
+
838
+ ```ruby
839
+ byebug if 'bar' == foo and 20 == iter_count
840
+ ```
841
+
842
+ ## Byebug Command Reference
843
+
844
+ ## Command Syntax
845
+ Usually a command is put on a single line. There is no limit on how long it can be.
846
+ It starts with a command name, which is followed by arguments whose meaning depends
847
+ on the command name. For example, the command `step` accepts an argument which is the
848
+ number of times to step, as in `step 5`. You can also use the `step` command with no
849
+ arguments. Some commands do not allow any arguments.
850
+
851
+ Multiple commands can be put on a line by separating each with a semicolon `;`. You
852
+ can disable the meaning of a semicolon to separate commands by escaping it with a
853
+ backslash.
854
+
855
+ For example, if you have [autoeval]() set, which is the default, you might want to
856
+ enter the following code to compute the 5th Fibonacci number.
857
+
858
+ ```
859
+ (byebug) fib1=0; fib2=1; 5.times {|temp| temp=fib1; fib1=fib2; fib2 += temp }
860
+ 0
861
+ 1
862
+ SyntaxError Exception: /home/davidr/Proyectos/sample_app/trace.rb:1: syntax
863
+ error, unexpected end-of-input, expecting '}'
864
+ 5.times { |temp| temp=fib1
865
+ ^
866
+ nil
867
+ 1
868
+ SyntaxError Exception: /home/davidr/Proyectos/sample_app/trace.rb:1: syntax
869
+ error, unexpected tSTRING_DEND, expecting end-of-input
870
+ fib2 += temp }
871
+ ^
872
+ nil
873
+ (byebug) fib1=0\; fib2=1\; 5.times {|temp| temp=fib1\; fib1=fib2\; fib2 += temp }
874
+ 5
875
+ (byebug) fib2
876
+ 8
877
+ ```
878
+
879
+ You might also consider using the [irb]() or [pry]() commands and then you won't have
880
+ to escape semicolons.
881
+
882
+ A blank line as input (typing just `<RET>`) means to repeat the previous command.
883
+
884
+ Byebug uses readline, which handles line editing and retrieval of previous commands.
885
+ Up arrow, for example, moves to the previous byebug command; down arrow moves to the
886
+ next more recent command (provided you are not already at the last command). Command
887
+ history is saved in file `.byebug_hist`. A limit is put on the history size. You
888
+ can see this with the `show history size` command. See [history]() for history
889
+ parameters.
890
+
891
+ ### Command Output
892
+ In the command-line interface, when `byebug` is waiting for input it presents a
893
+ prompt of the form `(byebug)`. If the program has terminated normally the prompt will
894
+ be `(byebug:ctrl)` and in post-mortem debugging it will be
895
+ `(byebug:post-mortem)`.
896
+
897
+ Whenever `byebug` gives an error message such as for an invalid command or an invalid
898
+ location position, it will generally preface the message with `***`. However if
899
+ annotation mode is on then the message is put in a `begin-error` annotation and no
900
+ `***` appears.
901
+
902
+ ### Help
903
+ Once inside `byebug` you can always ask it for information on its commands using the
904
+ `help` command. You can use `help` (abbreviated `h`) with no arguments to display a
905
+ short list of named classes of commands
906
+
907
+ ```
908
+ (byebug) `help`
909
+ Type "help <command-name>" for help on a specific command
910
+
911
+ Available commands:
912
+ backtrace catch continue disable down enable exit frame
913
+ info jump list next pp putl reload save
914
+ show source trace up where break condition delete
915
+ display edit eval finish help irb kill method
916
+ p ps quit restart set skip step undisplay
917
+ var
918
+ ```
919
+
920
+ With a command name as `help` argument, `byebug` displays short information on how to
921
+ use that command.
922
+
923
+ ```
924
+ (byebug) help list
925
+ l[ist] list forward
926
+ l[ist] - list backward
927
+ l[ist] = list current line
928
+ l[ist] nn-mm list given lines
929
+ * NOTE - to turn on autolist, use 'set autolist'
930
+ (byebug)
931
+ ```
932
+
933
+ A number of commands, namely `info`, `set`, `show`, `enable` and `disable`, have many
934
+ sub-parameters or _subcommands_. When you ask for help for one of these commands, you
935
+ will get help for all of the subcommands that command offers. Sometimes you may want
936
+ help only on a subcommand and to do this just follow the command with its subcommand
937
+ name. For example `help set annotate` will just give help about the annotate command.
938
+ Furthermore it will give longer help than the summary information that appears when
939
+ you ask for help. You don't need to list the full subcommand name, just enough
940
+ letters to make that subcommand distinct from others will do. For example,
941
+ `help set an` is the same as `help set annotate`.
942
+
943
+ Some examples follow.
944
+
945
+ ```
946
+ (byebug) help info
947
+ info[ subcommand]
948
+
949
+ Generic command for showing things about the program being debugged.
950
+
951
+ --
952
+ List of "info" subcommands:
953
+ --
954
+ info args -- Argument variables of current stack frame
955
+ info breakpoints -- Status of user-settable breakpoints
956
+ info catch -- Exceptions that can be caught in the current stack
957
+ frame
958
+ info display -- Expressions to display when program stops
959
+ info file -- Info about a particular file read in
960
+ info files -- File names and timestamps of files read in
961
+ info global_variables -- Global variables
962
+ info instance_variables -- Instance variables of the current stack frame
963
+ info line -- Line number and file name of current position in
964
+ source file
965
+ info locals -- Local variables of the current stack frame
966
+ info program -- Execution status of the program
967
+ info stack -- Backtrace of the stack
968
+ info variables -- Local and instance variables of the current stack
969
+ frame
970
+ ```
971
+
972
+ ```
973
+ (byebug) help info breakpoints
974
+ Status of user-settable breakpoints.
975
+ Without argument, list info about all breakpoints.
976
+ With an integer argument, list info on that breakpoint.
977
+ ```
978
+
979
+ ```
980
+ (byebug) help info br
981
+ Status of user-settable breakpoints.
982
+ Without argument, list info about all breakpoints.
983
+ With an integer argument, list info on that breakpoint.
758
984
  ```
data/bin/byebug CHANGED
@@ -28,7 +28,7 @@
28
28
  # Add <i>path</i> to <tt>$LOAD_PATH</tt>. Like the <tt>ruby -I</tt> command,
29
29
  # it supports multiple load paths separated by colons.
30
30
  #
31
- #<tt>-m | --post-mortem</tt>::
31
+ #<tt>--post-mortem</tt>::
32
32
  # Activate post-mortem mode.
33
33
  #
34
34
  #<tt>--no-quit</tt>::
@@ -77,10 +77,9 @@ def debug_program(options)
77
77
  print "\032\032starting\n" if Byebug.annotate and Byebug.annotate > 2
78
78
 
79
79
  # Record where we are we can know if the call stack has been truncated or not.
80
- Byebug.start_sentinal=caller(0)[1]
80
+ Byebug.start_sentinal = caller[0]
81
81
 
82
- bt = Byebug.debug_load(Byebug::PROG_SCRIPT, options.stop)
83
- if bt
82
+ if bt = Byebug.debug_load(Byebug::PROG_SCRIPT, options.stop)
84
83
  print bt.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
85
84
  print "Uncaught exception: #{bt}\n"
86
85
  end
@@ -103,8 +102,8 @@ end
103
102
 
104
103
  options = OpenStruct.new(
105
104
  'annotate' => Byebug.annotate,
106
- 'no_rewrite_program' => false,
107
105
  'nx' => false,
106
+ 'post_mortem' => false,
108
107
  'quit' => true,
109
108
  'restart_script' => nil,
110
109
  'script' => nil,
@@ -132,12 +131,12 @@ EOB
132
131
  |path| $LOAD_PATH.unshift(*path.split(':')) }
133
132
  opts.on('--no-quit', 'Do not quit when script finishes') {
134
133
  options.quit = false }
135
- opts.on('--no-rewrite-program', 'Don\'t set $0 to the program debugged') {
136
- options.no_rewrite_program = true }
137
134
  opts.on('--no-stop', 'Do not stop when script is loaded') {
138
135
  options.stop = false }
139
136
  opts.on('-nx', 'Don\'t run any byebug initialization files') {
140
137
  options.nx = true }
138
+ opts.on('--post-mortem', 'Run byebug in post-mortem mode') {
139
+ options.post_mortem = true }
141
140
  opts.on('-r', '--require SCRIPT', String, 'Require library before script') {
142
141
  |name| if name == 'debug'
143
142
  puts 'byebug not compatible with Ruby\'s \'debug\' lib, option ignored'
@@ -227,7 +226,7 @@ prog_script = whence_file(prog_script) unless File.exist?(prog_script)
227
226
  Byebug::PROG_SCRIPT = File.expand_path prog_script
228
227
 
229
228
  # Set up trace hook for byebug
230
- Byebug.start
229
+ Byebug.start post_mortem: options.post_mortem
231
230
 
232
231
  # load initrc script (e.g. .byebugrc)
233
232
  Byebug.run_init_script(StringIO.new) unless options.nx
@@ -247,10 +246,7 @@ end
247
246
  options.stop = false if options.tracing
248
247
  Byebug.tracing = options.tracing
249
248
 
250
- if !options.quit
251
- if Byebug.started?
252
- until Byebug.stop do end
253
- end
249
+ loop do
254
250
  begin
255
251
  debug_program(options)
256
252
  rescue SyntaxError
@@ -260,13 +256,13 @@ if !options.quit
260
256
  print $!.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
261
257
  print "Uncaught exception: #{$!}\n"
262
258
  end
263
- print "The program finished.\n" unless
264
- Byebug.annotate.to_i > 1 # annotate has its own way
259
+ print "The program finished.\n" unless Byebug.annotate.to_i > 1
260
+
261
+ break if options.quit
262
+
265
263
  interface = Byebug::LocalInterface.new
266
264
  # Not sure if ControlCommandProcessor is really the right
267
265
  # thing to use. CommandProcessor requires a state.
268
266
  processor = Byebug::ControlCommandProcessor.new(interface)
269
267
  processor.process_commands
270
- else
271
- debug_program(options)
272
268
  end
@@ -29,5 +29,4 @@ Gem::Specification.new do |s|
29
29
  s.add_development_dependency 'rake', '~> 10.0.4'
30
30
  s.add_development_dependency 'rake-compiler', '~> 0.8.3'
31
31
  s.add_development_dependency 'mocha', '~> 0.14.0'
32
- s.add_development_dependency 'minitest', '~> 5.0.3'
33
32
  end
@@ -449,11 +449,12 @@ Byebug_load(int argc, VALUE *argv, VALUE self)
449
449
  {
450
450
  VALUE file, stop, context_obj;
451
451
  debug_context_t *dc;
452
+ VALUE status = Qnil;
452
453
  int state = 0;
453
454
 
454
455
  if (rb_scan_args(argc, argv, "11", &file, &stop) == 1)
455
456
  {
456
- stop = Qfalse;
457
+ stop = Qfalse;
457
458
  }
458
459
 
459
460
  Byebug_start(self);
@@ -470,17 +471,15 @@ Byebug_load(int argc, VALUE *argv, VALUE self)
470
471
  rb_load_protect(file, 0, &state);
471
472
  if (0 != state)
472
473
  {
473
- VALUE errinfo = rb_errinfo();
474
- reset_stepping_stop_points(dc);
475
- rb_set_errinfo(Qnil);
476
- return errinfo;
474
+ status = rb_errinfo();
475
+ reset_stepping_stop_points(dc);
477
476
  }
478
477
 
479
478
  /* We should run all at_exit handler's in order to provide, for instance, a
480
479
  * chance to run all defined test cases */
481
480
  rb_exec_end_proc();
482
481
 
483
- return Qnil;
482
+ return status;
484
483
  }
485
484
 
486
485
  static VALUE
@@ -111,15 +111,13 @@ module Byebug
111
111
  Byebug.const_set('INITIAL_DIR', Dir.pwd) unless defined? Byebug::INITIAL_DIR
112
112
  end
113
113
  Byebug.tracing = options[:tracing] unless options[:tracing].nil?
114
- Byebug.start_sentinal=caller(0)[1]
114
+ Byebug.start_sentinal = caller[0]
115
115
  if Byebug.started?
116
116
  retval = block && block.call(self)
117
117
  else
118
118
  retval = Byebug._start(&block)
119
119
  end
120
- if options[:post_mortem]
121
- post_mortem
122
- end
120
+ post_mortem if options[:post_mortem]
123
121
  return retval
124
122
  end
125
123
 
@@ -189,7 +187,7 @@ module Byebug
189
187
  return if self.post_mortem?
190
188
  self.post_mortem = true
191
189
  debug_at_exit do
192
- handle_post_mortem($!) if $! && post_mortem?
190
+ handle_post_mortem($!) if post_mortem?
193
191
  end
194
192
  end
195
193
  end
@@ -286,9 +284,9 @@ module Rails
286
284
  ::Byebug.start
287
285
  puts "=> Byebug enabled"
288
286
  rescue LoadError
289
- puts "You're missing the 'byebug' gem. Add it to your Gemfile, bundle " \
290
- "it and try again."
291
- exit(1)
287
+ puts "You're missing the 'byebug' gem. Add it to your Gemfile, " \
288
+ "bundle it and try again."
289
+ exit
292
290
  end
293
291
 
294
292
  def call(env)
@@ -296,4 +294,15 @@ module Rails
296
294
  end
297
295
  end
298
296
  end
297
+
298
+ class Console
299
+ def require_debugger
300
+ require 'byebug'
301
+ puts "=> Byebug enabled"
302
+ rescue LoadError
303
+ puts "You're missing the 'byebug' gem. Add it to your Gemfile, bundle, " \
304
+ "it and try again."
305
+ exit
306
+ end
307
+ end
299
308
  end