pry-byebug 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c42e1d5a58d90aa640bcd1e79be383d78286fc66
4
- data.tar.gz: 32cf706c69453f75a70729fa4caf95b023642379
3
+ metadata.gz: 4b3ed5737036fb3e67543d8df53880500db2ea98
4
+ data.tar.gz: f4130936f658687b08af6ee8bed74e8554b6a77b
5
5
  SHA512:
6
- metadata.gz: d4e5826a3e0d91869ff79953c45e475d0ecb5252e50171a5ad18f8a667625558690af3b00e09d0b8ccb68c55257e5bc0f285edb85334388fd7a4b8ea9c6ce826
7
- data.tar.gz: e87f0c3fe28da82b42e2146c108ae73b0832b4bc10d1f1b54baaefccf639580d8874cc5c7a1149fbd46500969ce3b55bd4e13b81531f1d05913735ad389fd193
6
+ metadata.gz: a361fb51061ca0c6efd216623dca9754173352dcca012a82f48b80fffb767fbe1e39b649213c15b1737275f19ef6943394a9c3310dc9da7f2d9651f685d009d6
7
+ data.tar.gz: aeb8e5bed91c15c156cd739906791469369b55787a38a1c7212d3441f75ad6978b984877eae54d05814258205416ae17daa1da3bffe90434187bcfafc1b70f2d
@@ -1,4 +1,10 @@
1
- ## 3.0.0 (Unreleased)
1
+ ## 3.0.1 (2015-04-02)
2
+
3
+ - Improvements:
4
+ * Fix several formatting and alignment issues.
5
+
6
+
7
+ ## 3.0.0 (2015-02-02)
2
8
 
3
9
  - Improvements:
4
10
  * Adds RuboCop to enforce a consistent code style.
@@ -76,7 +76,7 @@ module Byebug
76
76
  def at_breakpoint(_context, breakpoint)
77
77
  @pry ||= Pry.new
78
78
 
79
- brkpt_num = "\nBreakpoint #{breakpoint.id}. "
79
+ brkpt_num = "\n Breakpoint #{breakpoint.id}. "
80
80
  @pry.output.print Pry::Helpers::Text.bold(brkpt_num)
81
81
 
82
82
  n_hits = breakpoint.hit_count
@@ -2,5 +2,5 @@
2
2
  # Main container module for Pry-Byebug functionality
3
3
  #
4
4
  module PryByebug
5
- VERSION = '3.0.0'
5
+ VERSION = '3.0.1'
6
6
  end
@@ -134,15 +134,14 @@ class Pry
134
134
  end
135
135
 
136
136
  def process
137
- if breakpoints.count == 0
138
- return output.puts(text.bold('No breakpoints defined.'))
139
- end
137
+ return bold_puts('No breakpoints defined.') if breakpoints.count == 0
140
138
 
141
139
  if opts.verbose?
142
140
  breakpoints.each { |b| print_full_breakpoint(b) }
143
141
  else
144
142
  print_breakpoints_header
145
143
  breakpoints.each { |b| print_short_breakpoint(b) }
144
+ output.puts
146
145
  end
147
146
  end
148
147
  end
@@ -169,36 +168,41 @@ class Pry
169
168
  # Includes surrounding code at that point.
170
169
  #
171
170
  def print_full_breakpoint(br)
172
- header = text.bold("Breakpoint #{br.id}:")
173
- status = br.enabled? ? '(Enabled)' : '(Disabled)'
171
+ header = "Breakpoint #{br.id}:"
172
+ status = br.enabled? ? 'Enabled' : 'Disabled'
174
173
  code = br.source_code.with_line_numbers.to_s
175
174
  condition = br.expr ? "#{text.bold('Condition:')} #{br.expr}\n" : ''
176
175
 
177
- output.puts("#{header} #{br} #{status} :\n#{condition}#{code}\n")
176
+ output.puts <<-EOP.gsub(/ {8}/, '')
177
+
178
+ #{text.bold(header)} #{br} (#{status}) #{condition}
179
+
180
+ #{code}
181
+
182
+ EOP
178
183
  end
179
184
 
180
185
  #
181
186
  # Print out concise information about a breakpoint.
182
187
  #
183
188
  def print_short_breakpoint(breakpoint)
184
- id = sprintf('%*d ', max_width, breakpoint.id)
189
+ id = sprintf('%*d', max_width, breakpoint.id)
185
190
  status = breakpoint.enabled? ? 'Yes' : 'No'
