pryx 0.7.2 → 0.8.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76fdf9e7d782f22dc0456d28a788c919e2d4747bbbd5e291e82de79e7b9d97ad
4
- data.tar.gz: 14ecbce0582117218559250839b4d7c8a90266c73a940108ca209a28ed9219e9
3
+ metadata.gz: d7421b2883be187afe07d771287fdf53908136c62cc795a6b4fd6f9030c71d9f
4
+ data.tar.gz: ac5aba055317fc12c5bfdf3b0574e5bcffa484547ed5998930779d3e6741046f
5
5
  SHA512:
6
- metadata.gz: e89e4c497c13332305da1dbd0da59412befb4ce394a7f9847b9b1b8fc94a2fbae705813b51e304d7f800d6319babb68acb399196b52e6c0ac1d6f5aa0373242c
7
- data.tar.gz: 6943f56b628aad6ec753eb8a2a61aaff4de87e765a5cc52e26a1764e43db7fc38df00c2672de28a50b57cbdd55f30cf75005ab65776d88496400b5323bc7e9c3
6
+ metadata.gz: 20417e730575de7f13b4b9a42423300167982385566cf8e987f9e33273bcd45a906968640f71cf4fcc810e52ce71b367bab7393757e5201f9e3f2cb435ee7a61
7
+ data.tar.gz: 39e37f2c2a21d2f24c9518e4ffdd9734e2d8fe703c6c99070fb3ebca629ae39b1d7064a5ced9070dc896c4f707ae706779675c67436ee1d3d86e262669c5d147
data/README.md CHANGED
@@ -132,11 +132,12 @@ pryx is same as pry, but, with plugins and libraries correct configured.
132
132
 
133
133
  irbx is same things for irb.
134
134
 
135
- pry! just a alias to `pry-remote` command, when `Kernel#pry!` was intercepted in a background process,
136
- you can run `pry!` directly in terminal connect to it.
135
+ `pry!` just a alias to `binding.pry`, but, if process is running on background, it a alias to `binding.remote_pry('0.0.0.0', 9876)`,
136
+ you can specify host or port manually, like this: `pry!(host: '192.168.1.100')`.
137
+ in another terminal, you can run `pry!` directly to connect to it use IP + port.
137
138
 
138
- if your's pry-remote server started background on another host, or on a container, you man need
139
- specify hostname and port, e.g. connnect to 192.168.1.100, with port 9876
139
+ e.g. assume your's pry-remote server started background on another host(192.168.1.100), port 9876
140
+ It maybe in container, you can connect remote pry like this:
140
141
 
