flutter 0.2.3 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +3 -3
- data/lib/flutter/minitest.rb +1 -0
- data/lib/flutter/parser.rb +5 -2
- data/lib/flutter/persistence.rb +28 -6
- data/lib/flutter/rspec.rb +1 -0
- data/lib/flutter/tracker.rb +13 -12
- data/lib/flutter/version.rb +1 -1
- metadata +20 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d64f01105b1eb61fb5c2514010eeec3d621288de8a2848d6f33e9d0df8ffba5
|
4
|
+
data.tar.gz: f33009db17d8d1547c7bbb93cfc27501993ba9305181cf0c1390c3cc654936ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f8fe1d1202d25f388c133086cc5973e4149945db4758742d8a505dc28c6ca848d375b62243cd1e39eb6e4c0ab951ee6303f72cae0c2a65f720785922840b5a
|
7
|
+
data.tar.gz: 7ccaf668f298dbe5c85d12464a17170c75e843be087f2f86ee49fb967764c3456fd9dceac981db4e8c86a2b896f167e957457bf3ba42da12d2ace747e1af373e
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,15 @@ 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.2.5 - 2022-10-13
|
9
|
+
### Added
|
10
|
+
- Explicit dependency on `pry` for reflecting sources of methods
|
11
|
+
- Use source hints from coverage to include dynamically added classes in signature generation
|
12
|
+
|
13
|
+
## 0.2.4 - 2022-10-04
|
14
|
+
### Changed
|
15
|
+
- Relax version requirement for dry-configurable
|
16
|
+
|
8
17
|
## 0.2.3 - 2022-10-04
|
9
18
|
### Fixed
|
10
19
|
- Disable filtering when Flutter.enabled=false
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![CI](https://github.com/indydevs/flutter/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/indydevs/flutter/actions/workflows/main.yml)
|
4
4
|
[![codecov](https://codecov.io/github/indydevs/flutter/branch/main/graph/badge.svg?token=XANF37D9C1)](https://codecov.io/github/indydevs/flutter)
|
5
5
|
[![Gem](https://img.shields.io/gem/v/flutter)](https://rubygems.org/gems/flutter)
|
6
|
-
[![Docs](
|
6
|
+
[![Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://flutter.indydevs.org)
|
7
7
|
|
8
8
|
```
|
9
9
|
__ __
|
@@ -12,8 +12,8 @@
|
|
12
12
|
(_/ \_)
|
13
13
|
|
14
14
|
```
|
15
|
-
Flutter plugs in to your [RSpec](https://rspec.info/) or [Minitest](https://github.com/minitest/minitest) test suites
|
16
|
-
code
|
15
|
+
Flutter plugs in to your [RSpec](https://rspec.info/) or [Minitest](https://github.com/minitest/minitest) test suites to
|
16
|
+
run only the tests that exercise the code that has changed since the last run.
|
17
17
|
|
18
18
|
It can be used in local development as a live incremental test runner in
|
19
19
|
combination with [Guard](https://github.com/guard/guard) (See examples for [minitest](#with-guard) and [rspec](#with-guard-1) respectively)
|
data/lib/flutter/minitest.rb
CHANGED
data/lib/flutter/parser.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "parser/current"
|
4
|
+
require "pry"
|
4
5
|
require "digest/sha1"
|
5
6
|
require "set"
|
6
7
|
|
@@ -13,9 +14,9 @@ module Flutter
|
|
13
14
|
attr_reader :method_cache
|
14
15
|
end
|
15
16
|
|
16
|
-
def initialize(file)
|
17
|
+
def initialize(file, hints = [])
|
17
18
|
@signatures = {}
|
18
|
-
@targets = Set.new
|
19
|
+
@targets = Set.new(hints)
|
19
20
|
if File.exist?(file)
|
20
21
|
code = File.open(file, "r").read
|
21
22
|
@file = File.absolute_path(file)
|
@@ -70,6 +71,8 @@ module Flutter
|
|
70
71
|
hash = source_hash(instance.instance_method(method))
|
71
72
|
["#{container}:#{method}", hash] if hash
|
72
73
|
end.compact.to_h)
|
74
|
+
rescue NameError
|
75
|
+
next
|
73
76
|
rescue
|
74
77
|
warn("Failed to parse #{@file}")
|
75
78
|
break
|
data/lib/flutter/persistence.rb
CHANGED
@@ -30,11 +30,17 @@ module Flutter
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# Mapping of +source file -> callable_id -> signature+
|
33
|
-
# @return [Hash<String, Hash<String, String>>]
|
33
|
+
# @return [Hash<String, Hash<String, String>>]
|
34
34
|
def source_mapping
|
35
35
|
raise NotImplementedError
|
36
36
|
end
|
37
37
|
|
38
|
+
# Mapping of +source file -> class or module
|
39
|
+
# @return [Hash<String, Set<String>]
|
40
|
+
def source_hints
|
41
|
+
raise NotImplementedError
|
42
|
+
end
|
43
|
+
|
38
44
|
##
|
39
45
|
# Update {#test_mapping}
|
40
46
|
#
|
@@ -47,7 +53,8 @@ module Flutter
|
|
47
53
|
# Update {#source_mapping}
|
48
54
|
#
|
49
55
|
# @param [Hash<String, Hash<String, String>>] mapping
|
50
|
-
|
56
|
+
# @param [Hash<String, Hash<String, String>>] hints
|
57
|
+
def update_source_mapping!(mapping, hints)
|
51
58
|
raise NotImplementedError
|
52
59
|
end
|
53
60
|
|
@@ -103,14 +110,20 @@ module Flutter
|
|
103
110
|
@state.fetch(:source_mapping) { @state[:source_mapping] = {} }
|
104
111
|
end
|
105
112
|
|
113
|
+
# (see AbstractStorage#source_hints)
|
114
|
+
def source_hints
|
115
|
+
@state.fetch(:source_hints) { @state[:source_hints] = {} }
|
116
|
+
end
|
117
|
+
|
106
118
|
# (see AbstractStorage#update_test_mapping!)
|
107
119
|
def update_test_mapping!(mapping)
|
108
120
|
test_mapping.merge!(mapping)
|
109
121
|
end
|
110
122
|
|
111
123
|
# (see AbstractStorage#update_source_mapping!)
|
112
|
-
def update_source_mapping!(mapping)
|
124
|
+
def update_source_mapping!(mapping, hints)
|
113
125
|
source_mapping.merge!(mapping)
|
126
|
+
source_hints.merge!(hints)
|
114
127
|
end
|
115
128
|
|
116
129
|
# (see AbstractStorage#clear!)
|
@@ -153,14 +166,21 @@ module Flutter
|
|
153
166
|
# (see AbstractStorage#test_mapping)
|
154
167
|
def test_mapping
|
155
168
|
@state.transaction do
|
156
|
-
return @state[:test_mapping]
|
169
|
+
return @state[:test_mapping] || {}
|
157
170
|
end
|
158
171
|
end
|
159
172
|
|
160
173
|
# (see AbstractStorage#source_mapping)
|
161
174
|
def source_mapping
|
162
175
|
@state.transaction do
|
163
|
-
return @state[:source_mapping]
|
176
|
+
return @state[:source_mapping] || {}
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# (see AbstractStorage#source_hints)
|
181
|
+
def source_hints
|
182
|
+
@state.transaction do
|
183
|
+
return @state[:source_hints] || {}
|
164
184
|
end
|
165
185
|
end
|
166
186
|
|
@@ -173,10 +193,12 @@ module Flutter
|
|
173
193
|
end
|
174
194
|
|
175
195
|
# (see AbstractStorage#update_source_mapping!)
|
176
|
-
def update_source_mapping!(mapping)
|
196
|
+
def update_source_mapping!(mapping, hints)
|
177
197
|
@state.transaction do
|
178
198
|
@state[:source_mapping] ||= {}
|
199
|
+
@state[:source_hints] ||= {}
|
179
200
|
@state[:source_mapping].merge!(mapping)
|
201
|
+
@state[:source_hints].merge!(hints)
|
180
202
|
end
|
181
203
|
end
|
182
204
|
|
data/lib/flutter/rspec.rb
CHANGED
data/lib/flutter/tracker.rb
CHANGED
@@ -4,7 +4,6 @@ require "deep_merge"
|
|
4
4
|
require "set"
|
5
5
|
require_relative "persistence"
|
6
6
|
require_relative "parser"
|
7
|
-
require "pry"
|
8
7
|
|
9
8
|
module Flutter
|
10
9
|
# @attr [Hash<String, Hash<String, Set<String>>>] test_mapping Mapping of tests to
|
@@ -33,6 +32,7 @@ module Flutter
|
|
33
32
|
@path_mapping = {}
|
34
33
|
@method_prefixes = {}
|
35
34
|
@tracked_files = {}
|
35
|
+
@source_hints = @storage.source_hints
|
36
36
|
end
|
37
37
|
|
38
38
|
# Starts tracking calls made by +test+
|
@@ -80,7 +80,7 @@ module Flutter
|
|
80
80
|
|
81
81
|
sources = @test_mapping[test]
|
82
82
|
sources.map do |file, methods|
|
83
|
-
@current_source_mapping[file] ||= Flutter::Parser.new(file).signatures
|
83
|
+
@current_source_mapping[file] ||= Flutter::Parser.new(file, @source_hints[file]).signatures
|
84
84
|
methods.map do |method|
|
85
85
|
@source_mapping.dig(file, method) == @current_source_mapping.dig(file, method)
|
86
86
|
end.all?
|
@@ -93,7 +93,7 @@ module Flutter
|
|
93
93
|
# @return [void]
|
94
94
|
def persist!
|
95
95
|
@storage.update_test_mapping!(@test_mapping)
|
96
|
-
@storage.update_source_mapping!(generate_source_mapping)
|
96
|
+
@storage.update_source_mapping!(generate_source_mapping, @source_hints)
|
97
97
|
@storage.persist!
|
98
98
|
end
|
99
99
|
|
@@ -119,11 +119,12 @@ module Flutter
|
|
119
119
|
|
120
120
|
if tracked?(tracepoint.path, tracepoint.callee_id)
|
121
121
|
rel_path = relative_path(tracepoint.path)
|
122
|
-
|
122
|
+
class_name, seperator = method_prefix(tracepoint.defined_class).values_at(:class, :seperator)
|
123
|
+
@source_hints.fetch(rel_path) { @source_hints[rel_path] = Set.new } << class_name if class_name
|
123
124
|
@test_mapping.fetch(test) do
|
124
125
|
@test_mapping[test] = {}
|
125
126
|
end.fetch(rel_path) { @test_mapping[test][rel_path] = Set.new } << (
|
126
|
-
|
127
|
+
class_name ? "#{class_name}#{seperator}#{tracepoint.callee_id}" : tracepoint.callee_id
|
127
128
|
)
|
128
129
|
end
|
129
130
|
end
|
@@ -133,22 +134,22 @@ module Flutter
|
|
133
134
|
end
|
134
135
|
|
135
136
|
##
|
136
|
-
# Returns a prefix based on Tracepoint.defined_class
|
137
|
+
# Returns a (class name, separator) prefix based on Tracepoint.defined_class
|
137
138
|
#
|
138
139
|
# @param [Class] tracepoint_class
|
139
|
-
# @return [String]
|
140
|
+
# @return [Hash<Symbol, String>]
|
140
141
|
#
|
141
142
|
def method_prefix(tracepoint_class)
|
142
|
-
return unless tracepoint_class
|
143
|
+
return { class: nil, seperator: nil } unless tracepoint_class
|
143
144
|
|
144
145
|
@method_prefixes[tracepoint_class] ||= if tracepoint_class.to_s.start_with?("#<Class")
|
145
146
|
if tracepoint_class.superclass.name && tracepoint_class.to_s.include?(tracepoint_class.superclass.name)
|
146
|
-
|
147
|
+
{ class: tracepoint_class.superclass.name, separator: "::" }
|
147
148
|
else
|
148
|
-
tracepoint_class.to_s.sub(/#<Class:(.*?)(\(.*?\))?>/, '\1
|
149
|
+
{ class: tracepoint_class.to_s.sub(/#<Class:(.*?)(\(.*?\))?>/, '\1'), separator: "::" }
|
149
150
|
end
|
150
151
|
else
|
151
|
-
|
152
|
+
{ class: tracepoint_class.name, seperator: ":" }
|
152
153
|
end
|
153
154
|
end
|
154
155
|
|
@@ -173,7 +174,7 @@ module Flutter
|
|
173
174
|
# @return [Hash<String, Hash<String, Hash<String, String>>>]
|
174
175
|
def generate_source_mapping
|
175
176
|
@test_mapping.map { |_k, v| v.keys }.flatten.uniq.map do |file|
|
176
|
-
[file, @current_source_mapping.fetch(file) { Flutter::Parser.new(file).signatures }]
|
177
|
+
[file, @current_source_mapping.fetch(file) { Flutter::Parser.new(file, @source_hints[file] || []).signatures }]
|
177
178
|
end.to_h.deep_merge(@test_source_mapping)
|
178
179
|
end
|
179
180
|
end
|
data/lib/flutter/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.5
|
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-
|
12
|
+
date: 2022-10-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: deep_merge
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0.
|
34
|
+
version: '0.11'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0.
|
41
|
+
version: '0.11'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: parser
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,9 +53,22 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '3.1'
|
56
|
-
|
57
|
-
|
58
|
-
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: pry
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.13'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.13'
|
70
|
+
description: "Plug in for RSpec & Minitest test suites\n to run only the tests that
|
71
|
+
exercise the code that has changed\n "
|
59
72
|
email:
|
60
73
|
- ali@indydevs.org
|
61
74
|
- ankita@indydevs.org
|