pryx 0.7.2 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76fdf9e7d782f22dc0456d28a788c919e2d4747bbbd5e291e82de79e7b9d97ad
4
- data.tar.gz: 14ecbce0582117218559250839b4d7c8a90266c73a940108ca209a28ed9219e9
3
+ metadata.gz: 201316b55fb222f72cfdddd561767a135fe203d749e3c0bdbb27498141063120
4
+ data.tar.gz: ebe0d7afe5b5a6b1aa38c615538fc316e3a2b7a8b6460010f9d5bf7437739000
5
5
  SHA512:
6
- metadata.gz: e89e4c497c13332305da1dbd0da59412befb4ce394a7f9847b9b1b8fc94a2fbae705813b51e304d7f800d6319babb68acb399196b52e6c0ac1d6f5aa0373242c
7
- data.tar.gz: 6943f56b628aad6ec753eb8a2a61aaff4de87e765a5cc52e26a1764e43db7fc38df00c2672de28a50b57cbdd55f30cf75005ab65776d88496400b5323bc7e9c3
6
+ metadata.gz: 03b8b8fa86de79e7a8527790e32a74ba42a9277d30c73a7f678c18e5fa5f05a05537d1762d0327eb2545a204749bf25b25c8c4f94cc15b371d18ed34ce717dc1
7
+ data.tar.gz: a05a4acd097aa02fb00a0db9fa5e7e27789944126ce2902a11d051658d5bdaeff0fbfc450cc5e6448670ab9d007141a787b53e4bb3b486664ceb6b837194b084
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
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Binding
4
+ unless method_defined?(:source_location)
5
+ def source_location
6
+ eval "[__FILE__, __LINE__.to_i]"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "forwardable"
4
+
5
+ module Break
6
+ class Command
7
+ extend Forwardable
8
+
9
+ def initialize(session)
10
+ @session = session
11
+ end
12
+
13
+ def execute
14
+ raise NotImplementedError
15
+ end
16
+
17
+ private
18
+
19
+ attr_reader :session
20
+ def_delegators :session, :context, :context!, :frontend
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class DownCommand < TracePointCommand
5
+ def execute(*)
6
+ if context.depth >= 0
7
+ frontend.notify("Cannot go further down the stack")
8
+ else
9
+ super
10
+ end
11
+ end
12
+
13
+ def execute_trace(trace, *)
14
+ trace.disable
15
+
16
+ context!(*context.bindings, depth: context.depth + 1)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class NextCommand < TracePointCommand
5
+ trace :line, :call, :return, :class, :end, :b_call, :b_return
6
+
7
+ def execute_trace(trace, *)
8
+ case trace.event
9
+ when :call, :class, :b_call
10
+ context.bindings << trace.binding
11
+ context.depth += 1
12
+ when :return, :end, :b_return
13
+ context.bindings.pop
14
+ context.depth -= 1
15
+ when :line
16
+ return if context.depth.positive?
17
+
18
+ trace.disable
19
+
20
+ context!(*context.bindings[0...-1], trace.binding)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class StepCommand < TracePointCommand
5
+ trace :line, :call, :return, :class, :end, :b_call, :b_return
6
+
7
+ def execute_trace(trace, *)
8
+ case trace.event
9
+ when :call, :class, :b_call
10
+ trace.disable
11
+
12
+ context!(*context.bindings, trace.binding)
13
+ when :return, :end, :b_return
14
+ context.bindings.pop
15
+ context.depth -= 1
16
+ when :line
17
+ return if context.depth.positive?
18
+
19
+ trace.disable
20
+
21
+ context!(*context.bindings[0...-1], trace.binding)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class TracePointCommand < Command
5
+ class << self
6
+ attr_reader :trace_events
7
+
8
+ def trace(*events)
9
+ @trace_events = events
10
+ end
11
+ end
12
+
13
+ def initialize(*)
14
+ super
15
+
16
+ @delayed_context = Fiber.new do |*args|
17
+ session.context!(*args)
18
+
19
+ loop do
20
+ session.context!(*Fiber.yield)
21
+ end
22
+ end
23
+ end
24
+
25
+ def execute(*args)
26
+ TracePoint.trace(*trace_events) do |trace|
27
+ next if Filter.internal?(trace.path)
28
+
29
+ execute_trace(trace, *args)
30
+ end
31
+
32
+ session.leave
33
+ end
34
+
35
+ def execute_trace
36
+ raise NotImplementedError
37
+ end
38
+
39
+ private
40
+
41
+ def context!(*args)
42
+ @delayed_context.resume(*args)
43
+ rescue FiberError
44
+ session.context!(*args)
45
+ end
46
+
47
+ def trace_events
48
+ self.class.trace_events
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class UpCommand < TracePointCommand
5
+ def execute(*)
6
+ if context.bindings[context.depth - 2]
7
+ super
8
+ else
9
+ frontend.notify("Cannot go further up the stack")
10
+ end
11
+ end
12
+
13
+ def execute_trace(trace, *)
14
+ trace.disable
15
+
16
+ context!(*context.bindings, depth: context.depth - 1)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class WhereCommand < Command
5
+ def execute(*)
6
+ frontend.where
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ require_relative "commands/tracepoint_command"
2
+ require_relative "commands/next_command"
3
+ require_relative "commands/step_command"
4
+ require_relative "commands/up_command"
5
+ require_relative "commands/down_command"
6
+ require_relative "commands/where_command"
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class Context
5
+ attr_accessor :bindings
6
+ attr_accessor :depth
7
+
8
+ def initialize(*bindings, depth: 0)
9
+ @bindings = bindings
10
+ @depth = depth
11
+ end
12
+
13
+ def binding
14
+ @bindings[@depth - 1]
15
+ end
16
+
17
+ def inspect
18
+ "#{path}:#{lineno}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ module Filter
5
+ extend self
6
+
7
+ attr_reader :internal
8
+
9
+ def register_internal(*paths)
10
+ (@internal ||= []).concat(paths)
11
+ end
12
+
13
+ def internal?(path)
14
+ @internal.any? { |location| path.include?(location) }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
4
+
5
+ module Break::IRB
6
+ class Commands < Module
7
+ def initialize(session)
8
+ define_command session, :next, Break::NextCommand
9
+ define_command session, :step, Break::StepCommand
10
+ define_command session, :up, Break::UpCommand
11
+ define_command session, :down, Break::DownCommand
12
+ define_command session, :whereami, Break::WhereCommand
13
+ end
14
+
15
+ private
16
+
17
+ def define_command(session, name, cls)
18
+ define_method(name) do |*args|
19
+ cls.new(session).execute(*args)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "irb"
4
+
5
+ module Break::IRB
6
+ class Frontend
7
+ def initialize
8
+ IRB.setup caller_locations.first.path, argv: []
9
+ end
10
+
11
+ def attach(session)
12
+ @workspace = IRB::WorkSpace.new(session.context.binding)
13
+ @irb = safely_build_irb_instance(session, @workspace)
14
+
15
+ where
16
+
17
+ @irb.suspend_context special_case_next_eval(@irb.context) do
18
+ @irb.run(IRB.conf)
19
+ end
20
+ end
21
+
22
+ def detach
23
+ @irb&.context&.exit
24
+ end
25
+
26
+ def where
27
+ puts @workspace.code_around_binding if @workspace
28
+ end
29
+
30
+ def notify(message)
31
+ puts message
32
+ end
33
+
34
+ private
35
+
36
+ # Evaling `next` is a `SyntaxError` in Ruby. Since IRB does not have
37
+ # commands support in the lexer level, we need to call the `next` command
38
+ # in syntactically correct way.
39
+ def special_case_next_eval(irb_context)
40
+ def irb_context.evaluate(line, line_no, *args, **kwargs)
41
+ line = "self.next\n" if line == "next\n"
42
+ super(line, line_no, *args, **kwargs)
43
+ end
44
+
45
+ irb_context
46
+ end
47
+
48
+ # Trying to instantiate an `IRB:Irb` object with a workspace having a
49
+ # binding coming from `BasicObject`.
50
+ def safely_build_irb_instance(session, workspace)
51
+ irb = IRB::Irb.allocate
52
+ irb.instance_variable_set :@context, IRB::Context.new(irb, workspace, nil)
53
+ irb.instance_variable_set :@signal_status, :IN_IRB
54
+ irb.instance_variable_set :@scanner, RubyLex.new
55
+
56
+ begin
57
+ irb.context.main.extend IRB::ExtendCommandBundle
58
+ rescue NameError, TypeError
59
+ # Potential `NameError`: undefined method `irb_print_working_workspace' for class `#<Class:#420>'.
60
+ # Ignore it.
61
+ end
62
+
63
+ irb.context.main.extend Commands.new(session)
64
+ irb
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break::IRB
4
+ module Overrides
5
+ def irb
6
+ session = Break::Session.new(self, frontend: Frontend.new)
7
+ session.enter
8
+ end
9
+ end
10
+ end
data/lib/break/irb.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "irb/frontend"
4
+ require_relative "irb/commands"
5
+ require_relative "irb/overrides"
6
+
7
+ require "open-uri"
8
+
9
+ Break::Filter.register_internal IRB.method(:start).source_location.first.chomp(".rb")
10
+ Break::Filter.register_internal URI.method(:open).source_location.first.chomp(".rb")
11
+ Break::Filter.register_internal "(irb)"
12
+
13
+ Binding.prepend Break::IRB::Overrides
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break::Pry
4
+ Commands = Pry::CommandSet.new do
5
+ create_command "next", "Go to the next line." do
6
+ group "Break"
7
+
8
+ banner <<-BANNER
9
+ Usage: next
10
+
11
+ Step over within the same frame.
12
+
13
+ Examples:
14
+ next #=> Move a line forward.
15
+ BANNER
16
+
17
+ def process
18
+ pry = defined?(pry_instance) ? pry_instance : _pry_
19
+ pry.__break_session__[:pry_instance] = pry
20
+
21
+
22
+ command = Break::NextCommand.new(pry.__break_session__)
23
+ command.execute
24
+ end
25
+ end
26
+
27
+ create_command "step", "Step into the current line invocation." do
28
+ group "Break"
29
+
30
+ banner <<-BANNER
31
+ Usage: step
32
+
33
+ Step into a method call.
34
+
35
+ Examples:
36
+ step #=> Step into the method invocation.
37
+ BANNER
38
+
39
+ def process
40
+ pry = defined?(pry_instance) ? pry_instance : _pry_
41
+ pry.__break_session__[:pry_instance] = pry
42
+
43
+ command = Break::StepCommand.new(pry.__break_session__)
44
+ command.execute
45
+ end
46
+ end
47
+
48
+ create_command "up", "Go up a frame." do
49
+ group "Break"
50
+
51
+ banner <<-BANNER
52
+ Usage: up
53
+
54
+ Go to the frame that called the current one. Can be used only if the
55
+ command `step` was issued before.
56
+
57
+ Examples:
58
+ up #=> Step into the method invocation.
59
+ BANNER
60
+
61
+ def process
62
+ pry = defined?(pry_instance) ? pry_instance : _pry_
63
+ pry.__break_session__[:pry_instance] = pry
64
+
65
+ command = Break::UpCommand.new(pry.__break_session__)
66
+ command.execute
67
+ end
68
+ end
69
+
70
+ create_command "down", "Go down a frame." do
71
+ group "Break"
72
+
73
+ banner <<-BANNER
74
+ Usage: down
75
+
76
+ Go to the frame called from the current one. Can be used only if the
77
+ command `step` was issued before.
78
+
79
+ Examples:
80
+ down #=> Step to the previous frame.
81
+ BANNER
82
+
83
+ def process
84
+ pry = defined?(pry_instance) ? pry_instance : _pry_
85
+ pry.__break_session__[:pry_instance] = pry
86
+
87
+ command = Break::DownCommand.new(pry.__break_session__)
88
+ command.execute
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break::Pry
4
+ class Frontend
5
+ def attach(session)
6
+ previous_pry = session[:pry_instance]
7
+
8
+ @pry = Pry.start session.context.binding, __break_session__: session,
9
+ input: previous_pry.input,
10
+ output: previous_pry.output
11
+ where
12
+ end
13
+
14
+ def detach
15
+ throw :breakout
16
+ end
17
+
18
+ def where
19
+ @pry&.run_command "whereami".dup
20
+ rescue MethodSource::SourceNotFoundError
21
+ puts "Cannot find method code."
22
+ end
23
+
24
+ def notify(message)
25
+ puts message
26
+ end
27
+ end
28
+ end
data/lib/break/pry.rb ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "pry"
5
+
6
+ require_relative "pry/frontend"
7
+ require_relative "pry/commands"
8
+ require_relative "pry/extensions"
9
+
10
+ Break::Filter.register_internal MethodSource.method(:source_helper).source_location.first.chomp(".rb")
11
+ Break::Filter.register_internal CodeRay.method(:scan).source_location.first.chomp(".rb")
12
+ Break::Filter.register_internal Pry.method(:start).source_location.first.chomp("/pry_class.rb")
13
+ Break::Filter.register_internal Forwardable.instance_method(:def_delegator).source_location.first.chomp(".rb")
14
+ Break::Filter.register_internal "(pry)"
15
+ Break::Filter.register_internal __dir__
16
+
17
+ Pry.config.hooks.add_hook :before_session, :start_initial_break_session do |_, _, pry|
18
+ pry.__break_session__ ||= Break::Session.new(pry.current_binding, frontend: Break::Pry::Frontend.new)
19
+ end
20
+
21
+ Pry.config.commands.import Break::Pry::Commands
22
+
23
+ begin
24
+ require "pry-remote"
25
+
26
+ Break::Filter.register_internal binding.method(:remote_pry).source_location.first.chomp('.rb')
27
+ Break::Filter.register_internal DRb.method(:start_service).source_location.first.chomp('/drb.rb')
28
+
29
+ at_exit do
30
+ Break::Pry.current_remote_server&.teardown
31
+ end
32
+ rescue LoadError
33
+ # Do nothing if we cannot require pry-remote.
34
+ end
35
+ rescue LoadError
36
+ # Do nothing if we cannot require pry.
37
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ class Session
5
+ attr_reader :contexts
6
+ attr_reader :frontend
7
+
8
+ def initialize(binding, frontend:)
9
+ @contexts = [Context.new(binding)]
10
+ @frontend = frontend
11
+ @metadata = {}
12
+ end
13
+
14
+ def enter
15
+ frontend.attach(self)
16
+ end
17
+
18
+ def leave
19
+ frontend.detach
20
+ end
21
+
22
+ def context
23
+ contexts.last
24
+ end
25
+
26
+ def context!(*bindings, depth: 0)
27
+ contexts << Context.new(*bindings, depth: depth)
28
+ enter
29
+ end
30
+
31
+ def [](key)
32
+ @metadata[key]
33
+ end
34
+
35
+ def []=(key, value)
36
+ @metadata[key] = value
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "minitest"
4
+
5
+ module Break
6
+ class TestingFrontend
7
+ class << self
8
+ def build(&block)
9
+ Class.new(self, &block)
10
+ end
11
+
12
+ def stack
13
+ @stack ||= []
14
+ end
15
+
16
+ def [](index)
17
+ stack[index]
18
+ end
19
+
20
+ def last
21
+ stack.last
22
+ end
23
+
24
+ def clear
25
+ stack.clear
26
+ end
27
+ end
28
+
29
+ attr_reader :session
30
+
31
+ def initialize
32
+ self.class.stack << self
33
+ end
34
+
35
+ def attach(session)
36
+ @session = session
37
+ end
38
+
39
+ def detach; end
40
+
41
+ def where; end
42
+
43
+ def notify(_message); end
44
+ end
45
+
46
+ class Test < Minitest::Test
47
+ def self.test(name, &block)
48
+ define_method("test_#{name}", &block)
49
+ end
50
+
51
+ def pass
52
+ Kernel.binding.tap do |binding|
53
+ yield binding if block_given?
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Break
4
+ VERSION = "0.30.0"
5
+ end
data/lib/break.rb ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "break/version"
4
+ require_relative "break/session"
5
+ require_relative "break/context"
6
+ require_relative "break/command"
7
+ require_relative "break/commands"
8
+ require_relative "break/filter"
9
+ require_relative "break/binding_ext"
10
+
11
+ require_relative "break/irb"
12
+ require_relative "break/pry"
13
+
14
+ Break::Filter.register_internal __dir__
15
+ Break::Filter.register_internal "<internal:"
@@ -1,9 +1,28 @@
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: 下面两行代码顺序不要换。
8
- require 'pryx/ap_hack'
9
- require 'pryx/break_hack'
7
+ # WARN: 下面两行 require 代码顺序不要换。
8
+ require 'awesome_print'
9
+
10
+ # AwesomePrint.defaults = {
11
+ # index: false
12
+ # }
13
+
14
+ if defined? AwesomePrint
15
+ if defined? Pry
16
+ AwesomePrint.pry!
17
+ else
18
+ AwesomePrint.irb!
19
+ end
20
+ end
21
+
22
+ # Add break gem into pryx for fix pry-remote issue.
23
+ # See https://github.com/gsamokovarov/break/issues/9
24
+
25
+ require_relative '../break'
26
+ Pry.commands.alias_command 'n', 'next'
27
+ Pry.commands.alias_command 's', 'step'
28
+ 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, 0]
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.0
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-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.9'
27
- - !ruby/object:Gem::Dependency
28
- name: break
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.30'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.30'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: clipboard
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -235,7 +221,29 @@ files:
235
221
  - bin/irbx
