synvert-core 1.28.4 → 1.29.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: cc7906502ebd8ee2093236003a46a312f11487be41316be86777128c1685bda1
4
- data.tar.gz: 706c9c932dfbfb16ba5cff3374380b54ae8239d12e2ef98dd7c4c45dd765d7a0
3
+ metadata.gz: 1dda2705261d25cdacf3eed0d8c7bb02b66cdcb8bb6774ffc7839b675f685f47
4
+ data.tar.gz: a45e9724ced71c2d55ec9f517fd1a51f571b5ec01dd6d83055e87056ec627579
5
5
  SHA512:
6
- metadata.gz: 767ec7b8f201e7cdb28fd145ac83a5afbc0c96f4d1536dc7bd18c996f948a780ee70925c041b134078fbdfb6728605840e285badce8635beb6631b045220c4c4
7
- data.tar.gz: 6514f640f49da23297fd5ce904fa71ab913bf6b2fd352c56fd04248e28ae303700b0fd72e548c25ca72839b787a1730d7dc862cdcc00f02fda126ed7ce90956e
6
+ metadata.gz: c64807dda9469a101349d4987edc2092035c1bc342ade195e82acd4d3e74f04c49002c6810c5586f812dc7b3ed8ada54780b660cd0e73d8ab2c094d03688e608
7
+ data.tar.gz: e54c85411a4aa0776c94afafd3a8cf62d0d7a33df2106c3f16ab437138c0e47b94d27c40b33f0bf0098e39a3cf88bba917d1bee1bb5c8f0224aed84be7455d42
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.29.0 (2023-09-26)
4
+
5
+ * Update `node_mutation` to 1.21.0
6
+ * Revert "Combine actions within scope"
7
+ * Add `group` dsl
8
+
9
+ ## 1.28.5 (2023-09-25)
10
+
11
+ * Update `node-query` to 1.13.11
12
+ * Update `node_mutation` to 1.20.0
13
+ * Combine actions within scope
14
+ * Iterate actions in engine
15
+
3
16
  ## 1.28.4 (2023-08-16)
4
17
 
5
18
  * Merge `test_results` based on file_path
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (1.28.4)
4
+ synvert-core (1.29.0)
5
5
  activesupport (< 7.0.0)
6
- node_mutation (>= 1.19.3)
7
- node_query (>= 1.13.9)
6
+ node_mutation (>= 1.21.0)
7
+ node_query (>= 1.13.11)
8
8
  parallel
9
9
  parser
10
10
  parser_node_ext (>= 1.2.0)
11
11
  syntax_tree
12
- syntax_tree_ext (>= 0.6.0)
12
+ syntax_tree_ext (>= 0.6.4)
13
13
 
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activesupport (6.1.7.4)
17
+ activesupport (6.1.7.6)
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.19.0)
51
+ minitest (5.20.0)
52
52
  nenv (0.3.0)
53
- node_mutation (1.19.3)
54
- node_query (1.13.10)
53
+ node_mutation (1.21.0)
54
+ node_query (1.13.11)
55
55
  notiffany (0.1.3)
56
56
  nenv (~> 0.1)
57
57
  shellany (~> 0.0)
@@ -84,14 +84,14 @@ GEM
84
84
  rspec-support (~> 3.10.0)
85
85
  rspec-support (3.10.3)
86
86
  shellany (0.0.1)
87
- syntax_tree (6.1.1)
87
+ syntax_tree (6.2.0)
88
88
  prettier_print (>= 1.2.0)
89
- syntax_tree_ext (0.6.3)
89
+ syntax_tree_ext (0.6.4)
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.11)
94
+ zeitwerk (2.6.12)
95
95
 
96
96
  PLATFORMS
97
97
  ruby
