synvert-core 1.28.3 → 1.28.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +9 -9
- data/lib/synvert/core/rewriter.rb +27 -6
- data/lib/synvert/core/version.rb +1 -1
- data/synvert-core-ruby.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7906502ebd8ee2093236003a46a312f11487be41316be86777128c1685bda1
|
4
|
+
data.tar.gz: 706c9c932dfbfb16ba5cff3374380b54ae8239d12e2ef98dd7c4c45dd765d7a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 767ec7b8f201e7cdb28fd145ac83a5afbc0c96f4d1536dc7bd18c996f948a780ee70925c041b134078fbdfb6728605840e285badce8635beb6631b045220c4c4
|
7
|
+
data.tar.gz: 6514f640f49da23297fd5ce904fa71ab913bf6b2fd352c56fd04248e28ae303700b0fd72e548c25ca72839b787a1730d7dc862cdcc00f02fda126ed7ce90956e
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (1.28.
|
4
|
+
synvert-core (1.28.4)
|
5
5
|
activesupport (< 7.0.0)
|
6
|
-
node_mutation (>= 1.19.
|
7
|
-
node_query (>= 1.13.
|
6
|
+
node_mutation (>= 1.19.3)
|
7
|
+
node_query (>= 1.13.9)
|
8
8
|
parallel
|
9
9
|
parser
|
10
10
|
parser_node_ext (>= 1.2.0)
|
@@ -14,7 +14,7 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
activesupport (6.1.7.
|
17
|
+
activesupport (6.1.7.4)
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
19
|
i18n (>= 1.6, < 2)
|
20
20
|
minitest (>= 5.1)
|
@@ -48,10 +48,10 @@ GEM
|
|
48
48
|
rb-inotify (~> 0.9, >= 0.9.10)
|
49
49
|
lumberjack (1.2.8)
|
50
50
|
method_source (1.0.0)
|
51
|
-
minitest (5.
|
51
|
+
minitest (5.19.0)
|
52
52
|
nenv (0.3.0)
|
53
|
-
node_mutation (1.19.
|
54
|
-
node_query (1.13.
|
53
|
+
node_mutation (1.19.3)
|
54
|
+
node_query (1.13.10)
|
55
55
|
notiffany (0.1.3)
|
56
56
|
nenv (~> 0.1)
|
57
57
|
shellany (~> 0.0)
|
@@ -86,12 +86,12 @@ GEM
|
|
86
86
|
shellany (0.0.1)
|
87
87
|
syntax_tree (6.1.1)
|
88
88
|
prettier_print (>= 1.2.0)
|
89
|
-
syntax_tree_ext (0.6.
|
89
|
+
syntax_tree_ext (0.6.3)
|
90
90
|
syntax_tree
|
91
91
|
thor (1.2.1)
|
92
92
|
tzinfo (2.0.6)
|
93
93
|
concurrent-ruby (~> 1.0)
|
94
|
-
zeitwerk (2.6.
|
94
|
+
zeitwerk (2.6.11)
|
95
95
|
|
96
96
|
PLATFORMS
|
97
97
|
ruby
|
@@ -91,7 +91,7 @@ module Synvert::Core
|
|
91
91
|
# @!attribute [r] gem_spec
|
92
92
|
# @return [Rewriter::GemSpec] the gem spec
|
93
93
|
# @!attribute [r] test_results
|
94
|
-
# @return [
|
94
|
+
# @return [Hash<String, Object>] the test results
|
95
95
|
# @!attribute [rw] options
|
96
96
|
# @return [Hash] the rewriter options
|
97
97
|
attr_reader :group,
|
@@ -121,7 +121,7 @@ module Synvert::Core
|
|
121
121
|
@affected_files = Set.new
|
122
122
|
@redo_until_no_change = false
|
123
123
|
@options = DEFAULT_OPTIONS.dup
|
124
|
-
@test_results = []
|
124
|
+
@test_results = Hash.new { |h, k| h[k] = [] }
|
125
125
|
self.class.register(@group, @name, self)
|
126
126
|
end
|
127
127
|
|
@@ -153,7 +153,22 @@ module Synvert::Core
|
|
153
153
|
if !@affected_files.empty? && @redo_until_no_change # redo
|
154
154
|
test
|
155
155
|
end
|
156
|
-
@test_results
|
156
|
+
@test_results.map do |filename, test_results|
|
157
|
+
new_actions = test_results.map(&:actions).flatten.sort_by(&:end)
|
158
|
+
last_start = -1
|
159
|
+
conflicted = new_actions.any? do |action|
|
160
|
+
if last_start > action.end
|
161
|
+
true
|
162
|
+
else
|
163
|
+
last_start = action.start
|
164
|
+
false
|
165
|
+
end
|
166
|
+
end
|
167
|
+
result = NodeMutation::Result.new(affected: true, conflicted: conflicted)
|
168
|
+
result.actions = new_actions
|
169
|
+
result.file_path = filename
|
170
|
+
result
|
171
|
+
end
|
157
172
|
end
|
158
173
|
|
159
174
|
# Add a warning.
|
@@ -287,7 +302,7 @@ module Synvert::Core
|
|
287
302
|
result = NodeMutation::Result.new(affected: true, conflicted: false)
|
288
303
|
result.actions = [NodeMutation::Struct::Action.new(:add_file, 0, 0, content)]
|
289
304
|
result.file_path = filename
|
290
|
-
|
305
|
+
merge_test_result(result)
|
291
306
|
return
|
292
307
|
end
|
293
308
|
|
@@ -314,7 +329,7 @@ module Synvert::Core
|
|
314
329
|
result = NodeMutation::Result.new(affected: true, conflicted: false)
|
315
330
|
result.actions = [NodeMutation::Struct::Action.new(:remove_file, 0, -1)]
|
316
331
|
result.file_path = filename
|
317
|
-
|
332
|
+
merge_test_result(result)
|
318
333
|
return
|
319
334
|
end
|
320
335
|
|
@@ -430,7 +445,13 @@ module Synvert::Core
|
|
430
445
|
end
|
431
446
|
|
432
447
|
def merge_test_results(results)
|
433
|
-
|
448
|
+
results.compact.select(&:affected?).each do |result|
|
449
|
+
merge_test_result(result)
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
def merge_test_result(result)
|
454
|
+
@test_results[result.file_path] << result
|
434
455
|
end
|
435
456
|
end
|
436
457
|
end
|
data/lib/synvert/core/version.rb
CHANGED
data/synvert-core-ruby.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_runtime_dependency "activesupport", "< 7.0.0"
|
23
|
-
spec.add_runtime_dependency "node_query", ">= 1.13.
|
24
|
-
spec.add_runtime_dependency "node_mutation", ">= 1.19.
|
23
|
+
spec.add_runtime_dependency "node_query", ">= 1.13.9"
|
24
|
+
spec.add_runtime_dependency "node_mutation", ">= 1.19.3"
|
25
25
|
spec.add_runtime_dependency "parser"
|
26
26
|
spec.add_runtime_dependency "parser_node_ext", ">= 1.2.0"
|
27
27
|
spec.add_runtime_dependency "syntax_tree"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.28.
|
4
|
+
version: 1.28.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.13.
|
33
|
+
version: 1.13.9
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.13.
|
40
|
+
version: 1.13.9
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: node_mutation
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.19.
|
47
|
+
version: 1.19.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.19.
|
54
|
+
version: 1.19.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: parser
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
|
-
rubygems_version: 3.4.
|
210
|
+
rubygems_version: 3.4.18
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: convert ruby code to better syntax.
|