236
222
  - bin/pry!
237
223
  - bin/pryx
224
+ - lib/break.rb
225
+ - lib/break/binding_ext.rb
226
+ - lib/break/command.rb
227
+ - lib/break/commands.rb
228
+ - lib/break/commands/down_command.rb
229
+ - lib/break/commands/next_command.rb
230
+ - lib/break/commands/step_command.rb
231
+ - lib/break/commands/tracepoint_command.rb
232
+ - lib/break/commands/up_command.rb
233
+ - lib/break/commands/where_command.rb
234
+ - lib/break/context.rb
235
+ - lib/break/filter.rb
236
+ - lib/break/irb.rb
237
+ - lib/break/irb/commands.rb
238
+ - lib/break/irb/frontend.rb
239
+ - lib/break/irb/overrides.rb
240
+ - lib/break/pry.rb
241
+ - lib/break/pry/commands.rb
238
242
  - lib/break/pry/extensions.rb
243
+ - lib/break/pry/frontend.rb
244
+ - lib/break/session.rb
245
+ - lib/break/testing.rb
246
+ - lib/break/version.rb
239
247
  - lib/pry-byebug.rb
240
248
  - lib/pry-byebug/WARN
241
249
  - lib/pry-byebug/base.rb
@@ -250,9 +258,7 @@ files:
250
258
  - lib/pry-state/printer.rb
251
259
  - lib/pry-yes.rb
252
260
  - lib/pryx.rb
253
- - lib/pryx/ap_hack.rb
254
261
  - lib/pryx/background.rb
255
- - lib/pryx/break_hack.rb
256
262
  - lib/pryx/common_plugins.rb
257
263
  - lib/pryx/drip.wav
258
264
  - lib/pryx/irb_hack.rb
data/lib/pryx/ap_hack.rb DELETED
@@ -1,15 +0,0 @@
1
- require 'awesome_print'
2
-
3
- # AwesomePrint.defaults = {
4
- # index: false
5
- # }
6
-
7
- if defined? AwesomePrint
8
- if defined? Pry
9
- require 'pry'
10
- AwesomePrint.pry!
11
- else
12
- require 'irb'
13
- AwesomePrint.irb!
14
- end
15
- 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