flutter 0.2.6 → 0.3.0

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: 2470e3d751dcee88e34d5954533cd0e27eabed7bc2da3f125e44455491e024ee
4
- data.tar.gz: 27c405a255544315c4e27792351cefcbacab177308793973396be672f94ad007
3
+ metadata.gz: 892688c26b88bc96c4c37c4ea72d7ef54342dc242c7741a0241250a96e4d484e
4
+ data.tar.gz: 4700cb7256bf15cc3b1238607eb37c37b96d93828413ed793733bf3374b39730
5
5
  SHA512:
6
- metadata.gz: d5b4d52b2afc31b98c1103a11bdc95cf53ac932ce7498f8488f6dc352f04cf1396bc4fb00a13d735fd719651a7b6728b1f03ec7dc0ca6465b4404ba0ef4e8376
7
- data.tar.gz: 3857beb1103a0d64d7a31d3de1c1b1c5da7ff7a3c5d71d84b43d9d422d94a0a81a1f0a0eb3bf359ef6786803d097ed4da9575f592739328487b9acbc480db12f
6
+ metadata.gz: 8c8f5fbb1e054bbb041002c25b9ff4545b83938320be7af311df4cabda4829c105778153e95b6a9ced5861602a24ad7266f2d7900abcd813a471ba70128238f0
7
+ data.tar.gz: 13c7c7818265fcfa0b4738bd51e179ab787dc242dbb6213234a635472a996b10db7c983188f837ee4ce76675d17a9036592eee5a14b7c7ff629ead075f4004e6
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## Unreleased
8
+ ## 0.3.0 - 2022-10-16
9
+ ### Changed
10
+ - Switch from `pry` to `method_source` as the actual dependency for inspecting method sources for generating signatures
11
+
12
+ ### Fixed
13
+ - Ensure partial test runs don't clobber source mappings for previously run test cases
14
+
8
15
  ## 0.2.6 - 2022-10-14
9
16
  ### Added
10
17
  - Backward compatibilty hack for default values in `dry-configurable < 0.13`
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pry"
3
+ require "method_source"
4
4
  require_relative "tracker"
5
5
 
6
6
  begin
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "method_source"
3
4
  require "parser/current"
4
- require "pry"
5
5
  require "digest/sha1"
6
6
  require "set"
7
7
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "deep_merge"
3
4
  require "fileutils"
4
5
  require "set"
5
6
  module Flutter
@@ -122,8 +123,8 @@ module Flutter
122
123
 
123
124
  # (see AbstractStorage#update_source_mapping!)
124
125
  def update_source_mapping!(mapping, hints)
125
- source_mapping.merge!(mapping)
126
- source_hints.merge!(hints)
126
+ source_mapping.deep_merge!(mapping)
127
+ source_hints.deep_merge!(hints)
127
128
  end
128
129
 
129
130
  # (see AbstractStorage#clear!)
@@ -197,8 +198,8 @@ module Flutter
197
198
  @state.transaction do
198
199
  @state[:source_mapping] ||= {}
199
200
  @state[:source_hints] ||= {}
200
- @state[:source_mapping].merge!(mapping)
201
- @state[:source_hints].merge!(hints)
201
+ @state[:source_mapping].deep_merge!(mapping)
202
+ @state[:source_hints].deep_merge!(hints)
202
203
  end
203
204
  end
204
205
 
data/lib/flutter/rspec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "pry"
3
+ require "method_source"
4
4
  require_relative "tracker"
5
5
 
6
6
  module Flutter
@@ -33,6 +33,7 @@ module Flutter
33
33
  @method_prefixes = {}
34
34
  @tracked_files = {}
35
35
  @source_hints = @storage.source_hints
36
+ @tracker_pwd = Dir.pwd
36
37
  end
37
38
 
38
39
  # Starts tracking calls made by +test+
@@ -73,12 +74,14 @@ module Flutter
73
74
  @test_source_mapping.fetch(test_location_rel) do
74
75
  @test_source_mapping[test_location_rel] = {}
75
76
  end[test] = Digest::SHA1.hexdigest(test_source)