186
191
  expr = breakpoint.expr ? breakpoint.expr : ''
187
192
 
188
- output.puts("#{id} #{status} #{breakpoint} #{expr}")
193
+ output.puts(" #{id} #{status} #{breakpoint} #{expr}")
189
194
  end
190
195
 
191
196
  #
192
197
  # Prints a header for the breakpoint list.
193
198
  #
194
199
  def print_breakpoints_header
195
- header = "#{' ' * (max_width - 1)}# Enabled At "
200
+ header = "#{' ' * (max_width - 1)}# Enabled At "
196
201
 
197
- output.puts <<-EOP
202
+ output.puts <<-EOP.gsub(/ {8}/, '')
198
203
 
199
204
  #{text.bold(header)}
200
205
  #{text.bold('-' * header.size)}
201
-
202
206
  EOP
203
207
  end
204
208
 
@@ -206,7 +210,7 @@ class Pry
206
210
  # Max width of breakpoints id column
207
211
  #
208
212
  def max_width
209
- [Math.log10(breakpoints.count).ceil, 1].max
213
+ ::Byebug.breakpoints.last.id.to_s.length
210
214
  end
211
215
  end
212
216
  end
@@ -53,7 +53,7 @@ module BreakpointSpecs
53
53
 
54
54
  def test_shows_breakpoint_hit
55
55
  match = @output.string.match(@regexp)
56
- @output.string.must_match(/^Breakpoint #{match[:id]}\. First hit/)
56
+ @output.string.must_match(/^ Breakpoint #{match[:id]}\. First hit/)
57
57
  end
58
58
 
59
59
  def test_shows_breakpoint_line
@@ -84,7 +84,7 @@ class BreakpointsTestCommands < Minitest::Spec
84
84
  @input = InputTester.new('break 7')
85
85
  redirect_pry_io(@input, @output) { load break_first_file }
86
86
  @line = 7
87
- @regexp = /^Breakpoint (?<id>\d+): #{break_first_file} @ 7 \(Enabled\)/
87
+ @regexp = / Breakpoint (?<id>\d+): #{break_first_file} @ 7 \(Enabled\)/
88
88
  end
89
89
 
90
90
  include BreakpointSpecs
@@ -95,7 +95,7 @@ class BreakpointsTestCommands < Minitest::Spec
95
95
  @input = InputTester.new('break Break1Example#a')
96
96
  redirect_pry_io(@input, @output) { load break_first_file }
97
97
  @line = 7
98
- @regexp = /Breakpoint (?<id>\d+): Break1Example#a \(Enabled\)/
98
+ @regexp = / Breakpoint (?<id>\d+): Break1Example#a \(Enabled\)/
99
99
  end
100
100
 
101
101
  include BreakpointSpecs
@@ -106,7 +106,7 @@ class BreakpointsTestCommands < Minitest::Spec
106
106
  @input = InputTester.new('break Break1Example#c!')
107
107
  redirect_pry_io(@input, @output) { load break_first_file }
108
108
  @line = 17
109
- @regexp = /Breakpoint (?<id>\d+): Break1Example#c! \(Enabled\)/
109
+ @regexp = / Breakpoint (?<id>\d+): Break1Example#c! \(Enabled\)/
110
110
  end
111
111
 
112
112
  include BreakpointSpecs
@@ -117,7 +117,7 @@ class BreakpointsTestCommands < Minitest::Spec
117
117
  @input = InputTester.new('break #b')
118
118
  redirect_pry_io(@input, @output) { load break_second_file }
119
119
  @line = 11
120
- @regexp = /Breakpoint (?<id>\d+): Break2Example#b \(Enabled\)/
120
+ @regexp = / Breakpoint (?<id>\d+): Break2Example#b \(Enabled\)/
121
121
  end
122
122
 
123
123
  include BreakpointSpecs
@@ -133,5 +133,11 @@ class BreakpointsTestCommands < Minitest::Spec
133
133
  it 'shows all breakpoints' do
134
134
  @output.string.must_match(/Yes \s*Break2Example#b/)
135
135
  end
136
+
137
+ it 'properly aligns headers' do
138
+ width = Byebug.breakpoints.last.id.to_s.length
139
+ @output.string.must_match(/ {#{width - 1}}# Enabled At/)
140
+ @output.string.must_match(/ \d{#{width}} Yes Break2Example#b/)
141
+ end
136
142
  end
137
143
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-byebug
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rodríguez
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-02 00:00:00.000000000 Z
12
+ date: 2015-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry