byebug 6.0.1 → 6.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbe8d8d298e3c0b99567a1f38024883979f90910
4
- data.tar.gz: 2b39f4c8cd9d970ae1e2d2c29ed4462cf35d322b
3
+ metadata.gz: 9bd941f093c6a49a371dfefe4cb06d9285eb5154
4
+ data.tar.gz: cc056395c95ece29b62647a4875d759ac18708c6
5
5
  SHA512:
6
- metadata.gz: e8450631530abd699cf86afdfe4787676aa3e4c405c20fadb1acc455dff420b3afbfda3d2e4cab6d0f6a2ae6306e01d8f76b48330efcb69fe8f4182a9bbb5d82
7
- data.tar.gz: b992d11ab40ad0641be835e4ecc3b2643fc24d88a19fba43d5f7aa95f2b234011506d9328e6d7e0cad68dbb9e9f906e78a646aa252251ff73b7a1a2c30e94d9a
6
+ metadata.gz: 092d68626a8dc9190494a66d84405c5e36b709e1ca2548eb4b76e7b949aa1605548e3cc7a19aeb5988cc1480adfc21619f5603dce31471020ef2c04c83c287e7
7
+ data.tar.gz: e6d15db6847705de02000c299a1ca7be98d63e4f15ac306348a82d19d9667f90451c01dbee66c12744d4166f558bffbb1cf9f3ac7f46861b3cbde8257cda2576
@@ -1,3 +1,8 @@
1
+ ## 6.0.2 - 2015-08-20
2
+ ### Fixed
3
+ * The user should always be given back a prompt unless (s)he explicitly states
4
+ the opposite. This provides a more general fix to the bug resolved in 6.0.1.
5
+
1
6
  ## 6.0.1 - 2015-08-19
2
7
  ### Fixed
3
8
  * Bug in evaluation where the user would lose the command prompt when entering
@@ -45,8 +45,6 @@ module Byebug
45
45
 
46
46
  errmsg(pr('break.errors.expression', expr: @match[2]))
47
47
  b.enabled = false
48
- rescue => e
49
- errmsg(e.message)
50
48
  end
51
49
 
52
50
  private
@@ -35,8 +35,6 @@ module Byebug
35
35
  return help_for(@match[1], command) unless @match[2]
36
36
 
37
37
  help_for(@match[2], subcommand)
38
- rescue => e
39
- errmsg(e.message)
40
38
  end
41
39
 
42
40
  private
@@ -30,7 +30,7 @@ module Byebug
30
30
  history = processor.interface.history
31
31
 
32
32
  if @match[:num_cmds]
33
- size, = get_int(@match[:num_cmds], 'history', 1, history.size)
33
+ size, err = get_int(@match[:num_cmds], 'history', 1, history.size)
34
34
  return errmsg(err) unless size
35
35
  end
36
36
 
@@ -36,11 +36,11 @@ module Byebug
36
36
 
37
37
  def execute
38
38
  msg = "No sourcefile available for #{frame.file}"
39
- return errmsg(msg) unless File.exist?(frame.file)
39
+ fail(msg) unless File.exist?(frame.file)
40
40
 
41
41
  max_lines = n_lines(frame.file)
42
42
  b, e = range(@match[2], max_lines)
43
- return errmsg('Invalid line range') unless valid_range?(b, e, max_lines)
43
+ fail('Invalid line range') unless valid_range?(b, e, max_lines)
44
44
 
45
45
  display_lines(b, e)
46
46
 
@@ -85,11 +85,11 @@ module Byebug
85
85
 
86
86
  def parse_range(input, size, max_line)
87
87
  first, err = get_int(lower_bound(input), 'List', 1, max_line)
88
- return [-1, -1] if err
88
+ fail(err) unless first
89
89
 
90
90
  if upper_bound(input)
91
- last, = get_int(upper_bound(input), 'List', 1, max_line)
92
- return [-1, -1] unless last
91
+ last, err = get_int(upper_bound(input), 'List', 1, max_line)
92
+ fail(err) unless last
93
93
 
94
94
  last = amend(last, max_line)
95
95
  else
@@ -14,17 +14,16 @@ module Byebug
14
14
  #
15
15
  def get_int(str, cmd, min = nil, max = nil)
