pryx 0.5.0 → 0.6.0
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/README.md +33 -14
- data/lib/pry-disasm/commands.rb +1 -1
- data/lib/pry-disasm.rb +8 -1
- data/lib/pryx/common_plugins.rb +9 -0
- data/lib/pryx/irb_hack.rb +14 -5
- data/lib/pryx/looksee_hack.rb +3 -3
- data/lib/pryx/pry_hack.rb +12 -13
- data/lib/pryx/pry_plugins.rb +2 -0
- data/lib/pryx/version.rb +1 -1
- data/lib/pryx_irb.rb +1 -6
- metadata +49 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83cd7279138aacd2a29d974c18db5fd6d1a6bd6aa9ed6012167e88771c50d13e
|
4
|
+
data.tar.gz: 5d34a1c16ccaa9abfed32635614262e44414d5bd48b26e5ffc25614b1bf623c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96c64a8e59687991d2c9ede2973ef32f97549c4b8aaa8e60f0993fa5202ec6dc62267e73e3bfb88404fe1b0424622a4224c60b2ce2d604799c4d2b50128d911b
|
7
|
+
data.tar.gz: 27b2f23ad20df15b0330cb929def9ead48d725c0743ad2174521dae7622e97ad8aed6329df162138443f18ab6c590f972d952b6dd431b5102888cbb1eff4b7a7
|
data/README.md
CHANGED
@@ -70,22 +70,26 @@ $: RUBYOPT+='-rpryx_irb' ruby your_file.rb # add irb! in your_file for start pry
|
|
70
70
|
|
71
71
|
Following feature both available when start a Pry or IRB session:
|
72
72
|
|
73
|
-
1.
|
74
|
-
2.
|
75
|
-
3. Use
|
73
|
+
1. Add `next/step/up/down` command for debug, use [break](https://github.com/gsamokovarov/break)
|
74
|
+
2. Add `Kernel#ls1`(use ls1 to avoid conflict with pry builtin ls command), see [looksee](https://github.com/oggy/looksee)
|
75
|
+
3. Use `ap` for pretty print. see [awesome-print](https://github.com/awesome-print/awesome_print)
|
76
|
+
4. Use `Clipboard.copy` or `Clipboard.paste` to interactive with system clipboard. see [clipboard](https://github.com/janlelis/clipboard)
|
76
77
|
|
77
|
-
Following
|
78
|
+
Following is pry command available only after start a Pry session:
|
78
79
|
|
79
|
-
1.
|
80
|
+
1. Add `$/?` command for see source, see [pry-doc](https://github.com/pry/pry-doc)
|
80
81
|
2. pry-remote debug support. you still use `pry!` no changes, it will use `pry-remote` automatically
|
81
82
|
if current ruby process was running on backround, then, it will use pry-remote, and listen on 0.0.0.0:9876,
|
82
83
|
Then, you can connect to it from another terminal! see [pry-remote](https://github.com/Mon-Ouie/pry-remote)
|
83
|
-
3.
|
84
|
-
4.
|
85
|
-
5.
|
86
|
-
6.
|
87
|
-
|
88
|
-
|
84
|
+
3. Add `pa` command, see [pry-power_assert](https://github.com/yui-knk/pry-power_assert)
|
85
|
+
4. Add `hier` command for print the class hierarchies, see [pry-hier](https://github.com/phaul/pry-hier)
|
86
|
+
5. Add `pry-aa_ancestors` command for print the class hierarchy, see [pry-aa_ancestors](https://github.com/tbpgr/pry-aa_ancestors)
|
87
|
+
6. Add `up/down/frame/stack` command, see [pry-stack_explorer](https://github.com/pry/pry-stack_explorer)
|
88
|
+
7. Add `yes` or `y` command, see [pry-yes](https://github.com/christofferh/pry-yes)
|
89
|
+
8. Add `pry-disam`, Check following screenshot for a example:
|
90
|
+
|
91
|
+

|
92
|
+
|
89
93
|
### Kernel#pry1 Kernel#pry2 (sorry for this bad name, please create a issue you have a better one)
|
90
94
|
|
91
95
|
pry2 do nothing, but it will be interceptd and start a pry session only after pry1 is running.
|
@@ -106,7 +110,10 @@ but above plugins and libraries all correct configured.
|
|
106
110
|
|
107
111
|
we have another Kernel#pry?, which enable `pry-state` automatically, see [pry-state](https://github.com/SudhagarS/pry-state)
|
108
112
|
|
109
|
-
###
|
113
|
+
### Add command from command line, rescue, kill-pry-rescue, pryx, irbx, pry!
|
114
|
+
|
115
|
+
`rescue` and `kill-pry-rescue` come from `pry-rescue` gem, it not load by default, but you can use rescue command from command line directly.
|
116
|
+
see [pry-rescue](https://github.com/ConradIrwin/pry-rescue)
|
110
117
|
|
111
118
|
pryx is same as pry, but, with plugins and libraries correct configured.
|
112
119
|
|
@@ -124,8 +131,20 @@ $: pry! -s 192.168.1.100 -p 9876
|
|
124
131
|
|
125
132
|
## Philosophy
|
126
133
|
|
127
|
-
This gem is design to
|
128
|
-
|
134
|
+
This gem is design to Minimal impact on target ruby code, in fact, after `require 'pryx'` or `RUBYOPT='-rpryx'`
|
135
|
+
(they do same thing), only several instance method be defined on Kernel, and several gems add to $LOAD_PATH,
|
136
|
+
but not load, ready to require it, no more. so, it should be safe to use it, either affect performance nor
|
137
|
+
namespace/variables etc.
|
138
|
+
|
139
|
+
But, you should only use it in development, though, it was tested is run in container(alpine) too.
|
140
|
+
|
141
|
+
|
142
|
+
## Limit
|
143
|
+
|
144
|
+
1. `break` not work well if you add more than one break point, but still use `next` goto the next break point,
|
145
|
+
See https://github.com/gsamokovarov/break/issues/12
|
146
|
+
2. because `pry!` use binding.of\_caller, when work with pry-stack\_explorer up command, you can see two
|
147
|
+
more stack get pushed. so, you have to up 3 times instead 1 time in normal case.
|
129
148
|
|
130
149
|
## Support
|
131
150
|
|
data/lib/pry-disasm/commands.rb
CHANGED
data/lib/pry-disasm.rb
CHANGED
@@ -3,7 +3,14 @@ require 'pry-disasm/commands'
|
|
3
3
|
|
4
4
|
class PryDisasm
|
5
5
|
def self.process(expr)
|
6
|
-
|
6
|
+
case expr
|
7
|
+
when Method, Proc
|
8
|
+
str = RubyVM::InstructionSequence.disasm(expr)
|
9
|
+
when String
|
10
|
+
str = RubyVM::InstructionSequence.compile(expr).disasm
|
11
|
+
else
|
12
|
+
return puts "Error: The command 'disasm' requires Method/Proc/String instance."
|
13
|
+
end
|
7
14
|
|
8
15
|
lines = str.split("\n")
|
9
16
|
lines[0].gsub!(/=+/) { |s| "\033[0;32m#{s}\033[0m" }
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'binding_of_caller'
|
2
|
+
require 'clipboard'
|
3
|
+
|
4
|
+
# ap_hack 可以确保,当使用 irb! 时,looksee ls1 输出显示正确,同时不用关闭 irb :USE_COLORIZE 设置。
|
5
|
+
# See https://github.com/oggy/looksee/issues/57
|
6
|
+
# 但是,ap_hack 必须放到 break_hack 前面,调换顺序,上面的 hack 失效。
|
7
|
+
# WARN: 下面两行代码顺序不要换。
|
8
|
+
require 'pryx/ap_hack'
|
9
|
+
require 'pryx/break_hack'
|
data/lib/pryx/irb_hack.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'binding_of_caller'
|
2
|
-
|
3
1
|
class Binding
|
4
2
|
def _irb(_host=nil)
|
5
3
|
warn '[1m[33mloading irb ...[0m'
|
@@ -26,7 +24,9 @@ module Kernel
|
|
26
24
|
|
27
25
|
ENV['IRB_was_started'] = 'true'
|
28
26
|
|
29
|
-
|
27
|
+
require 'binding_of_caller'
|
28
|
+
|
29
|
+
irb3(2)
|
30
30
|
end
|
31
31
|
|
32
32
|
def reirb!
|
@@ -37,10 +37,19 @@ module Kernel
|
|
37
37
|
ENV['IRB2_should_start'] = 'true'
|
38
38
|
end
|
39
39
|
|
40
|
-
def irb2
|
40
|
+
def irb2
|
41
41
|
if ENV['IRB2_should_start'] == 'true'
|
42
42
|
ENV['IRB2_should_start'] = nil
|
43
|
-
|
43
|
+
|
44
|
+
require 'binding_of_caller'
|
45
|
+
|
46
|
+
irb3(2)
|
44
47
|
end
|
45
48
|
end
|
49
|
+
|
50
|
+
def irb3(caller=1)
|
51
|
+
require 'binding_of_caller'
|
52
|
+
|
53
|
+
binding.of_caller(caller)._irb
|
54
|
+
end
|
46
55
|
end
|
data/lib/pryx/looksee_hack.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
# 被覆写的方法 灰色 30
|
11
11
|
|
12
12
|
module Kernel
|
13
|
-
def
|
13
|
+
def _load_looksee
|
14
14
|
case RbConfig::CONFIG['ruby_version']
|
15
15
|
when '1.9.0'...'2.1.0'
|
16
16
|
require 'old_looksee'
|
@@ -23,12 +23,12 @@ module Kernel
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def ls1(*args)
|
26
|
-
|
26
|
+
_load_looksee unless defined? Looksee
|
27
27
|
Looksee[self, *args, :noprivate]
|
28
28
|
end
|
29
29
|
|
30
30
|
def ls2(*args)
|
31
|
-
|
31
|
+
_load_looksee unless defined? Looksee
|
32
32
|
Looksee[self, *args]
|
33
33
|
end
|
34
34
|
end
|
data/lib/pryx/pry_hack.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# 注意如果开启 pry-stack_explorer, 就不要使用 debugger, 因为进入新的上下文后, pry-stack_explorer 将失效.
|
2
2
|
|
3
|
-
require 'binding_of_caller'
|
4
|
-
|
5
3
|
class Binding
|
6
4
|
def _pry(host=nil, port=nil, options={})
|
7
5
|
if host
|
@@ -10,8 +8,7 @@ class Binding
|
|
10
8
|
require 'pry'
|
11
9
|
end
|
12
10
|
|
13
|
-
require 'pryx/
|
14
|
-
require 'pryx/break_hack'
|
11
|
+
require 'pryx/common_plugins'
|
15
12
|
require 'pryx/pry_plugins'
|
16
13
|
|
17
14
|
if host
|
@@ -55,14 +52,6 @@ module Kernel
|
|
55
52
|
# 这里如果有代码, 将会让 pry! 进入这个方法, 因此保持为空.
|
56
53
|
end
|
57
54
|
|
58
|
-
# 等价于默认的 binding.pry, 会反复被拦截。
|
59
|
-
# 起成 pry3 这个名字,也是为了方便直接使用。
|
60
|
-
def pry3(caller=1, remote: nil, port: 9876)
|
61
|
-
remote = '0.0.0.0' if Pryx::Background.background?
|
62
|
-
|
63
|
-
binding.of_caller(caller)._pry(remote, port)
|
64
|
-
end
|
65
|
-
|
66
55
|
def pry1
|
67
56
|
ENV['Pry2_should_start'] = 'true'
|
68
57
|
end
|
@@ -73,10 +62,20 @@ module Kernel
|
|
73
62
|
def pry2(caller=1, remote: nil, port: 9876)
|
74
63
|
if ENV['Pry2_should_start'] == 'true'
|
75
64
|
ENV['Pry2_should_start'] = nil
|
76
|
-
|
65
|
+
pry3(2, remote: remote, port: port)
|
77
66
|
end
|
78
67
|
end
|
79
68
|
|
69
|
+
# 等价于默认的 binding.pry, 会反复被拦截。
|
70
|
+
# 起成 pry3 这个名字,也是为了方便直接使用。
|
71
|
+
def pry3(caller=1, remote: nil, port: 9876)
|
72
|
+
remote = '0.0.0.0' if Pryx::Background.background?
|
73
|
+
|
74
|
+
require 'binding_of_caller'
|
75
|
+
|
76
|
+
binding.of_caller(caller)._pry(remote, port)
|
77
|
+
end
|
78
|
+
|
80
79
|
def notify_send(msg)
|
81
80
|
system("notify-send \"#{msg}\"") if system 'which notify-send &>/dev/null'
|
82
81
|
|
data/lib/pryx/pry_plugins.rb
CHANGED
data/lib/pryx/version.rb
CHANGED
data/lib/pryx_irb.rb
CHANGED
@@ -5,10 +5,5 @@
|
|
5
5
|
# we need set `export RUBYOPT+=" -rpryx_irb"` instead of `-rpryx` to make
|
6
6
|
# irb work with break and ap gem.
|
7
7
|
|
8
|
-
|
9
|
-
# 但是,ap_hack 不可以放到 break_hack 后面,否则会失效。
|
10
|
-
# WARN: 下面两行代码顺序不要换。
|
11
|
-
require 'pryx/ap_hack'
|
12
|
-
require 'pryx/break_hack'
|
13
|
-
|
8
|
+
require 'pryx/common_plugins'
|
14
9
|
require 'pryx'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pryx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Billy.Zheng(zw963)
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '4.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: clipboard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: pry
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +126,16 @@ dependencies:
|
|
112
126
|
name: pry-aa_ancestors
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- - "
|
129
|
+
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: 0.0.1
|
118
132
|
type: :runtime
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - "
|
136
|
+
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: 0.0.1
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: pry-stack_explorer
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +151,21 @@ dependencies:
|
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0.6'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: pry-rescue
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.5'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.5'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: minitest
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
142
170
|
requirements:
|
143
171
|
- - ">="
|
@@ -150,6 +178,20 @@ dependencies:
|
|
150
178
|
- - ">="
|
151
179
|
- !ruby/object:Gem::Version
|
152
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: m
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '1.6'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '1.6'
|
153
195
|
- !ruby/object:Gem::Dependency
|
154
196
|
name: ritual
|
155
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,6 +239,7 @@ files:
|
|
197
239
|
- lib/pryx/ap_hack.rb
|
198
240
|
- lib/pryx/background.rb
|
199
241
|
- lib/pryx/break_hack.rb
|
242
|
+
- lib/pryx/common_plugins.rb
|
200
243
|
- lib/pryx/drip.wav
|
201
244
|
- lib/pryx/irb_hack.rb
|
202
245
|
- lib/pryx/looksee_hack.rb
|