data/README.md CHANGED
@@ -101,6 +101,7 @@ Actions:
101
101
  * [warn](https://xinminlabs.github.io/synvert-core-ruby/Synvert/Core/Rewriter/Instance.html#warn-instance_method) - warn message
102
102
  * [replace_erb_stmt_with_expr](https://xinminlabs.github.io/synvert-core-ruby/Synvert/Core/Rewriter/Instance.html#replace_erb_stmt_with_expr-instance_method) - replace erb stmt code to expr code
103
103
  * [noop](https://xinminlabs.github.io/synvert-core-ruby/Synvert/Core/Rewriter/Instance.html#noop-instance_method) - no operation
104
+ * [group](https://xinminlabs.github.io/synvert-core-ruby/Synvert/Core/Rewriter/Instance.html#group-instance_method) - group actions
104
105
  * [add_action](https://xinminlabs.github.io/synvert-core-ruby/Synvert/Core/Rewriter/Instance.html#add_action-instance_method) - add custom action
105
106
 
106
107
  Others:
@@ -34,7 +34,7 @@ module Synvert::Core
34
34
  start += index + END_LINE.length
35
35
  end
36
36
  indices.each do |index|
37
- actions.each do |action|
37
+ NodeMutation::Helper.iterate_actions(actions) do |action|
38
38
  action.start -= END_LINE.length if action.start > index
39
39
  action.end -= END_LINE.length if action.end > index
40
40
  end
@@ -407,6 +407,16 @@ module Synvert::Core
407
407
  @current_mutation.noop(@current_node)
408
408
  end
409
409
 
410
+ # Group actions.
411
+ # @example
412
+ # group do
413
+ # delete :message, :dot
414
+ # replace 'receiver.caller.message', with: 'flat_map'
415
+ # end
416
+ def group(&block)
417
+ @current_mutation.group(&block)
418
+ end
419
+
410
420
  # Add a custom action.
411
421
  # @example
412
422
  # remover_action = NodeMutation::RemoveAction.new(node)
@@ -156,14 +156,15 @@ module Synvert::Core
156
156
  @test_results.map do |filename, test_results|
157
157
  new_actions = test_results.map(&:actions).flatten.sort_by(&:end)
158
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
159
+ conflicted =
160
+ new_actions.any? do |action|
161
+ if last_start > action.end
162
+ true
163
+ else
164
+ last_start = action.start
165
+ false
166
+ end
165
167
  end
166
- end
167
168
  result = NodeMutation::Result.new(affected: true, conflicted: conflicted)
168
169
  result.actions = new_actions
169
170
  result.file_path = filename
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.28.4'
5
+ VERSION = '1.29.0'
6
6
  end
7
7
  end
@@ -262,6 +262,13 @@ module Synvert::Core
262
262
  instance.noop
263
263
  end
264
264
 
265
+ it 'parses group' do
266
+ instance.instance_variable_set(:@current_mutation, double)
267
+ instance.current_node = double
268
+ expect(instance.instance_variable_get(:@current_mutation)).to receive(:group)
269
+ instance.group {}
270
+ end
271
+
265
272
  it 'parses warn' do
266
273
  expect(Rewriter::Warning).to receive(:new).with(instance, 'foobar')
267
274
  instance.warn 'foobar'
@@ -20,11 +20,11 @@ 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.9"
24
- spec.add_runtime_dependency "node_mutation", ">= 1.19.3"
23
+ spec.add_runtime_dependency "node_query", ">= 1.13.11"
24
+ spec.add_runtime_dependency "node_mutation", ">= 1.21.0"
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"
28
- spec.add_runtime_dependency "syntax_tree_ext", ">= 0.6.0"
28
+ spec.add_runtime_dependency "syntax_tree_ext", ">= 0.6.4"
29
29
  spec.add_runtime_dependency "parallel"
30
30
  end
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
4
+ version: 1.29.0
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-08-16 00:00:00.000000000 Z
11
+ date: 2023-09-26 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.9
33
+ version: 1.13.11
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.9
40
+ version: 1.13.11
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.3
47
+ version: 1.21.0
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.3
54
+ version: 1.21.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: parser
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 0.6.0
103
+ version: 0.6.4
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 0.6.0
110
+ version: 0.6.4
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: parallel
113
113
  requirement: !ruby/object:Gem::Requirement