141
142
  ```sh
142
143
  $: pry! -s 192.168.1.100 -p 9876
data/bin/pryx CHANGED
@@ -8,6 +8,7 @@ $0 = 'pry'
8
8
 
9
9
  require 'pry'
10
10
  require 'pryx'
11
+ require 'pryx/ap_hack'
11
12
 
12
13
  # Process command line options and run Pry
13
14
  opts = Pry::CLI.parse_options
data/bin/pryx_rails ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # (C) John Mair (banisterfiend)
5
+ # MIT license
6
+
7
+ $0 = 'pry'
8
+
9
+ $LOAD_PATH.unshift('.')
10
+ require 'config/environment'
11
+
12
+ require 'pry'
13
+ require 'pryx'
14
+ require 'pryx/ap_hack'
15
+
16
+ # Process command line options and run Pry
17
+ opts = Pry::CLI.parse_options
18
+ Pry::CLI.start(opts)
data/lib/pryx/ap_hack.rb CHANGED
@@ -6,10 +6,8 @@ require 'awesome_print'
6
6
 
7
7
  if defined? AwesomePrint
8
8
  if defined? Pry
9
- require 'pry'
10
9
  AwesomePrint.pry!
11
10
  else
12
- require 'irb'
13
11
  AwesomePrint.irb!
14
12
  end
15
13
  end
@@ -1,9 +1,12 @@
1
1
  require 'binding_of_caller'
2
2
  require 'clipboard'
3
3
 
4
- # ap_hack 可以确保,当使用 irb! 时,looksee ls1 输出显示正确,同时不用关闭 irb :USE_COLORIZE 设置。
4
+ # HACK: for ap 可以确保,当使用 irb! 时,looksee ls1 输出显示正确,同时不用关闭 irb :USE_COLORIZE 设置。
5
5
  # See https://github.com/oggy/looksee/issues/57
6
6
  # 但是,ap_hack 必须放到 break_hack 前面,调换顺序,上面的 hack 失效。
7
- # WARN: 下面两行代码顺序不要换。
7
+ # WARN: 下面两行 require 代码顺序不要换。
8
8
  require 'pryx/ap_hack'
9
- require 'pryx/break_hack'
9
+ require 'break'
10
+ Pry.commands.alias_command 'n', 'next'
11
+ Pry.commands.alias_command 's', 'step'
12
+ Pry.commands.alias_command 'w', 'watch' # watch is pry builtin
data/lib/pryx/pry_hack.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # 注意如果开启 pry-stack_explorer, 就不要使用 debugger, 因为进入新的上下文后, pry-stack_explorer 将失效.
2
2
 
3
3
  class Binding
4
- def _pry(host=nil, port=nil, options={})
4
+ def _pry(host: nil, port: nil, options: {})
5
5
  if host
6
6
  require 'pry-remote'
7
7
  else
@@ -14,7 +14,7 @@ class Binding
14
14
  if host
15
15
  notify_send('loading remote pry ...')
16
16
  # remote_pry(host, port, options) if Pry.initial_session?
17
- remote_pry(host, port, options)
17
+ self.remote_pry(host, port, options)
18
18
  else
19
19
  warn 'loading pry ...'
20
20
  self.pry
@@ -24,12 +24,14 @@ end
24
24
 
25
25
  module Kernel
26
26
  # 运行 pry! 会被拦截, 且只会被拦截一次.
27
- def pry!(remote: nil, port: 9876)
28
- return unless ENV['Pry_was_started'].nil?
27
+ def pry!(host: nil, port: 9876)
28
+ if Pryx::Background.foreground? and host.nil?
29
+ return unless ENV['Pry_was_started'].nil?
29
30
 
30
- ENV['Pry_was_started'] = 'true'
31
+ ENV['Pry_was_started'] = 'true'
32
+ end
31
33
 
32
- pry3(2, remote: remote, port: port)
34
+ pry3(2, host: host, port: port)
33
35
 
34
36
  # 这里如果有代码, 将会让 pry! 进入这个方法, 因此保持为空.
35
37
  end
@@ -41,13 +43,13 @@ module Kernel
41
43
 
42
44
  # 和 pry! 的差别就是,pry? 使用 pry-state 插件输出当前 context 的很多变量内容。
43
45
  # 注意:不需要总是开启 pry-state,因为有时候会输出太多内容,造成刷屏。
44
- def pry?(remote: nil, port: 9876)
46
+ def pry?(host: nil, port: 9876)
45
47
  return unless ENV['Pry_was_started'].nil?
46
48
 
47
49
  require 'pry-state'
48
50
  ENV['Pry_was_started'] = 'true'
49
51
 
50
- pry3(2, remote: remote, port: port)
52
+ pry3(2, host: host, port: port)
51
53
 
52
54
  # 这里如果有代码, 将会让 pry! 进入这个方法, 因此保持为空.
53
55
  end
@@ -59,21 +61,21 @@ module Kernel
59
61
  # 1. 单独运行 pry2, 永远不会被拦截,
60
62
  # 2. 如果之前运行过 pry1, 此时 pry2 将被拦截, 且只会被拦截一次.
61
63
 
62
- def pry2(remote: nil, port: 9876)
64
+ def pry2(host: nil, port: 9876)
63
65
  if ENV['Pry2_should_start'] == 'true'
64
66
  ENV['Pry2_should_start'] = nil
65
- pry3(2, remote: remote, port: port)
67
+ pry3(2, host: host, port: port)
66
68
  end
67
69
  end
68
70
 
69
71
  # 等价于默认的 binding.pry, 会反复被拦截。
70
72
  # 起成 pry3 这个名字,也是为了方便直接使用。
71
- def pry3(caller=1, remote: nil, port: 9876)
72
- remote = '0.0.0.0' if Pryx::Background.background?
73
+ def pry3(caller=1, host: nil, port: 9876)
74
+ host = '0.0.0.0' if Pryx::Background.background?
73
75
 
74
76
  require 'binding_of_caller'
75
77
 
76
- binding.of_caller(caller)._pry(remote, port)
78
+ binding.of_caller(caller)._pry(host: host, port: port)
77
79
  end
78
80
 
79
81
  def notify_send(msg)
data/lib/pryx/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pryx
4
- VERSION = [0, 7, 2]
4
+ VERSION = [0, 8, 2]
5
5
 
6
6
  class << VERSION
7
7
  include Comparable
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pryx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billy.Zheng(zw963)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-01 00:00:00.000000000 Z
11
+ date: 2022-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.30'
33
+ version: 0.40.0
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: '0.30'
40
+ version: 0.40.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: clipboard
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -227,6 +227,7 @@ executables:
227
227
  - irbx
228
228
  - pry!
229
229
  - pryx
230
+ - pryx_rails
230
231
  extensions: []
231
232
  extra_rdoc_files: []
232
233
  files:
@@ -235,7 +236,7 @@ files:
235
236
  - bin/irbx
236
237
  - bin/pry!
237
238
  - bin/pryx
238
- - lib/break/pry/extensions.rb
239
+ - bin/pryx_rails
239
240
  - lib/pry-byebug.rb
240
241
  - lib/pry-byebug/WARN
241
242
  - lib/pry-byebug/base.rb
@@ -252,7 +253,6 @@ files:
252
253
  - lib/pryx.rb
253
254
  - lib/pryx/ap_hack.rb
254
255
  - lib/pryx/background.rb
255
- - lib/pryx/break_hack.rb
256
256
  - lib/pryx/common_plugins.rb
257
257
  - lib/pryx/drip.wav
258
258
  - lib/pryx/irb_hack.rb
@@ -1,56 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Break::Pry
4
- module PryExtensions
5
- attr_accessor :__break_session__
6
-
7
- def initialize(options={})
8
- super(options)
9
-
10
- @__break_session__ = options[:__break_session__]
11
- end
12
- end
13
- end
14
-
15
- Pry.prepend Break::Pry::PryExtensions
16
-
17
- begin
18
- require 'pry-remote'
19
-
20
- module Break::Pry
21
- class << self
22
- attr_accessor :current_remote_server
23
- end
24
-
25
- module PryRemoteServerExtensions
26
- def initialize(*)
27
- Break::Pry.current_remote_server&.teardown
28
-
29
- super
30
- end
31
-
32
- def run
33
- return if Break::Pry.current_remote_server
34
-
35
- Break::Pry.current_remote_server = self
36
-
37
- setup
38
-
39
- Pry.start @object, @options.merge(input: client.input_proxy, output: client.output)
40
- end
41
-
42
- def teardown
43
- super
44
- ensure
45
- Break::Pry.current_remote_server = nil
46
- end
47
- end
48
- end
49
-
50
- # Hack for break works with pry_remote.
51
- # More details, see: https://github.com/gsamokovarov/break/issues/9
52
-
53
- # PryRemote::Server.prepend Break::Pry::PryRemoteServerExtensions
54
- rescue LoadError
55
- # Do nothing if we cannot require pry-remote.
56
- end
@@ -1,6 +0,0 @@
1
- require 'break'
2
- load "#{__dir__}/../break/pry/extensions.rb"
3
-
4
- Pry.commands.alias_command 'n', 'next'
5
- Pry.commands.alias_command 's', 'step'
6
- Pry.commands.alias_command 'w', 'watch' # watch is pry builtin