76
- return false unless
77
- @test_mapping.key?(test) && @test_source_mapping[test_location_rel][test] == @source_mapping.dig(
78
- test_location_rel, test
79
- )
77
+ test_seen = @test_mapping.key?(test)
78
+
79
+ test_source_unchanged = @test_source_mapping[test_location_rel][test] == @source_mapping.dig(
80
+ test_location_rel, test
81
+ )
82
+ return unless test_seen && test_source_unchanged
80
83
 
81
- sources = @test_mapping[test]
84
+ sources = @test_mapping[test] || {}
82
85
  sources.map do |file, methods|
83
86
  @current_source_mapping[file] ||= Flutter::Parser.new(file, @source_hints[file]).signatures
84
87
  methods.map do |method|
@@ -119,18 +122,18 @@ module Flutter
119
122
 
120
123
  if tracked?(tracepoint.path, tracepoint.callee_id)
121
124
  rel_path = relative_path(tracepoint.path)
122
- class_name, seperator = method_prefix(tracepoint.defined_class).values_at(:class, :seperator)
125
+ class_name, separator = method_prefix(tracepoint.defined_class).values_at(:class, :separator)
123
126
  @source_hints.fetch(rel_path) { @source_hints[rel_path] = Set.new } << class_name if class_name
124
127
  @test_mapping.fetch(test) do
125
128
  @test_mapping[test] = {}
126
129
  end.fetch(rel_path) { @test_mapping[test][rel_path] = Set.new } << (
127
- class_name ? "#{class_name}#{seperator}#{tracepoint.callee_id}" : tracepoint.callee_id
130
+ class_name ? "#{class_name}#{separator}#{tracepoint.callee_id}" : tracepoint.callee_id
128
131
  )
129
132
  end
130
133
  end
131
134
 
132
135
  def relative_path(file)
133
- @path_mapping[file] ||= Pathname.new(file).relative_path_from(Dir.pwd).to_s
136
+ @path_mapping[file] ||= Pathname.new(file).relative_path_from(@tracker_pwd).to_s
134
137
  end
135
138
 
136
139
  ##
@@ -140,7 +143,7 @@ module Flutter
140
143
  # @return [Hash<Symbol, String>]
141
144
  #
142
145
  def method_prefix(tracepoint_class)
143
- return { class: nil, seperator: nil } unless tracepoint_class
146
+ return { class: nil, separator: nil } unless tracepoint_class
144
147
 
145
148
  @method_prefixes[tracepoint_class] ||= if tracepoint_class.to_s.start_with?("#<Class")
146
149
  if tracepoint_class.superclass.name && tracepoint_class.to_s.include?(tracepoint_class.superclass.name)
@@ -149,7 +152,7 @@ module Flutter
149
152
  { class: tracepoint_class.to_s.sub(/#<Class:(.*?)(\(.*?\))?>/, '\1'), separator: "::" }
150
153
  end
151
154
  else
152
- { class: tracepoint_class.name, seperator: ":" }
155
+ { class: tracepoint_class.name, separator: ":" }
153
156
  end
154
157
  end
155
158
 
@@ -169,9 +172,9 @@ module Flutter
169
172
  end
170
173
 
171
174
  ##
172
- # Generates a mapping of
175
+ # Generates a mapping of source files to method=>signatures
173
176
  #
174
- # @return [Hash<String, Hash<String, Hash<String, String>>>]
177
+ # @return [Hash<String, Hash<String, String>>]
175
178
  def generate_source_mapping
176
179
  @test_mapping.map { |_k, v| v.keys }.flatten.uniq.map do |file|
177
180
  [file, @current_source_mapping.fetch(file) { Flutter::Parser.new(file, @source_hints[file] || []).signatures }]
@@ -3,5 +3,5 @@
3
3
  # :nocov:
4
4
 
5
5
  module Flutter
6
- VERSION = "0.2.6"
6
+ VERSION = "0.3.0"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ali-Akber Saifee
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-10-14 00:00:00.000000000 Z
12
+ date: 2022-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: deep_merge
@@ -40,33 +40,33 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0.11'
42
42
  - !ruby/object:Gem::Dependency
43
- name: parser
43
+ name: method_source
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '3.1'
48
+ version: '1.0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '3.1'
55
+ version: '1.0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: pry
57
+ name: parser
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0.13'
62
+ version: '3.1'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.13'
69
+ version: '3.1'
70
70
  description: "Plug in for RSpec & Minitest test suites\n to run only the tests that
71
71
  exercise the code that has changed\n "
72
72
  email: