pryx 0.8.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2abbd74097d3935a2c891a174964906f3670f432c9098ed29c49a2d627af5ee8
4
- data.tar.gz: 34a2d005fc80f393398acc48ca584a79867f12b5f8f5b39ce4fa8cb99a4e738e
3
+ metadata.gz: 2feb9ad3cf24d155fd61504945371bc47c1c31b111249e7f387624bcb76a2cad
4
+ data.tar.gz: f4a8f822b8843a546400e0a3418248b5bcd581c54236775b42f58bfb61218015
5
5
  SHA512:
6
- metadata.gz: a2d570d7dcf1a6450c242539b7cec72d7204a1d71544d2d277bd161e2b5dcc4afb712265af8b0b8ce0a3b913a51a55373a4add3fc3299a938782c1b50333169a
7
- data.tar.gz: 5accbceecc2f0639458bce8481a00704bf8c88f3bdac5539b54f12e32d748252e3f9d813c07c3d7e327eb4f9e5d10c4483f311f95cb1981dd1bab80645ff481f
6
+ metadata.gz: 519a408c47c2ee75c0c37b3bb5cd0bf184a60c8b8eeb3bc33aedc085c0ed63f22985c2971584b85040ecb9e965d720364eff0b73d1434f1cd3c0c0b60a5adb20
7
+ data.tar.gz: b4e95675496e2a12c58bdeb7e0a3b46115d1f16258316158620bb1c9ff7b03befc6551b887aa708a8463d96cd0828614bcef1817c68919a3e186f8b15114fec6
data/README.md CHANGED
@@ -10,7 +10,7 @@ Instead, install it directly via RubyGems
10
10
 
11
11
  $ gem install pryx
12
12
 
13
- Then use can use pryx cross all your's project.
13
+ Then user can use pryx cross all your's project.
14
14
 
15
15
  ## Usage
16
16
 
@@ -26,13 +26,14 @@ $: ruby your_file.rb # add pry! in your_file for start pry session
26
26
 
27
27
  or Run your's code directly use:
28
28
 
29
+
29
30
  ```sh
30
31
  $: RUBYOPT+='-rpryx' ruby your_file.rb # add pry! in your_file for start pry session
31
32
  ```
32
33
 
33
34
  Then, try add `pry!` into your's ruby code, then run it, have fun!
34
35
 
35
- Following is a example, assume we have test.rb, it content like this:
36
+ Following is a example, assume there is a `test.rb` with content:
36
37
 
