irbtools 4.0.11 → 4.1.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/CHANGELOG.md +213 -159
- data/Gemfile.lock +28 -30
- data/README.md +87 -86
- data/irbtools.gemspec +1 -1
- data/lib/irbtools/commands/code.rb +29 -16
- data/lib/irbtools/commands/howtocall.rb +29 -16
- data/lib/irbtools/commands/look.rb +13 -10
- data/lib/irbtools/commands/shadow.rb +13 -9
- data/lib/irbtools/commands/sys.rb +9 -14
- data/lib/irbtools/configure.rb +1 -0
- data/lib/irbtools/implementation.rb +5 -12
- data/lib/irbtools/version.rb +1 -1
- data/lib/irbtools.rb +0 -1
- data/spec/irbtools_commands_spec.rb +6 -6
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 057ccf651fd4fcb5a0b5b9c9e465a22805fd06c3e1807db2d4ecc25164ed4065
|
|
4
|
+
data.tar.gz: 6910623184264bad5962e142b845e48418e99164204e867e14c66eb9a6a8cad9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9005040abdcc670c7d7c786e98eb2d7013fdaf9a10bd701ea0404b7a2c97eba656b2f26831f4acf1826a70eec03eede34c28d80dd1d00b07e9a3b967cfd4eb3
|
|
7
|
+
data.tar.gz: effd68833e3e32a02ec171959fc6ee9c5d94fc10dd19eaba1903fb1f00a654728e1254fdb4d4ca7e489547f216d15574995b3983b926f75c45169223421df8a1
|
data/CHANGELOG.md
CHANGED
|
@@ -1,293 +1,347 @@
|
|
|
1
1
|
# Irbtools Changelog
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
- Fix command loading (was broken in previous version)
|
|
6
|
+
- Minor changes to command argument parsing
|
|
7
|
+
- Set required IRB to 1.13.0
|
|
8
|
+
|
|
3
9
|
## 4.0.11
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
- Loosen IRB dependency to allow IRB 1.14
|
|
6
12
|
|
|
7
13
|
## 4.0.10
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
- Loosen IRB dependency to allow IRB 1.13, fixes #57
|
|
10
16
|
|
|
11
17
|
## 4.0.9
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
- Fix loading command `Base` class and require IRB 1.12 to make sure it is available
|
|
14
20
|
|
|
15
21
|
## 4.0.8
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
- Require IRB 1.11
|
|
24
|
+
- Fix "NameError: uninitialized constant IRB::ExtendCommand::Nop"
|
|
25
|
+
- Bump core_docs gem
|
|
20
26
|
|
|
21
27
|
## 4.0.7
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
- Allow clipboard gem v2
|
|
24
30
|
|
|
25
31
|
## 4.0.6
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
- Bump FancyIRB to close #56
|
|
28
34
|
|
|
29
35
|
## 4.0.5
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
- Bump IRB and FancyIRB
|
|
32
38
|
|
|
33
39
|
## 4.0.4
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
- Loosen IRB dependency
|
|
36
42
|
|
|
37
43
|
## 4.0.3
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
- code / howtocall commands: Support question mark / exclamation mark methods
|
|
40
46
|
|
|
41
47
|
## 4.0.2
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
- Bump interactive_editor gem (Ruby 3.2 compatibility)
|
|
44
50
|
|
|
45
51
|
## 4.0.1
|
|
46
52
|
|
|
47
|
-
|
|
53
|
+
- Bump ruby_engine gem
|
|
48
54
|
|
|
49
55
|
## 4.0.0
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
- Requires IRB 1.6 (Ruby 3.2 bundles IRB 1.6.2)
|
|
58
|
+
- Requires Ruby 3.0
|
|
59
|
+
|
|
60
|
+
- Remove a bunch of gems:
|
|
61
|
+
|
|
62
|
+
- Drop binding.repl gem since it was only needed for older Rubies
|
|
63
|
+
- Drop ori gem, since IRB now has `show_doc`
|
|
64
|
+
- Drop RubyInfo
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
* Drop binding.repl gem since it was only needed for older Rubies
|
|
56
|
-
* Drop ori gem, since IRB now has `show_doc`
|
|
57
|
-
* Drop RubyInfo
|
|
66
|
+
- Retire irbtools-more:
|
|
58
67
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* Leave binding_of_caller optional
|
|
68
|
+
- Move looksee to core irbtools
|
|
69
|
+
- Move core_docs to core irbtools
|
|
70
|
+
- Remove bond (outdated)
|
|
71
|
+
- Leave binding_of_caller optional
|
|
64
72
|
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
- Add command wrappers for code, howtocall, looksee, shadow
|
|
74
|
+
- Add `$` command to directly call system
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
- Version bumps: looksee, os, methodfinder, code, core_docs, debugging
|
|
77
|
+
- Alias IRB's ls to ils (fixes #53)
|
|
78
|
+
- Remove support for RIPL repl (outdated)
|
|
71
79
|
|
|
72
80
|
## 3.0.5
|
|
73
|
-
|
|
81
|
+
|
|
82
|
+
- Bump methodfinder dependency & update usage (fixes #52)
|
|
74
83
|
|
|
75
84
|
## 3.0.4
|
|
76
|
-
|
|
85
|
+
|
|
86
|
+
- Loosen Ruby dependency to allow Ruby 3.0
|
|
77
87
|
|
|
78
88
|
## 3.0.3
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
|
|
90
|
+
- Workaround a HIRB issue for newer IRBs (fixes #48)
|
|
91
|
+
- Workaround ORI issue for newer IRBs
|
|
81
92
|
|
|
82
93
|
## 3.0.2
|
|
83
|
-
|
|
94
|
+
|
|
95
|
+
- Bump wirb to ensure Ruby 2.7 compatibility
|
|
84
96
|
|
|
85
97
|
## 3.0.1
|
|
86
|
-
|
|
98
|
+
|
|
99
|
+
- Bump fancy_irb to ensure Ruby 2.7 compatiblity
|
|
87
100
|
|
|
88
101
|
## 3.0.0
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
|
|
103
|
+
- Make IRB itself a dependency (default gem)
|
|
104
|
+
- Move: "Every day… IRB" into its own git repository
|
|
105
|
+
- https://github.com/janlelis/every_day_irb
|
|
106
|
+
- Replace instance and method_locator gems with new object_shadow gem
|
|
107
|
+
- Improve README
|
|
108
|
+
- Version bump code, clipboard, and methodfinder
|
|
95
109
|
|
|
96
110
|
## 2.2.2
|
|
97
|
-
|
|
111
|
+
|
|
112
|
+
- Remove Rails WIRB loading hack (no longer necessary)
|
|
98
113
|
|
|
99
114
|
## 2.2.1
|
|
100
|
-
|
|
101
|
-
|
|
115
|
+
|
|
116
|
+
- Allow os gem to be below 1.0
|
|
117
|
+
- Do not use binding.repl gem if Ruby version is at least 2.5
|
|
102
118
|
|
|
103
119
|
## 2.2.0
|
|
104
|
-
|
|
120
|
+
|
|
121
|
+
- Remove info, version, engine, and os methods. Use RubyInfo, RubyVersion, RubyEngine, and OS instead (fixes #40)
|
|
105
122
|
|
|
106
123
|
## 2.1.0
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
124
|
+
|
|
125
|
+
- Improve Rails compatibility
|
|
126
|
+
- Do not load instance gem in the context of Rails
|
|
127
|
+
- Make sure to actually require "irb" before using it
|
|
128
|
+
- Use terrible hack to load Wirb in context of Rails
|
|
129
|
+
- Relax paint dependency (allows usage of paint >= 2.0)
|
|
130
|
+
- Require new versions of fancy_irb, clipboard, os
|
|
131
|
+
- Set abort_on_exception to true for late threads (early threads do this implicitly via join)
|
|
114
132
|
|
|
115
133
|
## 2.0.1
|
|
116
|
-
|
|
134
|
+
|
|
135
|
+
- Remove g gem
|
|
117
136
|
|
|
118
137
|
## 2.0.0
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
|
|
139
|
+
- Use Wirb 2.0 and FancyIrb 1.0
|
|
140
|
+
- Drop support for Ruby 1
|
|
141
|
+
- Simplify starting from code via: require 'irbtools/binding'
|
|
142
|
+
- Rename method to show a method's source to: code
|
|
143
|
+
- Add instance gem
|
|
144
|
+
- Remove code organization gems (boson + alias)
|
|
145
|
+
- Don't add '.' to the load path, use rr (require_relative) instead
|
|
146
|
+
- Improve loading order of libraries
|
|
147
|
+
- Remove aliases for Irbtools configuration
|
|
148
|
+
- Integrate irbtools-more into irbtools main repo
|
|
149
|
+
- EveryDayIrb now gets released on its own, instead with every new irbtools version
|
|
150
|
+
- Improve documentation in Readme
|
|
131
151
|
|
|
132
152
|
## 1.7.1
|
|
133
|
-
|
|
153
|
+
|
|
154
|
+
- bump binding.repl, hirb, methodfinder
|
|
134
155
|
|
|
135
156
|
## 1.7.0
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
157
|
+
|
|
158
|
+
- bump boson, boson-more, binding.repl
|
|
159
|
+
- required ruby version: 1.9.3
|
|
160
|
+
- remove awesome_print
|
|
139
161
|
|
|
140
162
|
## 1.6.1
|
|
141
|
-
|
|
142
|
-
|
|
163
|
+
|
|
164
|
+
- don't load debugging/repl by default
|
|
165
|
+
- rename re method to engine and rv to version
|
|
143
166
|
|
|
144
167
|
## 1.6.0
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
168
|
+
|
|
169
|
+
- remove zucker dependency, but add debugging, ruby_version, ruby_engine, ruby_info and os gem
|
|
170
|
+
- configure binding.repl to load irb, not pry
|
|
171
|
+
- bump binding.repl, paint, wirb
|
|
148
172
|
|
|
149
173
|
## 1.5.1
|
|
150
|
-
|
|
151
|
-
|
|
174
|
+
|
|
175
|
+
- include binding.repl gem
|
|
176
|
+
- bump coderay, awesome_print, method_source, wirb
|
|
152
177
|
|
|
153
178
|
## 1.5.0
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
179
|
+
|
|
180
|
+
- update debundle hack
|
|
181
|
+
- load less zucker libraries
|
|
182
|
+
- add alias gem
|
|
183
|
+
- finaly load boson correctly (but don't load any boson plugin, yet), also depend on boson-more
|
|
184
|
+
- version bumps (zucker, clipboard, paint, hirb, wirb, ap, coderay, g)
|
|
159
185
|
|
|
160
186
|
## 1.4.0
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
187
|
+
|
|
188
|
+
- every_day_irb is now a module that extends self
|
|
189
|
+
- specs for most of every_day_irb's functionality
|
|
190
|
+
- add helper method for paging output with hirb: page
|
|
191
|
+
- version bumps, including wirb and fancy_irb
|
|
192
|
+
- remove sketches dependency, it's a great gem, but very similar to interactive_editor
|
|
193
|
+
- Object#mlp alias for method_lookup_path
|
|
167
194
|
|
|
168
195
|
## 1.3.0 == 1.2.3
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
196
|
+
|
|
197
|
+
- add modern debundle note
|
|
198
|
+
- remove loading of .railsrc
|
|
199
|
+
- remove dbg method
|
|
200
|
+
- version bumps
|
|
173
201
|
|
|
174
202
|
## 1.2.2
|
|
175
|
-
|
|
176
|
-
|
|
203
|
+
|
|
204
|
+
- fix errors when inspect returns nil (e.g. CarrierWave uploaders)
|
|
205
|
+
- create legacy branch for 1.8.7 support
|
|
177
206
|
|
|
178
207
|
## 1.2.1
|
|
179
|
-
|
|
180
|
-
|
|
208
|
+
|
|
209
|
+
- fix newboson loader issue
|
|
210
|
+
- minor version bumps
|
|
181
211
|
|
|
182
212
|
## 1.2.0
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
213
|
+
|
|
214
|
+
- version bumps: hirb, awesome_print, coderay, g, methodfinder, method_source
|
|
215
|
+
- remove RVM helpers: Sorry, were too buggy...
|
|
216
|
+
- fix/improve 'cd' helper method
|
|
217
|
+
- improve readme
|
|
218
|
+
- move looksee gem to irbtools-more
|
|
219
|
+
- more little tweaks
|
|
189
220
|
|
|
190
221
|
## 1.1.1
|
|
191
|
-
|
|
222
|
+
|
|
223
|
+
- fix the Ripl.after_rc bug
|
|
192
224
|
|
|
193
225
|
## 1.1.0
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
226
|
+
|
|
227
|
+
- fix hirb loading/unicode issue + colorize tables (thanks to halan)
|
|
228
|
+
- colorize paged wirb output
|
|
229
|
+
- include method locator gem (improved ancestors)
|
|
230
|
+
- include looksee gem (aliased as Object#l/Object#ll and Object#edit)
|
|
231
|
+
- include method source gem (Object#src)
|
|
232
|
+
- small tweaks...
|
|
200
233
|
|
|
201
234
|
## 1.0.6
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
235
|
+
|
|
236
|
+
- add possibility to modify library callbacks without removing the library by using: replace_library_callback or add_library_callback
|
|
237
|
+
- fix hirb dependency issue
|
|
238
|
+
- readme improvements
|
|
205
239
|
|
|
206
240
|
## 1.0.5
|
|
207
|
-
|
|
241
|
+
|
|
242
|
+
- use paint gem for terminal colors
|
|
208
243
|
|
|
209
244
|
## 1.0.4
|
|
210
|
-
|
|
211
|
-
|
|
245
|
+
|
|
246
|
+
- improve error-handling
|
|
247
|
+
- fix broken loading of boson + interactive_editor
|
|
212
248
|
|
|
213
249
|
## 1.0.3
|
|
214
|
-
|
|
250
|
+
|
|
251
|
+
- fix post-install banner typo
|
|
215
252
|
|
|
216
253
|
## 1.0.2
|
|
217
|
-
|
|
254
|
+
|
|
255
|
+
- version bumps for zucker (rbx compatible) and wirb (improved generic object-description highlighting)
|
|
218
256
|
|
|
219
257
|
## 1.0.1
|
|
220
|
-
|
|
258
|
+
|
|
259
|
+
- add missing require 'rbconfig'
|
|
221
260
|
|
|
222
261
|
## 1.0.0
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
262
|
+
|
|
263
|
+
- gemify general helpers/rvm stuff ("every_day_irb", "rvm_loader")
|
|
264
|
+
- 6 different loading schemas: start, thread, autoload, sub_session, late, late_thread
|
|
265
|
+
- load almost every feature via threads
|
|
266
|
+
- don't use zucker/alias_for, autload zucker/env (except zucker/os) for performance reasons
|
|
267
|
+
- add irbtools/minimal mode for starting Irbtools without the default set of libraries
|
|
268
|
+
- replace RV and RE with rv and re
|
|
229
269
|
|
|
230
270
|
## 0.8.8
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
271
|
+
|
|
272
|
+
- fix 0.8.7 file permissions
|
|
273
|
+
- add methodfinder gem
|
|
274
|
+
- don't depend on guessmethod anymore
|
|
234
275
|
|
|
235
276
|
## 0.8.7
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
277
|
+
|
|
278
|
+
- fix railsrc loading
|
|
279
|
+
- add ori gem for nice Object#ri calling
|
|
280
|
+
- minor tweaks
|
|
239
281
|
|
|
240
282
|
## 0.8.6
|
|
241
|
-
|
|
242
|
-
|
|
283
|
+
|
|
284
|
+
- windows support
|
|
285
|
+
- update hirb + activate unicode-drawn tables
|
|
243
286
|
|
|
244
287
|
## 0.8.5
|
|
245
|
-
|
|
288
|
+
|
|
289
|
+
- rails related fixes
|
|
246
290
|
|
|
247
291
|
## 0.8.4
|
|
248
|
-
|
|
292
|
+
|
|
293
|
+
- now using wirb instead of wirble
|
|
249
294
|
|
|
250
295
|
## 0.8.3
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
296
|
+
|
|
297
|
+
- improved/added rvm methods (use, gemset, rubies, gemsets)
|
|
298
|
+
- RVM (Ruby API) constant gets autoloaded
|
|
299
|
+
- improved cd command
|
|
300
|
+
- don't load guessmethod by default (it's cool, but not always suited for production)
|
|
301
|
+
- more small changes
|
|
256
302
|
|
|
257
303
|
## 0.8.2
|
|
258
|
-
|
|
259
|
-
|
|
304
|
+
|
|
305
|
+
- only do irb specific features if in irb (ripl compatibility)
|
|
306
|
+
- more generic shell_name (in welcome message)
|
|
260
307
|
|
|
261
308
|
## 0.8.1
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
309
|
+
|
|
310
|
+
- rewrote irb_rocket: fancy_irb. No more workarounds needed, anymore.
|
|
311
|
+
- added sketches gem
|
|
312
|
+
- customizable welcome message
|
|
313
|
+
- more little fixes/enhancements
|
|
266
314
|
|
|
267
315
|
## 0.8.0
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
316
|
+
|
|
317
|
+
- added Object#ri method
|
|
318
|
+
- feature: extension package loading (e.g. irbtools-more)
|
|
319
|
+
- feature: loading in IRB.conf[:IRB_RC] (loading when a subirb starts, no more guessmethod rails errors)
|
|
320
|
+
- added rerequire (rrq) and ld load helper
|
|
272
321
|
|
|
273
322
|
## 0.7.4
|
|
274
|
-
|
|
275
|
-
|
|
323
|
+
|
|
324
|
+
- added workaround to use irb_rocket and hirb at the same time (basic hack, e.g. paging does not work)
|
|
325
|
+
- fixed little VERSION bug
|
|
276
326
|
|
|
277
327
|
## 0.7.3
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
328
|
+
|
|
329
|
+
- refactored file structure and added new Irbtools.add_lib method
|
|
330
|
+
- load railsrc if executed with rails and Irbtools.railsrc is set
|
|
331
|
+
- more little fixes
|
|
281
332
|
|
|
282
333
|
## 0.7.2
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
334
|
+
|
|
335
|
+
- fixed Rails 3 bug
|
|
336
|
+
- added boson gem (command repository)
|
|
337
|
+
- remember history when resetting or switching ruby version
|
|
286
338
|
|
|
287
339
|
## 0.7.1
|
|
288
|
-
|
|
340
|
+
|
|
341
|
+
- added method for starting a debugger
|
|
289
342
|
|
|
290
343
|
## 0.7.0
|
|
291
|
-
* initial release
|
|
292
344
|
|
|
293
|
-
|
|
345
|
+
- initial release
|
|
346
|
+
|
|
347
|
+
J-\_-L
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
irbtools (4.0
|
|
4
|
+
irbtools (4.1.0)
|
|
5
5
|
clipboard (>= 1.4, < 3.0)
|
|
6
6
|
code (>= 0.9.4, < 2.0)
|
|
7
7
|
coderay (~> 1.1)
|
|
@@ -11,7 +11,7 @@ PATH
|
|
|
11
11
|
fancy_irb (~> 2.1)
|
|
12
12
|
hirb (~> 0.7, >= 0.7.3)
|
|
13
13
|
interactive_editor (~> 0.0, >= 0.0.12)
|
|
14
|
-
irb (>= 1.
|
|
14
|
+
irb (>= 1.13.0, < 1.15)
|
|
15
15
|
looksee (~> 5.0)
|
|
16
16
|
methodfinder (~> 2.2, >= 2.2.5)
|
|
17
17
|
object_shadow (~> 1.1)
|
|
@@ -24,7 +24,7 @@ PATH
|
|
|
24
24
|
GEM
|
|
25
25
|
remote: https://rubygems.org/
|
|
26
26
|
specs:
|
|
27
|
-
cd (1.0.
|
|
27
|
+
cd (1.0.2)
|
|
28
28
|
clipboard (2.0.0)
|
|
29
29
|
code (0.9.4)
|
|
30
30
|
coderay (~> 1.1)
|
|
@@ -34,58 +34,56 @@ GEM
|
|
|
34
34
|
yard (~> 0.9.11)
|
|
35
35
|
debugging (2.1.0)
|
|
36
36
|
paint (>= 0.9, < 3.0)
|
|
37
|
-
diff-lcs (1.5.
|
|
37
|
+
diff-lcs (1.5.1)
|
|
38
38
|
every_day_irb (2.2.0)
|
|
39
39
|
cd (~> 1.0)
|
|
40
40
|
fancy_irb (2.1.2)
|
|
41
41
|
irb (>= 1.7, < 2.0)
|
|
42
42
|
paint (>= 0.9, < 3.0)
|
|
43
43
|
unicode-display_width (>= 2.5)
|
|
44
|
-
ffi (1.
|
|
44
|
+
ffi (1.17.0)
|
|
45
45
|
hirb (0.7.3)
|
|
46
46
|
interactive_editor (0.0.12)
|
|
47
47
|
spoon (~> 0.0.6)
|
|
48
48
|
io-console (0.7.2)
|
|
49
|
-
irb (1.
|
|
50
|
-
rdoc
|
|
49
|
+
irb (1.14.1)
|
|
50
|
+
rdoc (>= 4.0.0)
|
|
51
51
|
reline (>= 0.4.2)
|
|
52
52
|
looksee (5.0.0)
|
|
53
|
-
method_source (1.
|
|
53
|
+
method_source (1.1.0)
|
|
54
54
|
methodfinder (2.2.5)
|
|
55
55
|
object_shadow (1.1.1)
|
|
56
56
|
os (1.1.4)
|
|
57
57
|
paint (2.3.0)
|
|
58
58
|
psych (5.1.2)
|
|
59
59
|
stringio
|
|
60
|
-
rake (13.
|
|
61
|
-
rdoc (6.
|
|
60
|
+
rake (13.2.1)
|
|
61
|
+
rdoc (6.7.0)
|
|
62
62
|
psych (>= 4.0.0)
|
|
63
|
-
reline (0.5.
|
|
63
|
+
reline (0.5.10)
|
|
64
64
|
io-console (~> 0.5)
|
|
65
|
-
rspec (3.
|
|
66
|
-
rspec-core (~> 3.
|
|
67
|
-
rspec-expectations (~> 3.
|
|
68
|
-
rspec-mocks (~> 3.
|
|
69
|
-
rspec-core (3.
|
|
70
|
-
rspec-support (~> 3.
|
|
71
|
-
rspec-expectations (3.
|
|
65
|
+
rspec (3.13.0)
|
|
66
|
+
rspec-core (~> 3.13.0)
|
|
67
|
+
rspec-expectations (~> 3.13.0)
|
|
68
|
+
rspec-mocks (~> 3.13.0)
|
|
69
|
+
rspec-core (3.13.1)
|
|
70
|
+
rspec-support (~> 3.13.0)
|
|
71
|
+
rspec-expectations (3.13.3)
|
|
72
72
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
73
|
-
rspec-support (~> 3.
|
|
74
|
-
rspec-mocks (3.
|
|
73
|
+
rspec-support (~> 3.13.0)
|
|
74
|
+
rspec-mocks (3.13.1)
|
|
75
75
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
76
|
-
rspec-support (~> 3.
|
|
77
|
-
rspec-support (3.
|
|
78
|
-
ruby_engine (2.0.
|
|
79
|
-
ruby_version (1.0.
|
|
76
|
+
rspec-support (~> 3.13.0)
|
|
77
|
+
rspec-support (3.13.1)
|
|
78
|
+
ruby_engine (2.0.3)
|
|
79
|
+
ruby_version (1.0.3)
|
|
80
80
|
spoon (0.0.6)
|
|
81
81
|
ffi
|
|
82
|
-
stringio (3.1.
|
|
83
|
-
unicode-display_width (2.
|
|
84
|
-
webrick (1.7.0)
|
|
82
|
+
stringio (3.1.1)
|
|
83
|
+
unicode-display_width (2.6.0)
|
|
85
84
|
wirb (2.2.2)
|
|
86
85
|
paint (>= 0.9, < 3.0)
|
|
87
|
-
yard (0.9.
|
|
88
|
-
webrick (~> 1.7.0)
|
|
86
|
+
yard (0.9.37)
|
|
89
87
|
|
|
90
88
|
PLATFORMS
|
|
91
89
|
ruby
|
|
@@ -97,4 +95,4 @@ DEPENDENCIES
|
|
|
97
95
|
rspec
|
|
98
96
|
|
|
99
97
|
BUNDLED WITH
|
|
100
|
-
2.
|
|
98
|
+
2.5.20
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Irbtools [![[version]](https://badge.fury.io/rb/irbtools.svg)](https://badge.fury.io/rb/irbtools)
|
|
1
|
+
# Irbtools [![[version]](https://badge.fury.io/rb/irbtools.svg)](https://badge.fury.io/rb/irbtools) [![[ci]](https://github.com/janlelis/irbtools/workflows/Test/badge.svg)](https://github.com/janlelis/irbtools/actions?query=workflow%3ATest)
|
|
2
2
|
|
|
3
3
|
## Irbtools 4 for Current IRB
|
|
4
4
|
|
|
@@ -8,12 +8,18 @@ The current version of Irbtools requires [IRB 1.12+](https://github.com/ruby/irb
|
|
|
8
8
|
|
|
9
9
|
Improves Ruby's IRB with:
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- a default configuration
|
|
12
|
+
- improved syntax highlighting of result objects
|
|
13
|
+
- helpful commands for debugging and introspection
|
|
14
14
|
|
|
15
15
|
## Examples
|
|
16
16
|
|
|
17
|
+
### Call system commands with `$`
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
>> $ git status # displays current git status
|
|
21
|
+
```
|
|
22
|
+
|
|
17
23
|
### Show lookup chain and method list grouped by visibility
|
|
18
24
|
|
|
19
25
|
```ruby
|
|
@@ -145,12 +151,6 @@ require(path)
|
|
|
145
151
|
choose_from_list(question, list)
|
|
146
152
|
```
|
|
147
153
|
|
|
148
|
-
### Call system commands with `$`
|
|
149
|
-
|
|
150
|
-
```ruby
|
|
151
|
-
>> $ git status # displays current git status
|
|
152
|
-
```
|
|
153
|
-
|
|
154
154
|
## Setup
|
|
155
155
|
|
|
156
156
|
$ gem install irbtools
|
|
@@ -169,7 +169,7 @@ your code with:
|
|
|
169
169
|
|
|
170
170
|
binding.irb
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
_Optional:_ If the **binding_of_caller** gem is available, you can just call the `irb`
|
|
173
173
|
method and it will start a session with the current binding:
|
|
174
174
|
|
|
175
175
|
irb
|
|
@@ -178,38 +178,38 @@ method and it will start a session with the current binding:
|
|
|
178
178
|
|
|
179
179
|
### General IRB Improvements
|
|
180
180
|
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
181
|
+
- Syntax highlighting ([wirb](https://github.com/janlelis/wirb/) / [fancy_irb](https://github.com/janlelis/fancy_irb))
|
|
182
|
+
- Loads included libraries efficiently to reduce IRB start-up time
|
|
183
|
+
- Customizable views for specfic options using [hirb](https://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html). By default, ActiveRecord results get displayed as a table.
|
|
184
184
|
|
|
185
185
|
### Included Debugging Methods for IRB
|
|
186
186
|
|
|
187
187
|
#### Highlights
|
|
188
188
|
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
189
|
+
- Lookup and manipulate instance variables / methods with ease using [object_shadow](https://github.com/janlelis/object_shadow/)
|
|
190
|
+
- Go even further with [looksee](https://github.com/oggy/looksee), the best lookup path inspection tool out there
|
|
191
|
+
- Display a method's source code using [code](https://github.com/janlelis/code)
|
|
192
|
+
- Find methods that turn one value into another value with [methodfinder](https://github.com/citizen428/methodfinder)
|
|
193
|
+
- [Use VIM from inside IRB](https://github.com/jberkel/interactive_editor)
|
|
194
194
|
|
|
195
195
|
#### Extra Commands
|
|
196
196
|
|
|
197
197
|
Commands get treated specially by IRB and do not necessarily follow Ruby syntax.
|
|
198
198
|
|
|
199
|
-
Command
|
|
200
|
-
|
|
201
|
-
`code `
|
|
202
|
-
`howtocall ` | -
|
|
203
|
-
`look `
|
|
204
|
-
`shadow `
|
|
205
|
-
`sys `
|
|
199
|
+
| Command | Alias | Description | Example |
|
|
200
|
+
| ------------ | ----- | ------------------------------------------------ | ----------------------- |
|
|
201
|
+
| `code ` | - | Shows syntax-highlighted source code of a method | `code Array#reverse` |
|
|
202
|
+
| `howtocall ` | - | Shows the method signature | `howtocall String#gsub` |
|
|
203
|
+
| `look ` | - | Shows looksee method list | `look [1,2,3]` |
|
|
204
|
+
| `shadow ` | `+ ` | Shows object shadow method list | `shadow [1,2,3]` |
|
|
205
|
+
| `sys ` | `$ ` | Calls system shell | `$ top` |
|
|
206
206
|
|
|
207
207
|
Two default commands have an additional alias:
|
|
208
208
|
|
|
209
|
-
Command
|
|
210
|
-
|
|
211
|
-
`show_doc` | `ri ` | Shows documentation
|
|
212
|
-
`chws`
|
|
209
|
+
| Command | Alias | Description | Example |
|
|
210
|
+
| ---------- | ----- | ----------------------- | ---------------- |
|
|
211
|
+
| `show_doc` | `ri ` | Shows documentation | `ri String#gsub` |
|
|
212
|
+
| `chws` | `co ` | "change into an object" | `co [1,2,3]` |
|
|
213
213
|
|
|
214
214
|
##### IRB's ls?
|
|
215
215
|
|
|
@@ -217,69 +217,69 @@ Please note that IRB's own **ls** command is aliased to `ils`, since `ls` alread
|
|
|
217
217
|
|
|
218
218
|
#### Ruby Introspection
|
|
219
219
|
|
|
220
|
-
Method / Constant
|
|
221
|
-
|
|
222
|
-
`Object#lp` or `Object#look` |
|
|
223
|
-
`Object#shadow`
|
|
224
|
-
`code`
|
|
225
|
-
`howtocall`
|
|
226
|
-
`mf`
|
|
220
|
+
| Method / Constant | Arguments | Description | Provided By |
|
|
221
|
+
| ---------------------------- | ----------------------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
222
|
+
| `Object#lp` or `Object#look` | | Supercharged method introspection in IRB | [looksee](https://github.com/oggy/looksee) |
|
|
223
|
+
| `Object#shadow` | | Manipulate instance variables and learn about callable methods | [object_shadow](https://github.com/janlelis/object_shadow/) |
|
|
224
|
+
| `code` | object = self, method_name | Display the method source with syntax highlighting. Will also try to look up C methods. | [code](https://github.com/janlelis/code) |
|
|
225
|
+
| `howtocall` | object = self, method_or_proc | Display parameter names and types you will need to call a method | [debugging/howtocall](https://github.com/janlelis/debugging#howtocallobj--self-method_or_proc) |
|
|
226
|
+
| `mf` | object1, object2 | Find methods which turn one value into another value | [methodfinder](https://github.com/citizen428/methodfinder) |
|
|
227
227
|
|
|
228
228
|
#### Platform Info
|
|
229
229
|
|
|
230
|
-
Method / Constant | Arguments
|
|
231
|
-
|
|
232
|
-
`OS`
|
|
233
|
-
`RubyVersion`
|
|
234
|
-
`RubyEngine`
|
|
230
|
+
| Method / Constant | Arguments | Description | Provided By |
|
|
231
|
+
| ----------------- | --------- | ---------------------------------- | -------------------------------------------------------- |
|
|
232
|
+
| `OS` | | Query operating system information | [os](https://github.com/rdp/os) |
|
|
233
|
+
| `RubyVersion` | | Show the Ruby version | [ruby_version](https://github.com/janlelis/ruby_version) |
|
|
234
|
+
| `RubyEngine` | | Show the Ruby engine | [ruby_engine](https://github.com/janlelis/ruby_engine) |
|
|
235
235
|
|
|
236
236
|
#### General Utils
|
|
237
237
|
|
|
238
|
-
Method / Constant
|
|
239
|
-
|
|
240
|
-
`beep`
|
|
241
|
-
`clear`
|
|
242
|
-
`copy`
|
|
243
|
-
`copy_output`
|
|
244
|
-
`colorize`
|
|
245
|
-
`ed` / `emacs` / `mate` / `mvim` / `nano` / `vi` / `vim` | filename = nil
|
|
246
|
-
`ld`
|
|
247
|
-
`pa`
|
|
248
|
-
`page`
|
|
249
|
-
`paste`
|
|
250
|
-
`q`
|
|
251
|
-
`re`
|
|
252
|
-
`reset!`
|
|
253
|
-
`rq`
|
|
254
|
-
`rr`
|
|
255
|
-
`rrq` / `rerequire`
|
|
256
|
-
`wp`
|
|
238
|
+
| Method / Constant | Arguments | Description | Provided By |
|
|
239
|
+
| -------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
240
|
+
| `beep` | | Ring terminal bell | [debugging/beep](https://github.com/janlelis/debugging#beep) |
|
|
241
|
+
| `clear` | | Clear the terminal | [every_day_irb](https://github.com/janlelis/every_day_irb) |
|
|
242
|
+
| `copy` | string | Copy something to the clipboard | [clipboard](https://github.com/janlelis/clipboard) |
|
|
243
|
+
| `copy_output` | | Copy session output history to the clipboard | [clipboard](https://github.com/janlelis/clipboard), irbtools |
|
|
244
|
+
| `colorize` | string | Syntax-highlight a string of Ruby code | [coderay](https://github.com/rubychan/coderay), irbtools |
|
|
245
|
+
| `ed` / `emacs` / `mate` / `mvim` / `nano` / `vi` / `vim` | filename = nil | Start an editor in the session context | [interactive_editor](https://github.com/jberkel/interactive_editor) |
|
|
246
|
+
| `ld` | file | Shortcut for `load lib.to_s + '.rb'` | [every_day_irb](https://github.com/janlelis/every_day_irb) |
|
|
247
|
+
| `pa` | string, color | Print a string in the specified color | [paint](https://github.com/janlelis/paint#utilities) |
|
|
248
|
+
| `page` | what, options = {} | Use pager to improve viewing longer content | [hirb](https://github.com/cldwalker/hirb#pager), irbtools |
|
|
249
|
+
| `paste` | | Paste clipboard content | [clipboard](https://github.com/janlelis/clipboard) |
|
|
250
|
+
| `q` | \*args | Like `Kernel#p`, but prints results on one line, with different colors | [debugging/q](https://github.com/janlelis/debugging#qargs) |
|
|
251
|
+
| `re` | string, regexg, groups = nil | Regex debugging helper | [debugging/re](https://github.com/janlelis/debugging#qargs) |
|
|
252
|
+
| `reset!` | | Restart the current IRB session | [every_day_irb](https://github.com/janlelis/every_day_irb) |
|
|
253
|
+
| `rq` | lib | Shortcut for `require lib.to_s`. Use it like this: `rq:prime` | [every_day_irb](https://github.com/janlelis/every_day_irb) |
|
|
254
|
+
| `rr` | lib | Shortcut for `require_relative lib.to_s` | [every_day_irb](https://github.com/janlelis/every_day_irb) |
|
|
255
|
+
| `rrq` / `rerequire` | lib | Hack to remove a library from `$LOADED_FEATURES` and `require` it again | [every_day_irb](https://github.com/janlelis/every_day_irb) |
|
|
256
|
+
| `wp` | inspect_string | Syntax-highlight a Ruby return value | [wirb](https://github.com/janlelis/wirb#kernelwp) |
|
|
257
257
|
|
|
258
258
|
#### Files and Navigation
|
|
259
259
|
|
|
260
|
-
Method / Constant | Arguments
|
|
261
|
-
|
|
262
|
-
`cat`
|
|
263
|
-
`cd`
|
|
264
|
-
`chmod`
|
|
265
|
-
`chmod_R`
|
|
266
|
-
`chown`
|
|
267
|
-
`chown_R`
|
|
268
|
-
`cp`
|
|
269
|
-
`cp_r`
|
|
270
|
-
`ls`
|
|
271
|
-
`ln`
|
|
272
|
-
`ln_s`
|
|
273
|
-
`ln_sf`
|
|
274
|
-
`mkdir`
|
|
275
|
-
`mkdir_p`
|
|
276
|
-
`cp`
|
|
277
|
-
`pwd`
|
|
278
|
-
`ray`
|
|
279
|
-
`rm`
|
|
280
|
-
`rm_r`
|
|
281
|
-
`rm_rf`
|
|
282
|
-
`rmdir`
|
|
260
|
+
| Method / Constant | Arguments | Description | Provided By |
|
|
261
|
+
| ----------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
262
|
+
| `cat` | path | Read file contents | [every_day_irb](https://github.com/janlelis/every_day_irb) |
|
|
263
|
+
| `cd` | path = nil | Change the directory. Can also be used in these forms: `~cd` (change to home directory), `-cd` (change to previous directory) | [cd](https://github.com/janlelis/cd) |
|
|
264
|
+
| `chmod` | mode, path | Set file mode for file | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
265
|
+
| `chmod_R` | mode, path | Set file mode for directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
266
|
+
| `chown` | user, group, path | Set file owner for file | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
267
|
+
| `chown_R` | user, group, path | Set file owner for directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
268
|
+
| `cp` | source, destination | Copy file | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
269
|
+
| `cp_r` | source, destination | Copy directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
270
|
+
| `ls` | path = "." | List directory content | [cd](https://github.com/janlelis/cd) |
|
|
271
|
+
| `ln` | target, link | Create symlink (`ln`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
272
|
+
| `ln_s` | target, link | Create symlink (`ln -s`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
273
|
+
| `ln_sf` | target, link | Create symlink (`ln -sf`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
274
|
+
| `mkdir` | path | Create a new directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
275
|
+
| `mkdir_p` | path | Create a new directory (with `-p` option) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
276
|
+
| `cp` | source, destination | Move file or directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
277
|
+
| `pwd` | | Return current directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
278
|
+
| `ray` | path | Syntax highlight a Ruby file | [coderay](https://github.com/rubychan/coderay), irbtools |
|
|
279
|
+
| `rm` | path | Delete a file (`rm`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
280
|
+
| `rm_r` | path | Delete a file or directory (`rm -r`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
281
|
+
| `rm_rf` | path | Delete a file or directory, with force (`rm -rf`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
282
|
+
| `rmdir` | path | Delete an empty directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html) |
|
|
283
283
|
|
|
284
284
|
### Advanced Tweaking
|
|
285
285
|
|
|
@@ -312,7 +312,8 @@ You can use **Irbtools** without colors/IRB extensions. To do so, put this into
|
|
|
312
312
|
require 'irbtools/non_fancy'
|
|
313
313
|
Irbtools.start
|
|
314
314
|
```
|
|
315
|
-
## J-_-L
|
|
316
315
|
|
|
317
|
-
|
|
316
|
+
## J-\_-L
|
|
317
|
+
|
|
318
|
+
Copyright (c) 2010-2024 Jan Lelis <https://janlelis.com> released under the MIT
|
|
318
319
|
license.
|
data/irbtools.gemspec
CHANGED
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
# Dependencies
|
|
21
21
|
|
|
22
22
|
# Core Functionality
|
|
23
|
-
s.add_dependency %q<irb>, ">= 1.
|
|
23
|
+
s.add_dependency %q<irb>, ">= 1.13.0", "< 1.15"
|
|
24
24
|
s.add_dependency %q<every_day_irb>, "~> 2.2"
|
|
25
25
|
s.add_dependency %q<fancy_irb>, "~> 2.1"
|
|
26
26
|
s.add_dependency %q<wirb>, "~> 2.0", ">= 2.2.1"
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
require "irb/command
|
|
1
|
+
require "irb/command"
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module Irbtools
|
|
4
4
|
module Command
|
|
5
|
-
class Code < Base
|
|
5
|
+
class Code < IRB::Command::Base
|
|
6
6
|
category "Introspection"
|
|
7
7
|
description "Shows the syntax-highlighted source code of a method"
|
|
8
|
+
help_message <<~HELP
|
|
9
|
+
Shows the syntax-highlighted source code of a method. Works with Ruby's
|
|
10
|
+
native methods.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
Example usages:
|
|
13
|
+
>> code SecureRandom.uuid
|
|
14
|
+
>> code Array#reverse
|
|
15
|
+
HELP
|
|
16
|
+
|
|
17
|
+
def transform_arg(arg)
|
|
18
|
+
if arg.empty?
|
|
19
|
+
"[]"
|
|
20
|
+
elsif arg.strip =~ /\A(?:([\w:]+)([#.]))?(\w+[?!]?)\z/
|
|
21
|
+
if $1
|
|
22
|
+
if $2 == "#"
|
|
23
|
+
"[#{$1}, #{$1}.instance_method(:#{$3})]"
|
|
18
24
|
else
|
|
19
|
-
"
|
|
25
|
+
"[#{$1}, :#{$3}]"
|
|
20
26
|
end
|
|
21
27
|
else
|
|
22
|
-
|
|
28
|
+
"[:#{$3}]"
|
|
23
29
|
end
|
|
30
|
+
else
|
|
31
|
+
nil
|
|
24
32
|
end
|
|
25
33
|
end
|
|
26
34
|
|
|
27
|
-
def execute(
|
|
28
|
-
|
|
35
|
+
def execute(arg)
|
|
36
|
+
if code_parameters_code = transform_arg(arg)
|
|
37
|
+
code_parameters = @irb_context.workspace.binding.eval(code_parameters_code)
|
|
38
|
+
@irb_context.workspace.binding.send(:code, *code_parameters)
|
|
39
|
+
else
|
|
40
|
+
warn "code: Please use rdoc syntax, e.g. Array#sum"
|
|
41
|
+
end
|
|
29
42
|
rescue NameError
|
|
30
43
|
warn "code: Class or method not found."
|
|
31
44
|
end
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
require "irb/command
|
|
1
|
+
require "irb/command"
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module Irbtools
|
|
4
4
|
module Command
|
|
5
|
-
class Howtocall < Base
|
|
5
|
+
class Howtocall < IRB::Command::Base
|
|
6
6
|
category "Introspection"
|
|
7
7
|
description "Displays method signatures based on Method#parameters"
|
|
8
|
+
help_message <<~HELP
|
|
9
|
+
Displays method signatures based on Method#parameters, with the same limitations,
|
|
10
|
+
so it's more useful with methods implemented in Ruby itself
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
Example usages:
|
|
13
|
+
>> howtocall Gem.add_to_load_path
|
|
14
|
+
>> howtocall Array#sum
|
|
15
|
+
HELP
|
|
16
|
+
|
|
17
|
+
def transform_arg(arg)
|
|
18
|
+
if arg.empty?
|
|
19
|
+
"[]"
|
|
20
|
+
elsif arg.strip =~ /\A(?:([\w:]+)([#.]))?(\w+[?!]?)\z/
|
|
21
|
+
if $1
|
|
22
|
+
if $2 == "#"
|
|
23
|
+
"[#{$1}, #{$1}.instance_method(:#{$3})]"
|
|
18
24
|
else
|
|
19
|
-
"
|
|
25
|
+
"[#{$1}, :#{$3}]"
|
|
20
26
|
end
|
|
21
27
|
else
|
|
22
|
-
|
|
28
|
+
"[:#{$3}]"
|
|
23
29
|
end
|
|
30
|
+
else
|
|
31
|
+
nil
|
|
24
32
|
end
|
|
25
33
|
end
|
|
26
34
|
|
|
27
|
-
def execute(
|
|
28
|
-
|
|
35
|
+
def execute(arg)
|
|
36
|
+
if howtocall_parameters_code = transform_arg(arg)
|
|
37
|
+
howtocall_parameters = @irb_context.workspace.binding.eval(howtocall_parameters_code)
|
|
38
|
+
@irb_context.workspace.binding.send(:howtocall, *howtocall_parameters)
|
|
39
|
+
else
|
|
40
|
+
warn "howtocall: Please use rdoc syntax, e.g. Array#sum"
|
|
41
|
+
end
|
|
29
42
|
rescue NameError
|
|
30
43
|
warn "howtocall: Class or method not found"
|
|
31
44
|
end
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
require "irb/command
|
|
1
|
+
require "irb/command"
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module Irbtools
|
|
4
4
|
module Command
|
|
5
|
-
class Look < Base
|
|
5
|
+
class Look < IRB::Command::Base
|
|
6
6
|
category "Introspection"
|
|
7
|
-
description 'Method list and lookup path inspection based on looksee gem'
|
|
7
|
+
description 'Method list and lookup path inspection based on the looksee gem'
|
|
8
|
+
help_message <<~HELP
|
|
9
|
+
Method list and lookup path inspection based on the looksee gem.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
Example usage: look [1,2,3]
|
|
12
|
+
HELP
|
|
13
|
+
|
|
14
|
+
def execute(arg)
|
|
15
|
+
if arg.strip.empty?
|
|
16
|
+
p @irb_context.workspace.binding.look
|
|
12
17
|
else
|
|
13
|
-
|
|
14
|
-
obj.look(*params)
|
|
18
|
+
p @irb_context.workspace.binding.eval(arg).look
|
|
15
19
|
end
|
|
16
20
|
end
|
|
17
21
|
end
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
|
-
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
require "irb/command
|
|
1
|
+
require "irb/command"
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module Irbtools
|
|
4
4
|
module Command
|
|
5
|
-
class Shadow < Base
|
|
5
|
+
class Shadow < IRB::Command::Base
|
|
6
6
|
category "Introspection"
|
|
7
|
-
description 'Method list and lookup path inspection based on object shadow gem'
|
|
7
|
+
description 'Method list and lookup path inspection based on the object shadow gem'
|
|
8
|
+
help_message <<~HELP
|
|
9
|
+
Method list and lookup path inspection based on the object shadow gem.
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
Example usage: + [1,2,3]
|
|
12
|
+
HELP
|
|
13
|
+
|
|
14
|
+
def execute(arg)
|
|
15
|
+
if arg.strip.empty?
|
|
16
|
+
p @irb_context.workspace.binding.shadow
|
|
12
17
|
else
|
|
13
|
-
|
|
14
|
-
obj.shadow(*params)
|
|
18
|
+
p @irb_context.workspace.binding.eval(arg).shadow
|
|
15
19
|
end
|
|
16
20
|
end
|
|
17
21
|
end
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
require "irb/command
|
|
1
|
+
require "irb/command"
|
|
2
2
|
|
|
3
|
-
module
|
|
3
|
+
module Irbtools
|
|
4
4
|
module Command
|
|
5
|
-
class Sys < Base
|
|
5
|
+
class Sys < IRB::Command::Base
|
|
6
6
|
category "Misc"
|
|
7
7
|
description 'Run a system command'
|
|
8
|
+
help_message <<~HELP
|
|
9
|
+
Run a command via Ruby's Kernel#system method
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if args.empty? || string_literal?(args)
|
|
12
|
-
args
|
|
13
|
-
else
|
|
14
|
-
args.strip.dump
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
11
|
+
Example usage: $ cowsay "Hello from IRB"
|
|
12
|
+
HELP
|
|
18
13
|
|
|
19
|
-
def execute(
|
|
20
|
-
system(
|
|
14
|
+
def execute(arg)
|
|
15
|
+
system(arg)
|
|
21
16
|
end
|
|
22
17
|
end
|
|
23
18
|
end
|
data/lib/irbtools/configure.rb
CHANGED
|
@@ -127,18 +127,11 @@ module Irbtools
|
|
|
127
127
|
end
|
|
128
128
|
|
|
129
129
|
def load_commands
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
[:look, :Look, nil, [:look, IRB::ExtendCommandBundle::OVERRIDE_ALL]],
|
|
136
|
-
[:shadow, :Shadow, nil, [:shadow, IRB::ExtendCommandBundle::OVERRIDE_ALL]],
|
|
137
|
-
[:sys, :Sys, nil, [:sys, IRB::ExtendCommandBundle::OVERRIDE_ALL]],
|
|
138
|
-
].each{ |ecconfig|
|
|
139
|
-
ec.push(ecconfig)
|
|
140
|
-
IRB::ExtendCommandBundle.def_extend_command(*ecconfig)
|
|
141
|
-
}
|
|
130
|
+
IRB::Command.register(:code, Irbtools::Command::Code)
|
|
131
|
+
IRB::Command.register(:howtocall, Irbtools::Command::Howtocall)
|
|
132
|
+
IRB::Command.register(:look, Irbtools::Command::Look)
|
|
133
|
+
IRB::Command.register(:shadow, Irbtools::Command::Shadow)
|
|
134
|
+
IRB::Command.register(:sys, Irbtools::Command::Sys)
|
|
142
135
|
end
|
|
143
136
|
|
|
144
137
|
def add_command_aliases
|
data/lib/irbtools/version.rb
CHANGED
data/lib/irbtools.rb
CHANGED
|
@@ -5,18 +5,18 @@ describe "irbtools commands" do
|
|
|
5
5
|
describe "howtocall / code" do
|
|
6
6
|
it "support ri Syntax like String.name or String#gsub" do
|
|
7
7
|
expect(
|
|
8
|
-
|
|
9
|
-
).to eq "String, :name"
|
|
8
|
+
Irbtools::Command::Howtocall.new(nil).transform_arg("String.name")
|
|
9
|
+
).to eq "[String, :name]"
|
|
10
10
|
|
|
11
11
|
expect(
|
|
12
|
-
|
|
13
|
-
).to eq "String, String.instance_method(:gsub)"
|
|
12
|
+
Irbtools::Command::Code.new(nil).transform_arg("String#gsub")
|
|
13
|
+
).to eq "[String, String.instance_method(:gsub)]"
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it "supports question-mark methods" do
|
|
17
17
|
expect(
|
|
18
|
-
|
|
19
|
-
).to eq "String, String.instance_method(:ascii_only?)"
|
|
18
|
+
Irbtools::Command::Howtocall.new(nil).transform_arg("String#ascii_only?")
|
|
19
|
+
).to eq "[String, String.instance_method(:ascii_only?)]"
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: irbtools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jan Lelis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-09-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: irb
|
|
@@ -16,7 +16,7 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.
|
|
19
|
+
version: 1.13.0
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
22
|
version: '1.15'
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 1.
|
|
29
|
+
version: 1.13.0
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '1.15'
|
|
@@ -376,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
376
376
|
- !ruby/object:Gem::Version
|
|
377
377
|
version: '0'
|
|
378
378
|
requirements: []
|
|
379
|
-
rubygems_version: 3.5.
|
|
379
|
+
rubygems_version: 3.5.20
|
|
380
380
|
signing_key:
|
|
381
381
|
specification_version: 4
|
|
382
382
|
summary: Irbtools happy IRB.
|