pry-moves 1.0.6 → 1.0.8

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: 61b610bb60b125b53c4f246fcc065676ee5e1814870f67c8b6f2337846d183ef
4
- data.tar.gz: 258d1d9deb64451e47dd712a8784b2bc8abba2f7f2ca2d9428e887056cdfcc4c
3
+ metadata.gz: d5dd73d9bf5340f7b9660e07be21e5a156fba16cd43005aef95c6a0b6ac18147
4
+ data.tar.gz: 6293a071d17ee76aaf7dc9eaee97284331147fa9cd214e965e8c7500b200fed7
5
5
  SHA512:
6
- metadata.gz: 4b0885e290ed0409a09efbb36c70d3bb1661280227f105b3a11f7bd0993d3349cc3c4f23cf186c167f256e6a8b8ab7657342b609c024336797af418d31304cf9
7
- data.tar.gz: 50fe8355c051a76a61f2861eb3c596fa28ed8d2c38812948785f0e44b31b4e627bb81ab99c5d630b17c5313f7d7acaae954af523066c93baeb34367021013549
6
+ metadata.gz: e42e8c1a57e66778e9f81beca8a17e3f5929d5354f6c5c26b29c346ef7d00a9c4830f12eb08af0c62c45ddfff307fcb2909affb400318cabfc827aa6d2685daf
7
+ data.tar.gz: 5bbf6d3f960084634dd0f22fa9b2965be9671b9fa39a2ccbd1152c96059a912b3ddff3116ba640081deb922d6b86c8de653a1f69012ba82c3fb8a6150e72b4cc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pry-moves (1.0.5)
4
+ pry-moves (1.0.7)
5
5
  awesome_print (>= 1.8.0)
6
6
  binding_of_caller (~> 0.7)
7
7
  colorize (~> 0.8)
@@ -95,7 +95,7 @@ module PryMoves
95
95
 
96
96
  helpers do
97
97
  def breakout_navigation(action, param)
98
- return if var_precedence action
98
+ return if PryMoves::Vars.var_precedence action, target
99
99
 
100
100
  check_file_context
101
101
  _pry_.binding_stack.clear # Clear the binding stack.
@@ -106,24 +106,6 @@ module PryMoves
106
106
  }
107
107
  end
108
108
 
109
- def var_precedence action
110
- if Pry.config.ignore_once_var_precedence
111
- Pry.config.ignore_once_var_precedence = false
112
- return
113
- end
114
-
115
- input = Pry.config.original_user_input || action.to_s
116
- return if %w[next debug].include? input # next - ruby keyword
117
- begin
118
- binding_value = target.eval(input)
119
- puts "ℹ️️ Variable \"#{input}\" found. To execute command type its alias or \\#{input}"
120
- puts PryMoves::Painter.colorize binding_value
121
- true
122
- rescue => e
123
- # puts (e.backtrace.reverse + ["var_precedence exception:".red, "#{e}".red]).join "\n"
124
- end
125
- end
126
-
127
109
  # Ensures that a command is executed in a local file context.
128
110
  def check_file_context
129
111
  unless PryMoves.check_file_context(target)
@@ -32,9 +32,9 @@ module PryMoves::Restartable
32
32
 
33
33
  end
34
34
 
35
- class PryMoves::Restart < RuntimeError
35
+ class PryMoves::Restart < Exception
36
36
  end
37
- class PryMoves::Reload < RuntimeError
37
+ class PryMoves::Reload < Exception
38
38
  end
39
39
  RSpec::Support::AllExceptionsExceptOnesWeMustNotRescue::AVOID_RESCUING.concat [PryMoves::Restart, PryMoves::Reload] if defined? RSpec
40
40
 
@@ -0,0 +1,23 @@
1
+ module PryMoves::Vars
2
+
3
+ extend self
4
+
5
+ def var_precedence action, target
6
+ if Pry.config.ignore_once_var_precedence
7
+ Pry.config.ignore_once_var_precedence = false
8
+ return
9
+ end
10
+
11
+ input = Pry.config.original_user_input || action.to_s
12
+ return if %w[next debug].include? input # next - ruby keyword
13
+ begin
14
+ binding_value = target.eval(input)
15
+ puts "ℹ️️ Variable \"#{input}\" found. To execute command type its alias or \\#{input}"
16
+ puts PryMoves::Painter.colorize binding_value
17
+ true
18
+ rescue => e
19
+ # puts (e.backtrace.reverse + ["var_precedence exception:".red, "#{e}".red]).join "\n"
20
+ end
21
+ end
22
+
23
+ end
@@ -1,3 +1,3 @@
1
1
  module PryMoves
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.8'
3
3
  end
