tapping_device 0.5.7 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +14 -4
- data/.gitignore +2 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +67 -0
- data/Gemfile +11 -0
- data/Makefile +3 -0
- data/lib/tapping_device.rb +3 -4
- data/lib/tapping_device/method_hijacker.rb +4 -0
- data/lib/tapping_device/output.rb +6 -7
- data/lib/tapping_device/output/{payload.rb → payload_wrapper.rb} +23 -3
- data/lib/tapping_device/output/writer.rb +5 -3
- data/lib/tapping_device/payload.rb +23 -13
- data/lib/tapping_device/trackers/initialization_tracker.rb +3 -3
- data/lib/tapping_device/trackers/mutation_tracker.rb +3 -4
- data/lib/tapping_device/version.rb +1 -1
- data/tapping_device.gemspec +0 -7
- metadata +5 -35
- data/Gemfile.lock +0 -78
- data/lib/tapping_device/output/file_writer.rb +0 -21
- data/lib/tapping_device/output/stdout_writer.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8adc4b6842ade7721eafaf72e9b94c8a6a852c1f9f9beebdf2556b20cef6d4a
|
4
|
+
data.tar.gz: ab22b319f6468837e92f851f00f863cf732dd3c0cc73e286d5f9569d00c34db6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992f31b79a3c0a8abc8471ae643f02586cf76d505da493cfe66b37338781251c3dfdba43a158776431c93a342e8b9a02baff78118b71c679aba2f9114c65077c
|
7
|
+
data.tar.gz: cad971d539041804a9860225f17ae23754dc46ea6fa5b7dc15d674e5189c081dd4f6f2602eeea9c27e616fb1b959126fe452ef5f641e249d73392782b17a3c2c
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
name: Ruby
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
workflow_dispatch:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
pull_request:
|
4
9
|
|
5
10
|
jobs:
|
6
11
|
test:
|
@@ -8,9 +13,12 @@ jobs:
|
|
8
13
|
runs-on: ${{ matrix.os }}
|
9
14
|
strategy:
|
10
15
|
matrix:
|
11
|
-
rails_version: ['5.2', '6']
|
12
|
-
ruby_version: ['2.
|
16
|
+
rails_version: ['5.2', '6.0.0', '6.1.0']
|
17
|
+
ruby_version: ['2.7', '3.0']
|
13
18
|
os: [ubuntu-latest]
|
19
|
+
exclude:
|
20
|
+
- ruby_version: '3.0'
|
21
|
+
rails_version: '5.2'
|
14
22
|
steps:
|
15
23
|
- uses: actions/checkout@v1
|
16
24
|
|
@@ -34,7 +42,9 @@ jobs:
|
|
34
42
|
bundle install --jobs 4 --retry 3
|
35
43
|
|
36
44
|
- name: Run test with Rails ${{ matrix.rails_version }}
|
37
|
-
|
45
|
+
env:
|
46
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
47
|
+
run: make test
|
38
48
|
|
39
49
|
- name: Publish Test Coverage
|
40
50
|
uses: paambaati/codeclimate-action@v2.6.0
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,72 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [Unreleased](https://github.com/st0012/tapping_device/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.7...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Support Ruby 3.0 [\#71](https://github.com/st0012/tapping_device/pull/71) ([st0012](https://github.com/st0012))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Drop activerecord requirement [\#73](https://github.com/st0012/tapping_device/pull/73) ([st0012](https://github.com/st0012))
|
14
|
+
- Improve file-writing tests [\#72](https://github.com/st0012/tapping_device/pull/72) ([st0012](https://github.com/st0012))
|
15
|
+
- Simplify output logic with Ruby' Logger class [\#70](https://github.com/st0012/tapping_device/pull/70) ([st0012](https://github.com/st0012))
|
16
|
+
- Refactor Payload classes [\#68](https://github.com/st0012/tapping_device/pull/68) ([st0012](https://github.com/st0012))
|
17
|
+
|
18
|
+
## [v0.5.7](https://github.com/st0012/tapping_device/tree/v0.5.7) (2020-09-09)
|
19
|
+
|
20
|
+
[Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.6...v0.5.7)
|
21
|
+
|
22
|
+
**Closed issues:**
|
23
|
+
|
24
|
+
- Support tag option [\#64](https://github.com/st0012/tapping_device/issues/64)
|
25
|
+
|
26
|
+
**Merged pull requests:**
|
27
|
+
|
28
|
+
- Use pastel to replace handmade colorizing logic [\#66](https://github.com/st0012/tapping_device/pull/66) ([st0012](https://github.com/st0012))
|
29
|
+
- Add tag option [\#65](https://github.com/st0012/tapping_device/pull/65) ([st0012](https://github.com/st0012))
|
30
|
+
|
31
|
+
## [v0.5.6](https://github.com/st0012/tapping_device/tree/v0.5.6) (2020-07-17)
|
32
|
+
|
33
|
+
[Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.5...v0.5.6)
|
34
|
+
|
35
|
+
## [v0.5.5](https://github.com/st0012/tapping_device/tree/v0.5.5) (2020-07-16)
|
36
|
+
|
37
|
+
[Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.4...v0.5.5)
|
38
|
+
|
39
|
+
**Fixed bugs:**
|
40
|
+
|
41
|
+
- InitializationTracker's logic can cause error [\#60](https://github.com/st0012/tapping_device/issues/60)
|
42
|
+
|
43
|
+
**Closed issues:**
|
44
|
+
|
45
|
+
- Refactor get\_method\_from\_object [\#59](https://github.com/st0012/tapping_device/issues/59)
|
46
|
+
|
47
|
+
**Merged pull requests:**
|
48
|
+
|
49
|
+
- Fix init tracker [\#61](https://github.com/st0012/tapping_device/pull/61) ([st0012](https://github.com/st0012))
|
50
|
+
|
51
|
+
## [v0.5.4](https://github.com/st0012/tapping_device/tree/v0.5.4) (2020-07-05)
|
52
|
+
|
53
|
+
[Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.3...v0.5.4)
|
54
|
+
|
55
|
+
**Closed issues:**
|
56
|
+
|
57
|
+
- Add with\_print\_calls method [\#52](https://github.com/st0012/tapping_device/issues/52)
|
58
|
+
- Tapping any instance of class [\#51](https://github.com/st0012/tapping_device/issues/51)
|
59
|
+
- Add ignore\_private option [\#50](https://github.com/st0012/tapping_device/issues/50)
|
60
|
+
|
61
|
+
**Merged pull requests:**
|
62
|
+
|
63
|
+
- Restructure README.md [\#58](https://github.com/st0012/tapping_device/pull/58) ([st0012](https://github.com/st0012))
|
64
|
+
- Better support on private methods [\#57](https://github.com/st0012/tapping_device/pull/57) ([st0012](https://github.com/st0012))
|
65
|
+
- Add with\_\* helpers \(e.g. with\_print\_calls\) [\#56](https://github.com/st0012/tapping_device/pull/56) ([st0012](https://github.com/st0012))
|
66
|
+
- Add force\_recording option for debugging [\#55](https://github.com/st0012/tapping_device/pull/55) ([st0012](https://github.com/st0012))
|
67
|
+
- Add print\_instance\_\* and write\_instance\_\* helpers [\#54](https://github.com/st0012/tapping_device/pull/54) ([st0012](https://github.com/st0012))
|
68
|
+
- Fix tap\_init by adding c\_\* event type [\#53](https://github.com/st0012/tapping_device/pull/53) ([st0012](https://github.com/st0012))
|
69
|
+
|
3
70
|
## [v0.5.3](https://github.com/st0012/tapping_device/tree/v0.5.3) (2020-06-21)
|
4
71
|
|
5
72
|
[Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.2...v0.5.3)
|
data/Gemfile
CHANGED
@@ -2,3 +2,14 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in tapping_device.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
rails_version = ENV["RAILS_VERSION"]
|
7
|
+
rails_version = "6.1.0" if rails_version.nil?
|
8
|
+
|
9
|
+
if rails_version.to_f < 6
|
10
|
+
gem "sqlite3", "~> 1.3.0"
|
11
|
+
else
|
12
|
+
gem "sqlite3"
|
13
|
+
end
|
14
|
+
|
15
|
+
gem "activerecord", "~> #{rails_version}"
|
data/Makefile
ADDED
data/lib/tapping_device.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require "active_record"
|
2
1
|
require "active_support/core_ext/module/introspection"
|
3
2
|
require "pry" # for using Method#source
|
4
3
|
|
@@ -141,7 +140,7 @@ class TappingDevice
|
|
141
140
|
end
|
142
141
|
|
143
142
|
def build_payload(tp:, filepath:, line_number:)
|
144
|
-
Payload.
|
143
|
+
Payload.new(
|
145
144
|
target: @target,
|
146
145
|
receiver: tp.self,
|
147
146
|
method_name: tp.callee_id,
|
@@ -152,10 +151,10 @@ class TappingDevice
|
|
152
151
|
line_number: line_number,
|
153
152
|
defined_class: tp.defined_class,
|
154
153
|
trace: get_traces(tp),
|
155
|
-
is_private_call
|
154
|
+
is_private_call: tp.defined_class.private_method_defined?(tp.callee_id),
|
156
155
|
tag: options[:tag],
|
157
156
|
tp: tp
|
158
|
-
|
157
|
+
)
|
159
158
|
end
|
160
159
|
|
161
160
|
def get_method_object_from(target, method_name)
|
@@ -20,10 +20,14 @@ class TappingDevice
|
|
20
20
|
|
21
21
|
def is_writer_method?(method_name)
|
22
22
|
has_definition_source?(method_name) && method_name.match?(/\w+=/) && target.method(method_name).source.match?(/attr_writer|attr_accessor/)
|
23
|
+
rescue MethodSource::SourceNotFoundError
|
24
|
+
false
|
23
25
|
end
|
24
26
|
|
25
27
|
def is_reader_method?(method_name)
|
26
28
|
has_definition_source?(method_name) && target.method(method_name).source.match?(/attr_reader|attr_accessor/)
|
29
|
+
rescue MethodSource::SourceNotFoundError
|
30
|
+
false
|
27
31
|
end
|
28
32
|
|
29
33
|
def has_definition_source?(method_name)
|
@@ -1,7 +1,6 @@
|
|
1
|
-
require "
|
1
|
+
require "logger"
|
2
|
+
require "tapping_device/output/payload_wrapper"
|
2
3
|
require "tapping_device/output/writer"
|
3
|
-
require "tapping_device/output/stdout_writer"
|
4
|
-
require "tapping_device/output/file_writer"
|
5
4
|
|
6
5
|
class TappingDevice
|
7
6
|
module Output
|
@@ -13,16 +12,16 @@ class TappingDevice
|
|
13
12
|
|
14
13
|
module Helpers
|
15
14
|
def and_write(payload_method = nil, options: {}, &block)
|
16
|
-
and_output(payload_method, options: options,
|
15
|
+
and_output(payload_method, options: options, logger: Logger.new(options[:log_file]), &block)
|
17
16
|
end
|
18
17
|
|
19
18
|
def and_print(payload_method = nil, options: {}, &block)
|
20
|
-
and_output(payload_method, options: options,
|
19
|
+
and_output(payload_method, options: options, logger: Logger.new($stdout), &block)
|
21
20
|
end
|
22
21
|
|
23
|
-
def and_output(payload_method = nil, options: {},
|
22
|
+
def and_output(payload_method = nil, options: {}, logger:, &block)
|
24
23
|
output_block = generate_output_block(payload_method, block)
|
25
|
-
@output_writer =
|
24
|
+
@output_writer = Writer.new(options: options, output_block: output_block, logger: logger)
|
26
25
|
self
|
27
26
|
end
|
28
27
|
|
@@ -2,18 +2,38 @@ require "pastel"
|
|
2
2
|
|
3
3
|
class TappingDevice
|
4
4
|
module Output
|
5
|
-
class
|
5
|
+
class PayloadWrapper
|
6
6
|
UNDEFINED = "[undefined]"
|
7
7
|
PRIVATE_MARK = " (private)"
|
8
8
|
|
9
9
|
PASTEL = Pastel.new
|
10
10
|
PASTEL.alias_color(:orange, :bright_red, :bright_yellow)
|
11
11
|
|
12
|
+
TappingDevice::Payload::ATTRS.each do |attr|
|
13
|
+
define_method attr do |options = {}|
|
14
|
+
@payload.send(attr)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
alias :is_private_call? :is_private_call
|
19
|
+
|
20
|
+
def method_head
|
21
|
+
@payload.method_head
|
22
|
+
end
|
23
|
+
|
24
|
+
def location(options = {})
|
25
|
+
@payload.location(options)
|
26
|
+
end
|
27
|
+
|
12
28
|
alias :raw_arguments :arguments
|
13
29
|
alias :raw_return_value :return_value
|
14
30
|
|
31
|
+
def initialize(payload)
|
32
|
+
@payload = payload
|
33
|
+
end
|
34
|
+
|
15
35
|
def method_name(options = {})
|
16
|
-
name = ":#{
|
36
|
+
name = ":#{@payload.method_name}"
|
17
37
|
|
18
38
|
name += " [#{tag}]" if tag
|
19
39
|
name += PRIVATE_MARK if is_private_call?
|
@@ -95,7 +115,7 @@ class TappingDevice
|
|
95
115
|
end
|
96
116
|
|
97
117
|
def ivar_changes(options = {})
|
98
|
-
|
118
|
+
@payload.ivar_changes.map do |ivar, value_changes|
|
99
119
|
before = generate_string_result(value_changes[:before], options[:inspect])
|
100
120
|
after = generate_string_result(value_changes[:after], options[:inspect])
|
101
121
|
|
@@ -1,19 +1,21 @@
|
|
1
1
|
class TappingDevice
|
2
2
|
module Output
|
3
3
|
class Writer
|
4
|
-
def initialize(options
|
4
|
+
def initialize(options:, output_block:, logger:)
|
5
5
|
@options = options
|
6
6
|
@output_block = output_block
|
7
|
+
@logger = logger
|
7
8
|
end
|
8
9
|
|
9
10
|
def write!(payload)
|
10
|
-
|
11
|
+
output = generate_output(payload)
|
12
|
+
@logger << output
|
11
13
|
end
|
12
14
|
|
13
15
|
private
|
14
16
|
|
15
17
|
def generate_output(payload)
|
16
|
-
@output_block.call(
|
18
|
+
@output_block.call(PayloadWrapper.new(payload), @options)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
@@ -1,22 +1,32 @@
|
|
1
1
|
class TappingDevice
|
2
|
-
class Payload
|
2
|
+
class Payload
|
3
3
|
ATTRS = [
|
4
4
|
:target, :receiver, :method_name, :method_object, :arguments, :return_value, :filepath, :line_number,
|
5
|
-
:defined_class, :trace, :tag, :tp, :ivar_changes, :is_private_call
|
5
|
+
:defined_class, :trace, :tag, :tp, :ivar_changes, :is_private_call
|
6
6
|
]
|
7
7
|
|
8
|
-
ATTRS
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
8
|
+
attr_accessor(*ATTRS)
|
9
|
+
|
10
|
+
alias :is_private_call? :is_private_call
|
13
11
|
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
def initialize(
|
13
|
+
target:, receiver:, method_name:, method_object:, arguments:, return_value:, filepath:, line_number:,
|
14
|
+
defined_class:, trace:, tag:, tp:, is_private_call:
|
15
|
+
)
|
16
|
+
@target = target
|
17
|
+
@receiver = receiver
|
18
|
+
@method_name = method_name
|
19
|
+
@method_object = method_object
|
20
|
+
@arguments = arguments
|
21
|
+
@return_value = return_value
|
22
|
+
@filepath = filepath
|
23
|
+
@line_number = line_number
|
24
|
+
@defined_class = defined_class
|
25
|
+
@trace = trace
|
26
|
+
@tag = tag
|
27
|
+
@tp = tp
|
28
|
+
@ivar_changes = {}
|
29
|
+
@is_private_call = is_private_call
|
20
30
|
end
|
21
31
|
|
22
32
|
def method_head
|
@@ -11,7 +11,7 @@ class TappingDevice
|
|
11
11
|
|
12
12
|
def track(object)
|
13
13
|
super
|
14
|
-
@is_active_record_model = target.ancestors.include?(ActiveRecord::Base)
|
14
|
+
@is_active_record_model = defined?(ActiveRecord) && target.ancestors.include?(ActiveRecord::Base)
|
15
15
|
self
|
16
16
|
end
|
17
17
|
|
@@ -20,8 +20,8 @@ class TappingDevice
|
|
20
20
|
|
21
21
|
return payload if @is_active_record_model
|
22
22
|
|
23
|
-
payload
|
24
|
-
payload
|
23
|
+
payload.return_value = payload.receiver
|
24
|
+
payload.receiver = target
|
25
25
|
payload
|
26
26
|
end
|
27
27
|
|
@@ -47,7 +47,7 @@ class TappingDevice
|
|
47
47
|
payload = super
|
48
48
|
|
49
49
|
if change_capturing_event?(tp)
|
50
|
-
payload
|
50
|
+
payload.ivar_changes = capture_ivar_changes
|
51
51
|
end
|
52
52
|
|
53
53
|
payload
|
@@ -55,15 +55,14 @@ class TappingDevice
|
|
55
55
|
|
56
56
|
def capture_ivar_changes
|
57
57
|
changes = {}
|
58
|
-
|
59
58
|
additional_keys = @latest_instance_variables.keys - @instance_variables_snapshot.keys
|
60
59
|
additional_keys.each do |key|
|
61
|
-
changes[key] = {before: Output::
|
60
|
+
changes[key] = {before: Output::PayloadWrapper::UNDEFINED, after: @latest_instance_variables[key]}
|
62
61
|
end
|
63
62
|
|
64
63
|
removed_keys = @instance_variables_snapshot.keys - @latest_instance_variables.keys
|
65
64
|
removed_keys.each do |key|
|
66
|
-
changes[key] = {before: @instance_variables_snapshot[key], after: Output::
|
65
|
+
changes[key] = {before: @instance_variables_snapshot[key], after: Output::PayloadWrapper::UNDEFINED}
|
67
66
|
end
|
68
67
|
|
69
68
|
remained_keys = @latest_instance_variables.keys - additional_keys
|
data/tapping_device.gemspec
CHANGED
@@ -26,17 +26,10 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
|
-
if ENV["RAILS_VERSION"]
|
30
|
-
spec.add_dependency "activerecord", "~> #{ENV["RAILS_VERSION"]}"
|
31
|
-
else
|
32
|
-
spec.add_dependency "activerecord", ">= 5.2"
|
33
|
-
end
|
34
|
-
|
35
29
|
spec.add_dependency "pry" # for using Method#source in MutationTracker
|
36
30
|
spec.add_dependency "activesupport"
|
37
31
|
spec.add_dependency "pastel"
|
38
32
|
|
39
|
-
spec.add_development_dependency "sqlite3", ">= 1.3.6"
|
40
33
|
spec.add_development_dependency "database_cleaner"
|
41
34
|
spec.add_development_dependency "bundler", "~> 2.0"
|
42
35
|
spec.add_development_dependency "rake", "~> 13.0"
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tapping_device
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- st0012
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activerecord
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.2'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '5.2'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: pry
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +52,6 @@ dependencies:
|
|
66
52
|
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: sqlite3
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.3.6
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.3.6
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
56
|
name: database_cleaner
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,8 +140,8 @@ files:
|
|
168
140
|
- CHANGELOG.md
|
169
141
|
- CODE_OF_CONDUCT.md
|
170
142
|
- Gemfile
|
171
|
-
- Gemfile.lock
|
172
143
|
- LICENSE.txt
|
144
|
+
- Makefile
|
173
145
|
- README.md
|
174
146
|
- Rakefile
|
175
147
|
- bin/console
|
@@ -184,9 +156,7 @@ files:
|
|
184
156
|
- lib/tapping_device/manageable.rb
|
185
157
|
- lib/tapping_device/method_hijacker.rb
|
186
158
|
- lib/tapping_device/output.rb
|
187
|
-
- lib/tapping_device/output/
|
188
|
-
- lib/tapping_device/output/payload.rb
|
189
|
-
- lib/tapping_device/output/stdout_writer.rb
|
159
|
+
- lib/tapping_device/output/payload_wrapper.rb
|
190
160
|
- lib/tapping_device/output/writer.rb
|
191
161
|
- lib/tapping_device/payload.rb
|
192
162
|
- lib/tapping_device/trackable.rb
|
@@ -219,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
189
|
- !ruby/object:Gem::Version
|
220
190
|
version: '0'
|
221
191
|
requirements: []
|
222
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.2.15
|
223
193
|
signing_key:
|
224
194
|
specification_version: 4
|
225
195
|
summary: tapping_device lets you understand what your Ruby objects do without digging
|
data/Gemfile.lock
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
tapping_device (0.5.7)
|
5
|
-
activerecord (>= 5.2)
|
6
|
-
activesupport
|
7
|
-
pastel
|
8
|
-
pry
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
activemodel (6.0.3.2)
|
14
|
-
activesupport (= 6.0.3.2)
|
15
|
-
activerecord (6.0.3.2)
|
16
|
-
activemodel (= 6.0.3.2)
|
17
|
-
activesupport (= 6.0.3.2)
|
18
|
-
activesupport (6.0.3.2)
|
19
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
-
i18n (>= 0.7, < 2)
|
21
|
-
minitest (~> 5.1)
|
22
|
-
tzinfo (~> 1.1)
|
23
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
24
|
-
coderay (1.1.3)
|
25
|
-
concurrent-ruby (1.1.7)
|
26
|
-
database_cleaner (1.7.0)
|
27
|
-
diff-lcs (1.3)
|
28
|
-
docile (1.3.2)
|
29
|
-
i18n (1.8.5)
|
30
|
-
concurrent-ruby (~> 1.0)
|
31
|
-
json (2.3.0)
|
32
|
-
method_source (1.0.0)
|
33
|
-
minitest (5.14.2)
|
34
|
-
pastel (0.8.0)
|
35
|
-
tty-color (~> 0.5)
|
36
|
-
pry (0.13.1)
|
37
|
-
coderay (~> 1.1)
|
38
|
-
method_source (~> 1.0)
|
39
|
-
rake (13.0.1)
|
40
|
-
rspec (3.8.0)
|
41
|
-
rspec-core (~> 3.8.0)
|
42
|
-
rspec-expectations (~> 3.8.0)
|
43
|
-
rspec-mocks (~> 3.8.0)
|
44
|
-
rspec-core (3.8.2)
|
45
|
-
rspec-support (~> 3.8.0)
|
46
|
-
rspec-expectations (3.8.4)
|
47
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.8.0)
|
49
|
-
rspec-mocks (3.8.1)
|
50
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.8.0)
|
52
|
-
rspec-support (3.8.2)
|
53
|
-
simplecov (0.17.1)
|
54
|
-
docile (~> 1.1)
|
55
|
-
json (>= 1.8, < 3)
|
56
|
-
simplecov-html (~> 0.10.0)
|
57
|
-
simplecov-html (0.10.2)
|
58
|
-
sqlite3 (1.4.1)
|
59
|
-
thread_safe (0.3.6)
|
60
|
-
tty-color (0.5.2)
|
61
|
-
tzinfo (1.2.7)
|
62
|
-
thread_safe (~> 0.1)
|
63
|
-
zeitwerk (2.4.0)
|
64
|
-
|
65
|
-
PLATFORMS
|
66
|
-
ruby
|
67
|
-
|
68
|
-
DEPENDENCIES
|
69
|
-
bundler (~> 2.0)
|
70
|
-
database_cleaner
|
71
|
-
rake (~> 13.0)
|
72
|
-
rspec (~> 3.0)
|
73
|
-
simplecov (= 0.17.1)
|
74
|
-
sqlite3 (>= 1.3.6)
|
75
|
-
tapping_device!
|
76
|
-
|
77
|
-
BUNDLED WITH
|
78
|
-
2.1.1
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class TappingDevice
|
2
|
-
module Output
|
3
|
-
class FileWriter < Writer
|
4
|
-
def initialize(options, output_block)
|
5
|
-
@path = options[:log_file]
|
6
|
-
|
7
|
-
File.write(@path, "") # clean file
|
8
|
-
|
9
|
-
super
|
10
|
-
end
|
11
|
-
|
12
|
-
def write!(payload)
|
13
|
-
output = generate_output(payload)
|
14
|
-
|
15
|
-
File.open(@path, "a") do |f|
|
16
|
-
f << output
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|