37
38
  ```rb
38
39
  # test.rb
@@ -51,58 +52,46 @@ use http connection.
51
52
 
52
53
  ![pry_remote.png](images/pry_remote.png)
53
54
 
54
-
55
55
  Until now, you've only seen the tip of the iceberg, please have a try.
56
56
 
57
57
 
58
- If you prefer to use IRB over Pry, use can add following code instead.
59
-
60
- ```sh
61
- $: export RUBYOPT+=' -rpryx_irb'
62
- $: ruby your_file.rb # add pry! in your_file for start pry session
63
- ```
58
+ the preferred way to use pryx is add `export RUBYOPT+=' -rpryx'` to system start script.
64
59
 
65
- __WARN__: `require 'pryx_irb'` will enable many gems by default in your's ruby code.
66
- so, prefer to use `require 'pryx'`, because latter almost not affect your's code,
67
- only several methods added into Kernel#, and gems only be require if you run invoke
68
- those added methods.
60
+ It should almost not affect your's code too much, only special methods defined into Kernel#,
61
+ no any gem be required before you invoke those added methods.
69
62
 
70
63
  ## useful command which added directly to Kernel#
71
64
 
72
- ### Kernel#pry!
73
-
65
+ ### Kernel#pry!
66
+
74
67
  start a pry session, this session only can be intercept once if add into a loop.
75
68
  when used with a rails/roda web server, it only intercept one per request.
76
69
 
77
- we have IRB equivalent, named `irb!`, for use more nice feature, use following code instead:
78
-
79
- ```sh
80
- $: RUBYOPT+='-rpryx_irb' ruby your_file.rb # add irb! in your_file for start pry session
81
- ```
70
+ we have IRB equivalent, named `irb!`, though, only a little feature support it.
82
71
 
83
72
  Following feature both available when start a Pry or IRB session:
84
73
 
85
- 1. Add `next/step/up/down` command for debug, use [break](https://github.com/gsamokovarov/break) [pry-stack_explorer](https://github.com/pry/pry-stack_explorer)
86
- 2. Add `Kernel#ls1`(use ls1 to avoid conflict with pry builtin ls command), see [looksee](https://github.com/oggy/looksee)
87
- 3. Use `ap` for pretty print. see [awesome-print](https://github.com/awesome-print/awesome_print)
88
- 4. Use `Clipboard.copy` or `Clipboard.paste` to interactive with system clipboard. see [clipboard](https://github.com/janlelis/clipboard)
74
+ 1. Add `Kernel#ls1`(use ls1 to avoid conflict with pry builtin ls command), see [looksee](https://github.com/oggy/looksee)
75
+ 2. Use `ap` for pretty print. see [awesome-print](https://github.com/awesome-print/awesome_print)
76
+ 3. Use `Clipboard.copy` or `Clipboard.paste` to interactive with system clipboard. see [clipboard](https://github.com/janlelis/clipboard)
89
77
 
90
- Following is pry command available only after start a Pry session:
78
+ Following feature available only for a Pry session:
91
79
 
92
- 1. Add `$/?` command for see source, see [pry-doc](https://github.com/pry/pry-doc)
93
- 2. pry-remote debug support. you still use `pry!` no changes, it will use `pry-remote` automatically
80
+ 1. Add `next/step/continue/up/down` command for debug, use [pry-nav](https://github.com/nixme/pry-nav) [pry-stack_explorer](https://github.com/pry/pry-stack_explorer)
81
+ 2. Add `$/?` command for see source, see [pry-doc](https://github.com/pry/pry-doc)
82
+ 3. pry-remote debug support. you still use `pry!` no changes, it will use `pry-remote` automatically
94
83
  if current ruby process was running on backround, then, it will use pry-remote, and listen on 0.0.0.0:9876,
95
84
  Then, you can connect to it from another terminal! see [pry-remote](https://github.com/Mon-Ouie/pry-remote)
96
- 3. Add `pa` command, see [pry-power_assert](https://github.com/yui-knk/pry-power_assert)
97
- 4. Add `hier` command for print the class hierarchies, see [pry-hier](https://github.com/phaul/pry-hier)
98
- 5. Add `pry-aa_ancestors` command for print the class hierarchy, see [pry-aa_ancestors](https://github.com/tbpgr/pry-aa_ancestors)
99
- 6. Add `up/down/frame/stack` command, see [pry-stack_explorer](https://github.com/pry/pry-stack_explorer)
100
- 7. Add `yes` or `y` command, see [pry-yes](https://github.com/christofferh/pry-yes)
85
+ 4. Add `pa` command, see [pry-power_assert](https://github.com/yui-knk/pry-power_assert)
86
+ 5. Add `hier` command for print the class hierarchies, see [pry-hier](https://github.com/phaul/pry-hier)
87
+ 6. Add `pry-aa_ancestors` command for print the class hierarchy, see [pry-aa_ancestors](https://github.com/tbpgr/pry-aa_ancestors)
88
+ 7. Add `up/down/frame/stack` command, see [pry-stack_explorer](https://github.com/pry/pry-stack_explorer)
89
+ 8. Add `yes` or `y` command, see [pry-yes](https://github.com/christofferh/pry-yes)
101
90
  9. Add `pry-disam`, Check following screenshot for a example:
102
91
 
103
92
  ![pry-disasm](images/disasm.png)
104
93
 
105
- ### Kernel#pry1 Kernel#pry2 (sorry for this bad name, please create a issue you have a better one)
94
+ ### Kernel#pry1 Kernel#pry2 (sorry for the bad name, please create a issue you have a better one)
106
95
 
107
96
  pry2 do nothing, but it will be interceptd and start a pry session only after pry1 is running.
108
97
 
@@ -153,8 +142,10 @@ But, you should only use it in development, though, it was tested is run in cont
153
142
 
154
143
  ## Limit
155
144
 
156
- 1. `break` not work well if you add more than one break point, but still use `next` goto the next break point,
157
- See https://github.com/gsamokovarov/break/issues/12
145
+ 1. When use looksee with irb for Ruby 3.1.x, looksee output color was not correct displayed.
146
+ check: https://github.com/oggy/looksee/issues/57
147
+ 2. Pry's show auto-watch when not work, because `Enter` key rebinding to `run the last command`.
148
+ i consider this is more useful, you can always use `w` alias to see the watch changes.
158
149
 
159
150
  ## Support
160
151
 
data/bin/irbx CHANGED
@@ -9,4 +9,8 @@
9
9
  require 'irb'
10
10
  require 'pryx_cli'
11
11
 
12
+ # Fix `irb: warn: can't alias ls from irb_ls` issue.
13
+ # See: https://github.com/oggy/looksee/issues/56
14
+ Looksee.rename :_ls
15
+
12
16
  IRB.start(__FILE__)
data/bin/pryx CHANGED
@@ -7,8 +7,8 @@
7
7
  $0 = 'pry'
8
8
 
9
9
  require 'pry'
10
- require 'pryx/pry_plugins'
11
10
  require 'pryx_cli'
11
+ require 'pryx/pry_plugins'
12
12
 
13
13
  # Process command line options and run Pry
14
14
  opts = Pry::CLI.parse_options
@@ -13,6 +13,12 @@ class HookAction
13
13
  end
14
14
 
15
15
  def act
16
+ # when using guard, locals :e, :lib, :pry_state_prev get printed.
17
+ # this 'if' cuts them off.
18
+ if @binding.eval("self.class") == Object
19
+ return
20
+ end
21
+
16
22
  if ENV['SHOW_GLOBAL_VARIABLES']
17
23
  (binding.eval('global_variables').sort - IGNORABLE_GLOBAL_VARS).each do |var|
18
24
  eval_and_print var, var_color: 'white', value_colore: 'yellow'
data/lib/pryx/ap_hack.rb CHANGED
@@ -8,6 +8,7 @@ if defined? AwesomePrint
8
8
  if defined? Pry
9
9
  AwesomePrint.pry!
10
10
  else
11
+ # auto ap only works when running with `irbx`
11
12
  AwesomePrint.irb!
12
13
  end
13
14
  end
@@ -1,12 +1,3 @@
1
- require 'binding_of_caller'
2
1
  require 'clipboard'
3
-
4
- # HACK: for ap 可以确保,当使用 irb! 时,looksee ls1 输出显示正确,同时不用关闭 irb :USE_COLORIZE 设置。
5
- # See https://github.com/oggy/looksee/issues/57
6
- # 但是,ap_hack 必须放到 break_hack 前面,调换顺序,上面的 hack 失效。
7
- # WARN: 下面两行 require 代码顺序不要换。
8
2
  require 'pryx/ap_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
3
+ require 'pryx/looksee_hack'
data/lib/pryx/irb_hack.rb CHANGED
@@ -2,17 +2,7 @@ class Binding
2
2
  def _irb(_host=nil)
3
3
  warn 'loading irb ...'
4
4
 
5
- if defined? Break and defined? IRB
6
- # This is need for work with looksee better.
7
- # See discuss on https://github.com/oggy/looksee/issues/57
8
- IRB.conf[:USE_COLORIZE] = false
9
- else
10
- warn "For work with Break and Looksee, please set
11
- export RUBYOPT='-rpryx_irb'
12
- instead of
13
- export RUBYOPT='-rpryx'
14
- "
15
- end
5
+ require 'pryx/common_plugins'
16
6
 
17
7
  self.irb
18
8
  end
@@ -24,8 +14,6 @@ module Kernel
24
14
 
25
15
  ENV['IRB_was_started'] = 'true'
26
16
 
27
- require 'binding_of_caller'
28
-
29
17
  irb3(2)
30
18
  end
31
19
 
@@ -40,9 +28,6 @@ module Kernel
40
28
  def irb2
41
29
  if ENV['IRB2_should_start'] == 'true'
42
30
  ENV['IRB2_should_start'] = nil
43
-
44
- require 'binding_of_caller'
45
-
46
31
  irb3(2)
47
32
  end
48
33
  end
@@ -11,12 +11,8 @@
11
11
 
12
12
  module Kernel
13
13
  def _load_looksee
14
- case RbConfig::CONFIG['ruby_version']
15
- when '1.9.0'...'2.1.0'
16
- require 'old_looksee'
17
- when '2.1.0'...'3.2.0'
18
- require 'looksee'
19
- end
14
+ require 'looksee'
15
+
20
16
  Looksee.rename :ls_looksee
21
17
 
22
18
  Looksee.editor = '.emacsclient +%l %f' # e.g. [].ls1.edit :to_set
data/lib/pryx/pry_hack.rb CHANGED
@@ -9,6 +9,8 @@ class Binding
9
9
  end
10
10
 
11
11
  require 'pryx/common_plugins'
12
+
13
+ # NOTICE: Ensure pry-navs (in pry_plugins) always required after pry-remote
12
14
  require 'pryx/pry_plugins'
13
15
 
14
16
  if host
@@ -24,8 +26,11 @@ end
24
26
 
25
27
  module Kernel
26
28
  # 运行 pry! 会被拦截, 且只会被拦截一次.
27
- def pry!(host: nil, port: 9876, state: true)
28
- require 'pry-state' if state
29
+ def pry!(host: nil, port: 9876, state: false)
30
+ # You can use environment variables SHOW_GLOBAL_VARIABLES,
31
+ # HIDE_INSTANCE_VARIABLES and HIDE_LOCAL_VARIABLES
32
+ # to customise the kind of variables shown.
33
+ require_relative '../pry-state' if state
29
34
 
30
35
  if Pryx::Background.foreground? and host.nil?
31
36
  return unless ENV['Pry_was_started'].nil?
@@ -43,19 +48,6 @@ module Kernel
43
48
  ENV['Pry_was_started'] = nil
44
49
  end
45
50
 
46
- # 和 pry! 的差别就是,pry? 使用 pry-state 插件输出当前 context 的很多变量内容。
47
- # 注意:不需要总是开启 pry-state,因为有时候会输出太多内容,造成刷屏。
48
- def pry?(host: nil, port: 9876)
49
- return unless ENV['Pry_was_started'].nil?
50
-
51
- require 'pry-state'
52
- ENV['Pry_was_started'] = 'true'
53
-
54
- pry3(2, host: host, port: port)
55
-
56
- # 这里如果有代码, 将会让 pry! 进入这个方法, 因此保持为空.
57
- end
58
-
59
51
  def pry1
60
52
  ENV['Pry2_should_start'] = 'true'
61
53
  end
@@ -17,8 +17,10 @@ Pry::Commands.alias_command 'aa', 'aa_ancestors'
17
17
  require 'pry-stack_explorer' # Add command `up/down/frame[n]/stack`
18
18
  require 'pryx/pry-stack_explorer_hack'
19
19
 
20
+ require 'pry-nav'
21
+
20
22
  # Add command `cc`
21
- Pry::Commands.block_command 'cc', 'Continue, but stop in pry! breakpoint' do
23
+ Pry::Commands.block_command 'cc', 'Continue, but stop in pry! breakpoint too' do
22
24
  Pry.instance_variable_set(:@initial_session, true)
23
25
  ENV['Pry_was_started'] = nil
24
26
  throw(:breakout)
@@ -26,7 +28,9 @@ end
26
28
 
27
29
  Pry.commands.alias_command 'wai', 'whereami' # Add command alias `wai`
28
30
 
29
- # Hit Enter repeat last command
31
+ # Hit Enter repeat last command, this feature will make auto-watch unavailable.
30
32
  Pry::Commands.command(/^$/, 'repeat last command') do
31
- pry_instance.run_command Pry.history.to_a.last
33
+ run Pry.history.to_a.last
32
34
  end
35
+ # So, add a new alias w for user use it manually
36
+ Pry.commands.alias_command 'w', 'watch' # watch is pry builtin
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, 8, 6]
4
+ VERSION = [0, 9, 0]
5
5
 
6
6
  class << VERSION
7
7
  include Comparable
data/lib/pryx.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require 'pryx/version'
4
4
  require 'pryx/background'
5
5
  require 'pryx/trap_backtrace'
6
- require 'pryx/looksee_hack'
7
6
  require 'pryx/pry_hack'
8
7
  require 'pryx/irb_hack'
9
8
 
data/lib/pryx_cli.rb CHANGED
@@ -1,12 +1,7 @@
1
- require 'clipboard'
2
-
3
- require 'pryx/ap_hack'
4
-
5
1
  # This require is needed, because can't require looksee in method when use with bundler.
6
2
  # bundler remove looksee from $LOAD_PATH when start with rails.
7
3
  require 'looksee'
8
- require 'pryx/looksee_hack'
9
-
4
+ require 'pryx/common_plugins'
10
5
  require 'pryx'
11
6
 
12
7
  if File.exist? 'config/environment.rb'
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.8.6
4
+ version: 0.9.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-07-08 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.9'
27
27
  - !ruby/object:Gem::Dependency
28
- name: break
28
+ name: clipboard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.40.0
33
+ version: '1.3'
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.40.0
40
+ version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
- name: clipboard
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '0.14'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '0.14'
55
55
  - !ruby/object:Gem::Dependency
56
- name: looksee
56
+ name: pry-nav
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.4'
61
+ version: 1.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '4.4'
68
+ version: 1.0.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry
70
+ name: looksee
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.14'
75
+ version: '4.4'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.14'
82
+ version: '4.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry-aa_ancestors
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -164,20 +164,6 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.6'
167
- - !ruby/object:Gem::Dependency
168
- name: pry-state
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: 0.1.10
174
- type: :runtime
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: 0.1.10
181
167
  - !ruby/object:Gem::Dependency
182
168
  name: m
183
169
  requirement: !ruby/object:Gem::Requirement
@@ -261,7 +247,6 @@ files:
261
247
  - lib/pryx/trap_backtrace.rb
262
248
  - lib/pryx/version.rb
263
249
  - lib/pryx_cli.rb
264
- - lib/pryx_irb.rb
265
250
  homepage: http://github.com/zw963/pryx
266
251
  licenses:
267
252
  - MIT
@@ -282,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
267
  - !ruby/object:Gem::Version
283
268
  version: '0'
284
269
  requirements: []
285
- rubygems_version: 3.3.3
270
+ rubygems_version: 3.3.7
286
271
  signing_key:
287
272
  specification_version: 4
288
273
  summary: pry extension tools!
data/lib/pryx_irb.rb DELETED
@@ -1,9 +0,0 @@
1
- # We need apply those hack before irb was loaded for work with irb.
2
- # So we have to add it here, same hacks for Pry is add to method
3
- # Binding#_pry which defined in lib/pryx/pry_hack.rb
4
-
5
- # we need set `export RUBYOPT+=" -rpryx_irb"` instead of `-rpryx` to make
6
- # irb work with break and ap gem.
7
-
8
- require 'pryx/common_plugins'
9
- require 'pryx'