tapping_device 0.6.0 → 0.6.1

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: d8adc4b6842ade7721eafaf72e9b94c8a6a852c1f9f9beebdf2556b20cef6d4a
4
- data.tar.gz: ab22b319f6468837e92f851f00f863cf732dd3c0cc73e286d5f9569d00c34db6
3
+ metadata.gz: 9700574881872ce91eedf976fd5fa7c8506acfa1c0ea8819dc15eeef6e519a9b
4
+ data.tar.gz: 71b65b11ed57273a0c061f23141d5da92078a16f9a7c7f75e9aebb2de71c32c4
5
5
  SHA512:
6
- metadata.gz: 992f31b79a3c0a8abc8471ae643f02586cf76d505da493cfe66b37338781251c3dfdba43a158776431c93a342e8b9a02baff78118b71c679aba2f9114c65077c
7
- data.tar.gz: cad971d539041804a9860225f17ae23754dc46ea6fa5b7dc15d674e5189c081dd4f6f2602eeea9c27e616fb1b959126fe452ef5f641e249d73392782b17a3c2c
6
+ metadata.gz: 7ead5f7a86fd942005a85394a0b59e309fc41bcf625369006ec848d2688722cf5fcc8651ad925c103536bef49e1d0a50f4aab75a177242c48873bc5703aea8cd
7
+ data.tar.gz: f7cab27f0e27937f8c5a8f8c08283ae376e5b7880dffa21857e48c3bcf6e17ed1cb265b5ef399b2f2d294bf5af97b6b26aef16589f97f502c9ebfa29178de0a8
data/CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased](https://github.com/st0012/tapping_device/tree/HEAD)
3
+ ## [v0.6.0](https://github.com/st0012/tapping_device/tree/v0.6.0) (2021-04-25)
4
4
 
5
- [Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.7...HEAD)
5
+ [Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.7...v0.6.0)
6
6
 
7
7
  **Implemented enhancements:**
8
8
 
@@ -19,6 +19,10 @@
19
19
 
20
20
  [Full Changelog](https://github.com/st0012/tapping_device/compare/v0.5.6...v0.5.7)
21
21
 
22
+ **Implemented enhancements:**
23
+
24
+ - Use pastel in output payload [\#62](https://github.com/st0012/tapping_device/issues/62)
25
+
22
26
  **Closed issues:**
23
27
 
24
28
  - Support tag option [\#64](https://github.com/st0012/tapping_device/issues/64)
data/Gemfile CHANGED
@@ -13,3 +13,9 @@ else
13
13
  end
14
14
 
15
15
  gem "activerecord", "~> #{rails_version}"
16
+
17
+ gem "rake", "~> 13.0"
18
+ gem "rspec", "~> 3.0"
19
+ gem "simplecov", "~> 0.17.1"
20
+ gem "database_cleaner", "~> 2.0.0"
21
+ gem "pry"
@@ -1,12 +1,11 @@
1
- require "active_support/core_ext/module/introspection"
2
- require "pry" # for using Method#source
1
+ require "method_source" # for using Method#source
3
2
 
4
3
  require "tapping_device/version"
5
4
  require "tapping_device/manageable"
6
5
  require "tapping_device/payload"
7
6
  require "tapping_device/output"
8
7
  require "tapping_device/trackable"
9
- require "tapping_device/configurable"
8
+ require "tapping_device/configuration"
10
9
  require "tapping_device/exceptions"
11
10
  require "tapping_device/method_hijacker"
12
11
  require "tapping_device/trackers/initialization_tracker"
@@ -27,7 +26,6 @@ class TappingDevice
27
26
 
28
27
  extend Manageable
29
28
 
30
- include Configurable
31
29
  include Output::Helpers
32
30
 
33
31
  def initialize(options = {}, &block)
@@ -119,8 +117,10 @@ class TappingDevice
119
117
 
120
118
  # this needs to be placed upfront so we can exclude noise before doing more work
121
119
  def should_be_skipped_by_paths?(filepath)
122
- options[:exclude_by_paths].any? { |pattern| pattern.match?(filepath) } ||
123
- (options[:filter_by_paths].present? && !options[:filter_by_paths].any? { |pattern| pattern.match?(filepath) })
120
+ exclude_by_paths = options[:exclude_by_paths]
121
+ filter_by_paths = options[:filter_by_paths]
122
+ exclude_by_paths.any? { |pattern| pattern.match?(filepath) } ||
123
+ (filter_by_paths && !filter_by_paths.empty? && !filter_by_paths.any? { |pattern| pattern.match?(filepath) })
124
124
  end
125
125
 
126
126
  def is_tapping_device_call?(tp)
@@ -136,7 +136,7 @@ class TappingDevice
136
136
  end
137
137
 
138
138
  def with_condition_satisfied?(payload)
139
- @with_condition.blank? || @with_condition.call(payload)
139
+ @with_condition.nil? || @with_condition.call(payload)
140
140
  end
141
141
 
142
142
  def build_payload(tp:, filepath:, line_number:)
@@ -1,10 +1,5 @@
1
- require "active_support/configurable"
2
- require "active_support/concern"
3
-
4
1
  class TappingDevice
5
- module Configurable
6
- extend ActiveSupport::Concern
7
-
2
+ class Configuration
8
3
  DEFAULTS = {
9
4
  filter_by_paths: [],
10
5
  exclude_by_paths: [],
@@ -16,12 +11,24 @@ class TappingDevice
16
11
  only_private: false
17
12
  }.merge(TappingDevice::Output::DEFAULT_OPTIONS)
18
13
 
19
- included do
20
- include ActiveSupport::Configurable
14
+ def initialize
15
+ @options = {}
21
16
 
22
17
  DEFAULTS.each do |key, value|
23
- config[key] = value
18
+ @options[key] = value
24
19
  end
25
20
  end
21
+
22
+ def [](key)
23
+ @options[key]
24
+ end
25
+
26
+ def []=(key, value)
27
+ @options[key] = value
28
+ end
29
+ end
30
+
31
+ def self.config
32
+ @config ||= Configuration.new
26
33
  end
27
34
  end
@@ -65,7 +65,7 @@ class TappingDevice
65
65
 
66
66
  # regenerate attributes with `colorize: true` support
67
67
  define_method attribute do |options = {}|
68
- call_result = send("original_#{attribute}", options)
68
+ call_result = send("original_#{attribute}", options).to_s
69
69
 
70
70
  if options[:colorize]
71
71
  PASTEL.send(color, call_result)
@@ -120,7 +120,7 @@ class TappingDevice
120
120
  after = generate_string_result(value_changes[:after], options[:inspect])
121
121
 
122
122
  if options[:colorize]
123
- ivar = PASTEL.orange(ivar)
123
+ ivar = PASTEL.orange(ivar.to_s)
124
124
  before = PASTEL.bright_blue(before.to_s)
125
125
  after = PASTEL.bright_blue(after.to_s)
126
126
  end
@@ -1,3 +1,3 @@
1
1
  class TappingDevice
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -15,24 +15,15 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  spec.metadata["source_code_uri"] = "https://github.com/st0012/tapping_device"
18
- spec.metadata["changelog_uri"] = "https://github.com/st0012/tapping_device/releases"
18
+ spec.metadata["changelog_uri"] = "https://github.com/st0012/tapping_device/CHANGELOG.md"
19
19
 
20
20
  # Specify which files should be added to the gem when it is released.
21
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
22
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
24
  end
25
- spec.bindir = "exe"
26
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
25
  spec.require_paths = ["lib"]
28
26
 
29
- spec.add_dependency "pry" # for using Method#source in MutationTracker
30
- spec.add_dependency "activesupport"
31
- spec.add_dependency "pastel"
32
-
33
- spec.add_development_dependency "database_cleaner"
34
- spec.add_development_dependency "bundler", "~> 2.0"
35
- spec.add_development_dependency "rake", "~> 13.0"
36
- spec.add_development_dependency "rspec", "~> 3.0"
37
- spec.add_development_dependency "simplecov", "0.17.1"
27
+ spec.add_dependency "method_source", "~> 1.0.0"
28
+ spec.add_dependency "pastel", "~> 0.7"
38
29
  end
metadata CHANGED
@@ -1,127 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tapping_device
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - st0012
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-25 00:00:00.000000000 Z
11
+ date: 2021-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: pry
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: activesupport
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: pastel
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: database_cleaner
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: bundler
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '2.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rake
14
+ name: method_source
85
15
  requirement: !ruby/object:Gem::Requirement
86
16
  requirements:
87
17
  - - "~>"
88
18
  - !ruby/object:Gem::Version
89
- version: '13.0'
90
- type: :development
19
+ version: 1.0.0
20
+ type: :runtime
91
21
  prerelease: false
92
22
  version_requirements: !ruby/object:Gem::Requirement
93
23
  requirements:
94
24
  - - "~>"
95
25
  - !ruby/object:Gem::Version
96
- version: '13.0'
26
+ version: 1.0.0
97
27
  - !ruby/object:Gem::Dependency
98
- name: rspec
28
+ name: pastel
99
29
  requirement: !ruby/object:Gem::Requirement
100
30
  requirements:
101
31
  - - "~>"
102
32
  - !ruby/object:Gem::Version
103
- version: '3.0'
104
- type: :development
33
+ version: '0.7'
34
+ type: :runtime
105
35
  prerelease: false
106
36
  version_requirements: !ruby/object:Gem::Requirement
107
37
  requirements:
108
38
  - - "~>"
109
39
  - !ruby/object:Gem::Version
110
- version: '3.0'
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - '='
116
- - !ruby/object:Gem::Version
117
- version: 0.17.1
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - '='
123
- - !ruby/object:Gem::Version
124
- version: 0.17.1
40
+ version: '0.7'
125
41
  description: tapping_device lets you understand what your Ruby objects do without
126
42
  digging into the code
127
43
  email:
@@ -151,7 +67,7 @@ files:
151
67
  - images/print_mutations.png
152
68
  - images/print_traces.png
153
69
  - lib/tapping_device.rb
154
- - lib/tapping_device/configurable.rb
70
+ - lib/tapping_device/configuration.rb
155
71
  - lib/tapping_device/exceptions.rb
156
72
  - lib/tapping_device/manageable.rb
157
73
  - lib/tapping_device/method_hijacker.rb
@@ -173,7 +89,7 @@ licenses:
173
89
  metadata:
174
90
  homepage_uri: https://github.com/st0012/tapping_device
175
91
  source_code_uri: https://github.com/st0012/tapping_device
176
- changelog_uri: https://github.com/st0012/tapping_device/releases
92
+ changelog_uri: https://github.com/st0012/tapping_device/CHANGELOG.md
177
93
  post_install_message:
178
94
  rdoc_options: []
179
95
  require_paths: