pry-byebug 1.0.0 → 1.1.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 +4 -4
- data/.gitignore +7 -8
- data/.travis.yml +6 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile +1 -1
- data/README.md +33 -64
- data/Rakefile +9 -0
- data/lib/pry-byebug/commands.rb +19 -8
- data/lib/pry-byebug/processor.rb +44 -54
- data/lib/pry-byebug/pry_ext.rb +1 -1
- data/lib/pry-byebug/version.rb +1 -1
- data/pry-byebug.gemspec +14 -12
- data/test/base_test.rb +14 -0
- data/test/breakpoints_test.rb +14 -0
- data/test/commands_test.rb +72 -0
- data/test/examples/stepping.rb +25 -0
- data/test/processor_test.rb +6 -0
- data/test/pry_ext_test.rb +6 -0
- data/test/pry_remote_ext_test.rb +6 -0
- data/test/test_helper.rb +34 -0
- metadata +59 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e1e394709d63ed2099ec627d75981a29885c9641
|
|
4
|
+
data.tar.gz: 1a79cdd78a21fde30ff264adcbeeec8c96af877c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 083288cd0f862524132bda50de9ac708ee173e39718bb0594ca176c043cfc49cd35eca27c8ed69b67d3ad70c5d5a3d2ff10e99ffd89c77f4ba509beb2ee7e0ff
|
|
7
|
+
data.tar.gz: 3c0224f0d2895b5f60745ef89d672fc0cc11ac260ddb19ce81ac139f5c9146d3b8615d1ddb9a6610150a01225e832884f541ce91fd77f7720828a9e85fc9db22
|
data/.gitignore
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
tmp
|
|
2
|
+
pkg
|
|
3
|
+
doc
|
|
4
|
+
|
|
3
5
|
.bundle
|
|
4
6
|
.config
|
|
5
7
|
.yardoc
|
|
6
8
|
.gdb_history
|
|
9
|
+
.ruby-gemset
|
|
10
|
+
.ruby-version
|
|
11
|
+
|
|
7
12
|
Gemfile.lock
|
|
8
13
|
InstalledFiles
|
|
9
14
|
_yardoc
|
|
10
15
|
coverage
|
|
11
|
-
doc/
|
|
12
16
|
lib/bundler/man
|
|
13
|
-
pkg
|
|
14
17
|
rdoc
|
|
15
|
-
spec/reports
|
|
16
|
-
test/tmp
|
|
17
|
-
test/version_tmp
|
|
18
|
-
tmp
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
## 1.
|
|
1
|
+
## 1.1.1 (2013-02-07)
|
|
2
|
+
|
|
3
|
+
* Adds some initial tests to the test suite
|
|
4
|
+
* Fixes bug when doing "step n" or "next n" where n > 1 right after binding.pry
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## 1.1.0 (2013-06-06)
|
|
8
|
+
|
|
9
|
+
* Adds a test suite (thanks @teeparham!)
|
|
10
|
+
* Uses byebug ~> 1.4.0
|
|
11
|
+
* Uses s, n, f and c aliases by default (thanks @jgakos!)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.0, 1.0.1 (2013-05-07)
|
|
2
15
|
|
|
3
16
|
* Forked from [pry-debugger](https://github.com/nixme/pry-debugger) to support
|
|
4
17
|
byebug
|
|
18
|
+
* Dropped pry-remote support
|
|
19
|
+
|
|
5
20
|
|
|
6
21
|
## 0.2.2 (2013-03-07)
|
|
7
22
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
pry-byebug
|
|
1
|
+
pry-byebug [![Gem Version][1]][2] [![Build Status][3]][4]
|
|
2
2
|
============
|
|
3
3
|
|
|
4
4
|
_Fast execution control in Pry_
|
|
5
5
|
|
|
6
|
-
Adds **step**, **next**, **finish
|
|
6
|
+
Adds **step**, **next**, **finish** and **continue** commands and
|
|
7
7
|
**breakpoints** to [Pry][pry] using [byebug][byebug].
|
|
8
8
|
|
|
9
9
|
To use, invoke pry normally. No need to start your script or app differently.
|
|
@@ -19,17 +19,33 @@ For a complete debugging environment, add
|
|
|
19
19
|
[pry-stack_explorer][pry-stack_explorer] for call-stack frame navigation.
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Drop
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
gem 'pry-byebug'
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
in your Gemfile and run
|
|
31
|
+
|
|
32
|
+
bundle install
|
|
33
|
+
|
|
34
|
+
_Make sure you include the gem globally or inside the `:test` group if you plan
|
|
35
|
+
to use it to debug your tests!_
|
|
36
|
+
|
|
37
|
+
|
|
22
38
|
## Execution Commands
|
|
23
39
|
|
|
24
40
|
**step:** Step execution into the next line or method. Takes an optional numeric
|
|
25
|
-
argument to step multiple times.
|
|
41
|
+
argument to step multiple times. Aliased to `s`
|
|
26
42
|
|
|
27
43
|
**next:** Step over to the next line within the same frame. Also takes an
|
|
28
|
-
optional numeric argument to step multiple lines.
|
|
44
|
+
optional numeric argument to step multiple lines. Aliased to `n`
|
|
29
45
|
|
|
30
|
-
**finish:** Execute until current stack frame returns.
|
|
46
|
+
**finish:** Execute until current stack frame returns. Aliased to `f`
|
|
31
47
|
|
|
32
|
-
**continue:** Continue program execution and end the Pry session.
|
|
48
|
+
**continue:** Continue program execution and end the Pry session. Aliased to `c`
|
|
33
49
|
|
|
34
50
|
|
|
35
51
|
## Breakpoints
|
|
@@ -68,59 +84,12 @@ the source code around each breakpoint.
|
|
|
68
84
|
|
|
69
85
|
## Caveats
|
|
70
86
|
|
|
71
|
-
|
|
72
|
-
environments.
|
|
73
|
-
|
|
74
|
-
Only supports MRI 1.9.2 and 1.9.3. For a pure ruby approach not reliant on
|
|
75
|
-
[byebug][byebug], check out [pry-nav][pry-nav]. Note: *pry-nav* and
|
|
76
|
-
*pry-byebug* cannot be loaded together.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
## Remote debugging
|
|
80
|
-
|
|
81
|
-
Support for [pry-remote][pry-remote] (>= 0.1.4) is also included. Requires
|
|
82
|
-
explicity requiring *pry-byebug*, not just relying on pry's plugin loader.
|
|
83
|
-
|
|
84
|
-
Want to debug a Rails app running inside [foreman][foreman]? Add to your
|
|
85
|
-
Gemfile:
|
|
86
|
-
|
|
87
|
-
```ruby
|
|
88
|
-
gem 'pry'
|
|
89
|
-
gem 'pry-remote'
|
|
90
|
-
gem 'pry-stack_explorer'
|
|
91
|
-
gem 'pry-byebug'
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Then add `binding.remote_pry` where you want to pause:
|
|
95
|
-
|
|
96
|
-
```ruby
|
|
97
|
-
class UsersController < ApplicationController
|
|
98
|
-
def index
|
|
99
|
-
binding.remote_pry
|
|
100
|
-
...
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Load a page that triggers the code. Connect to the session:
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
$ bundle exec pry-remote
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Using Pry with Rails? Check out [Jazz Hands][jazz_hands].
|
|
87
|
+
Only supports MRI 2.0.0 or newer.
|
|
112
88
|
|
|
113
89
|
|
|
114
90
|
## Tips
|
|
115
91
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
```ruby
|
|
119
|
-
Pry.commands.alias_command 'c', 'continue'
|
|
120
|
-
Pry.commands.alias_command 's', 'step'
|
|
121
|
-
Pry.commands.alias_command 'n', 'next'
|
|
122
|
-
Pry.commands.alias_command 'f', 'finish'
|
|
123
|
-
```
|
|
92
|
+
Using Pry with Rails? Check out [Jazz Hands][jazz_hands].
|
|
124
93
|
|
|
125
94
|
|
|
126
95
|
## Contributors
|
|
@@ -135,15 +104,15 @@ Pry.commands.alias_command 'f', 'finish'
|
|
|
135
104
|
Patches and bug reports are welcome. Just send a [pull request][pullrequests] or
|
|
136
105
|
file an [issue][issues]. [Project changelog][changelog].
|
|
137
106
|
|
|
138
|
-
|
|
139
|
-
|
|
140
107
|
[pry]: http://pry.github.com
|
|
141
|
-
[byebug]:
|
|
108
|
+
[byebug]: https://github.com/deivid-rodriguez/byebug
|
|
142
109
|
[pry-stack_explorer]: https://github.com/pry/pry-stack_explorer
|
|
143
|
-
[pry-nav]: https://github.com/nixme/pry-nav
|
|
144
|
-
[pry-remote]: https://github.com/Mon-Ouie/pry-remote
|
|
145
|
-
[foreman]: https://github.com/ddollar/foreman
|
|
146
110
|
[jazz_hands]: https://github.com/nixme/jazz_hands
|
|
147
|
-
[pullrequests]: https://github.com/
|
|
148
|
-
[issues]: https://github.com/
|
|
149
|
-
[changelog]: https://github.com/
|
|
111
|
+
[pullrequests]: https://github.com/deivid-rodriguez/pry-byebug/pulls
|
|
112
|
+
[issues]: https://github.com/deivid-rodriguez/pry-byebug/issues
|
|
113
|
+
[changelog]: https://github.com/deivid-rodriguez/pry-byebug/blob/master/CHANGELOG.md
|
|
114
|
+
[pry-nav]: https://github.com/nixme/pry-nav
|
|
115
|
+
[1]: https://badge.fury.io/rb/pry-byebug.png
|
|
116
|
+
[2]: http://badge.fury.io/rb/pry-byebug
|
|
117
|
+
[3]: https://secure.travis-ci.org/deivid-rodriguez/pry-byebug.png
|
|
118
|
+
[4]: http://travis-ci.org/deivid-rodriguez/pry-byebug
|
data/Rakefile
CHANGED
data/lib/pry-byebug/commands.rb
CHANGED
|
@@ -8,6 +8,7 @@ module PryByebug
|
|
|
8
8
|
|
|
9
9
|
banner <<-BANNER
|
|
10
10
|
Usage: step [TIMES]
|
|
11
|
+
Aliases: s
|
|
11
12
|
|
|
12
13
|
Step execution forward. By default, moves a single step.
|
|
13
14
|
|
|
@@ -22,13 +23,14 @@ module PryByebug
|
|
|
22
23
|
breakout_navigation :step, args.first
|
|
23
24
|
end
|
|
24
25
|
end
|
|
25
|
-
|
|
26
|
+
alias_command 's', 'step'
|
|
26
27
|
|
|
27
28
|
create_command 'next' do
|
|
28
29
|
description 'Execute the next line within the current stack frame.'
|
|
29
30
|
|
|
30
31
|
banner <<-BANNER
|
|
31
32
|
Usage: next [LINES]
|
|
33
|
+
Aliases: n
|
|
32
34
|
|
|
33
35
|
Step over within the same frame. By default, moves forward a single
|
|
34
36
|
line.
|
|
@@ -44,27 +46,37 @@ module PryByebug
|
|
|
44
46
|
breakout_navigation :next, args.first
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
|
-
|
|
49
|
+
alias_command 'n', 'next'
|
|
48
50
|
|
|
49
51
|
create_command 'finish' do
|
|
50
52
|
description 'Execute until current stack frame returns.'
|
|
51
53
|
|
|
54
|
+
banner <<-BANNER
|
|
55
|
+
Usage: finish
|
|
56
|
+
Aliases: f
|
|
57
|
+
BANNER
|
|
58
|
+
|
|
52
59
|
def process
|
|
53
60
|
check_file_context
|
|
54
61
|
breakout_navigation :finish
|
|
55
62
|
end
|
|
56
63
|
end
|
|
57
|
-
|
|
64
|
+
alias_command 'f', 'finish'
|
|
58
65
|
|
|
59
66
|
create_command 'continue' do
|
|
60
67
|
description 'Continue program execution and end the Pry session.'
|
|
61
68
|
|
|
69
|
+
banner <<-BANNER
|
|
70
|
+
Usage: continue
|
|
71
|
+
Aliases: c
|
|
72
|
+
BANNER
|
|
73
|
+
|
|
62
74
|
def process
|
|
63
75
|
check_file_context
|
|
64
76
|
run 'exit-all'
|
|
65
77
|
end
|
|
66
78
|
end
|
|
67
|
-
|
|
79
|
+
alias_command 'c', 'continue'
|
|
68
80
|
|
|
69
81
|
create_command 'break' do
|
|
70
82
|
description 'Set or edit a breakpoint.'
|
|
@@ -202,12 +214,11 @@ module PryByebug
|
|
|
202
214
|
end
|
|
203
215
|
alias_command 'breaks', 'breakpoints'
|
|
204
216
|
|
|
205
|
-
|
|
206
217
|
helpers do
|
|
207
218
|
def breakout_navigation(action, times = nil)
|
|
208
|
-
_pry_.binding_stack.clear
|
|
209
|
-
throw :breakout_nav, {
|
|
210
|
-
:action => action,
|
|
219
|
+
_pry_.binding_stack.clear # Clear the binding stack.
|
|
220
|
+
throw :breakout_nav, { # Break out of the REPL loop and signal tracer
|
|
221
|
+
:action => action,
|
|
211
222
|
:times => times,
|
|
212
223
|
:pry => _pry_
|
|
213
224
|
}
|
data/lib/pry-byebug/processor.rb
CHANGED
|
@@ -14,6 +14,7 @@ module PryByebug
|
|
|
14
14
|
# Wrap a Pry REPL to catch navigational commands and act on them.
|
|
15
15
|
def run(initial = true, &block)
|
|
16
16
|
return_value = nil
|
|
17
|
+
|
|
17
18
|
command = catch(:breakout_nav) do # Throws from PryByebug::Commands
|
|
18
19
|
return_value = yield
|
|
19
20
|
{} # Nothing thrown == no navigational command
|
|
@@ -31,18 +32,16 @@ module PryByebug
|
|
|
31
32
|
# inside Byebug. If we step normally, it'll stop inside this
|
|
32
33
|
# Processor. So jump out and stop at the above frame, then step/next
|
|
33
34
|
# from our callback.
|
|
34
|
-
finish
|
|
35
35
|
@delayed[command[:action]] = times
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if :next == command[:action]
|
|
36
|
+
step_out 2
|
|
37
|
+
elsif :next == command[:action]
|
|
39
38
|
step_over times
|
|
40
39
|
|
|
41
40
|
elsif :step == command[:action]
|
|
42
|
-
|
|
41
|
+
step_into times
|
|
43
42
|
|
|
44
43
|
elsif :finish == command[:action]
|
|
45
|
-
|
|
44
|
+
step_out
|
|
46
45
|
end
|
|
47
46
|
else
|
|
48
47
|
stop
|
|
@@ -64,31 +63,24 @@ module PryByebug
|
|
|
64
63
|
end
|
|
65
64
|
end
|
|
66
65
|
|
|
67
|
-
|
|
68
66
|
# --- Callbacks from byebug C extension ---
|
|
69
|
-
|
|
70
67
|
def at_line(context, file, line)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
p "Stop_reason: #{context.stop_reason}"
|
|
75
|
-
@delayed = Hash.new(0) unless :step == context.stop_reason
|
|
68
|
+
# If any delayed nexts/steps, do 'em.
|
|
69
|
+
if @delayed[:next] > 1
|
|
70
|
+
step_over @delayed[:next] - 1
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@delayed = Hash.new(0)
|
|
72
|
+
elsif @delayed[:step] > 1
|
|
73
|
+
step_into @delayed[:step] - 1
|
|
80
74
|
|
|
81
|
-
elsif @delayed[:
|
|
82
|
-
|
|
83
|
-
@delayed = Hash.new(0)
|
|
75
|
+
elsif @delayed[:finish] > 1
|
|
76
|
+
step_out @delayed[:finish] - 1
|
|
84
77
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
@delayed = Hash.new(0)
|
|
88
|
-
|
|
89
|
-
else # Otherwise, resume the pry session at the stopped line.
|
|
78
|
+
# Otherwise, resume the pry session at the stopped line.
|
|
79
|
+
else
|
|
90
80
|
resume_pry context
|
|
91
81
|
end
|
|
82
|
+
|
|
83
|
+
@delayed = Hash.new(0)
|
|
92
84
|
end
|
|
93
85
|
|
|
94
86
|
# Called when a breakpoint is triggered. Note: `at_line`` is called
|
|
@@ -100,7 +92,7 @@ module PryByebug
|
|
|
100
92
|
"Hit #{breakpoint.hit_count} times." )
|
|
101
93
|
if (expr = breakpoint.expr)
|
|
102
94
|
@pry.output.print Pry::Helpers::Text.bold("Condition: ")
|
|
103
|
-
@pry.output.puts
|
|
95
|
+
@pry.output.puts expr
|
|
104
96
|
end
|
|
105
97
|
end
|
|
106
98
|
|
|
@@ -108,42 +100,40 @@ module PryByebug
|
|
|
108
100
|
# TODO
|
|
109
101
|
end
|
|
110
102
|
|
|
103
|
+
private
|
|
111
104
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
new_binding = context.frame_binding(0)
|
|
118
|
-
Byebug.stop unless @always_enabled
|
|
105
|
+
# Resume an existing Pry REPL at the paused point.
|
|
106
|
+
# Binding extracted from Byebug::Context
|
|
107
|
+
def resume_pry(context)
|
|
108
|
+
new_binding = context.frame_binding(0)
|
|
109
|
+
Byebug.stop unless @always_enabled
|
|
119
110
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
run(false) do
|
|
112
|
+
@pry.repl new_binding
|
|
113
|
+
end
|
|
123
114
|
end
|
|
124
|
-
end
|
|
125
115
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
116
|
+
# Move execution forward.
|
|
117
|
+
def step_into(times)
|
|
118
|
+
Byebug.context.step_into times
|
|
119
|
+
end
|
|
130
120
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
121
|
+
# Move execution forward a number of lines in the same frame.
|
|
122
|
+
def step_over(lines)
|
|
123
|
+
Byebug.context.step_over lines, 0
|
|
124
|
+
end
|
|
135
125
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
126
|
+
# Execute until specified frame returns.
|
|
127
|
+
def step_out(frame = 0)
|
|
128
|
+
Byebug.context.step_out frame
|
|
129
|
+
end
|
|
140
130
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
131
|
+
# Cleanup when debugging is stopped and execution continues.
|
|
132
|
+
def stop
|
|
133
|
+
Byebug.stop if !@always_enabled && Byebug.started?
|
|
134
|
+
if PryByebug.current_remote_server # Cleanup DRb remote if running
|
|
135
|
+
PryByebug.current_remote_server.teardown
|
|
136
|
+
end
|
|
146
137
|
end
|
|
147
|
-
end
|
|
148
138
|
end
|
|
149
139
|
end
|
data/lib/pry-byebug/pry_ext.rb
CHANGED
|
@@ -9,7 +9,7 @@ class << Pry
|
|
|
9
9
|
@processor ||= PryByebug::Processor.new
|
|
10
10
|
|
|
11
11
|
if target.is_a?(Binding) && PryByebug.check_file_context(target)
|
|
12
|
-
# Wrap the
|
|
12
|
+
# Wrap the processor around the usual Pry.start to catch navigation
|
|
13
13
|
# commands.
|
|
14
14
|
@processor.run(true) do
|
|
15
15
|
start_without_pry_byebug(target, options)
|
data/lib/pry-byebug/version.rb
CHANGED
data/pry-byebug.gemspec
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require File.expand_path('../lib/pry-byebug/version', __FILE__)
|
|
1
|
+
require File.dirname(__FILE__) + '/lib/pry-byebug/version'
|
|
4
2
|
|
|
5
3
|
Gem::Specification.new do |gem|
|
|
6
4
|
gem.name = 'pry-byebug'
|
|
7
5
|
gem.version = PryByebug::VERSION
|
|
8
|
-
gem.
|
|
9
|
-
gem.email = '
|
|
6
|
+
gem.authors = ['David Rodríguez', 'Gopal Patel']
|
|
7
|
+
gem.email = 'deivid.rodriguez@gmail.com'
|
|
10
8
|
gem.license = 'MIT'
|
|
11
9
|
gem.homepage = 'https://github.com/deivid-rodriguez/pry-byebug'
|
|
12
10
|
gem.summary = 'Fast debugging with Pry.'
|
|
13
|
-
gem.description =
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
gem.description = %q{Combine 'pry' with 'byebug'. Adds 'step', 'next', and
|
|
12
|
+
'continue' commands to control execution.}
|
|
13
|
+
|
|
16
14
|
gem.files = `git ls-files`.split("\n")
|
|
17
|
-
gem.test_files = `git ls-files --
|
|
18
|
-
gem.require_paths = [
|
|
15
|
+
gem.test_files = `git ls-files -- test/*`.split("\n")
|
|
16
|
+
gem.require_paths = ['lib']
|
|
19
17
|
|
|
20
18
|
# Dependencies
|
|
21
19
|
gem.required_ruby_version = '>= 2.0.0'
|
|
22
|
-
|
|
23
|
-
gem.add_runtime_dependency '
|
|
20
|
+
|
|
21
|
+
gem.add_runtime_dependency 'pry', '~> 0.9.12'
|
|
22
|
+
gem.add_runtime_dependency 'byebug', '~> 1.5.0'
|
|
23
|
+
|
|
24
24
|
gem.add_development_dependency 'bundler', '~> 1.3.5'
|
|
25
|
+
gem.add_development_dependency 'rake', '~> 10.1.0'
|
|
26
|
+
gem.add_development_dependency 'mocha', '~> 0.14.0'
|
|
25
27
|
end
|
data/test/base_test.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class BaseTest < MiniTest::Spec
|
|
4
|
+
def test_main_file_context
|
|
5
|
+
Pry.stubs eval_path: "<main>"
|
|
6
|
+
assert PryByebug.check_file_context(TOPLEVEL_BINDING)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def test_other_file_context
|
|
10
|
+
Pry.stubs eval_path: "something"
|
|
11
|
+
refute PryByebug.check_file_context(TOPLEVEL_BINDING)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class BreakpointsTest < MiniTest::Spec
|
|
4
|
+
|
|
5
|
+
def test_add_raises_argument_error
|
|
6
|
+
Pry.stubs eval_path: "something"
|
|
7
|
+
File.stubs :exist?
|
|
8
|
+
assert_raises(ArgumentError) do
|
|
9
|
+
PryByebug::Breakpoints.add("file", 1)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class CommandsTest < MiniTest::Spec
|
|
4
|
+
let(:step_file) do
|
|
5
|
+
(Pathname.new(__FILE__) + "../examples/stepping.rb").cleanpath.to_s
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
Pry.color = false
|
|
10
|
+
Pry.pager = false
|
|
11
|
+
Pry.hooks = Pry::DEFAULT_HOOKS
|
|
12
|
+
@output = StringIO.new
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe 'Step Command' do
|
|
16
|
+
describe 'single step' do
|
|
17
|
+
before do
|
|
18
|
+
@input = InputTester.new('step')
|
|
19
|
+
redirect_pry_io(@input, @output) do
|
|
20
|
+
load step_file
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'shows current line' do
|
|
25
|
+
@output.string.must_match /\=> 3:/
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe 'multiple step' do
|
|
30
|
+
before do
|
|
31
|
+
@input = InputTester.new('step 2')
|
|
32
|
+
redirect_pry_io(@input, @output) do
|
|
33
|
+
load step_file
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'shows current line' do
|
|
38
|
+
@output.string.must_match /\=> 4:/
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'Next Command' do
|
|
44
|
+
describe 'single step' do
|
|
45
|
+
before do
|
|
46
|
+
@input = InputTester.new('next')
|
|
47
|
+
redirect_pry_io(@input, @output) do
|
|
48
|
+
load step_file
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'shows current line' do
|
|
53
|
+
@output.string.must_match /\=> 3:/
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
describe 'multiple step' do
|
|
58
|
+
before do
|
|
59
|
+
@input = InputTester.new('next 2')
|
|
60
|
+
redirect_pry_io(@input, @output) do
|
|
61
|
+
load step_file
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'shows current line' do
|
|
66
|
+
@output.string.must_match /\=> 20:/
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end
|
|
72
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
binding.pry
|
|
2
|
+
|
|
3
|
+
class SteppingExample
|
|
4
|
+
def a
|
|
5
|
+
z = 2
|
|
6
|
+
b
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def b
|
|
10
|
+
v2 = 5 if 1 == 2 ; [1,2,3].map { |a| a.to_f }
|
|
11
|
+
c
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def c
|
|
15
|
+
z = 4
|
|
16
|
+
5
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
ex = SteppingExample.new.a
|
|
21
|
+
2.times do
|
|
22
|
+
ex += 1
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
ex
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'pry/test/helper'
|
|
2
|
+
require 'minitest/autorun'
|
|
3
|
+
require 'pry-byebug'
|
|
4
|
+
require 'mocha/setup'
|
|
5
|
+
|
|
6
|
+
# Set I/O streams. Out defaults to an anonymous StringIO.
|
|
7
|
+
def redirect_pry_io(new_in, new_out = StringIO.new)
|
|
8
|
+
old_in = Pry.input
|
|
9
|
+
old_out = Pry.output
|
|
10
|
+
|
|
11
|
+
Pry.input = new_in
|
|
12
|
+
Pry.output = new_out
|
|
13
|
+
begin
|
|
14
|
+
yield
|
|
15
|
+
ensure
|
|
16
|
+
Pry.input = old_in
|
|
17
|
+
Pry.output = old_out
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class InputTester
|
|
22
|
+
def initialize(*actions)
|
|
23
|
+
@orig_actions = actions.dup
|
|
24
|
+
@actions = actions
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def readline(*)
|
|
28
|
+
@actions.shift
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def rewind
|
|
32
|
+
@actions = @orig_actions.dup
|
|
33
|
+
end
|
|
34
|
+
end
|
metadata
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pry-byebug
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
+
- David Rodríguez
|
|
7
8
|
- Gopal Patel
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
12
|
+
date: 2013-07-02 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: pry
|
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
|
16
17
|
requirements:
|
|
17
|
-
- -
|
|
18
|
+
- - ~>
|
|
18
19
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.9.
|
|
20
|
+
version: 0.9.12
|
|
20
21
|
type: :runtime
|
|
21
22
|
prerelease: false
|
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
24
|
requirements:
|
|
24
|
-
- -
|
|
25
|
+
- - ~>
|
|
25
26
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.9.
|
|
27
|
+
version: 0.9.12
|
|
27
28
|
- !ruby/object:Gem::Dependency
|
|
28
29
|
name: byebug
|
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
|
30
31
|
requirements:
|
|
31
32
|
- - ~>
|
|
32
33
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 1.
|
|
34
|
+
version: 1.5.0
|
|
34
35
|
type: :runtime
|
|
35
36
|
prerelease: false
|
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
38
|
requirements:
|
|
38
39
|
- - ~>
|
|
39
40
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 1.
|
|
41
|
+
version: 1.5.0
|
|
41
42
|
- !ruby/object:Gem::Dependency
|
|
42
43
|
name: bundler
|
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,15 +53,45 @@ dependencies:
|
|
|
52
53
|
- - ~>
|
|
53
54
|
- !ruby/object:Gem::Version
|
|
54
55
|
version: 1.3.5
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: rake
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ~>
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: 10.1.0
|
|
63
|
+
type: :development
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ~>
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: 10.1.0
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: mocha
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ~>
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: 0.14.0
|
|
77
|
+
type: :development
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ~>
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: 0.14.0
|
|
84
|
+
description: |-
|
|
85
|
+
Combine 'pry' with 'byebug'. Adds 'step', 'next', and
|
|
86
|
+
'continue' commands to control execution.
|
|
87
|
+
email: deivid.rodriguez@gmail.com
|
|
58
88
|
executables: []
|
|
59
89
|
extensions: []
|
|
60
90
|
extra_rdoc_files: []
|
|
61
91
|
files:
|
|
62
92
|
- .gitignore
|
|
63
93
|
- .ruby-gemset
|
|
94
|
+
- .travis.yml
|
|
64
95
|
- CHANGELOG.md
|
|
65
96
|
- Gemfile
|
|
66
97
|
- LICENSE
|
|
@@ -75,6 +106,14 @@ files:
|
|
|
75
106
|
- lib/pry-byebug/pry_remote_ext.rb
|
|
76
107
|
- lib/pry-byebug/version.rb
|
|
77
108
|
- pry-byebug.gemspec
|
|
109
|
+
- test/base_test.rb
|
|
110
|
+
- test/breakpoints_test.rb
|
|
111
|
+
- test/commands_test.rb
|
|
112
|
+
- test/examples/stepping.rb
|
|
113
|
+
- test/processor_test.rb
|
|
114
|
+
- test/pry_ext_test.rb
|
|
115
|
+
- test/pry_remote_ext_test.rb
|
|
116
|
+
- test/test_helper.rb
|
|
78
117
|
homepage: https://github.com/deivid-rodriguez/pry-byebug
|
|
79
118
|
licenses:
|
|
80
119
|
- MIT
|
|
@@ -99,4 +138,12 @@ rubygems_version: 2.0.3
|
|
|
99
138
|
signing_key:
|
|
100
139
|
specification_version: 4
|
|
101
140
|
summary: Fast debugging with Pry.
|
|
102
|
-
test_files:
|
|
141
|
+
test_files:
|
|
142
|
+
- test/base_test.rb
|
|
143
|
+
- test/breakpoints_test.rb
|
|
144
|
+
- test/commands_test.rb
|
|
145
|
+
- test/examples/stepping.rb
|
|
146
|
+
- test/processor_test.rb
|
|
147
|
+
- test/pry_ext_test.rb
|
|
148
|
+
- test/pry_remote_ext_test.rb
|
|
149
|
+
- test/test_helper.rb
|