data/lib/pry-moves.rb CHANGED
@@ -7,7 +7,7 @@ module PryMoves
7
7
  extend PryMoves::Restartable
8
8
 
9
9
  attr_accessor :is_open, :trace, :stack_tips,
10
- :stop_on_breakpoints,
10
+ :stop_on_breakpoints, :dont_print_errors,
11
11
  :test_example, :launched_specs_examples,
12
12
  :debug_called_times, :step_in_everywhere
13
13
 
@@ -102,6 +102,7 @@ module PryStackExplorer::FrameHelpers
102
102
  end
103
103
 
104
104
  def move(direction, param)
105
+ return if PryMoves::Vars.var_precedence direction, target
105
106
  raise Pry::CommandError, "Nowhere to go" unless frame_manager
106
107
 
107
108
  if param == '+' or param.nil?
@@ -112,4 +113,4 @@ module PryStackExplorer::FrameHelpers
112
113
  frame_manager.change_frame_to index
113
114
  end
114
115
  end
115
- end
116
+ end
@@ -123,3 +123,4 @@ Pry.config.hooks.add_hook(:when_started, :save_caller_bindings, PryStackExplorer
123
123
  # Import the StackExplorer commands
124
124
  Pry.config.commands.import PryStackExplorer::COMMANDS
125
125
 
126
+ Pry.config.commands.delete 'stat'
@@ -45,6 +45,7 @@ module PryStackExplorer
45
45
  create_command "top", "Top" do
46
46
  include FrameHelpers
47
47
  def process
48
+ return if PryMoves::Vars.var_precedence "top", target
48
49
  frame_manager.change_frame_to frame_manager.bindings.size - 1
49
50
  end
50
51
  end
@@ -52,6 +53,7 @@ module PryStackExplorer
52
53
  create_command "bottom", "Bottom" do
53
54
  include FrameHelpers
54
55
  def process
56
+ return if PryMoves::Vars.var_precedence "bottom", target
55
57
  frame_manager.change_frame_to 0
56
58
  end
57
59
  end
@@ -72,6 +74,7 @@ module PryStackExplorer
72
74
  BANNER
73
75
 
74
76
  def process
77
+ return if PryMoves::Vars.var_precedence "frame", target
75
78
  if !frame_manager
76
79
  raise Pry::CommandError, "nowhere to go!"
77
80
  else
data/lib/requires.rb CHANGED
@@ -6,6 +6,7 @@ require 'pry-moves/version'
6
6
  require 'pry-moves/pry_ext'
7
7
  require 'pry-moves/commands'
8
8
  require 'pry-moves/add_suffix'
9
+ require 'pry-moves/vars'
9
10
  require 'pry-moves/pry_wrapper'
10
11
  require 'pry-moves/bindings_stack'
11
12
  require 'pry-moves/code_reloader'
@@ -35,4 +36,4 @@ require 'pry-stack_explorer/pry-stack_explorer'
35
36
  require 'sugar/debug_sugar'
36
37
 
37
38
  # Optionally load pry-remote monkey patches
38
- require 'pry-moves/pry_remote_ext' if defined? PryRemote
39
+ require 'pry-moves/pry_remote_ext' if defined? PryRemote
@@ -8,10 +8,10 @@ def error(err = "Error", debug_object = nil)
8
8
  pry_moves_stack_end = true
9
9
  message = "😱 #{err}"
10
10
  debug_object ||= err.metadata if err.respond_to? :metadata
11
- unless PryMoves.open?
11
+ unless PryMoves.open? or err.is_a? PryMoves::Restart
12
12
  if PryMoves.stop_on_breakpoints
13
13
  PryMoves.debug_error message.red, debug_object
14
- else
14
+ elsif !PryMoves.dont_print_errors
15
15
  STDERR.puts PryMoves.format_debug_object(debug_object) if debug_object
16
16
  STDERR.puts message.ljust(80, ' ').red
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-moves
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - garmoshka-mo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-21 00:00:00.000000000 Z
11
+ date: 2023-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -144,6 +144,7 @@ files:
144
144
  - lib/pry-moves/recursion_tracker.rb
145
145
  - lib/pry-moves/restartable.rb
146
146
  - lib/pry-moves/tools.rb
147
+ - lib/pry-moves/vars.rb
147
148
  - lib/pry-moves/version.rb
148
149
  - lib/pry-moves/watch.rb
149
150
  - lib/pry-stack_explorer/VERSION