16
16
  if str !~ /\A-?[0-9]+\z/
17
- err = pr('parse.errors.int.not_number', cmd: cmd, str: str)
18
- return nil, errmsg(err)
17
+ return nil, pr('parse.errors.int.not_number', cmd: cmd, str: str)
19
18
  end
20
19
 
21
20
  int = str.to_i
22
21
  if min && int < min
23
22
  err = pr('parse.errors.int.too_low', cmd: cmd, str: str, min: min)
24
- return min, errmsg(err)
23
+ return nil, err
25
24
  elsif max && int > max
26
25
  err = pr('parse.errors.int.too_high', cmd: cmd, str: str, max: max)
27
- return max, errmsg(err)
26
+ return nil, err
28
27
  end
29
28
 
30
29
  int
@@ -9,30 +9,12 @@ module Byebug
9
9
  end
10
10
 
11
11
  def thread_arguments(ctx)
12
- status_flag = if ctx.suspended?
13
- '$'
14
- else
15
- current_thread?(ctx) ? '+' : ' '
16
- end
17
-
18
- debug_flag = ctx.ignored? ? '!' : ' '
19
-
20
- # Check whether it is Byebug.current_context or context
21
- if ctx == Byebug.current_context
22
- file_line = context.location
23
- else
24
- backtrace = ctx.thread.backtrace_locations
25
- if backtrace && backtrace[0]
26
- file_line = "#{backtrace[0].path}:#{backtrace[0].lineno}"
27
- end
28
- end
29
-
30
12
  {
31
- status_flag: status_flag,
32
- debug_flag: debug_flag,
13
+ status_flag: status_flag(ctx),
14
+ debug_flag: debug_flag(ctx),
33
15
  id: ctx.thnum,
34
16
  thread: ctx.thread.inspect,
35
- file_line: file_line || '',
17
+ file_line: location(ctx),
36
18
  pid: Process.pid,
37
19
  status: ctx.thread.status,
38
20
  current: current_thread?(ctx)
@@ -54,6 +36,28 @@ module Byebug
54
36
 
55
37
  [ctx, err]
56
38
  end
39
+
40
+ private
41
+
42
+ # TODO: Check whether it is Byebug.current_context or context
43
+ def location(ctx)
44
+ return context.location if ctx == Byebug.current_context
45
+
46
+ backtrace = ctx.thread.backtrace_locations
47
+ return '' unless backtrace && backtrace[0]
48
+
49
+ "#{backtrace[0].path}:#{backtrace[0].lineno}"
50
+ end
51
+
52
+ def status_flag(ctx)
53
+ return '$' if ctx.suspended?
54
+
55
+ current_thread?(ctx) ? '+' : ' '
56
+ end
57
+
58
+ def debug_flag(ctx)
59
+ ctx.ignored? ? '!' : ' '
60
+ end
57
61
  end
58
62
  end
59
63
  end
@@ -156,6 +156,8 @@ module Byebug
156
156
  return command.new(self, input).execute if command
157
157
 
158
158
  puts thread_safe_eval(input)
159
+ rescue => e
160
+ errmsg(e.message)
159
161
  end
160
162
  end
161
163
  end
@@ -19,14 +19,13 @@ module Byebug
19
19
  # Delegates to subcommands or prints help if no subcommand specified.
20
20
  #
21
21
  def execute
22
- return puts(help) unless @match[1]
22
+ subcmd_name = @match[1]
23
+ return puts(help) unless subcmd_name
23
24
 
24
- subcmd = subcommand_list.match(@match[1])
25
- fail CommandNotFound.new(@match[1], self.class) unless subcmd
25
+ subcmd = subcommand_list.match(subcmd_name)
26
+ fail CommandNotFound.new(subcmd_name, self.class) unless subcmd
26
27
 
27
28
  subcmd.new(processor, arguments).execute
28
- rescue => e
29
- errmsg(e.message)
30
29
  end
31
30
 
32
31
  #
@@ -2,5 +2,5 @@
2
2
  # Reopen main module to define the library version
3
3
  #
4
4
  module Byebug
5
- VERSION = '6.0.1'
5
+ VERSION = '6.0.2'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodriguez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-08-19 00:00:00.000000000 Z
13
+ date: 2015-08-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler