irbtools 3.0.5 → 4.0.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 +23 -0
- data/CONFIGURE.md +1 -2
- data/MIT-LICENSE.txt +1 -1
- data/README.md +189 -54
- data/irbtools.gemspec +17 -11
- data/lib/irbtools/binding.rb +4 -21
- data/lib/irbtools/commands/code.rb +35 -0
- data/lib/irbtools/commands/howtocall.rb +35 -0
- data/lib/irbtools/commands/look.rb +20 -0
- data/lib/irbtools/commands/shadow.rb +20 -0
- data/lib/irbtools/commands/sys.rb +25 -0
- data/lib/irbtools/commands.rb +5 -0
- data/lib/irbtools/configure.rb +1 -0
- data/lib/irbtools/implementation.rb +48 -37
- data/lib/irbtools/libraries.rb +14 -41
- data/lib/irbtools/version.rb +1 -1
- data/lib/irbtools.rb +6 -22
- metadata +49 -50
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e9a398324ec34c6a93632f3eb26f84be51607b45e1e06e311a3c7507e11e15b
|
|
4
|
+
data.tar.gz: bb9072432d1e2404e9bcb1a763d338458d97d8126bbdd6e26b773aaff98c514e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33c1fd0e1ee8b60cccbc8cc10620341826aaaebaed527bea9e4a046347d2a1753c91bdb69204619de6624981ed58e838d5b0fdf7c08cf26ce24375ec0d9a39ce
|
|
7
|
+
data.tar.gz: 2c8c5a3668896580a9f0e6f6e8a959eff7b80caacbfb3b6632114063ad1f511e03d56b3dccf84f0d6f5ccc42e3c16c8f065315feed9022f41a3ffd15f182083f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Irbtools Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0
|
|
4
|
+
|
|
5
|
+
* Requires IRB 1.6 (Ruby 3.2 bundles IRB 1.6.2)
|
|
6
|
+
* Requires Ruby 3.0
|
|
7
|
+
|
|
8
|
+
* Remove a bunch of gems:
|
|
9
|
+
* Drop binding.repl gem since it was only needed for older Rubies
|
|
10
|
+
* Drop ori gem, since IRB now has `show_doc`
|
|
11
|
+
* Drop RubyInfo
|
|
12
|
+
|
|
13
|
+
* Retire irbtools-more:
|
|
14
|
+
* Move looksee to core irbtools
|
|
15
|
+
* Move core_docs to core irbtools
|
|
16
|
+
* Remove bond (outdated)
|
|
17
|
+
* Leave binding_of_caller optional
|
|
18
|
+
|
|
19
|
+
* Add command wrappers for code, howtocall, looksee, shadow
|
|
20
|
+
* Add `$` command to directly call system
|
|
21
|
+
|
|
22
|
+
* Version bumps: looksee, os, methodfinder, code, core_docs, debugging
|
|
23
|
+
* Alias IRB's ls to ils (fixes #53)
|
|
24
|
+
* Remove support for RIPL repl (outdated)
|
|
25
|
+
|
|
3
26
|
## 3.0.5
|
|
4
27
|
* Bump methodfinder dependency & update usage (fixes #52)
|
|
5
28
|
|
data/CONFIGURE.md
CHANGED
|
@@ -43,8 +43,7 @@ The following options are possible
|
|
|
43
43
|
: Same as `:thread`, but after loading late libraries.
|
|
44
44
|
`:sub_session => true`
|
|
45
45
|
: The library is loaded every time a sub-session starts (using
|
|
46
|
-
`IRB.conf[:IRB_RC]`).
|
|
47
|
-
`ripl-after_rc` is used.
|
|
46
|
+
`IRB.conf[:IRB_RC]`).
|
|
48
47
|
`:autoload => :Constant`
|
|
49
48
|
: Use Ruby's `autoload` feature. It loads the library as soon as the
|
|
50
49
|
constant is encountered.
|
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,19 +1,156 @@
|
|
|
1
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
|
+
## Irbtools 4.0 for IRB 1.6+
|
|
4
|
+
|
|
5
|
+
The current version of Irbtools requires [IRB 1.6+](https://github.com/ruby/irb) (which is the default for Ruby
|
|
6
|
+
from 3.2 on). Please use Irbtools 3 for earlier versions of IRB.
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
Improves Ruby's IRB with:
|
|
11
|
+
|
|
12
|
+
- a default configuration
|
|
13
|
+
- improved syntax highlighting of result objects
|
|
14
|
+
- helpful commands for debugging and introspection
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
### Show lookup chain and method list grouped by visibility
|
|
19
|
+
|
|
20
|
+
```ruby
|
|
21
|
+
>> shadow [1,2,3].reverse
|
|
22
|
+
=> # ObjectShadow of Object #85280
|
|
23
|
+
|
|
24
|
+
## Lookup Chain
|
|
25
|
+
|
|
26
|
+
[#<Class:#<Array:0x00007fccd9cfac30>>, Array, Enumerable, Object, "…"]
|
|
27
|
+
|
|
28
|
+
## 141 Public Methods (Non-Class/Object)
|
|
29
|
+
|
|
30
|
+
[:&, :*, :+, :-, :<<, :<=>, :==, :[], :[]=, :all?, :any?, :append, :assoc, :at, :bsearch, :bsearch_index, :chain,
|
|
31
|
+
:chunk, :chunk_while, :clear, :collect, :collect!, :collect_concat, :combination, :compact, :compact!, :concat,
|
|
32
|
+
:count, :cycle, :deconstruct, :delete, :delete_at, :delete_if, :detect, :difference, :dig, :drop, :drop_while,
|
|
33
|
+
:each, :each_cons, :each_entry, :each_index, :each_slice, :each_with_index, :each_with_object, :empty?, :entries,
|
|
34
|
+
:eql?, :fetch, :fill, :filter, :filter!, :filter_map, :find, :find_all, :find_index, :first, :flat_map, :flatten,
|
|
35
|
+
:flatten!, :grep, :grep_v, :group_by, :hash, :include?, :index, :inject, :insert, :inspect, :intersect?,
|
|
36
|
+
:intersection, :join, :keep_if, :last, :lazy, :length, :map, :map!, :max, :max_by, :member?, :min, :min_by,
|
|
37
|
+
:minmax, :minmax_by, :none?, :one?, :pack, :partition, :permutation, :pop, :prepend, :product, :push, :rassoc,
|
|
38
|
+
:reduce, :reject, :reject!, :repeated_combination, :repeated_permutation, :replace, :reverse, :reverse!,
|
|
39
|
+
:reverse_each, :rindex, :rotate, :rotate!, :sample, :select, :select!, :shelljoin, :shift, :shuffle, :shuffle!,
|
|
40
|
+
:size, :slice, :slice!, :slice_after, :slice_before, :slice_when, :sort, :sort!, :sort_by, :sort_by!, :sum,
|
|
41
|
+
:take, :take_while, :tally, :to_a, :to_ary, :to_h, :to_s, :to_set, :transpose, :union, :uniq, :uniq!, :unshift,
|
|
42
|
+
:values_at, :zip, :|]
|
|
43
|
+
|
|
44
|
+
## 2 Private Methods (Non-Class/Object)
|
|
45
|
+
|
|
46
|
+
[:initialize, :initialize_copy]
|
|
47
|
+
|
|
48
|
+
## Object Inspect
|
|
49
|
+
|
|
50
|
+
[3, 2, 1]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Show a method list grouped by ancestors
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
>> look "str"
|
|
57
|
+
.
|
|
58
|
+
.
|
|
59
|
+
.
|
|
60
|
+
Comparable
|
|
61
|
+
< <= == > >= between? clamp
|
|
62
|
+
String
|
|
63
|
+
% crypt inspect squeeze!
|
|
64
|
+
* dedup intern start_with?
|
|
65
|
+
+ delete length strip
|
|
66
|
+
+@ delete! lines strip!
|
|
67
|
+
-@ delete_prefix ljust sub
|
|
68
|
+
<< delete_prefix! lstrip sub!
|
|
69
|
+
<=> delete_suffix lstrip! succ
|
|
70
|
+
.
|
|
71
|
+
.
|
|
72
|
+
.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Show source code of a Ruby-based method
|
|
76
|
+
|
|
77
|
+
```ruby
|
|
78
|
+
>> code SecureRandom.uuid
|
|
79
|
+
#
|
|
80
|
+
# /home/dan/.rvm/rubies/ruby-3.2.0/lib/ruby/3.2.0/random/formatter.rb:170
|
|
81
|
+
#
|
|
82
|
+
# Generate a random v4 UUID (Universally Unique IDentifier).
|
|
83
|
+
#
|
|
84
|
+
# require 'random/formatter'
|
|
85
|
+
#
|
|
86
|
+
# Random.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
|
|
87
|
+
# Random.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
|
|
88
|
+
# # or
|
|
89
|
+
# prng = Random.new
|
|
90
|
+
# prng.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b"
|
|
91
|
+
#
|
|
92
|
+
# The version 4 UUID is purely random (except the version).
|
|
93
|
+
# It doesn't contain meaningful information such as MAC addresses, timestamps, etc.
|
|
94
|
+
#
|
|
95
|
+
# The result contains 122 random bits (15.25 random bytes).
|
|
96
|
+
#
|
|
97
|
+
# See RFC4122[https://datatracker.ietf.org/doc/html/rfc4122] for details of UUID.
|
|
98
|
+
#
|
|
99
|
+
def uuid
|
|
100
|
+
ary = random_bytes(16).unpack("NnnnnN")
|
|
101
|
+
ary[2] = (ary[2] & 0x0fff) | 0x4000
|
|
102
|
+
ary[3] = (ary[3] & 0x3fff) | 0x8000
|
|
103
|
+
"%08x-%04x-%04x-%04x-%04x%08x" % ary
|
|
104
|
+
end
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Show source code of a natively implemented method
|
|
108
|
+
|
|
109
|
+
```ruby
|
|
110
|
+
>> code Array#reverse
|
|
111
|
+
//
|
|
112
|
+
// https://github.com/ruby/ruby/blob/ruby_3_2/array.c#L3282
|
|
113
|
+
//
|
|
114
|
+
// Returns a new \Array with the elements of +self+ in reverse order:
|
|
115
|
+
//
|
|
116
|
+
// a = ['foo', 'bar', 'two']
|
|
117
|
+
// a1 = a.reverse
|
|
118
|
+
// a1 # => ["two", "bar", "foo"]
|
|
119
|
+
static VALUE
|
|
120
|
+
rb_ary_reverse_m(VALUE ary)
|
|
121
|
+
{
|
|
122
|
+
long len = RARRAY_LEN(ary);
|
|
123
|
+
VALUE dup = rb_ary_new2(len);
|
|
124
|
+
|
|
125
|
+
if (len > 0) {
|
|
126
|
+
const VALUE *p1 = RARRAY_CONST_PTR_TRANSIENT(ary);
|
|
127
|
+
VALUE *p2 = (VALUE *)RARRAY_CONST_PTR_TRANSIENT(dup) + len - 1;
|
|
128
|
+
do *p2-- = *p1++; while (--len > 0);
|
|
129
|
+
}
|
|
130
|
+
ARY_SET_LEN(dup, RARRAY_LEN(ary));
|
|
131
|
+
return dup;
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Find out method signatures (most useful for Ruby-based methods with keyword args)
|
|
136
|
+
|
|
3
137
|
```ruby
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
_| _| _| _| _| _|_|_|_| _|_| _|_| _| _|_|_| _| _| _|
|
|
7
|
-
_| _|_|_| _|_|_| _| _| _| _| _| _| _|_| _| _|_| _|
|
|
8
|
-
_| _| _| _| _| _| _| _| _| _| _| _|_| _| _| _|
|
|
9
|
-
_|_|_| _| _| _|_|_| _| _|_| _|_| _|_| _| _|_|_| _| _|_|_| _|
|
|
10
|
-
_| _|
|
|
138
|
+
>> howtocall require
|
|
139
|
+
require(path)
|
|
11
140
|
```
|
|
12
141
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
142
|
+
```ruby
|
|
143
|
+
>> require "rubygems/user_interaction"
|
|
144
|
+
>> ui = Gem::ConsoleUI.new
|
|
145
|
+
>> howtocall ui.choose_from_list
|
|
146
|
+
choose_from_list(question, list)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Call system commands with `$`
|
|
150
|
+
|
|
151
|
+
```ruby
|
|
152
|
+
>> $ git status # displays current git status
|
|
153
|
+
```
|
|
17
154
|
|
|
18
155
|
## Setup
|
|
19
156
|
|
|
@@ -28,55 +165,66 @@ You also need to add irbtools to your project's `Gemfile`:
|
|
|
28
165
|
|
|
29
166
|
gem 'irbtools', require: 'irbtools/binding'
|
|
30
167
|
|
|
31
|
-
Then start IRB (with **Irbtools** loaded) from the terminal or directly from
|
|
168
|
+
Then start IRB (with **Irbtools** loaded) from the terminal or directly from
|
|
169
|
+
your code with:
|
|
32
170
|
|
|
33
171
|
binding.irb
|
|
34
172
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Some suggested gems will not be installed to ensure wider general support. For
|
|
38
|
-
the full feature set, you can install **irbtools-more**. To do so, change your
|
|
39
|
-
`.irbrc` to:
|
|
40
|
-
|
|
41
|
-
require 'irbtools/more'
|
|
173
|
+
*Optional:* If the **binding_of_caller** gem is available, you can just call the `irb`
|
|
174
|
+
method and it will start a session with the current binding:
|
|
42
175
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
gem 'irbtools-more', require: 'irbtools/binding'
|
|
176
|
+
irb
|
|
46
177
|
|
|
47
178
|
## Features
|
|
48
179
|
|
|
49
|
-
###
|
|
180
|
+
### General IRB Improvements
|
|
50
181
|
|
|
51
182
|
- Syntax highlighting ([wirb](https://github.com/janlelis/wirb/) / [fancy_irb](https://github.com/janlelis/fancy_irb))
|
|
52
|
-
- Loads included
|
|
53
|
-
- Customizable views for specfic options using [hirb](https://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html)
|
|
54
|
-
- ActiveRecord results get displayed as a table
|
|
55
|
-
- **(irbtools-more)** [Improved tab-completion](https://tagaholic.me/bond/)
|
|
183
|
+
- Loads included libraries efficiently to reduce IRB start-up time
|
|
184
|
+
- 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.
|
|
56
185
|
|
|
57
|
-
###
|
|
186
|
+
### Included Debugging Methods for IRB
|
|
58
187
|
|
|
59
188
|
#### Highlights
|
|
60
189
|
|
|
61
190
|
- Lookup and manipulate instance variables / methods with ease using [object_shadow](https://github.com/janlelis/object_shadow/)
|
|
62
|
-
-
|
|
191
|
+
- Go even further with [looksee](https://github.com/oggy/looksee), the best lookup path inspection tool out there
|
|
63
192
|
- Display a method's source code using [code](https://github.com/janlelis/code)
|
|
64
|
-
- Inline access to *ri* docs by [ori](https://github.com/dadooda/ori)
|
|
65
|
-
- If you have deactivated *ri*, you can re-generate the docs with something like: `rvm docs generate-ri`
|
|
66
193
|
- Find methods that turn one value into another value with [methodfinder](https://github.com/citizen428/methodfinder)
|
|
67
194
|
- [Use VIM from inside IRB](https://github.com/jberkel/interactive_editor)
|
|
68
195
|
|
|
196
|
+
#### Extra Commands
|
|
197
|
+
|
|
198
|
+
Commands get treated specially by IRB and do not necessarily follow Ruby syntax.
|
|
199
|
+
|
|
200
|
+
Command | Alias | Description | Example
|
|
201
|
+
------ | ---------- | ---------|---
|
|
202
|
+
`code ` | - | Shows syntax-highlighted source code of a method | `code Array#reverse`
|
|
203
|
+
`howtocall ` | - | Shows the method signature | `howtocall String#gsub`
|
|
204
|
+
`look ` | - | Shows looksee method list | `look [1,2,3]`
|
|
205
|
+
`shadow ` | `+ ` | Shows object shadow method list | `shadow [1,2,3]`
|
|
206
|
+
`sys ` | `$ ` | Calls system shell | `$ top`
|
|
207
|
+
|
|
208
|
+
Two default commands have an additional alias:
|
|
209
|
+
|
|
210
|
+
Command | Alias | Description | Example
|
|
211
|
+
------ | ---------- | ---------|---
|
|
212
|
+
`show_doc` | `ri ` | Shows documentation | `ri String#gsub`
|
|
213
|
+
`chws` | `co ` | "change into an object" | `co [1,2,3]`
|
|
214
|
+
|
|
215
|
+
##### IRB's ls?
|
|
216
|
+
|
|
217
|
+
Please note that IRB's own **ls** command is aliased to `ils`, since `ls` already refers to a method listing all files in the current directory. If you haven't tried looksee (`look`) or object shadows (`shadow`) - give it a try ;)
|
|
218
|
+
|
|
69
219
|
#### Ruby Introspection
|
|
70
220
|
|
|
71
221
|
Method / Constant | Arguments | Description | Provided By
|
|
72
222
|
------ | ---------- | -----------|-
|
|
73
|
-
`
|
|
223
|
+
`Object#lp` or `Object#look` | | Supercharged method introspection in IRB | [looksee](https://github.com/oggy/looksee)
|
|
224
|
+
`Object#shadow` | | Manipulate instance variables and learn about callable methods | [object_shadow](https://github.com/janlelis/object_shadow/)
|
|
225
|
+
`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)
|
|
74
226
|
`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)
|
|
75
227
|
`mf` | object1, object2 | Find methods which turn one value into another value | [methodfinder](https://github.com/citizen428/methodfinder)
|
|
76
|
-
`mof` | object, depth = 0, grep = // | Print a method list, ordered by modules (looksee lite) | [debugging](https://github.com/janlelis/debugging#mofobj-depth--nil)
|
|
77
|
-
`Object#lp` | | **(irbtools-more)** Supercharged method introspection in IRB | [looksee](https://github.com/oggy/looksee)
|
|
78
|
-
`Object#ri` | *args | Show ri documentation for this object or method | [ori](https://github.com/dadooda/ori)
|
|
79
|
-
`Object#shadow` | | Manipulate instance variables and learn about callable methods | [object_shadow](https://github.com/janlelis/object_shadow/)
|
|
80
228
|
|
|
81
229
|
#### Platform Info
|
|
82
230
|
|
|
@@ -85,14 +233,15 @@ Method / Constant | Arguments | Description | Provided By
|
|
|
85
233
|
`OS` | | Query operating system information | [os](https://github.com/rdp/os)
|
|
86
234
|
`RubyVersion` | | Show the Ruby version | [ruby_version](https://github.com/janlelis/ruby_version)
|
|
87
235
|
`RubyEngine` | | Show the Ruby engine | [ruby_engine](https://github.com/janlelis/ruby_engine)
|
|
88
|
-
`RubyInfo` | | List general information about the Ruby environment | [ruby_info](https://github.com/janlelis/ruby_info)
|
|
89
236
|
|
|
90
237
|
#### General Utils
|
|
91
238
|
|
|
92
239
|
Method / Constant | Arguments | Description | Provided By
|
|
93
240
|
------ | ---------- | -----------|-
|
|
94
241
|
`beep` | | Ring terminal bell | [debugging/beep](https://github.com/janlelis/debugging#beep)
|
|
242
|
+
`clear` | | Clear the terminal | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
95
243
|
`copy` | string | Copy something to the clipboard | [clipboard](https://github.com/janlelis/clipboard)
|
|
244
|
+
`copy_output` | | Copy session output history to the clipboard | [clipboard](https://github.com/janlelis/clipboard), irbtools
|
|
96
245
|
`colorize` | string | Syntax-highlight a string of Ruby code | [coderay](https://github.com/rubychan/coderay), irbtools
|
|
97
246
|
`ed` / `emacs` / `mate` / `mvim` / `nano` / `vi` / `vim` | filename = nil | Start an editor in the session context | [interactive_editor](https://github.com/jberkel/interactive_editor)
|
|
98
247
|
`ld` | file | Shortcut for `load lib.to_s + '.rb'` | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
@@ -101,21 +250,12 @@ Method / Constant | Arguments | Description | Provided By
|
|
|
101
250
|
`paste` | | Paste clipboard content | [clipboard](https://github.com/janlelis/clipboard)
|
|
102
251
|
`q` | *args | Like `Kernel#p`, but prints results on one line, with different colors | [debugging/q](https://github.com/janlelis/debugging#qargs)
|
|
103
252
|
`re` | string, regexg, groups = nil | Regex debugging helper | [debugging/re](https://github.com/janlelis/debugging#qargs)
|
|
253
|
+
`reset!` | | Restart the current IRB session | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
104
254
|
`rq` | lib | Shortcut for `require lib.to_s`. Use it like this: `rq:prime` | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
105
255
|
`rr` | lib | Shortcut for `require_relative lib.to_s` | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
106
256
|
`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)
|
|
107
257
|
`wp` | inspect_string | Syntax-highlight a Ruby return value | [wirb](https://github.com/janlelis/wirb#kernelwp)
|
|
108
258
|
|
|
109
|
-
#### IRB Support
|
|
110
|
-
|
|
111
|
-
Method / Constant | Arguments | Description | Provided By
|
|
112
|
-
------ | ---------- | -----------|-
|
|
113
|
-
`clear` | | Clear the terminal | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
114
|
-
`copy_input` | | Copy session history to the clipboard | [clipboard](https://github.com/janlelis/clipboard), irbtools
|
|
115
|
-
`copy_output` | | Copy session output history to the clipboard | [clipboard](https://github.com/janlelis/clipboard), irbtools
|
|
116
|
-
`reset!` | | Restart the current IRB session | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
117
|
-
`session_history` | number_of_lines = nil | Return a string of all commands issued in the current session | [every_day_irb](https://github.com/janlelis/every_day_irb)
|
|
118
|
-
|
|
119
259
|
#### Files and Navigation
|
|
120
260
|
|
|
121
261
|
Method / Constant | Arguments | Description | Provided By
|
|
@@ -128,7 +268,7 @@ Method / Constant | Arguments | Description | Provided By
|
|
|
128
268
|
`chown_R` | user, group, path | Set file owner for directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html)
|
|
129
269
|
`cp` | source, destination | Copy file | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html)
|
|
130
270
|
`cp_r` | source, destination | Copy directory | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html)
|
|
131
|
-
`ls` | path = "." | List directory content | [
|
|
271
|
+
`ls` | path = "." | List directory content | [cd](https://github.com/janlelis/cd)
|
|
132
272
|
`ln` | target, link | Create symlink (`ln`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html)
|
|
133
273
|
`ln_s` | target, link | Create symlink (`ln -s`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html)
|
|
134
274
|
`ln_sf` | target, link | Create symlink (`ln -sf`) | [fileutils](https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html)
|
|
@@ -173,12 +313,7 @@ You can use **Irbtools** without colors/IRB extensions. To do so, put this into
|
|
|
173
313
|
require 'irbtools/non_fancy'
|
|
174
314
|
Irbtools.start
|
|
175
315
|
```
|
|
176
|
-
|
|
177
|
-
### Hint: Web Console and Other Approaches
|
|
178
|
-
|
|
179
|
-
**Irbtools** works well together with the amazing [web-console!](https://github.com/rails/web-console), and also with the [ripl](https://github.com/cldwalker/ripl) IRB alternative.
|
|
180
|
-
|
|
181
316
|
## J-_-L
|
|
182
317
|
|
|
183
|
-
Copyright (c) 2010-
|
|
318
|
+
Copyright (c) 2010-2022 Jan Lelis <https://janlelis.com> released under the MIT
|
|
184
319
|
license.
|
data/irbtools.gemspec
CHANGED
|
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
|
5
5
|
s.name = 'irbtools'
|
|
6
6
|
s.version = Irbtools::VERSION
|
|
7
7
|
|
|
8
|
-
s.homepage = 'https://
|
|
8
|
+
s.homepage = 'https://github.com/janlelis/irbtools'
|
|
9
9
|
s.authors = ["Jan Lelis"]
|
|
10
10
|
s.email = ["hi@ruby.consulting"]
|
|
11
11
|
s.summary = 'Irbtools happy IRB.'
|
|
@@ -20,6 +20,12 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
lib/irbtools/hirb.rb
|
|
21
21
|
lib/irbtools/minimal.rb
|
|
22
22
|
lib/irbtools/binding.rb
|
|
23
|
+
lib/irbtools/commands.rb
|
|
24
|
+
lib/irbtools/commands/code.rb
|
|
25
|
+
lib/irbtools/commands/howtocall.rb
|
|
26
|
+
lib/irbtools/commands/look.rb
|
|
27
|
+
lib/irbtools/commands/shadow.rb
|
|
28
|
+
lib/irbtools/commands/sys.rb
|
|
23
29
|
Rakefile
|
|
24
30
|
irbtools.gemspec
|
|
25
31
|
]
|
|
@@ -29,35 +35,35 @@ Gem::Specification.new do |s|
|
|
|
29
35
|
CHANGELOG.md
|
|
30
36
|
MIT-LICENSE.txt
|
|
31
37
|
]
|
|
38
|
+
s.metadata = { "rubygems_mfa_required" => "true" }
|
|
32
39
|
s.license = 'MIT'
|
|
33
40
|
|
|
34
|
-
s.required_ruby_version = '>=
|
|
41
|
+
s.required_ruby_version = '>= 3.0', '< 4.0'
|
|
35
42
|
|
|
36
43
|
# # #
|
|
37
44
|
# Dependencies
|
|
38
45
|
|
|
39
46
|
# Core Functionality
|
|
40
|
-
s.add_dependency %q<irb>, "
|
|
41
|
-
s.add_dependency %q<every_day_irb>, "~> 2.
|
|
47
|
+
s.add_dependency %q<irb>, "~> 1.6.2"
|
|
48
|
+
s.add_dependency %q<every_day_irb>, "~> 2.2"
|
|
42
49
|
s.add_dependency %q<fancy_irb>, "~> 1.2", ">= 1.2.1"
|
|
43
50
|
s.add_dependency %q<wirb>, "~> 2.0", ">= 2.2.1"
|
|
44
51
|
s.add_dependency %q<hirb>, "~> 0.7", ">= 0.7.3"
|
|
45
|
-
s.add_dependency %q<binding.repl>, "~> 3.0"
|
|
46
52
|
|
|
47
53
|
# Utils
|
|
48
54
|
s.add_dependency %q<paint>, ">= 0.9", "< 3.0"
|
|
49
55
|
s.add_dependency %q<clipboard>, "~> 1.3"
|
|
50
56
|
s.add_dependency %q<interactive_editor>, "~> 0.0", ">= 0.0.10"
|
|
51
57
|
s.add_dependency %q<coderay>, "~> 1.1"
|
|
52
|
-
s.add_dependency %q<debugging>, "~>
|
|
58
|
+
s.add_dependency %q<debugging>, "~> 2.1"
|
|
53
59
|
|
|
54
60
|
# Introspection / Docs
|
|
61
|
+
s.add_dependency %q<looksee>, "~> 5.0"
|
|
55
62
|
s.add_dependency %q<object_shadow>, "~> 1.1"
|
|
56
|
-
s.add_dependency %q<code>, ">= 0.9.
|
|
57
|
-
s.add_dependency %q<
|
|
58
|
-
s.add_dependency %q<methodfinder>, "~> 2.2", ">= 2.2.
|
|
63
|
+
s.add_dependency %q<code>, ">= 0.9.4", "< 2.0"
|
|
64
|
+
s.add_dependency %q<core_docs>, "~> 0.9.9"
|
|
65
|
+
s.add_dependency %q<methodfinder>, "~> 2.2", ">= 2.2.5"
|
|
59
66
|
s.add_dependency %q<ruby_version>, "~> 1.0"
|
|
60
67
|
s.add_dependency %q<ruby_engine>, "~> 1.0"
|
|
61
|
-
s.add_dependency %q<
|
|
62
|
-
s.add_dependency %q<os>
|
|
68
|
+
s.add_dependency %q<os>, "~> 1.1", ">= 1.1.4"
|
|
63
69
|
end
|
data/lib/irbtools/binding.rb
CHANGED
|
@@ -3,27 +3,10 @@ begin
|
|
|
3
3
|
rescue LoadError
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
-
if
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
binding.of_caller(1).irb
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
else
|
|
15
|
-
require 'binding.repl'
|
|
16
|
-
BindingRepl.auto = %w[irb ripl ir rib pry]
|
|
17
|
-
|
|
18
|
-
class Binding
|
|
19
|
-
alias irb repl!
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
if defined? BindingOfCaller
|
|
23
|
-
require 'debugging/repl'
|
|
24
|
-
|
|
25
|
-
module Debugging
|
|
26
|
-
alias irb repl
|
|
6
|
+
if defined? BindingOfCaller
|
|
7
|
+
module Kernel
|
|
8
|
+
private def irb
|
|
9
|
+
binding.of_caller(1).irb
|
|
27
10
|
end
|
|
28
11
|
end
|
|
29
12
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require "irb/cmd/nop"
|
|
2
|
+
|
|
3
|
+
module IRB
|
|
4
|
+
module ExtendCommand
|
|
5
|
+
class Code < Nop
|
|
6
|
+
category "Introspection"
|
|
7
|
+
description "Shows the syntax-highlighted source code of a method"
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def transform_args(args)
|
|
11
|
+
if args.strip =~ /\A(?:([\w:]+)([#.]))?(\w+)\z/
|
|
12
|
+
if $1
|
|
13
|
+
if $2 == "#"
|
|
14
|
+
"#{$1}, #{$1}.instance_method(:#{$3})"
|
|
15
|
+
else
|
|
16
|
+
"#{$1}, :#{$3}"
|
|
17
|
+
end
|
|
18
|
+
else
|
|
19
|
+
":" + $3
|
|
20
|
+
end
|
|
21
|
+
else
|
|
22
|
+
args
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def execute(*args)
|
|
28
|
+
@irb_context.workspace.binding.send(:code, *args)
|
|
29
|
+
rescue NameError
|
|
30
|
+
warn "code: Class or method not found."
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require "irb/cmd/nop"
|
|
2
|
+
|
|
3
|
+
module IRB
|
|
4
|
+
module ExtendCommand
|
|
5
|
+
class Howtocall < Nop
|
|
6
|
+
category "Introspection"
|
|
7
|
+
description "Displays method signatures based on Method#parameters"
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def transform_args(args)
|
|
11
|
+
if args.strip =~ /\A(?:([\w:]+)([#.]))?(\w+)\z/
|
|
12
|
+
if $1
|
|
13
|
+
if $2 == "#"
|
|
14
|
+
"#{$1}, #{$1}.instance_method(:#{$3})"
|
|
15
|
+
else
|
|
16
|
+
"#{$1}, :#{$3}"
|
|
17
|
+
end
|
|
18
|
+
else
|
|
19
|
+
":" + $3
|
|
20
|
+
end
|
|
21
|
+
else
|
|
22
|
+
args
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def execute(*args)
|
|
28
|
+
@irb_context.workspace.binding.send(:howtocall, *args)
|
|
29
|
+
rescue NameError
|
|
30
|
+
warn "howtocall: Class or method not found"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "irb/cmd/nop"
|
|
2
|
+
|
|
3
|
+
module IRB
|
|
4
|
+
module ExtendCommand
|
|
5
|
+
class Look < Nop
|
|
6
|
+
category "Introspection"
|
|
7
|
+
description 'Method list and lookup path inspection based on looksee gem'
|
|
8
|
+
|
|
9
|
+
def execute(*args)
|
|
10
|
+
if args.empty?
|
|
11
|
+
@irb_context.workspace.binding.look
|
|
12
|
+
else
|
|
13
|
+
obj, *params = *args
|
|
14
|
+
obj.look(*params)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "irb/cmd/nop"
|
|
2
|
+
|
|
3
|
+
module IRB
|
|
4
|
+
module ExtendCommand
|
|
5
|
+
class Shadow < Nop
|
|
6
|
+
category "Introspection"
|
|
7
|
+
description 'Method list and lookup path inspection based on object shadow gem'
|
|
8
|
+
|
|
9
|
+
def execute(*args)
|
|
10
|
+
if args.empty?
|
|
11
|
+
@irb_context.workspace.binding.shadow
|
|
12
|
+
else
|
|
13
|
+
obj, *params = *args
|
|
14
|
+
obj.shadow(*params)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require "irb/cmd/nop"
|
|
2
|
+
|
|
3
|
+
module IRB
|
|
4
|
+
module ExtendCommand
|
|
5
|
+
class Sys < Nop
|
|
6
|
+
category "Misc"
|
|
7
|
+
description 'Run a system command'
|
|
8
|
+
|
|
9
|
+
class << self
|
|
10
|
+
def transform_args(args)
|
|
11
|
+
if args.empty? || string_literal?(args)
|
|
12
|
+
args
|
|
13
|
+
else
|
|
14
|
+
args.strip.dump
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def execute(*args)
|
|
20
|
+
system(*args)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
data/lib/irbtools/configure.rb
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module Irbtools
|
|
2
2
|
@libraries = { :start => [], :sub_session => [], :autoload => [], :thread => {}, :late => [], :late_thread => {} }
|
|
3
3
|
@lib_hooks = Hash.new{|h,k| h[k] = [] }
|
|
4
|
-
@packages = []
|
|
5
4
|
@shell_name = File.split($0)[-1].upcase
|
|
6
5
|
@welcome_message = "Welcome to #{ @shell_name }. You are using #{ RUBY_DESCRIPTION }. Have fun ;)"
|
|
7
6
|
@minimal ||= false
|
|
@@ -20,9 +19,6 @@ module Irbtools
|
|
|
20
19
|
# keys determine if lib is required, required on sub-session or autoloaded
|
|
21
20
|
attr_accessor :libraries
|
|
22
21
|
|
|
23
|
-
# an array of extension packages that get loaded (e.g. irbtools-more)
|
|
24
|
-
attr_accessor :packages
|
|
25
|
-
|
|
26
22
|
# add a library. the block gets executed, when the library was loaded.
|
|
27
23
|
# if the second param is true, it's hooked in into IRB.conf[:IRB_RC] instead of the start.
|
|
28
24
|
def add_library(lib, options = {}, &block)
|
|
@@ -83,23 +79,6 @@ module Irbtools
|
|
|
83
79
|
@lib_hooks.delete lib
|
|
84
80
|
end
|
|
85
81
|
|
|
86
|
-
# add extensions packages
|
|
87
|
-
def add_package(pkg)
|
|
88
|
-
@packages << pkg.to_s
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# remove extension package
|
|
92
|
-
def remove_package(pkg)
|
|
93
|
-
@packages.delete pkg.to_s
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
# actually require registered packages
|
|
97
|
-
def load_packages
|
|
98
|
-
@packages.each{ |pkg|
|
|
99
|
-
require "irbtools/#{pkg}"
|
|
100
|
-
}
|
|
101
|
-
end
|
|
102
|
-
|
|
103
82
|
# te be triggered when a library has loaded
|
|
104
83
|
def library_loaded(lib)
|
|
105
84
|
@lib_hooks[lib.to_s].each{ |hook| hook.call }
|
|
@@ -122,30 +101,62 @@ module Irbtools
|
|
|
122
101
|
$VERBOSE, $DEBUG = remember_verbose_and_debug
|
|
123
102
|
end
|
|
124
103
|
|
|
125
|
-
# configure irb
|
|
126
104
|
def configure_irb!
|
|
127
105
|
if defined?(IRB)
|
|
128
106
|
IRB.conf[:AUTO_INDENT] = true # simple auto indent
|
|
129
107
|
IRB.conf[:EVAL_HISTORY] = 42424242424242424242 # creates the special __ variable
|
|
130
108
|
IRB.conf[:SAVE_HISTORY] = 2000 # how many lines will go to ~/.irb_history
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
:PROMPT_N => "| ", # indenting
|
|
136
|
-
:PROMPT_C => " > ", # continuing a statement
|
|
137
|
-
:PROMPT_S => "%l> ", # continuing a string
|
|
138
|
-
:RETURN => "=> %s \n",
|
|
139
|
-
:AUTO_INDENT => true,
|
|
140
|
-
}})
|
|
141
|
-
|
|
142
|
-
IRB.conf[:PROMPT_MODE] = :IRBTOOLS
|
|
109
|
+
set_propmt
|
|
110
|
+
load_commands
|
|
111
|
+
add_command_aliases
|
|
112
|
+
rename_ls_to_ils
|
|
143
113
|
end
|
|
144
114
|
end
|
|
145
115
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
116
|
+
def set_propmt
|
|
117
|
+
(IRB.conf[:PROMPT] ||= {} ).merge!( {:IRBTOOLS => {
|
|
118
|
+
:PROMPT_I => ">> ", # normal
|
|
119
|
+
:PROMPT_N => "| ", # indenting
|
|
120
|
+
:PROMPT_C => " > ", # continuing a statement
|
|
121
|
+
:PROMPT_S => "%l> ", # continuing a string
|
|
122
|
+
:RETURN => "=> %s \n",
|
|
123
|
+
:AUTO_INDENT => true,
|
|
124
|
+
}})
|
|
125
|
+
|
|
126
|
+
IRB.conf[:PROMPT_MODE] = :IRBTOOLS
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def load_commands
|
|
130
|
+
ec = IRB::ExtendCommandBundle.instance_variable_get(:@EXTEND_COMMANDS)
|
|
131
|
+
|
|
132
|
+
[
|
|
133
|
+
[:code, :Code, nil, [:code, IRB::ExtendCommandBundle::OVERRIDE_ALL]],
|
|
134
|
+
[:howtocall, :Howtocall, nil, [:howtocall, IRB::ExtendCommandBundle::OVERRIDE_ALL]],
|
|
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
|
+
}
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def add_command_aliases
|
|
145
|
+
IRB.conf[:COMMAND_ALIASES] = (IRB.conf[:COMMAND_ALIASES] || {}).merge({
|
|
146
|
+
:ri => :show_doc,
|
|
147
|
+
:co => :chws,
|
|
148
|
+
:'$' => :sys,
|
|
149
|
+
:'+' => :shadow,
|
|
150
|
+
})
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# prevent clash between IRB's ls and FileUtil's ls
|
|
154
|
+
def rename_ls_to_ils
|
|
155
|
+
if aliases = IRB::ExtendCommandBundle.instance_variable_get(:@ALIASES)
|
|
156
|
+
if irb_ls = aliases.find{|a,*| a == :ls}
|
|
157
|
+
irb_ls[0] = :ils
|
|
158
|
+
end
|
|
159
|
+
end
|
|
149
160
|
end
|
|
150
161
|
|
|
151
162
|
# loads all the stuff
|
data/lib/irbtools/libraries.rb
CHANGED
|
@@ -21,14 +21,11 @@ Irbtools.add_library 'wirb/wp', thread: :paint do
|
|
|
21
21
|
Wirb.start
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
FancyIrb.start
|
|
27
|
-
end
|
|
24
|
+
Irbtools.add_library :fancy_irb, thread: :paint do
|
|
25
|
+
FancyIrb.start
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
Irbtools.add_library 'debugging/q', thread: :paint
|
|
31
|
-
Irbtools.add_library 'debugging/mof', thread: :paint
|
|
32
29
|
Irbtools.add_library 'debugging/re', thread: :paint
|
|
33
30
|
Irbtools.add_library 'debugging/beep', thread: :paint
|
|
34
31
|
Irbtools.add_library 'debugging/howtocall', thread: :paint
|
|
@@ -39,41 +36,23 @@ Irbtools.add_library 'object_shadow', thread: :paint do
|
|
|
39
36
|
ObjectShadow.include(ObjectShadow::DeepInspect)
|
|
40
37
|
end
|
|
41
38
|
|
|
42
|
-
Irbtools.add_library 'readline', thread: :
|
|
43
|
-
Irbtools.add_library '
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def self.get_ri_arg_prefix(cmd)
|
|
47
|
-
if cmd && (mat = cmd.match /\A(\s*.+?\.ri)\s+\S/)
|
|
48
|
-
mat[1]
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
39
|
+
Irbtools.add_library 'readline', thread: :readline
|
|
40
|
+
Irbtools.add_library 'os', thread: :os
|
|
41
|
+
Irbtools.add_library 'ruby_engine', thread: :re
|
|
42
|
+
Irbtools.add_library 'ruby_version', thread: :rv
|
|
52
43
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
begin
|
|
60
|
-
klass = Object.const_get $1
|
|
61
|
-
klass.ri $2
|
|
62
|
-
rescue
|
|
63
|
-
super
|
|
64
|
-
end
|
|
65
|
-
else
|
|
66
|
-
super
|
|
67
|
-
end
|
|
44
|
+
begin
|
|
45
|
+
# Object#l method for inspecting its lookup path
|
|
46
|
+
Irbtools.add_library 'looksee', thread: :ls do
|
|
47
|
+
Looksee.rename :lp
|
|
48
|
+
class Object
|
|
49
|
+
alias look lp
|
|
68
50
|
end
|
|
69
51
|
end
|
|
52
|
+
rescue LoadError
|
|
53
|
+
# do not load if not supported
|
|
70
54
|
end
|
|
71
55
|
|
|
72
|
-
Irbtools.add_library 'ruby_info', thread: :ri
|
|
73
|
-
Irbtools.add_library 'os', thread: :os
|
|
74
|
-
Irbtools.add_library 'ruby_engine', thread: :re
|
|
75
|
-
Irbtools.add_library 'ruby_version', thread: :rv
|
|
76
|
-
|
|
77
56
|
# # # load via autoload
|
|
78
57
|
|
|
79
58
|
Irbtools.add_library 'code', :autoload => :Code do
|
|
@@ -105,12 +84,6 @@ Irbtools.add_library :clipboard, :autoload => :Clipboard do
|
|
|
105
84
|
Clipboard.paste
|
|
106
85
|
end
|
|
107
86
|
|
|
108
|
-
# copies everything you have entered in this irb session
|
|
109
|
-
def copy_input
|
|
110
|
-
copy session_history
|
|
111
|
-
"The session input history has been copied to the clipboard."
|
|
112
|
-
end
|
|
113
|
-
|
|
114
87
|
# copies the output of all irb commands in this irb session
|
|
115
88
|
def copy_output
|
|
116
89
|
copy context.instance_variable_get(:@eval_history_values).inspect.gsub(/^\d+ (.*)/, '\1')
|
data/lib/irbtools/version.rb
CHANGED
data/lib/irbtools.rb
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
require_relative 'irbtools/configure'
|
|
2
|
-
|
|
3
|
-
# # # # #
|
|
4
|
-
# Make sure we load IRB if we are not in RIPL
|
|
5
|
-
|
|
6
|
-
require 'irb' unless Irbtools.ripl?
|
|
7
|
-
|
|
8
|
-
# # # # #
|
|
9
|
-
# Load irbtools extension packages
|
|
10
|
-
Irbtools.load_packages
|
|
2
|
+
require 'irb'
|
|
11
3
|
|
|
12
4
|
# # # # #
|
|
13
5
|
# Load: start
|
|
@@ -27,19 +19,11 @@ Irbtools.configure_irb!
|
|
|
27
19
|
|
|
28
20
|
# # # # #
|
|
29
21
|
# Load: sub-session / after_rc
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
else
|
|
37
|
-
original_irbrc_proc = IRB.conf[:IRB_RC]
|
|
38
|
-
IRB.conf[:IRB_RC] = proc{
|
|
39
|
-
Irbtools.load_libraries(Irbtools.libraries[:sub_session])
|
|
40
|
-
original_irbrc_proc.call if original_irbrc_proc
|
|
41
|
-
}
|
|
42
|
-
end
|
|
22
|
+
original_irbrc_proc = IRB.conf[:IRB_RC]
|
|
23
|
+
IRB.conf[:IRB_RC] = proc{
|
|
24
|
+
Irbtools.load_libraries(Irbtools.libraries[:sub_session])
|
|
25
|
+
original_irbrc_proc.call if original_irbrc_proc
|
|
26
|
+
}
|
|
43
27
|
|
|
44
28
|
# # # # #
|
|
45
29
|
# Load: threads
|
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: irbtools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.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:
|
|
11
|
+
date: 2022-12-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: irb
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 1.6.2
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 1.6.2
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: every_day_irb
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '2.
|
|
33
|
+
version: '2.2'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '2.
|
|
40
|
+
version: '2.2'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: fancy_irb
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -98,20 +98,6 @@ dependencies:
|
|
|
98
98
|
- - ">="
|
|
99
99
|
- !ruby/object:Gem::Version
|
|
100
100
|
version: 0.7.3
|
|
101
|
-
- !ruby/object:Gem::Dependency
|
|
102
|
-
name: binding.repl
|
|
103
|
-
requirement: !ruby/object:Gem::Requirement
|
|
104
|
-
requirements:
|
|
105
|
-
- - "~>"
|
|
106
|
-
- !ruby/object:Gem::Version
|
|
107
|
-
version: '3.0'
|
|
108
|
-
type: :runtime
|
|
109
|
-
prerelease: false
|
|
110
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
111
|
-
requirements:
|
|
112
|
-
- - "~>"
|
|
113
|
-
- !ruby/object:Gem::Version
|
|
114
|
-
version: '3.0'
|
|
115
101
|
- !ruby/object:Gem::Dependency
|
|
116
102
|
name: paint
|
|
117
103
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -186,14 +172,28 @@ dependencies:
|
|
|
186
172
|
requirements:
|
|
187
173
|
- - "~>"
|
|
188
174
|
- !ruby/object:Gem::Version
|
|
189
|
-
version: '
|
|
175
|
+
version: '2.1'
|
|
190
176
|
type: :runtime
|
|
191
177
|
prerelease: false
|
|
192
178
|
version_requirements: !ruby/object:Gem::Requirement
|
|
193
179
|
requirements:
|
|
194
180
|
- - "~>"
|
|
195
181
|
- !ruby/object:Gem::Version
|
|
196
|
-
version: '
|
|
182
|
+
version: '2.1'
|
|
183
|
+
- !ruby/object:Gem::Dependency
|
|
184
|
+
name: looksee
|
|
185
|
+
requirement: !ruby/object:Gem::Requirement
|
|
186
|
+
requirements:
|
|
187
|
+
- - "~>"
|
|
188
|
+
- !ruby/object:Gem::Version
|
|
189
|
+
version: '5.0'
|
|
190
|
+
type: :runtime
|
|
191
|
+
prerelease: false
|
|
192
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
193
|
+
requirements:
|
|
194
|
+
- - "~>"
|
|
195
|
+
- !ruby/object:Gem::Version
|
|
196
|
+
version: '5.0'
|
|
197
197
|
- !ruby/object:Gem::Dependency
|
|
198
198
|
name: object_shadow
|
|
199
199
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -214,7 +214,7 @@ dependencies:
|
|
|
214
214
|
requirements:
|
|
215
215
|
- - ">="
|
|
216
216
|
- !ruby/object:Gem::Version
|
|
217
|
-
version: 0.9.
|
|
217
|
+
version: 0.9.4
|
|
218
218
|
- - "<"
|
|
219
219
|
- !ruby/object:Gem::Version
|
|
220
220
|
version: '2.0'
|
|
@@ -224,24 +224,24 @@ dependencies:
|
|
|
224
224
|
requirements:
|
|
225
225
|
- - ">="
|
|
226
226
|
- !ruby/object:Gem::Version
|
|
227
|
-
version: 0.9.
|
|
227
|
+
version: 0.9.4
|
|
228
228
|
- - "<"
|
|
229
229
|
- !ruby/object:Gem::Version
|
|
230
230
|
version: '2.0'
|
|
231
231
|
- !ruby/object:Gem::Dependency
|
|
232
|
-
name:
|
|
232
|
+
name: core_docs
|
|
233
233
|
requirement: !ruby/object:Gem::Requirement
|
|
234
234
|
requirements:
|
|
235
235
|
- - "~>"
|
|
236
236
|
- !ruby/object:Gem::Version
|
|
237
|
-
version: 0.
|
|
237
|
+
version: 0.9.9
|
|
238
238
|
type: :runtime
|
|
239
239
|
prerelease: false
|
|
240
240
|
version_requirements: !ruby/object:Gem::Requirement
|
|
241
241
|
requirements:
|
|
242
242
|
- - "~>"
|
|
243
243
|
- !ruby/object:Gem::Version
|
|
244
|
-
version: 0.
|
|
244
|
+
version: 0.9.9
|
|
245
245
|
- !ruby/object:Gem::Dependency
|
|
246
246
|
name: methodfinder
|
|
247
247
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -251,7 +251,7 @@ dependencies:
|
|
|
251
251
|
version: '2.2'
|
|
252
252
|
- - ">="
|
|
253
253
|
- !ruby/object:Gem::Version
|
|
254
|
-
version: 2.2.
|
|
254
|
+
version: 2.2.5
|
|
255
255
|
type: :runtime
|
|
256
256
|
prerelease: false
|
|
257
257
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -261,7 +261,7 @@ dependencies:
|
|
|
261
261
|
version: '2.2'
|
|
262
262
|
- - ">="
|
|
263
263
|
- !ruby/object:Gem::Version
|
|
264
|
-
version: 2.2.
|
|
264
|
+
version: 2.2.5
|
|
265
265
|
- !ruby/object:Gem::Dependency
|
|
266
266
|
name: ruby_version
|
|
267
267
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -291,33 +291,25 @@ dependencies:
|
|
|
291
291
|
- !ruby/object:Gem::Version
|
|
292
292
|
version: '1.0'
|
|
293
293
|
- !ruby/object:Gem::Dependency
|
|
294
|
-
name:
|
|
294
|
+
name: os
|
|
295
295
|
requirement: !ruby/object:Gem::Requirement
|
|
296
296
|
requirements:
|
|
297
297
|
- - "~>"
|
|
298
298
|
- !ruby/object:Gem::Version
|
|
299
|
-
version: '1.
|
|
300
|
-
type: :runtime
|
|
301
|
-
prerelease: false
|
|
302
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
303
|
-
requirements:
|
|
304
|
-
- - "~>"
|
|
305
|
-
- !ruby/object:Gem::Version
|
|
306
|
-
version: '1.0'
|
|
307
|
-
- !ruby/object:Gem::Dependency
|
|
308
|
-
name: os
|
|
309
|
-
requirement: !ruby/object:Gem::Requirement
|
|
310
|
-
requirements:
|
|
299
|
+
version: '1.1'
|
|
311
300
|
- - ">="
|
|
312
301
|
- !ruby/object:Gem::Version
|
|
313
|
-
version:
|
|
302
|
+
version: 1.1.4
|
|
314
303
|
type: :runtime
|
|
315
304
|
prerelease: false
|
|
316
305
|
version_requirements: !ruby/object:Gem::Requirement
|
|
317
306
|
requirements:
|
|
307
|
+
- - "~>"
|
|
308
|
+
- !ruby/object:Gem::Version
|
|
309
|
+
version: '1.1'
|
|
318
310
|
- - ">="
|
|
319
311
|
- !ruby/object:Gem::Version
|
|
320
|
-
version:
|
|
312
|
+
version: 1.1.4
|
|
321
313
|
description: The Irbtools make working with Ruby's IRB console more fun & productive.
|
|
322
314
|
email:
|
|
323
315
|
- hi@ruby.consulting
|
|
@@ -337,6 +329,12 @@ files:
|
|
|
337
329
|
- irbtools.gemspec
|
|
338
330
|
- lib/irbtools.rb
|
|
339
331
|
- lib/irbtools/binding.rb
|
|
332
|
+
- lib/irbtools/commands.rb
|
|
333
|
+
- lib/irbtools/commands/code.rb
|
|
334
|
+
- lib/irbtools/commands/howtocall.rb
|
|
335
|
+
- lib/irbtools/commands/look.rb
|
|
336
|
+
- lib/irbtools/commands/shadow.rb
|
|
337
|
+
- lib/irbtools/commands/sys.rb
|
|
340
338
|
- lib/irbtools/configure.rb
|
|
341
339
|
- lib/irbtools/hirb.rb
|
|
342
340
|
- lib/irbtools/implementation.rb
|
|
@@ -344,10 +342,11 @@ files:
|
|
|
344
342
|
- lib/irbtools/minimal.rb
|
|
345
343
|
- lib/irbtools/non_fancy.rb
|
|
346
344
|
- lib/irbtools/version.rb
|
|
347
|
-
homepage: https://
|
|
345
|
+
homepage: https://github.com/janlelis/irbtools
|
|
348
346
|
licenses:
|
|
349
347
|
- MIT
|
|
350
|
-
metadata:
|
|
348
|
+
metadata:
|
|
349
|
+
rubygems_mfa_required: 'true'
|
|
351
350
|
post_install_message:
|
|
352
351
|
rdoc_options: []
|
|
353
352
|
require_paths:
|
|
@@ -356,7 +355,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
356
355
|
requirements:
|
|
357
356
|
- - ">="
|
|
358
357
|
- !ruby/object:Gem::Version
|
|
359
|
-
version: '
|
|
358
|
+
version: '3.0'
|
|
360
359
|
- - "<"
|
|
361
360
|
- !ruby/object:Gem::Version
|
|
362
361
|
version: '4.0'
|
|
@@ -366,7 +365,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
366
365
|
- !ruby/object:Gem::Version
|
|
367
366
|
version: '0'
|
|
368
367
|
requirements: []
|
|
369
|
-
rubygems_version: 3.
|
|
368
|
+
rubygems_version: 3.4.1
|
|
370
369
|
signing_key:
|
|
371
370
|
specification_version: 4
|
|
372
371
|
summary: Irbtools happy IRB.
|