pry-nav 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +8 -0
- data/README.md +14 -2
- data/lib/pry-nav.rb +3 -0
- data/lib/pry-nav/commands.rb +0 -4
- data/lib/pry-nav/pry_remote_ext.rb +24 -80
- data/lib/pry-nav/tracer.rb +3 -1
- data/lib/pry-nav/version.rb +1 -1
- data/pry-nav.gemspec +1 -0
- metadata +15 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.2.0 (2012-02-19)
|
2
|
+
|
3
|
+
# Removed single letter aliases for **step**, **next**, and **continue** because
|
4
|
+
of conflicts with common variable names.
|
5
|
+
* Update [pry-remote][pry-remote] support for 0.1.1. Older releases of
|
6
|
+
pry-remote no longer supported.
|
7
|
+
|
8
|
+
|
1
9
|
## 0.1.0 (2012-02-02)
|
2
10
|
|
3
11
|
* MRI 1.8.7 support
|
data/README.md
CHANGED
@@ -17,8 +17,12 @@ end
|
|
17
17
|
|
18
18
|
**pry-nav** is not yet thread-safe, so only use in single-threaded environments.
|
19
19
|
|
20
|
-
|
21
|
-
pry-
|
20
|
+
If you get `ArgumentError: uncaught throw :breakout_nav` errors, add `require
|
21
|
+
'pry-nav'` before calling `binding.pry`.
|
22
|
+
|
23
|
+
Rudimentary support for [pry-remote][pry-remote] (>= 0.1.1) is also included.
|
24
|
+
Ensure pry-remote is loaded or required before pry-nav. For example, in a
|
25
|
+
Gemfile:
|
22
26
|
|
23
27
|
```ruby
|
24
28
|
gem 'pry'
|
@@ -26,6 +30,14 @@ gem 'pry-remote'
|
|
26
30
|
gem 'pry-nav'
|
27
31
|
```
|
28
32
|
|
33
|
+
Stepping through code often? Add the following shortcuts to `~/.pryrc`:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
Pry.commands.alias_command 'c', 'continue'
|
37
|
+
Pry.commands.alias_command 's', 'step'
|
38
|
+
Pry.commands.alias_command 'n', 'next'
|
39
|
+
```
|
40
|
+
|
29
41
|
Debugging functionality is implemented through
|
30
42
|
[`set_trace_func`][set_trace_func], which imposes a large performance
|
31
43
|
penalty. **pry-nav** traces only when necessary, but due to a workaround for a
|
data/lib/pry-nav.rb
CHANGED
data/lib/pry-nav/commands.rb
CHANGED
@@ -1,89 +1,31 @@
|
|
1
1
|
require 'pry-remote'
|
2
|
-
require 'drb'
|
3
2
|
|
4
3
|
module PryRemote
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
uri = "druby://#{host}:#{port}"
|
15
|
-
|
16
|
-
@client = PryRemote::Client.new
|
17
|
-
@started = true
|
18
|
-
DRb.start_service uri, @client
|
19
|
-
|
20
|
-
puts "[pry-remote] Waiting for client on #{uri}"
|
21
|
-
@client.wait
|
22
|
-
|
23
|
-
# If client passed stdout and stderr, redirect actual messages there.
|
24
|
-
@old_stdout, $stdout =
|
25
|
-
if @client.stdout
|
26
|
-
[$stdout, @client.stdout]
|
27
|
-
else
|
28
|
-
[$stdout, $stdout]
|
29
|
-
end
|
30
|
-
|
31
|
-
@old_stderr, $stderr =
|
32
|
-
if @client.stderr
|
33
|
-
[$stderr, @client.stderr]
|
34
|
-
else
|
35
|
-
[$stderr, $stderr]
|
36
|
-
end
|
37
|
-
|
38
|
-
# Before Pry starts, save the pager config.
|
39
|
-
# We want to disable this because the pager won't do anything useful in
|
40
|
-
# this case (it will run on the server).
|
41
|
-
Pry.config.pager, @old_pager = false, Pry.config.pager
|
42
|
-
|
43
|
-
# As above, but for system config
|
44
|
-
Pry.config.system, @old_system = PryRemote::System, Pry.config.system
|
45
|
-
|
46
|
-
@client
|
47
|
-
end
|
48
|
-
|
49
|
-
def stop
|
50
|
-
return unless @started
|
51
|
-
|
52
|
-
# Reset output streams
|
53
|
-
$stdout = @old_stdout
|
54
|
-
$stderr = @old_stderr
|
55
|
-
|
56
|
-
# Reset config
|
57
|
-
Pry.config.pager = @old_pager
|
58
|
-
|
59
|
-
# Reset system
|
60
|
-
Pry.config.system = @old_system
|
61
|
-
|
62
|
-
begin
|
63
|
-
@client.kill
|
64
|
-
rescue DRb::DRbConnError
|
65
|
-
# Ignore connection errors. The CLI client may have killed itself.
|
66
|
-
ensure
|
67
|
-
DRb.stop_service
|
4
|
+
class Server
|
5
|
+
# Override the call to Pry.start to save off current Server, pass a
|
6
|
+
# pry_remote flag so pry-nav knows this is a remote session, and not kill
|
7
|
+
# the server right away
|
8
|
+
def run
|
9
|
+
if PryNav.current_remote_server
|
10
|
+
raise 'Already running a pry-remote session!'
|
11
|
+
else
|
12
|
+
PryNav.current_remote_server = self
|
68
13
|
end
|
69
14
|
|
70
|
-
|
71
|
-
|
15
|
+
setup
|
16
|
+
Pry.start @object, {
|
17
|
+
:input => client.input_proxy,
|
18
|
+
:output => client.output,
|
19
|
+
:pry_remote => true
|
20
|
+
}
|
72
21
|
end
|
73
|
-
end
|
74
|
-
end
|
75
22
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
Pry.start self, {
|
83
|
-
:input => client.input_proxy,
|
84
|
-
:output => client.output,
|
85
|
-
:pry_remote => true
|
86
|
-
}
|
23
|
+
# Override to reset our saved global current server session.
|
24
|
+
alias_method :teardown_existing, :teardown
|
25
|
+
def teardown
|
26
|
+
teardown_existing
|
27
|
+
PryNav.current_remote_server = nil
|
28
|
+
end
|
87
29
|
end
|
88
30
|
end
|
89
31
|
|
@@ -92,5 +34,7 @@ end
|
|
92
34
|
# PryNav::Tracer#run doesn't have a chance to cleanup.
|
93
35
|
at_exit do
|
94
36
|
set_trace_func nil
|
95
|
-
|
37
|
+
if PryNav.current_remote_server
|
38
|
+
PryNav.current_remote_server.teardown
|
39
|
+
end
|
96
40
|
end
|
data/lib/pry-nav/tracer.rb
CHANGED
@@ -26,7 +26,9 @@ module PryNav
|
|
26
26
|
start
|
27
27
|
else
|
28
28
|
stop if RUBY_VERSION == '1.9.2'
|
29
|
-
|
29
|
+
if @pry_start_options[:pry_remote] && PryNav.current_remote_server
|
30
|
+
PryNav.current_remote_server.teardown
|
31
|
+
end
|
30
32
|
end
|
31
33
|
|
32
34
|
return_value
|
data/lib/pry-nav/version.rb
CHANGED
data/pry-nav.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-nav
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
16
|
-
requirement: &
|
16
|
+
requirement: &70301060845020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,18 @@ dependencies:
|
|
21
21
|
version: 0.9.8.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70301060845020
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: pry-remote
|
27
|
+
requirement: &70301060843440 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.1.1
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70301060843440
|
25
36
|
description: Turn Pry into a primitive debugger. Adds 'step' and 'next' commands to
|
26
37
|
control execution.
|
27
38
|
email: nixme@stillhope.com
|