pry-shell 0.4.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +23 -3
- data/bin/console +1 -1
- data/lib/pry/shell/cli.rb +2 -2
- data/lib/pry/shell/configuration.rb +1 -1
- data/lib/pry/shell/io/input.rb +10 -0
- data/lib/pry/shell/patches/object.rb +1 -1
- data/lib/pry/shell/patches/pry_byebug.rb +13 -1
- data/lib/pry/shell/registry.rb +4 -3
- data/lib/pry/shell/session.rb +12 -2
- data/lib/pry/shell/ui/menu.rb +9 -0
- data/lib/pry/shell/version.rb +1 -1
- data/lib/pry-shell.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c2ada13df84d73e1825a12b3b6f1d48323a1ee26b259d0d621954f992b5bcba
|
4
|
+
data.tar.gz: '07290249ca6c84a110288199d5c467cb01a239066ec6ca219cac2ad6abdcda1e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfd6b5a61516dd27da717291944e550b8e6e15def4cd59ee21bd479f069f059c8d5e57047414fd6d36c51b81c8bcd691b39d8f2dc02fc595121381b6f7ad3349
|
7
|
+
data.tar.gz: 342f64a819c36580b331caf9bc67cc4407bace3531fb173c3d34f4bdfc25dab7a21cd9e8cb9803d91181a1db35652e5e48cabcb4a47c5cf74644ed39f6fbc65e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pry-shell (0.
|
4
|
+
pry-shell (0.5.1)
|
5
5
|
pry (~> 0.13.0)
|
6
6
|
tty-markdown
|
7
7
|
tty-prompt
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
byebug (11.1.3)
|
14
14
|
coderay (1.1.3)
|
15
15
|
diff-lcs (1.4.4)
|
16
|
-
kramdown (2.
|
16
|
+
kramdown (2.4.0)
|
17
17
|
rexml
|
18
18
|
method_source (1.0.0)
|
19
19
|
parallel (1.20.1)
|
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
rake (13.0.3)
|
32
32
|
regexp_parser (2.1.1)
|
33
33
|
rexml (3.2.5)
|
34
|
-
rouge (3.
|
34
|
+
rouge (3.29.0)
|
35
35
|
rspec (3.10.0)
|
36
36
|
rspec-core (~> 3.10.0)
|
37
37
|
rspec-expectations (~> 3.10.0)
|
@@ -94,4 +94,4 @@ DEPENDENCIES
|
|
94
94
|
rubocop (~> 1.7)
|
95
95
|
|
96
96
|
BUNDLED WITH
|
97
|
-
2.
|
97
|
+
2.3.15
|
data/README.md
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pry/shell`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
4
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
5
|
## Installation
|
8
6
|
|
9
7
|
Add this line to your application's Gemfile:
|
@@ -22,7 +20,29 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
Here's a [video showing how to use pry-shell](https://www.youtube.com/watch?v=Lzs_PL_BySo).
|
24
|
+
|
25
|
+
### Start the shell
|
26
|
+
|
27
|
+
$ pry-shell
|
28
|
+
|
29
|
+
### Add breakpoints
|
30
|
+
|
31
|
+
Include this snippet in the code line you are interested:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
binding.pry_shell
|
35
|
+
```
|
36
|
+
|
37
|
+
PryShell will enable [Byebug](https://github.com/deivid-rodriguez/byebug) by default if the `pry-byebug` gem has already been installed. In case if you want to disable byebug, you can set the `with_byebug` option as false, like so;
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
binding.pry_shell(with_byebug: false)
|
41
|
+
```
|
42
|
+
|
43
|
+
### Get access to the Pry session
|
44
|
+
|
45
|
+
Start the shell, add a breakpoint and make your program hit the desired code section. Afterwards, choose "Available sessions" from the shell main menu and hit "Enter". Then select your desired pry session and hit "Enter".
|
26
46
|
|
27
47
|
## Development
|
28
48
|
|
data/bin/console
CHANGED
data/lib/pry/shell/cli.rb
CHANGED
@@ -29,8 +29,8 @@ class Pry
|
|
29
29
|
Shell.configuration.port = arg
|
30
30
|
end
|
31
31
|
|
32
|
-
o.on "-
|
33
|
-
Shell.configuration.auto_connect =
|
32
|
+
o.on "--disable-auto-connect", "Disable auto connect feature" do
|
33
|
+
Shell.configuration.auto_connect = false
|
34
34
|
end
|
35
35
|
|
36
36
|
o.on "-v", "--version", "Print version and exit" do
|
data/lib/pry/shell/io/input.rb
CHANGED
@@ -7,11 +7,21 @@ class Pry
|
|
7
7
|
module IO
|
8
8
|
class Input < Base
|
9
9
|
def readline(prompt)
|
10
|
+
drb_thread
|
11
|
+
|
10
12
|
wait_until_current
|
11
13
|
|
12
14
|
string = object.readline(prompt, true)
|
13
15
|
|
14
16
|
Command.execute(client, string)
|
17
|
+
rescue
|
18
|
+
drb_thread.kill
|
19
|
+
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def drb_thread
|
24
|
+
@drb_thread ||= Thread.current
|
15
25
|
end
|
16
26
|
|
17
27
|
# Assigns the `completion_proc` given by the
|
@@ -4,7 +4,7 @@ class Pry
|
|
4
4
|
class Shell
|
5
5
|
module Patches
|
6
6
|
module Object
|
7
|
-
def pry_shell(host: DEFAULT_HOST, port: DEFAULT_PORT, with_byebug:
|
7
|
+
def pry_shell(host: DEFAULT_HOST, port: DEFAULT_PORT, with_byebug: true)
|
8
8
|
Session.run(self, host: host, port: port, with_byebug: with_byebug)
|
9
9
|
end
|
10
10
|
end
|
@@ -58,18 +58,30 @@ begin
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def start_with_pry_shell(target)
|
61
|
-
if Shell.active_shell_options[:
|
61
|
+
if Shell.active_shell_options[:enable_byebug?]
|
62
62
|
::Byebug::PryShellProcessor.start
|
63
63
|
else
|
64
64
|
start_without_pry_byebug(target, Shell.active_shell_options)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
module PryProcessor
|
70
|
+
def start
|
71
|
+
super
|
72
|
+
|
73
|
+
# We should step out one more frame as we are
|
74
|
+
# prepending another module to the hierarchy
|
75
|
+
::Byebug.current_context.step_out(5, true)
|
76
|
+
end
|
77
|
+
end
|
68
78
|
end
|
69
79
|
end
|
70
80
|
end
|
71
81
|
|
72
82
|
Pry.singleton_class.prepend(Pry::Shell::Patches::PryByebug)
|
73
83
|
Pry.singleton_class.alias_method(:start, :start_with_pry_byebug)
|
84
|
+
|
85
|
+
Byebug::PryProcessor.singleton_class.prepend(Pry::Shell::Patches::PryProcessor)
|
74
86
|
rescue LoadError # rubocop:disable Lint/SuppressedException
|
75
87
|
end
|
data/lib/pry/shell/registry.rb
CHANGED
data/lib/pry/shell/session.rb
CHANGED
@@ -37,7 +37,11 @@ class Pry
|
|
37
37
|
# to setup the Byebug.
|
38
38
|
# We are clearing this options in `PryShellProcessor` to ensure
|
39
39
|
# they do not leak.
|
40
|
-
|
40
|
+
unless enable_byebug?
|
41
|
+
pry_options[:remove_connection].call
|
42
|
+
|
43
|
+
Shell.clear_shell_options!
|
44
|
+
end
|
41
45
|
end
|
42
46
|
|
43
47
|
private
|
@@ -47,7 +51,7 @@ class Pry
|
|
47
51
|
def pry_options
|
48
52
|
{
|
49
53
|
remove_connection: -> { registry.remove(client) },
|
50
|
-
|
54
|
+
enable_byebug?: enable_byebug?,
|
51
55
|
driver: Pry::Shell::Repl,
|
52
56
|
pager: false,
|
53
57
|
input: client.input,
|
@@ -57,6 +61,12 @@ class Pry
|
|
57
61
|
}
|
58
62
|
end
|
59
63
|
|
64
|
+
# Setting the `with_byebug` option as `true` is not enough as the
|
65
|
+
# `pry-byebug` gem can be missing which we are currently depending on.
|
66
|
+
def enable_byebug?
|
67
|
+
with_byebug && defined?(::Byebug::PryShellProcessor)
|
68
|
+
end
|
69
|
+
|
60
70
|
def client
|
61
71
|
@client ||= registry.register(id: id, **attributes)
|
62
72
|
end
|
data/lib/pry/shell/ui/menu.rb
CHANGED
@@ -20,6 +20,15 @@ class Pry
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def draw_content
|
23
|
+
prompt.on(:keypress) do |event|
|
24
|
+
if event.value == "j"
|
25
|
+
prompt.trigger(:keydown)
|
26
|
+
end
|
27
|
+
|
28
|
+
if event.value == "k"
|
29
|
+
prompt.trigger(:keyup)
|
30
|
+
end
|
31
|
+
end
|
23
32
|
selection = prompt.select("Select a menu item", ITEMS)
|
24
33
|
|
25
34
|
switch_to(selection)
|
data/lib/pry/shell/version.rb
CHANGED
data/lib/pry-shell.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'pry/shell'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mehmet Emin INAC
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- bin/console
|
72
72
|
- bin/setup
|
73
73
|
- exe/pry-shell
|
74
|
+
- lib/pry-shell.rb
|
74
75
|
- lib/pry/shell.rb
|
75
76
|
- lib/pry/shell/cli.rb
|
76
77
|
- lib/pry/shell/client.rb
|
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
124
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.1.6
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: Provides remote pry sessions.
|