pry-plusplus 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/demo-pry-bond +86 -0
- data/bin/demo-pry-exception_explorer +26 -0
- data/bin/demo-pry-rescue +29 -0
- data/bin/pryq +4 -0
- data/lib/pry-plusplus.rb +3 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 222b3d5b2509f902fc0cdc8aa588af0e95332eb0
|
4
|
+
data.tar.gz: f03552fba2bc110fde4640aafa8a44975d8c6793
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6157448fe10bb49efa9b9b06b1c1994c5ecda42cf88707353bd3aeb6733a54fbe780df4ba7d802ee034534a96cdd566190ec44ca6672cfb7c3c6196fb508edc1
|
7
|
+
data.tar.gz: 38ff6df20f13c1c645eb23636bae73f36418c81c235ec8fb87630452587ced34630f426088a234d066a9de8af1a27c1b21a560de78097c8f59a20ec9b074baf1
|
data/bin/demo-pry-bond
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pry'
|
4
|
+
begin
|
5
|
+
require 'bond'
|
6
|
+
rescue LoadError
|
7
|
+
warn "You have to have the bond gem and a pry >0.9.10 for this demo to work."
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
DEMO_METHODS = %w(tab_hash tab_pry_commands tab_chain tab_require)
|
12
|
+
NOTABLE_LINE_OFFSET_BY_CONVENTION = 2
|
13
|
+
def go
|
14
|
+
DEMO_METHODS.each do |name| method(name).call end
|
15
|
+
"That's all, for now!"
|
16
|
+
end
|
17
|
+
|
18
|
+
def tab_hash
|
19
|
+
data = {asdf: 1, bsdf: 2, csdf: 3}
|
20
|
+
1 # ← (Sorry about this noise. It's to give the debugger a breakpoint.)
|
21
|
+
# To see hash-key completion, type: data[:<Tab><Tab>
|
22
|
+
# (then hit ^D to keep going)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
def tab_pry_commands
|
31
|
+
# Without bond, pry tries to complete symbols for every command context.
|
32
|
+
1
|
33
|
+
# Try it out:
|
34
|
+
# edit ./<Tab>
|
35
|
+
# (Note that not all commands have perfect completion lists. Github Issues
|
36
|
+
# are welcomed if you want to point out the ones that still need work!)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
class Donkey; def eeyaww; 'EEYAWW!' end end
|
43
|
+
class Monkey; def donkey; Donkey.new end end
|
44
|
+
def tab_chain
|
45
|
+
# Try Monkey.new.donkey.<Tab><Tab>
|
46
|
+
1
|
47
|
+
# Bond actually evaluates the method chain, completing only Donkey methods.
|
48
|
+
# (If you try this in the builtin completer, it will complete *all* methods)
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
def tab_require
|
56
|
+
# Oh, so you'd like to `require` with tabcompletion?
|
57
|
+
1
|
58
|
+
# Try:
|
59
|
+
# require 'u<Tab><Tab>
|
60
|
+
# (Don't worry about the .rb at the end, require works fine with it.)
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
Pry.config.hooks.add_hook :when_started, :test_hook do |target, opt, _pry_|
|
65
|
+
DEMO_METHODS.each do |name|
|
66
|
+
meth = method name
|
67
|
+
file, line = meth.source_location
|
68
|
+
line += NOTABLE_LINE_OFFSET_BY_CONVENTION
|
69
|
+
PryDebugger::Breakpoints.add file, line
|
70
|
+
end
|
71
|
+
# This is kinda junky, but required to satisfy the breakpoint:
|
72
|
+
Pry.instance_variable_get(:@processor).instance_variable_set :@pry, _pry_
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
binding.pry
|
80
|
+
# Let's check out few new features from the new completion backed by the `bond`
|
81
|
+
# gem.
|
82
|
+
# To get started, hit ^D.
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
go
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pry'
|
4
|
+
require 'pry-exception_explorer'
|
5
|
+
Pry.cli = true # for "enter-exception", currently needed unless run as "pry".
|
6
|
+
|
7
|
+
def faily_func
|
8
|
+
# You start at the location of the raise, but perhaps the trouble was
|
9
|
+
# earlier. Use pry-stack_explorer's "up" command to navigate.
|
10
|
+
raise 'Foo'
|
11
|
+
end
|
12
|
+
|
13
|
+
def outer_func
|
14
|
+
# Aha! You found me, the function at fault!
|
15
|
+
# Now, try "edit -c" to edit this file and make the "true" a "false"
|
16
|
+
should_never_happen = true
|
17
|
+
faily_func if should_never_happen
|
18
|
+
end
|
19
|
+
|
20
|
+
# You'll now see a demo of how to explore with pry-exception_explorer.
|
21
|
+
# Sometimes you end up with an exception in the REPL, and you didn't
|
22
|
+
# previously wrap it using the block form of the pry-exception_explorer trap.
|
23
|
+
# Go ahead and run "outer_func" (and notice how the exception is thrown, but
|
24
|
+
# you can subsequently run "wtf" to see the stack, and "enter-exception" to
|
25
|
+
# look around)
|
26
|
+
binding.pry
|
data/bin/demo-pry-rescue
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
def faily_func
|
3
|
+
fail
|
4
|
+
# Now that you're here, at the cause of the error, do:
|
5
|
+
# def faily_func; puts "Yay!" end
|
6
|
+
# Then do:
|
7
|
+
# try-again
|
8
|
+
end
|
9
|
+
|
10
|
+
def h8r_func
|
11
|
+
faily_func
|
12
|
+
rescue
|
13
|
+
# Now run cd-cause again.
|
14
|
+
# (Note: This type of rescue+raise handling is generally an anti-pattern.)
|
15
|
+
raise "Look at me, I found an exception!"
|
16
|
+
end
|
17
|
+
|
18
|
+
def h9r_func
|
19
|
+
h8r_func
|
20
|
+
rescue
|
21
|
+
# Now run: cd-cause
|
22
|
+
raise "Hey!! I found an exception!"
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'pry-rescue'
|
26
|
+
Pry.rescue do
|
27
|
+
h9r_func
|
28
|
+
end
|
29
|
+
puts "Got to end of dem-pry-rescue. Wasn't that nice?"
|
data/bin/pryq
ADDED
data/lib/pry-plusplus.rb
ADDED
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pry-plusplus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Timo Schilling
|
8
|
+
- "☈king"
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: pry-doc
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: pry-docmore
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: pry-byebug
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: pry-stack_explorer
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: pry-rescue
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: bond
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: jist
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
description: pry-doc + pry-docmore + pry-byebug + pry-stack_explorer + pry-rescue
|
113
|
+
+ bond + jist
|
114
|
+
email: rking-pry-plus@sharpsaw.org
|
115
|
+
executables:
|
116
|
+
- demo-pry-bond
|
117
|
+
- demo-pry-exception_explorer
|
118
|
+
- demo-pry-rescue
|
119
|
+
- pryq
|
120
|
+
extensions: []
|
121
|
+
extra_rdoc_files: []
|
122
|
+
files:
|
123
|
+
- bin/demo-pry-bond
|
124
|
+
- bin/demo-pry-exception_explorer
|
125
|
+
- bin/demo-pry-rescue
|
126
|
+
- bin/pryq
|
127
|
+
- lib/pry-plusplus.rb
|
128
|
+
homepage: https://github.com/timoschilling/pry-plusplus
|
129
|
+
licenses:
|
130
|
+
- CC0
|
131
|
+
metadata: {}
|
132
|
+
post_install_message:
|
133
|
+
rdoc_options: []
|
134
|
+
require_paths:
|
135
|
+
- lib
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
requirements: []
|
147
|
+
rubyforge_project:
|
148
|
+
rubygems_version: 2.4.5
|
149
|
+
signing_key:
|
150
|
+
specification_version: 4
|
151
|
+
summary: Pry + Essential Plugins
|
152
|
+
test_files: []
|
153
|
+
has_rdoc:
|