pry-moves 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/pry-moves/code_reloader.rb +10 -2
- data/lib/pry-moves/commands.rb +6 -0
- data/lib/pry-moves/formatter.rb +5 -3
- data/lib/pry-moves/restartable.rb +3 -0
- data/lib/pry-moves/version.rb +1 -1
- data/lib/pry-moves.rb +47 -3
- data/lib/sugar/debug_sugar.rb +4 -4
- data/pry-moves.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9263336bfe7c3be49b7672539f91ca3f0962d541fd5c5038001d5c5cf80b964d
|
4
|
+
data.tar.gz: 10e0a8c2d8eec1e34dd84b11134f8d615b02562c7583c86f56c1c4e4fbfad81c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d346fba1c2c84c50fabedad6557a5b20ccd449892d8f8e0c5b3f9529fa5ba0f0d1032b6da241aaf24c88c5a64e8b2c1313fa84046dd4b2ee78800208a213104
|
7
|
+
data.tar.gz: bd37798926c7a2fd4bf689e4160e9f1958e0db6760addea4534665e5f28509be92cb96f1be5bee6246995d933457f2dcda27f90906f295ba9f7107935f3d745a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -38,6 +38,7 @@ Documentation for latest version. For [v0.1.12 see documentation here](https://g
|
|
38
38
|
* `.method` or `123` or `:hash_key` - Continue traversing of last object in history. E.g. `orders` will list array, then `3` will enter `orders[3]`, then `.price` will enter `orders[3].price`
|
39
39
|
* `watch variable` - display variable's value on each step
|
40
40
|
* `diff expression` - display difference between saved expression (on first run) and expression 2
|
41
|
+
* `off` - Turn off debugging (don't stop on breakpoints)
|
41
42
|
* `@` - restart and reload scripts (in app/ & spec/ by default), reload rake tasks. Configurable.
|
42
43
|
* `#` - exit with code 3, can be wrapped in bash script to fully reload ruby scripts
|
43
44
|
* `!` - exit
|
@@ -98,6 +99,12 @@ PRY_MOVES_DEBUG_MISSING=off
|
|
98
99
|
PRY_MOVES_RELOADER=off
|
99
100
|
```
|
100
101
|
|
102
|
+
Debug:
|
103
|
+
```bash
|
104
|
+
TRACE_MOVES=on
|
105
|
+
```
|
106
|
+
|
107
|
+
|
101
108
|
## Threads, helpers
|
102
109
|
|
103
110
|
To allow traveling to parent thread, use:
|
@@ -31,7 +31,7 @@ class CodeReloader
|
|
31
31
|
|
32
32
|
def traverse_files
|
33
33
|
paths = PryMoves.reload_ruby_scripts[:monitor]
|
34
|
-
except = PryMoves.reload_ruby_scripts[:except]
|
34
|
+
except = PryMoves.reload_ruby_scripts[:except] + rails_path_exceptions
|
35
35
|
paths.each do |root|
|
36
36
|
files = Dir.glob("#{root}/**/*")
|
37
37
|
files.each do |path|
|
@@ -43,4 +43,12 @@ class CodeReloader
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
def rails_path_exceptions
|
47
|
+
Rails.autoloaders.main.ignore.map do
|
48
|
+
_1.to_s.gsub /^#{Rails.root.to_s}\//, ""
|
49
|
+
end
|
50
|
+
rescue
|
51
|
+
[]
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/lib/pry-moves/commands.rb
CHANGED
@@ -52,6 +52,7 @@ module PryMoves
|
|
52
52
|
end
|
53
53
|
|
54
54
|
block_command 'diff', 'Display difference' do
|
55
|
+
next if PryMoves::Vars.var_precedence :diff, target
|
55
56
|
cmd = arg_string.gsub(/^diff/, '').strip
|
56
57
|
PryMoves::Diff.new(_pry_, target).run_command cmd
|
57
58
|
end
|
@@ -65,6 +66,11 @@ module PryMoves
|
|
65
66
|
breakout_navigation :debug, cmd
|
66
67
|
end
|
67
68
|
|
69
|
+
block_command 'off', '' do
|
70
|
+
PryMoves.switch if PryMoves.stop_on_breakpoints?
|
71
|
+
run 'continue'
|
72
|
+
end
|
73
|
+
|
68
74
|
block_command :restart, '' do
|
69
75
|
PryMoves.restart_requested = true
|
70
76
|
run 'continue'
|
data/lib/pry-moves/formatter.rb
CHANGED
@@ -57,10 +57,12 @@ class PryMoves::Formatter
|
|
57
57
|
str.length > 50 ? "#{str.first 50}..." : str
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
def path_trash
|
61
|
+
@path_trash ||= defined?(Rails) ? Rails.root.to_s : Dir.pwd
|
62
|
+
end
|
61
63
|
|
62
64
|
def shorten_path(path)
|
63
|
-
path = path.gsub( /^#{
|
65
|
+
path = path.gsub( /^#{path_trash}\//, '')
|
64
66
|
PryMoves::Backtrace.trim_path ?
|
65
67
|
File.basename(path, ".*") : path
|
66
68
|
end
|
@@ -82,4 +84,4 @@ class PryMoves::Formatter
|
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
85
|
-
end
|
87
|
+
end
|
data/lib/pry-moves/version.rb
CHANGED
data/lib/pry-moves.rb
CHANGED
@@ -15,7 +15,51 @@ module PryMoves
|
|
15
15
|
Kernel.loop do
|
16
16
|
result = yield
|
17
17
|
debug "⏸ execution loop complete\n#{result}"
|
18
|
-
PryMoves.
|
18
|
+
PryMoves.reload_sources
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def stop_on_breakpoints?
|
23
|
+
stop_on_breakpoints
|
24
|
+
end
|
25
|
+
|
26
|
+
def switch
|
27
|
+
self.stop_on_breakpoints = !self.stop_on_breakpoints
|
28
|
+
if self.stop_on_breakpoints
|
29
|
+
puts '🪲 Debugging is turned on'
|
30
|
+
else
|
31
|
+
puts '🐞 Debugging is turned off'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def listen_signal_to_switch use_signals = %w[INFO QUIT]
|
36
|
+
# signals list in bash: stty -a
|
37
|
+
signal = use_signals.find {Signal.list[_1]}
|
38
|
+
unless signal
|
39
|
+
puts "No signals supported for PryMoves switch: #{use_signals}"
|
40
|
+
return
|
41
|
+
end
|
42
|
+
|
43
|
+
puts "🚥 Overriding #{signal} signal for PryMoves debug switch"
|
44
|
+
Signal.trap 'INFO' do
|
45
|
+
PryMoves.switch
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def debug_window_attached?
|
50
|
+
if !@last_attachment_check or Time.now - @last_attachment_check > 2
|
51
|
+
@is_debug_window_attached = begin
|
52
|
+
@last_attachment_check = Time.now
|
53
|
+
if `echo $STY` # is in screen
|
54
|
+
my_window = `echo $WINDOW`.strip
|
55
|
+
windows_list = `screen -Q windows`
|
56
|
+
windows_list.include? " #{my_window}*" # process is in currently active window
|
57
|
+
else
|
58
|
+
true
|
59
|
+
end
|
60
|
+
end
|
61
|
+
else
|
62
|
+
@is_debug_window_attached
|
19
63
|
end
|
20
64
|
end
|
21
65
|
|
@@ -44,7 +88,7 @@ module PryMoves
|
|
44
88
|
pry_moves_stack_end = true
|
45
89
|
message ||= data
|
46
90
|
PryMoves.re_execution
|
47
|
-
if PryMoves.stop_on_breakpoints
|
91
|
+
if PryMoves.stop_on_breakpoints?
|
48
92
|
self.debug_called_times += 1
|
49
93
|
return if at and self.debug_called_times != at
|
50
94
|
return if from and self.debug_called_times < from
|
@@ -60,7 +104,7 @@ module PryMoves
|
|
60
104
|
|
61
105
|
def runtime_debug(instance, external: false)
|
62
106
|
do_debug = (
|
63
|
-
stop_on_breakpoints and
|
107
|
+
stop_on_breakpoints? and
|
64
108
|
not open? and
|
65
109
|
(external or is_project_file?) and
|
66
110
|
not [RubyVM::InstructionSequence].include?(instance)
|
data/lib/sugar/debug_sugar.rb
CHANGED
@@ -9,7 +9,7 @@ def error(err = "Error", debug_object = nil)
|
|
9
9
|
message = "😱 #{err}"
|
10
10
|
debug_object ||= err.metadata if err.respond_to? :metadata
|
11
11
|
unless PryMoves.open? or err.is_a? PryMoves::Restart
|
12
|
-
if PryMoves.stop_on_breakpoints
|
12
|
+
if PryMoves.stop_on_breakpoints?
|
13
13
|
PryMoves.debug_error message.red, debug_object
|
14
14
|
elsif !PryMoves.dont_print_errors
|
15
15
|
STDERR.puts PryMoves.format_debug_object(debug_object) if debug_object
|
@@ -24,7 +24,7 @@ def shit!(err = 'Oh, shit!', debug_object = nil)
|
|
24
24
|
return if ENV['NO_SHIT']
|
25
25
|
pry_moves_stack_end = true
|
26
26
|
message = "💩 #{err.is_a?(String) ? err : err.message}"
|
27
|
-
raise err unless PryMoves.stop_on_breakpoints
|
27
|
+
raise err unless PryMoves.stop_on_breakpoints?
|
28
28
|
lines = [message.red]
|
29
29
|
lines.prepend debug_object.ai if debug_object
|
30
30
|
PryMoves.debug_error lines.join("\n")
|
@@ -33,9 +33,9 @@ end
|
|
33
33
|
|
34
34
|
Object.class_eval do
|
35
35
|
|
36
|
-
def required!
|
36
|
+
def required! param = nil
|
37
37
|
pry_moves_stack_end = true
|
38
|
-
error("required parameter is missing",
|
38
|
+
error("required parameter is missing", param) if self.nil?
|
39
39
|
self
|
40
40
|
end
|
41
41
|
|
data/pry-moves.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
# Dependencies
|
21
21
|
gem.required_ruby_version = '>= 1.8.7', '< 3'
|
22
22
|
gem.add_runtime_dependency 'pry', '>= 0.10.4', '< 0.13'
|
23
|
+
gem.add_runtime_dependency 'pry-coolline', '~> 0.2.5'
|
23
24
|
gem.add_runtime_dependency 'binding_of_caller', '~> 0.7'
|
24
25
|
gem.add_runtime_dependency 'colorize', '~> 0.8'
|
25
26
|
gem.add_runtime_dependency 'awesome_print', '>= 1.8.0'
|
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.
|
4
|
+
version: 1.0.9
|
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-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0.13'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: pry-coolline
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.2.5
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.2.5
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: binding_of_caller
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|