potato_debugger 0.00.1
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 +7 -0
- data/CHANGELOG.md +0 -0
- data/README.md +13 -0
- data/bin/debugger +9 -0
- data/bin/sample_session +9 -0
- data/lib/potato_debugger/hook_helper.rb +36 -0
- data/lib/potato_debugger/hooks.rb +53 -0
- data/lib/potato_debugger/version.rb +5 -0
- data/lib/potato_debugger.rb +3 -0
- metadata +55 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7413c74f4dcc5cced099d4a68d816aa5336e195d5daea559bb5138df639ec3bf
|
|
4
|
+
data.tar.gz: da4c640041b8342b54d454dc47fc9f8c2d3249b7cbac433b25cacc465beb1b3e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: aba385ac62c39c8047395a90ab5431703d6717c83598d62f10136abf64ab3de8c39bde788bfe2d61f0b032b100df1585932a67b13ddbd4702bdb7ca05b1963a8
|
|
7
|
+
data.tar.gz: a88e4b57069d9fba9ed39a4ecedddb654d00abacea62c6683b79f46130837c232ec0f99e9642e7314e99ea2d940cd2802b635e4f4f7f24855bbd97b85c80953b
|
data/CHANGELOG.md
ADDED
|
File without changes
|
data/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Potato Debugger
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
© Samuel O'Donnell ([Potato Baron](https://github.com/PotatoBaron89)) 2022<br> (Creator)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
This Gem is currently in the very early stages of development and isn't worth using. Check back later if interested.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Table of Contents
|
|
11
|
+
=================
|
|
12
|
+
|
|
13
|
+
Pending :)
|
data/bin/debugger
ADDED
data/bin/sample_session
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require_relative '../potato_debugger/hooks.rb'
|
|
2
|
+
require "awesome_print"
|
|
3
|
+
require 'time'
|
|
4
|
+
|
|
5
|
+
module PotatoDebugger
|
|
6
|
+
module HookHelper
|
|
7
|
+
def self.prepended(target)
|
|
8
|
+
puts "Hook has been attached to #{target}"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def log(value, key, original_value, calling_method, pry: false)
|
|
17
|
+
@debugger_instance.overview << "#{self.name}.name assigned new value #{value} by #{__method__} in #{self.class}"
|
|
18
|
+
@debugger_instance.cache[key] << {
|
|
19
|
+
value_before: original_value,
|
|
20
|
+
value_after: value,
|
|
21
|
+
time: Time.now,
|
|
22
|
+
_calling_method: calling_method,
|
|
23
|
+
stack_trace: caller[-2]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if pry
|
|
27
|
+
ap @debugger_instance.cache[key]
|
|
28
|
+
begin
|
|
29
|
+
binding.pry
|
|
30
|
+
rescue
|
|
31
|
+
binding.irb
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require_relative '../potato_debugger'
|
|
2
|
+
require "awesome_print"
|
|
3
|
+
require "pry"
|
|
4
|
+
|
|
5
|
+
module PotatoDebugger
|
|
6
|
+
class Hook
|
|
7
|
+
include PotatoDebugger
|
|
8
|
+
|
|
9
|
+
attr_accessor :options
|
|
10
|
+
|
|
11
|
+
def initialize(klass, **args)
|
|
12
|
+
@cache = {}
|
|
13
|
+
@class = klass
|
|
14
|
+
@overview ||= []
|
|
15
|
+
@options = {}
|
|
16
|
+
|
|
17
|
+
args.each {|arg, value| @options[arg] = value }
|
|
18
|
+
|
|
19
|
+
klass.instance_variables.each do |instance_var|
|
|
20
|
+
method_name = "#{instance_var}="
|
|
21
|
+
method_name[0] = ''
|
|
22
|
+
attribute = instance_var.to_s[1..25]
|
|
23
|
+
|
|
24
|
+
@cache[attribute.to_sym] = []
|
|
25
|
+
|
|
26
|
+
klass.define_singleton_method("tracked_#{attribute}") { ap @debugger_instance.cache[attribute] }
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
HookHelper.define_method(method_name) do |value|
|
|
30
|
+
log(value, attribute.to_sym, send(attribute), __method__, pry: @debugger_instance.options)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
klass.define_singleton_method("tracked") { |key, *opts|
|
|
34
|
+
options = {}
|
|
35
|
+
opts.each {|o| options[o] = true}
|
|
36
|
+
|
|
37
|
+
if opts.empty?
|
|
38
|
+
ap @debugger_instance.cache[key]
|
|
39
|
+
else
|
|
40
|
+
ap @debugger_instance.cache[key].filter do |e|
|
|
41
|
+
options.key? e
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
klass.instance_variable_set(:@debugger_instance, self)
|
|
48
|
+
klass.class.prepend(HookHelper)
|
|
49
|
+
|
|
50
|
+
self.class.attr_reader :cache, :overview
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: potato_debugger
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.00.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Samuel O'Donnell
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: |
|
|
14
|
+
An extremely early build for a Ruby Debugging tool, designed to be able to hook into various
|
|
15
|
+
classes and track changes. Not intended to be used by others at this stage.
|
|
16
|
+
email:
|
|
17
|
+
- ''
|
|
18
|
+
executables:
|
|
19
|
+
- debugger
|
|
20
|
+
extensions: []
|
|
21
|
+
extra_rdoc_files: []
|
|
22
|
+
files:
|
|
23
|
+
- CHANGELOG.md
|
|
24
|
+
- README.md
|
|
25
|
+
- bin/debugger
|
|
26
|
+
- bin/sample_session
|
|
27
|
+
- lib/potato_debugger.rb
|
|
28
|
+
- lib/potato_debugger/hook_helper.rb
|
|
29
|
+
- lib/potato_debugger/hooks.rb
|
|
30
|
+
- lib/potato_debugger/version.rb
|
|
31
|
+
homepage: https://github.com/PotatoBaron89/PotatoBaronDebugger
|
|
32
|
+
licenses:
|
|
33
|
+
- MIT
|
|
34
|
+
metadata:
|
|
35
|
+
changelog_uri: https://github.com/PotatoBaron89/PotatoBaronDebugger/blob/masterCHANGELOG.md
|
|
36
|
+
post_install_message:
|
|
37
|
+
rdoc_options: []
|
|
38
|
+
require_paths:
|
|
39
|
+
- lib
|
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '2.7'
|
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '0'
|
|
50
|
+
requirements: []
|
|
51
|
+
rubygems_version: 3.1.6
|
|
52
|
+
signing_key:
|
|
53
|
+
specification_version: 4
|
|
54
|
+
summary: A super early prototype of a debugging tool for Ruby. Not worth using yet.
|
|
55
|
+
test_files: []
|