synvert-core 1.26.3 → 1.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +14 -7
- data/lib/synvert/core/engine/slim.rb +1 -1
- data/lib/synvert/core/engine.rb +2 -0
- data/lib/synvert/core/errors.rb +10 -0
- data/lib/synvert/core/node_ext.rb +2 -0
- data/lib/synvert/core/rewriter/gem_spec.rb +2 -0
- data/lib/synvert/core/rewriter/instance.rb +27 -0
- data/lib/synvert/core/rewriter.rb +37 -6
- data/lib/synvert/core/utils.rb +2 -2
- data/lib/synvert/core/version.rb +1 -1
- data/lib/synvert/core.rb +4 -6
- data/spec/support/parser_helper.rb +1 -1
- data/spec/synvert/core/node_ext_spec.rb +13 -13
- data/spec/synvert/core/rewriter/helper_spec.rb +4 -4
- data/spec/synvert/core/rewriter_spec.rb +35 -1
- data/spec/synvert/core/utils_spec.rb +1 -1
- data/synvert-core-ruby.gemspec +5 -3
- metadata +38 -10
- data/lib/synvert/core/snippet_not_found_error.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6505a54441fe208f10c8c57b79d3ba5dab41fe7bc484d5ebaeb39da041775c9b
|
4
|
+
data.tar.gz: a198d79b76780f320d159a379eb8cc05e30e74419a8759d37f9c2eb9fe83c902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f76e819dc63a12e5c7e50f77f5f96e104b22181d1748a897a445b11b7fd1ca1f8342855c4f3911cd0848747c3581d18784bf7bc2670bef866084fea1bff82811
|
7
|
+
data.tar.gz: 77ffc3abe94e91b73d2e4ffa06455f4378687d833e0911f4716a1ea9cd5a7149bdac4af32c23e3183c7a6a784a064b12dcafc4171afdd083a911eb9fe899344c
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
## 1.
|
3
|
+
## 1.27.0 (2023-05-16)
|
4
|
+
|
5
|
+
* Configure `parser`, can be `parser` or `syntax_tree`
|
6
|
+
* Add `Errors` module
|
7
|
+
* Require `parser_node_ext` and `synvert_tree_ext` properly
|
8
|
+
|
9
|
+
## 1.26.3 (2023-05-13)
|
4
10
|
|
5
11
|
* Fix haml and slim engine to support attribute and ruby evalidation in the same line
|
6
12
|
* Fix ruby block in multi lins in haml and slim
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (1.
|
4
|
+
synvert-core (1.27.0)
|
5
5
|
activesupport (< 7.0.0)
|
6
|
-
node_mutation (>= 1.
|
7
|
-
node_query (>= 1.
|
6
|
+
node_mutation (>= 1.18.0)
|
7
|
+
node_query (>= 1.13.2)
|
8
8
|
parallel
|
9
9
|
parser
|
10
|
-
parser_node_ext (>= 1.
|
10
|
+
parser_node_ext (>= 1.1.0)
|
11
|
+
syntax_tree
|
12
|
+
syntax_tree_ext (>= 0.3.1)
|
11
13
|
|
12
14
|
GEM
|
13
15
|
remote: https://rubygems.org/
|
@@ -48,16 +50,17 @@ GEM
|
|
48
50
|
method_source (1.0.0)
|
49
51
|
minitest (5.18.0)
|
50
52
|
nenv (0.3.0)
|
51
|
-
node_mutation (1.
|
52
|
-
node_query (1.
|
53
|
+
node_mutation (1.18.0)
|
54
|
+
node_query (1.13.2)
|
53
55
|
notiffany (0.1.3)
|
54
56
|
nenv (~> 0.1)
|
55
57
|
shellany (~> 0.0)
|
56
58
|
parallel (1.23.0)
|
57
59
|
parser (3.2.2.1)
|
58
60
|
ast (~> 2.4.1)
|
59
|
-
parser_node_ext (1.
|
61
|
+
parser_node_ext (1.1.0)
|
60
62
|
parser
|
63
|
+
prettier_print (1.2.1)
|
61
64
|
pry (0.14.1)
|
62
65
|
coderay (~> 1.1)
|
63
66
|
method_source (~> 1.0)
|
@@ -79,6 +82,10 @@ GEM
|
|
79
82
|
rspec-support (~> 3.10.0)
|
80
83
|
rspec-support (3.10.3)
|
81
84
|
shellany (0.0.1)
|
85
|
+
syntax_tree (6.1.1)
|
86
|
+
prettier_print (>= 1.2.0)
|
87
|
+
syntax_tree_ext (0.3.1)
|
88
|
+
syntax_tree
|
82
89
|
thor (1.2.1)
|
83
90
|
tzinfo (2.0.6)
|
84
91
|
concurrent-ruby (~> 1.0)
|
@@ -33,7 +33,7 @@ module Synvert::Core
|
|
33
33
|
end
|
34
34
|
scan_attributes_between_whitespace(scanner, new_code)
|
35
35
|
if scanner.scan(/ ?==?/) # it matches ruby expression " span= current_user.login"
|
36
|
-
new_code << (WHITESPACE * (scanner.matched.size - 1)) + ';'
|
36
|
+
new_code << ((WHITESPACE * (scanner.matched.size - 1)) + ';')
|
37
37
|
scan_ruby_expression(scanner, new_code, leading_spaces_counts, leading_spaces_count)
|
38
38
|
else
|
39
39
|
scan_ruby_interpolation_and_plain_text(scanner, new_code, leading_spaces_counts, leading_spaces_count)
|
data/lib/synvert/core/engine.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'parser/current'
|
4
|
+
require 'parser_node_ext'
|
5
|
+
require 'syntax_tree'
|
6
|
+
require 'syntax_tree_ext'
|
7
|
+
|
3
8
|
module Synvert::Core
|
4
9
|
# Instance is an execution unit, it finds specified ast nodes,
|
5
10
|
# checks if the nodes match some conditions, then add, replace or remove code.
|
@@ -463,6 +468,19 @@ module Synvert::Core
|
|
463
468
|
# @param encoded_source [String] encoded source code
|
464
469
|
# @return [Node] ast node for file
|
465
470
|
def parse_code(file_path, encoded_source)
|
471
|
+
if @rewriter.syntax_tree_parser?
|
472
|
+
parse_code_by_syntax_tree(file_path, encoded_source)
|
473
|
+
else
|
474
|
+
parse_code_by_parser(file_path, encoded_source)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
# Parse code ast node by parser.
|
479
|
+
#
|
480
|
+
# @param file_path [String] file path
|
481
|
+
# @param encoded_source [String] encoded source code
|
482
|
+
# @return [Node] ast node for file
|
483
|
+
def parse_code_by_parser(file_path, encoded_source)
|
466
484
|
buffer = Parser::Source::Buffer.new file_path
|
467
485
|
buffer.source = encoded_source
|
468
486
|
|
@@ -470,5 +488,14 @@ module Synvert::Core
|
|
470
488
|
parser.reset
|
471
489
|
parser.parse buffer
|
472
490
|
end
|
491
|
+
|
492
|
+
# Parse code ast node by syntax_tree.
|
493
|
+
#
|
494
|
+
# @param file_path [String] file path
|
495
|
+
# @param encoded_source [String] encoded source code
|
496
|
+
# @return [Node] ast node for file
|
497
|
+
def parse_code_by_syntax_tree(_file_path, encoded_source)
|
498
|
+
SyntaxTree::Parser.new(encoded_source).parse.statements
|
499
|
+
end
|
473
500
|
end
|
474
501
|
end
|
@@ -9,7 +9,7 @@ module Synvert::Core
|
|
9
9
|
# One Rewriter checks if the depndency version matches, and it can contain one or many {Synvert::Core::Rewriter::Instance},
|
10
10
|
# which define the behavior what files and what codes to detect and rewrite to what code.
|
11
11
|
class Rewriter
|
12
|
-
DEFAULT_OPTIONS = { run_instance: true, write_to_file: true }.freeze
|
12
|
+
DEFAULT_OPTIONS = { run_instance: true, write_to_file: true, parser: 'parser' }.freeze
|
13
13
|
|
14
14
|
autoload :ReplaceErbStmtWithExprAction, 'synvert/core/rewriter/action/replace_erb_stmt_with_expr_action'
|
15
15
|
|
@@ -129,7 +129,9 @@ module Synvert::Core
|
|
129
129
|
# It will call the block.
|
130
130
|
def process
|
131
131
|
@affected_files = Set.new
|
132
|
-
|
132
|
+
ensure_current_adapter do
|
133
|
+
instance_eval(&@block)
|
134
|
+
end
|
133
135
|
|
134
136
|
process if !@affected_files.empty? && @redo_until_no_change # redo
|
135
137
|
end
|
@@ -144,7 +146,9 @@ module Synvert::Core
|
|
144
146
|
def test
|
145
147
|
@options[:write_to_file] = false
|
146
148
|
@affected_files = Set.new
|
147
|
-
|
149
|
+
ensure_current_adapter do
|
150
|
+
instance_eval(&@block)
|
151
|
+
end
|
148
152
|
|
149
153
|
if !@affected_files.empty? && @redo_until_no_change # redo
|
150
154
|
test
|
@@ -166,18 +170,33 @@ module Synvert::Core
|
|
166
170
|
@affected_files.add(file_path)
|
167
171
|
end
|
168
172
|
|
173
|
+
def syntax_tree_parser?
|
174
|
+
@options[:parser] == Synvert::SYNTAX_TREE_PARSER
|
175
|
+
end
|
176
|
+
|
169
177
|
#######
|
170
178
|
# DSL #
|
171
179
|
#######
|
172
180
|
|
173
181
|
# Configure the rewriter
|
174
182
|
# @example
|
183
|
+
# configure({ parser: Synvert::PARSER_PARSER })
|
175
184
|
# configure({ strategy: 'allow_insert_at_same_position' })
|
176
185
|
# @param options [Hash]
|
177
|
-
# @option
|
186
|
+
# @option adapter [String] Synvert::PARSER_PARSER or Synvert::SYNTAX_TREE_PARSER
|
187
|
+
# @option strategy [String] 'allow_insert_at_same_position'
|
178
188
|
def configure(options)
|
179
|
-
|
180
|
-
|
189
|
+
@options = @options.merge(options)
|
190
|
+
if options[:parser] && ![Synvert::PARSER_PARSER, Synvert::SYNTAX_TREE_PARSER].include?(options[:parser])
|
191
|
+
raise Errors::ParserNotSupported.new("Parser #{options[:adapter]} not supported")
|
192
|
+
end
|
193
|
+
|
194
|
+
if syntax_tree_parser?
|
195
|
+
NodeQuery.configure(adapter: NodeQuery::SyntaxTreeAdapter.new)
|
196
|
+
NodeMutation.configure(adapter: NodeMutation::SyntaxTreeAdapter.new)
|
197
|
+
else
|
198
|
+
NodeQuery.configure(adapter: NodeQuery::ParserAdapter.new)
|
199
|
+
NodeMutation.configure(adapter: NodeMutation::ParserAdapter.new)
|
181
200
|
end
|
182
201
|
end
|
183
202
|
|
@@ -366,6 +385,18 @@ module Synvert::Core
|
|
366
385
|
|
367
386
|
private
|
368
387
|
|
388
|
+
# Ensure back to current adapter after running a rewriter.
|
389
|
+
def ensure_current_adapter
|
390
|
+
current_query_adapter = NodeQuery.adapter
|
391
|
+
current_mutation_adapter = NodeMutation.adapter
|
392
|
+
begin
|
393
|
+
yield
|
394
|
+
ensure
|
395
|
+
NodeQuery.configure(adapter: current_query_adapter)
|
396
|
+
NodeMutation.configure(adapter: current_mutation_adapter)
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
369
400
|
# Handle one file.
|
370
401
|
# @param file_patterns [String] file patterns to find files.
|
371
402
|
# @yield [file_path] block to handle file.
|
data/lib/synvert/core/utils.rb
CHANGED
@@ -16,7 +16,7 @@ module Synvert::Core
|
|
16
16
|
uri = URI.parse(format_url(snippet_name))
|
17
17
|
return uri.open.read if remote_snippet_exists?(uri)
|
18
18
|
|
19
|
-
raise
|
19
|
+
raise Errors::SnippetNotFound.new("#{snippet_name} nout found")
|
20
20
|
elsif is_valid_file?(snippet_name)
|
21
21
|
return File.read(snippet_name)
|
22
22
|
else
|
@@ -26,7 +26,7 @@ module Synvert::Core
|
|
26
26
|
snippet_uri = URI.parse(format_url(remote_snippet_url(snippet_name)))
|
27
27
|
return snippet_uri.open.read if remote_snippet_exists?(snippet_uri)
|
28
28
|
|
29
|
-
raise
|
29
|
+
raise Errors::SnippetNotFound.new("#{snippet_name} nout found")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
data/lib/synvert/core/version.rb
CHANGED
data/lib/synvert/core.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'synvert/core/version'
|
4
|
-
require 'bundler'
|
5
|
-
require 'strscan'
|
6
|
-
require 'parser'
|
7
|
-
require 'parser/current'
|
8
|
-
require 'parser_node_ext'
|
9
4
|
require_relative './core/node_ext'
|
10
5
|
require 'active_support'
|
11
6
|
require 'active_support/core_ext'
|
@@ -19,7 +14,7 @@ module Synvert
|
|
19
14
|
autoload :Engine, 'synvert/core/engine'
|
20
15
|
autoload :Utils, 'synvert/core/utils'
|
21
16
|
autoload :Strategy, 'synvert/core/strategy'
|
22
|
-
autoload :
|
17
|
+
autoload :Errors, 'synvert/core/errors'
|
23
18
|
end
|
24
19
|
end
|
25
20
|
|
@@ -76,4 +71,7 @@ module Synvert
|
|
76
71
|
RAILS_MINITEST_FILES = %w[test/**/*.rb engines/*/test/**/*.rb]
|
77
72
|
RAILS_CUCUMBER_FILES = %w[features/**/*.rb]
|
78
73
|
RAILS_TEST_FILES = RAILS_MINITEST_FILES + RAILS_RSPEC_FILES + RAILS_CUCUMBER_FILES
|
74
|
+
|
75
|
+
PARSER_PARSER = 'parser'
|
76
|
+
SYNTAX_TREE_PARSER = 'syntax_tree'
|
79
77
|
end
|
@@ -6,14 +6,14 @@ describe Parser::AST::Node do
|
|
6
6
|
describe '#strip_curly_braces' do
|
7
7
|
context 'hash node' do
|
8
8
|
it 'removes curly braces' do
|
9
|
-
node =
|
9
|
+
node = parser_parse("{ foo: 'bar' }")
|
10
10
|
expect(node.strip_curly_braces).to eq("foo: 'bar'")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'other node' do
|
15
15
|
it 'do nothing' do
|
16
|
-
node =
|
16
|
+
node = parser_parse("'foobar'")
|
17
17
|
expect(node.strip_curly_braces).to eq("'foobar'")
|
18
18
|
end
|
19
19
|
end
|
@@ -22,7 +22,7 @@ describe Parser::AST::Node do
|
|
22
22
|
describe '#wrap_curly_braces' do
|
23
23
|
context 'hash node' do
|
24
24
|
it 'adds curly braces' do
|
25
|
-
node =
|
25
|
+
node = parser_parse("test(foo: 'bar')").arguments.first
|
26
26
|
expect(node.to_source).to eq("foo: 'bar'")
|
27
27
|
expect(node.wrap_curly_braces).to eq("{ foo: 'bar' }")
|
28
28
|
end
|
@@ -30,7 +30,7 @@ describe Parser::AST::Node do
|
|
30
30
|
|
31
31
|
context 'other node' do
|
32
32
|
it 'does nothing' do
|
33
|
-
node =
|
33
|
+
node = parser_parse("'foobar'")
|
34
34
|
expect(node.wrap_curly_braces).to eq("'foobar'")
|
35
35
|
end
|
36
36
|
end
|
@@ -39,7 +39,7 @@ describe Parser::AST::Node do
|
|
39
39
|
describe '#to_single_quote' do
|
40
40
|
context 'str node' do
|
41
41
|
it 'converts double quote to single quote' do
|
42
|
-
node =
|
42
|
+
node = parser_parse('"foobar"')
|
43
43
|
expect(node.to_source).to eq '"foobar"'
|
44
44
|
expect(node.to_single_quote).to eq "'foobar'"
|
45
45
|
end
|
@@ -47,7 +47,7 @@ describe Parser::AST::Node do
|
|
47
47
|
|
48
48
|
context 'other node' do
|
49
49
|
it 'does nothing' do
|
50
|
-
node =
|
50
|
+
node = parser_parse(':foobar')
|
51
51
|
expect(node.to_single_quote).to eq ':foobar'
|
52
52
|
end
|
53
53
|
end
|
@@ -56,14 +56,14 @@ describe Parser::AST::Node do
|
|
56
56
|
describe '#to_symbol' do
|
57
57
|
context 'str node' do
|
58
58
|
it 'converts string to symbol' do
|
59
|
-
node =
|
59
|
+
node = parser_parse("'foobar'")
|
60
60
|
expect(node.to_symbol).to eq ':foobar'
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
context 'other node' do
|
65
65
|
it 'does nothing' do
|
66
|
-
node =
|
66
|
+
node = parser_parse(':foobar')
|
67
67
|
expect(node.to_symbol).to eq ':foobar'
|
68
68
|
end
|
69
69
|
end
|
@@ -72,14 +72,14 @@ describe Parser::AST::Node do
|
|
72
72
|
describe '#to_string' do
|
73
73
|
context 'sym node' do
|
74
74
|
it 'converts symbol to string' do
|
75
|
-
node =
|
75
|
+
node = parser_parse(':foobar')
|
76
76
|
expect(node.to_string).to eq 'foobar'
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
context 'other node' do
|
81
81
|
it 'does nothing' do
|
82
|
-
node =
|
82
|
+
node = parser_parse("'foobar'")
|
83
83
|
expect(node.to_string).to eq "'foobar'"
|
84
84
|
end
|
85
85
|
end
|
@@ -88,19 +88,19 @@ describe Parser::AST::Node do
|
|
88
88
|
describe '#to_lambda_literal' do
|
89
89
|
context 'lambda node' do
|
90
90
|
it 'converts to lambda literal without arguments' do
|
91
|
-
node =
|
91
|
+
node = parser_parse('lambda { foobar }')
|
92
92
|
expect(node.to_lambda_literal).to eq('-> { foobar }')
|
93
93
|
end
|
94
94
|
|
95
95
|
it 'converts to lambda literal with arguments' do
|
96
|
-
node =
|
96
|
+
node = parser_parse('lambda { |x, y| foobar }')
|
97
97
|
expect(node.to_lambda_literal).to eq('->(x, y) { foobar }')
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
context 'other node' do
|
102
102
|
it 'does nothing' do
|
103
|
-
node =
|
103
|
+
node = parser_parse(':foobar')
|
104
104
|
expect(node.to_lambda_literal).to eq ':foobar'
|
105
105
|
end
|
106
106
|
end
|
@@ -16,7 +16,7 @@ module Synvert::Core
|
|
16
16
|
|
17
17
|
describe 'add_receiver_if_necessary' do
|
18
18
|
context 'with receiver' do
|
19
|
-
let(:node) {
|
19
|
+
let(:node) { parser_parse('User.save(false)') }
|
20
20
|
|
21
21
|
it 'adds reciever' do
|
22
22
|
allow(dummy_instance).to receive(:node).and_return(node)
|
@@ -27,7 +27,7 @@ module Synvert::Core
|
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'without receiver' do
|
30
|
-
let(:node) {
|
30
|
+
let(:node) { parser_parse('save(false)') }
|
31
31
|
|
32
32
|
it "doesn't add reciever" do
|
33
33
|
allow(dummy_instance).to receive(:node).and_return(node)
|
@@ -38,7 +38,7 @@ module Synvert::Core
|
|
38
38
|
|
39
39
|
describe 'add_arguments_with_parenthesis_if_necessary' do
|
40
40
|
context 'with arguments' do
|
41
|
-
let(:node) {
|
41
|
+
let(:node) { parser_parse('user.save(false)') }
|
42
42
|
|
43
43
|
it 'gets arguments with parenthesis' do
|
44
44
|
allow(dummy_instance).to receive(:node).and_return(node)
|
@@ -47,7 +47,7 @@ module Synvert::Core
|
|
47
47
|
end
|
48
48
|
|
49
49
|
context 'without argument' do
|
50
|
-
let(:node) {
|
50
|
+
let(:node) { parser_parse('user.save') }
|
51
51
|
|
52
52
|
it 'gets nothing' do
|
53
53
|
allow(dummy_instance).to receive(:node).and_return(node)
|
@@ -3,7 +3,41 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
module Synvert::Core
|
6
|
-
describe Rewriter do
|
6
|
+
RSpec.describe Rewriter do
|
7
|
+
describe '#configure' do
|
8
|
+
it 'parses parser' do
|
9
|
+
running_query_adapter = nil
|
10
|
+
running_mutation_adapter = nil
|
11
|
+
rewriter =
|
12
|
+
Rewriter.new 'group', 'name' do
|
13
|
+
configure parser: 'syntax_tree'
|
14
|
+
|
15
|
+
within_files '**/*.rb' do
|
16
|
+
running_query_adapter = NodeQuery.adapter
|
17
|
+
running_mutation_adapter = NodeMutation.adapter
|
18
|
+
end
|
19
|
+
end
|
20
|
+
input = "class Foobar\nend"
|
21
|
+
FakeFS do
|
22
|
+
File.write("code.rb", input)
|
23
|
+
rewriter.process
|
24
|
+
expect(running_query_adapter).to be_instance_of(NodeQuery::SyntaxTreeAdapter)
|
25
|
+
expect(running_mutation_adapter).to be_instance_of(NodeMutation::SyntaxTreeAdapter)
|
26
|
+
expect(NodeQuery.adapter).to be_instance_of(NodeQuery::ParserAdapter)
|
27
|
+
expect(NodeMutation.adapter).to be_instance_of(NodeMutation::ParserAdapter)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'parses unkown parser' do
|
32
|
+
rewriter =
|
33
|
+
Rewriter.new 'group', 'name' do
|
34
|
+
configure parser: 'unknown'
|
35
|
+
end
|
36
|
+
expect { rewriter.process }
|
37
|
+
.to raise_error(Errors::ParserNotSupported)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
7
41
|
it 'parses description' do
|
8
42
|
rewriter =
|
9
43
|
Rewriter.new 'group', 'name' do
|
@@ -16,7 +16,7 @@ module Synvert::Core
|
|
16
16
|
expect(described_class).to receive(:remote_snippet_exists?).and_return(false)
|
17
17
|
expect do
|
18
18
|
described_class.eval_snippet('http://example.com/rewriter.rb')
|
19
|
-
end.to raise_error(
|
19
|
+
end.to raise_error(Errors::SnippetNotFound)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/synvert-core-ruby.gemspec
CHANGED
@@ -20,9 +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.
|
24
|
-
spec.add_runtime_dependency "node_mutation", ">= 1.
|
23
|
+
spec.add_runtime_dependency "node_query", ">= 1.13.2"
|
24
|
+
spec.add_runtime_dependency "node_mutation", ">= 1.18.0"
|
25
25
|
spec.add_runtime_dependency "parser"
|
26
|
-
spec.add_runtime_dependency "parser_node_ext", ">= 1.
|
26
|
+
spec.add_runtime_dependency "parser_node_ext", ">= 1.1.0"
|
27
|
+
spec.add_runtime_dependency "syntax_tree"
|
28
|
+
spec.add_runtime_dependency "syntax_tree_ext", ">= 0.3.1"
|
27
29
|
spec.add_runtime_dependency "parallel"
|
28
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.
|
4
|
+
version: 1.27.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-05-
|
11
|
+
date: 2023-05-18 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.
|
33
|
+
version: 1.13.2
|
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.
|
40
|
+
version: 1.13.2
|
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.
|
47
|
+
version: 1.18.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.
|
54
|
+
version: 1.18.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: parser
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,42 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.1.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: syntax_tree
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: syntax_tree_ext
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.3.1
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.3.1
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: parallel
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,6 +147,7 @@ files:
|
|
119
147
|
- lib/synvert/core/engine/erb.rb
|
120
148
|
- lib/synvert/core/engine/haml.rb
|
121
149
|
- lib/synvert/core/engine/slim.rb
|
150
|
+
- lib/synvert/core/errors.rb
|
122
151
|
- lib/synvert/core/node_ext.rb
|
123
152
|
- lib/synvert/core/rewriter.rb
|
124
153
|
- lib/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action.rb
|
@@ -134,7 +163,6 @@ files:
|
|
134
163
|
- lib/synvert/core/rewriter/scope/goto_scope.rb
|
135
164
|
- lib/synvert/core/rewriter/scope/within_scope.rb
|
136
165
|
- lib/synvert/core/rewriter/warning.rb
|
137
|
-
- lib/synvert/core/snippet_not_found_error.rb
|
138
166
|
- lib/synvert/core/strategy.rb
|
139
167
|
- lib/synvert/core/utils.rb
|
140
168
|
- lib/synvert/core/version.rb
|
@@ -179,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
207
|
- !ruby/object:Gem::Version
|
180
208
|
version: '0'
|
181
209
|
requirements: []
|
182
|
-
rubygems_version: 3.4.
|
210
|
+
rubygems_version: 3.4.7
|
183
211
|
signing_key:
|
184
212
|
specification_version: 4
|
185
213
|
summary: convert ruby code to better syntax.
|