Hello community, here is the log from the commit of package rubygem-byebug for openSUSE:Factory checked in at 2016-05-23 16:37:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-byebug (Old) and /work/SRC/openSUSE:Factory/.rubygem-byebug.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-byebug" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-byebug/rubygem-byebug.changes 2016-04-14 13:06:50.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-byebug.new/rubygem-byebug.changes 2016-05-23 16:37:18.000000000 +0200 @@ -1,0 +2,36 @@ +Thu May 19 11:11:13 UTC 2016 - [email protected] + +- updated to version 9.0.3 + see installed CHANGELOG.md: + + ## 9.0.3 - 2016-05-16 + ### Fixed + * Unfriendly output in byebug's executable when no script specified (#256). + * Unfriendly output in byebug's executable when script doesn't exist. + * Unfriendly output in byebug's executable when script has invalid code. + ## 9.0.2 - 2016-05-15 + ### Fixed + * Skip to get a line in eval context (#263, thanks @k0kubun). + * Debugger getting disabled after `continue` even when linetrace is enabled + (#264, thanks @k0kubun). + ## 9.0.1 - 2016-05-14 + ### Fixed + * `quit` never exiting when remote debugging (#201). + ## 9.0.0 - 2016-05-11 + ### Fixed + * `irb` command unintentionally changing $PROGRAM_NAME. + * `pry` command failing. + * Unrelated error message when using `pry` command and Pry not installed. + * Interrupting program execution from remote control interface (#239, thanks + @izaera). + ### Removed + * Official Ruby 2.0.0 support. `var local` no longer works in Ruby 2.0. The + rest of the commands should still work as before, but `byebug` is no longer + tested against this version so they might start breaking in the + future. + ## 8.2.5 - 2016-04-27 + ### Fixed + * Allows paths with spaces (#244, thanks @HookyQR). + * Allows paths with colons (#244, thanks @HookyQR). + +------------------------------------------------------------------- Old: ---- byebug-8.2.4.gem New: ---- byebug-9.0.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-byebug.spec ++++++ --- /var/tmp/diff_new_pack.n79Wd0/_old 2016-05-23 16:37:19.000000000 +0200 +++ /var/tmp/diff_new_pack.n79Wd0/_new 2016-05-23 16:37:19.000000000 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-byebug -Version: 8.2.4 +Version: 9.0.3 Release: 0 %define mod_name byebug %define mod_full_name %{mod_name}-%{version} ++++++ byebug-8.2.4.gem -> byebug-9.0.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2016-04-08 12:31:52.000000000 +0200 +++ new/CHANGELOG.md 2016-05-16 09:42:32.000000000 +0200 @@ -2,6 +2,52 @@ ## Master (Unreleased) +## 9.0.3 - 2016-05-16 + +### Fixed + +* Unfriendly output in byebug's executable when no script specified (#256). +* Unfriendly output in byebug's executable when script doesn't exist. +* Unfriendly output in byebug's executable when script has invalid code. + +## 9.0.2 - 2016-05-15 + +### Fixed + +* Skip to get a line in eval context (#263, thanks @k0kubun). +* Debugger getting disabled after `continue` even when linetrace is enabled + (#264, thanks @k0kubun). + +## 9.0.1 - 2016-05-14 + +### Fixed + +* `quit` never exiting when remote debugging (#201). + +## 9.0.0 - 2016-05-11 + +### Fixed + +* `irb` command unintentionally changing $PROGRAM_NAME. +* `pry` command failing. +* Unrelated error message when using `pry` command and Pry not installed. +* Interrupting program execution from remote control interface (#239, thanks + @izaera). + +### Removed + +* Official Ruby 2.0.0 support. `var local` no longer works in Ruby 2.0. The + rest of the commands should still work as before, but `byebug` is no longer + tested against this version so they might start breaking in the + future. + +## 8.2.5 - 2016-04-27 + +### Fixed + +* Allows paths with spaces (#244, thanks @HookyQR). +* Allows paths with colons (#244, thanks @HookyQR). + ## 8.2.4 - 2016-04-08 ### Fixed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CONTRIBUTING.md new/CONTRIBUTING.md --- old/CONTRIBUTING.md 2016-04-08 12:31:52.000000000 +0200 +++ new/CONTRIBUTING.md 2016-05-16 09:42:32.000000000 +0200 @@ -1,10 +1,10 @@ -## Contributing to Byebug +# CONTRIBUTING Please note that this project is released with a [Contributor Code of Conduct](code_of_conduct.md). By participating in this project you agree to abide by its terms. -### Bug Reports +## Bug Reports * Try to reproduce the issue against the latest revision. There might be unrealeased work that fixes your problem! @@ -14,7 +14,7 @@ * Include the behavior you observed along with the behavior you expected, and why you expected it. -### Development dependencies +## Development dependencies * `Byebug` depends on Ruby's TracePoint API provided by `ruby-core`. This is a young API and a lot of bugs have been recently corrected, so make sure you @@ -24,7 +24,7 @@ * Running `bundle install` inside a local clone of `byebug` will get development dependencies installed. -### Running the test suite +## Running the test suite * Make sure you compile the C-extension using `bundle exec rake compile`. Otherwise you won't be able to use `byebug`. @@ -45,7 +45,7 @@ example: `script/minitest_runner.rb Byebug::BreakAtLinesTestCase test_catch_removes_specific_catchpoint` -### Code style +## Code style * Byebug uses [overcommit][] to enforce code style. Install the git hooks using `bundle exec overcommit --install`. They will review your changes before they @@ -53,7 +53,7 @@ [overcommit]: https://github.com/brigade/overcommit/ -### Byebug as a C-extension +## Byebug as a C-extension Byebug is a gem developed as a C-extension. The debugger internal's functionality is implemented in C (the interaction with the TracePoint API). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GUIDE.md new/GUIDE.md --- old/GUIDE.md 2016-04-08 12:31:52.000000000 +0200 +++ new/GUIDE.md 2016-05-16 09:42:32.000000000 +0200 @@ -1,3 +1,7 @@ +# GUIDE + +## Introduction + ### First Steps A handful of commands are enough to get started using `byebug`. The following @@ -610,10 +614,6 @@ program). In this section we'll consider some other things that might throw off new users to Ruby who are familiar with other languages and debugging in them. -* Bouncing Around in Blocks (iterators) -* No Parameter Values in a Call Stack -* Lines You Can Stop At - #### Bouncing Around in Blocks (iterators) When debugging languages with coroutines like Python and Ruby, a method call may @@ -1600,7 +1600,7 @@ later. To do that, use `disable display` or `enable display` followed by the expression number. -### Evaluation of expressions: display +### Evaluation of expressions: irb, pry To examine and change data in your script you can just evaluate any Ruby code from `byebug`'s prompt. Any input that is not recognized as a command will be @@ -1631,23 +1631,9 @@ 9: 10: if __FILE__ == $0 (byebug) irb -2.0.0-p247 :001 > (0..6).inject{|sum, i| sum +=i} +irb(main):001:0> (0..6).inject { |sum, i| sum += i } => 21 -2.0.0-p247 :002 > exit -/home/davidr/Proyectos/byebug/old_doc/triangle.rb @ 2 -def triangle(n) -(byebug) list # same line range as before going into irb -[1, 10] in /path/to/triangle.rb - 1: # Compute the n'th triangle number, the hard way: triangle(n) == (n*(n+1))/2 -=> 2: def triangle(n) - 3: tri = 0 - 4: 0.upto(n) do |i| - 5: tri += i - 6: end - 7: tri - 8: end - 9: - 10: if __FILE__ == $0 +irb(main):002:0> exit (byebug) ``` Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/byebug/breakpoint.c new/ext/byebug/breakpoint.c --- old/ext/byebug/breakpoint.c 2016-04-08 12:31:52.000000000 +0200 +++ new/ext/byebug/breakpoint.c 2016-05-16 09:42:32.000000000 +0200 @@ -277,7 +277,7 @@ return Qnil; } -int +static int filename_cmp_impl(VALUE source, char *file) { char *source_ptr, *file_ptr; @@ -309,7 +309,7 @@ return 1; } -int +static int filename_cmp(VALUE source, char *file) { #ifdef _WIN32 @@ -332,7 +332,7 @@ #endif } -int +static int classname_cmp(VALUE name, VALUE klass) { VALUE mod_name; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/byebug/byebug.c new/ext/byebug/byebug.c --- old/ext/byebug/byebug.c 2016-04-08 12:31:52.000000000 +0200 +++ new/ext/byebug/byebug.c 2016-05-16 09:42:32.000000000 +0200 @@ -37,9 +37,9 @@ /* * call-seq: - * Byebug.catchpoints -> array + * Byebug.catchpoints -> hash * - * Returns an array of catchpoints. + * Returns the catchpoints hash. */ static VALUE Catchpoints(VALUE self) @@ -352,7 +352,7 @@ { file = rb_tracearg_path(trace_arg); /* - * TODO: Sometimes the TracePoint API gives some return events without + * @todo Sometimes the TracePoint API gives some return events without * file:line information, so we need to guard for nil until we know what's * going on. This happens, for example, with active_support core extensions: * @@ -676,6 +676,9 @@ if (post_mortem == Qtrue) return Qfalse; + if (RTEST(tracing)) + return Qfalse; + context = Current_context(self); if (!NIL_P(context)) { @@ -841,7 +844,7 @@ * call-seq: * Byebug.add_catchpoint(exception) -> exception * - * Adds a new exception to the catchpoints array. + * Adds a new exception to the catchpoints hash. */ static VALUE Add_catchpoint(VALUE self, VALUE value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/byebug/byebug.h new/ext/byebug/byebug.h --- old/ext/byebug/byebug.h 2016-04-08 12:31:52.000000000 +0200 +++ new/ext/byebug/byebug.h 2016-05-16 09:42:32.000000000 +0200 @@ -93,7 +93,6 @@ } breakpoint_t; /* functions from locker.c */ -extern int is_in_locked(VALUE thread_id); extern void add_to_locked(VALUE thread); extern VALUE pop_from_locked(); extern void remove_from_locked(VALUE thread); @@ -121,9 +120,6 @@ /* functions from breakpoint.c */ extern void Init_breakpoint(VALUE mByebug); -extern VALUE catchpoint_hit_count(VALUE catchpoints, VALUE exception, - VALUE * exception_name); - extern VALUE find_breakpoint_by_pos(VALUE breakpoints, VALUE source, VALUE pos, VALUE bind); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/byebug/locker.c new/ext/byebug/locker.c --- old/ext/byebug/locker.c 2016-04-08 12:31:52.000000000 +0200 +++ new/ext/byebug/locker.c 2016-05-16 09:42:32.000000000 +0200 @@ -13,7 +13,7 @@ static locked_thread_t *locked_head = NULL; static locked_thread_t *locked_tail = NULL; -extern int +static int is_in_locked(VALUE thread) { locked_thread_t *node; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ext/byebug/threads.c new/ext/byebug/threads.c --- old/ext/byebug/threads.c 2016-04-08 12:31:52.000000000 +0200 +++ new/ext/byebug/threads.c 2016-05-16 09:42:32.000000000 +0200 @@ -7,7 +7,7 @@ VALUE next_thread = Qnil; /* To allow thread syncronization, we must stop threads when debugging */ -VALUE locker = Qnil; +static VALUE locker = Qnil; static int t_tbl_mark_keyvalue(st_data_t key, st_data_t value, st_data_t tbl) @@ -97,7 +97,7 @@ /* * Checks threads table for dead/finished threads. */ -void +static void cleanup_dead_threads(void) { threads_table_t *t_tbl; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/commands/break.rb new/lib/byebug/commands/break.rb --- old/lib/byebug/commands/break.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/commands/break.rb 2016-05-16 09:42:32.000000000 +0200 @@ -15,7 +15,7 @@ self.allow_in_control = true def self.regexp - /^\s* b(?:reak)? (?:\s+ (\S+))? (?:\s+ if \s+(.+))? \s*$/x + /^\s* b(?:reak)? (?:\s+ (.+?))? (?:\s+ if \s+(.+))? \s*$/x end def self.description @@ -52,7 +52,7 @@ def line_breakpoint(location) line_match = location.match(/^(\d+)$/) - file_line_match = location.match(/^([^:]+):(\d+)$/) + file_line_match = location.match(/^(.+):(\d+)$/) return unless line_match || file_line_match file = line_match ? frame.file : file_line_match[1] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/commands/edit.rb new/lib/byebug/commands/edit.rb --- old/lib/byebug/commands/edit.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/commands/edit.rb 2016-05-16 09:42:32.000000000 +0200 @@ -35,7 +35,7 @@ cmd = line ? "#{editor} +#{line} #{file}" : "#{editor} #{file}" - system(cmd) + Kernel.system(cmd) end private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/commands/info/file.rb new/lib/byebug/commands/info/file.rb --- old/lib/byebug/commands/info/file.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/commands/info/file.rb 2016-05-16 09:42:32.000000000 +0200 @@ -14,7 +14,7 @@ self.allow_in_post_mortem = true def self.regexp - /^\s* f(?:ile)? (?:\s+ (\S+))? \s*$/x + /^\s* f(?:ile)? (?:\s+ (.+))? \s*$/x end def self.description diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/commands/irb.rb new/lib/byebug/commands/irb.rb --- old/lib/byebug/commands/irb.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/commands/irb.rb 2016-05-16 09:42:32.000000000 +0200 @@ -25,12 +25,13 @@ end def execute - unless processor.interface.is_a?(LocalInterface) + unless processor.interface.instance_of?(LocalInterface) return errmsg(pr('base.errors.only_local')) end - # IRB tries to parse ARGV so we must clear it. See issue 197 - with_clean_argv { IRB.start(__FILE__) } + # @todo IRB tries to parse ARGV so we must clear it (see #197). Add a + # test case for it so we can remove this comment. + with_clean_argv { IRB.start } end private diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/commands/pry.rb new/lib/byebug/commands/pry.rb --- old/lib/byebug/commands/pry.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/commands/pry.rb 2016-05-16 09:42:32.000000000 +0200 @@ -25,17 +25,17 @@ end def execute - unless processor.interface.is_a?(LocalInterface) + unless processor.interface.instance_of?(LocalInterface) return errmsg(pr('base.errors.only_local')) end begin require 'pry' rescue LoadError - errmsg(pr('pry.errors.not_installed')) + return errmsg(pr('pry.errors.not_installed')) end - context.binding.pry + Pry.start(context.frame._binding) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/commands/restart.rb new/lib/byebug/commands/restart.rb --- old/lib/byebug/commands/restart.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/commands/restart.rb 2016-05-16 09:42:32.000000000 +0200 @@ -39,7 +39,7 @@ argv += (@match[:args] ? @match[:args].shellsplit : $ARGV.compact) puts pr('restart.success', cmd: argv.shelljoin) - exec(*argv) + Kernel.exec(*argv) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/frame.rb new/lib/byebug/frame.rb --- old/lib/byebug/frame.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/frame.rb 2016-05-16 09:42:32.000000000 +0200 @@ -47,13 +47,16 @@ # # Gets local variables for the frame. # - # TODO: Use brand new local_variable_get, local_variable_set and - # local_variable defined for rubies >= 2.1 + # @todo Use `Binding#local_variables` directly once we drop 2.1 support + # since it's a public method since ruby 2.2 # def locals return [] unless _binding - _binding.eval('local_variables.inject({}){|h, v| h[v] = eval(v.to_s); h}') + _binding.eval('local_variables').each_with_object({}) do |e, a| + a[e] = _binding.local_variable_get(e) + a + end end # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/helpers/file.rb new/lib/byebug/helpers/file.rb --- old/lib/byebug/helpers/file.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/helpers/file.rb 2016-05-16 09:42:32.000000000 +0200 @@ -54,7 +54,7 @@ # True for special files like -e, false otherwise # def virtual_file?(name) - ['(irb)', '-e', '(byebug)'].include?(name) + ['(irb)', '-e', '(byebug)', '(eval)'].include?(name) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/helpers/parse.rb new/lib/byebug/helpers/parse.rb --- old/lib/byebug/helpers/parse.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/helpers/parse.rb 2016-05-16 09:42:32.000000000 +0200 @@ -9,7 +9,7 @@ # # If either +min+ or +max+ is nil, that value has no bound. # - # TODO: Remove the `cmd` parameter. It has nothing to do with the method's + # @todo Remove the `cmd` parameter. It has nothing to do with the method's # purpose. # def get_int(str, cmd, min = nil, max = nil) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/helpers/thread.rb new/lib/byebug/helpers/thread.rb --- old/lib/byebug/helpers/thread.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/helpers/thread.rb 2016-05-16 09:42:32.000000000 +0200 @@ -28,10 +28,12 @@ def context_from_thread(thnum) ctx = Byebug.contexts.find { |c| c.thnum.to_s == thnum } - err = case - when ctx.nil? then pr('thread.errors.no_thread') - when ctx == context then pr('thread.errors.current_thread') - when ctx.ignored? then pr('thread.errors.ignored', arg: thnum) + err = if ctx.nil? + pr('thread.errors.no_thread') + elsif ctx == context + pr('thread.errors.current_thread') + elsif ctx.ignored? + pr('thread.errors.ignored', arg: thnum) end [ctx, err] @@ -39,7 +41,7 @@ private - # TODO: Check whether it is Byebug.current_context or context + # @todo Check whether it is Byebug.current_context or context def location(ctx) return context.location if ctx == Byebug.current_context diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/remote.rb new/lib/byebug/remote.rb --- old/lib/byebug/remote.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/remote.rb 2016-05-16 09:42:32.000000000 +0200 @@ -1,9 +1,10 @@ require 'socket' +require 'byebug/processors/control_processor' # # Remote debugging functionality. # -# TODO: Refactor & add tests +# @todo Refactor & add tests # module Byebug # Port number used for remote debugging @@ -73,27 +74,26 @@ # Connects to the remote byebug # def start_client(host = 'localhost', port = PORT) - Context.interface = LocalInterface.new + interface = LocalInterface.new puts 'Connecting to byebug server...' socket = TCPSocket.new(host, port) puts 'Connected.' - catch(:exit) do - while (line = socket.gets) - case line - when /^PROMPT (.*)$/ - input = Context.interface.read_command(Regexp.last_match[1]) - throw :exit unless input - socket.puts input - when /^CONFIRM (.*)$/ - input = Context.interface.confirm(Regexp.last_match[1]) - throw :exit unless input - socket.puts input - else - puts line - end + while (line = socket.gets) + case line + when /^PROMPT (.*)$/ + input = interface.read_command(Regexp.last_match[1]) + break unless input + socket.puts input + when /^CONFIRM (.*)$/ + input = interface.readline(Regexp.last_match[1]) + break unless input + socket.puts input + else + puts line end end + socket.close end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/runner.rb new/lib/byebug/runner.rb --- old/lib/byebug/runner.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/runner.rb 2016-05-16 09:42:32.000000000 +0200 @@ -14,21 +14,6 @@ include Helpers::ParseHelper # - # Error class signaling absence of a script to debug. - # - class NoScript < StandardError; end - - # - # Error class signaling a non existent script to debug. - # - class NonExistentScript < StandardError; end - - # - # Error class signaling a script with invalid Ruby syntax. - # - class InvalidScript < StandardError; end - - # # Special working modes that don't actually start the debugger. # attr_reader :help, :version, :remote @@ -63,7 +48,7 @@ def help=(text) @help ||= text - interface.puts("\n#{text}\n") + interface.puts("#{text}\n") end def version=(number) @@ -74,6 +59,8 @@ def remote=(host_and_port) @remote ||= Byebug.parse_host_and_port(host_and_port) + + Byebug.start_client(*@remote) end def init_script @@ -97,18 +84,11 @@ # Starts byebug to debug a program. # def run - prepare_options.order!($ARGV) - return if version || help - - if remote - Byebug.start_client(*remote) - return - end + option_parser.order!($ARGV) + return if non_script_option? || error_in_script? Byebug.run_init_script if init_script - setup_cmd_line_args - loop do debug_program @@ -127,8 +107,8 @@ # # Processes options passed from the command line. # - def prepare_options - OptionParser.new(banner, 25) do |opts| + def option_parser + @option_parser ||= OptionParser.new(banner, 25) do |opts| opts.banner = banner OptionSetter.new(self, opts).setup @@ -136,27 +116,61 @@ end # + # An option that doesn't need a script specified was given + # + def non_script_option? + version || help || remote + end + + # + # There is an error with the specified script + # + def error_in_script? + no_script? || non_existing_script? || invalid_script? + end + + # + # No script to debug specified + # + def no_script? + return false unless $ARGV.empty? + + print_error('You must specify a program to debug') + true + end + + # # Extracts debugged program from command line args. # - def setup_cmd_line_args + def non_existing_script? Byebug.mode = :standalone - raise(NoScript, 'You must specify a program to debug...') if $ARGV.empty? - program = which($ARGV.shift) program = which($ARGV.shift) if program == which('ruby') - raise(NonExistentScript, "The script doesn't exist") unless program - $PROGRAM_NAME = program + if program + $PROGRAM_NAME = program + false + else + print_error("The script doesn't exist") + true + end + end + + # + # Checks the debugged script has correct syntax + # + def invalid_script? + return false if syntax_valid?(File.read($PROGRAM_NAME)) + + print_error('The script has incorrect syntax') + true end # # Debugs a script only if syntax checks okay. # def debug_program - ok = syntax_valid?(File.read($PROGRAM_NAME)) - raise(InvalidScript, 'The script has incorrect syntax') unless ok - error = Byebug.debug_load($PROGRAM_NAME, stop) puts "#{error}\n#{error.backtrace}" if error end @@ -178,5 +192,13 @@ nil end + + # + # Prints an error message and a help string + # + def print_error(msg) + interface.errmsg(msg) + interface.puts(option_parser.help) + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/setting.rb new/lib/byebug/setting.rb --- old/lib/byebug/setting.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/setting.rb 2016-05-16 09:42:32.000000000 +0200 @@ -58,7 +58,7 @@ end # - # TODO: DRY this up. Very similar code exists in the CommandList class + # @todo DRY this up. Very similar code exists in the CommandList class # def help_all output = " List of supported settings:\n\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/byebug/version.rb new/lib/byebug/version.rb --- old/lib/byebug/version.rb 2016-04-08 12:31:52.000000000 +0200 +++ new/lib/byebug/version.rb 2016-05-16 09:42:32.000000000 +0200 @@ -3,5 +3,5 @@ # Reopen main module to define the library version # module Byebug - VERSION = '8.2.4'.freeze + VERSION = '9.0.3'.freeze end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2016-04-08 12:31:52.000000000 +0200 +++ new/metadata 2016-05-16 09:42:32.000000000 +0200 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: byebug version: !ruby/object:Gem::Version - version: 8.2.4 + version: 9.0.3 platform: ruby authors: - David Rodriguez @@ -10,7 +10,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2016-04-08 00:00:00.000000000 Z +date: 2016-05-16 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: bundler @@ -189,7 +189,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.6.0 +rubygems_version: 2.5.1 signing_key: specification_version: 4 summary: Ruby 2.0 fast debugger - base + CLI
