synvert-core 1.28.0 → 1.28.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +14 -12
- data/lib/synvert/core/rewriter/instance.rb +3 -2
- data/lib/synvert/core/rewriter.rb +5 -5
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/rewriter_spec.rb +1 -1
- data/synvert-core-ruby.gemspec +4 -4
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 967c9d4d1272398a382d90b14f77c72af4c6c2adb0cc7970e40893ff41090564
|
4
|
+
data.tar.gz: aa819bf4c76328726e2586c3943af54b7bd28ec7262d799fbea704e65266361c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 385ea78c97b34a315b74c0bee37a8dfd1d2a784e96c32bd1e781aa1bb6ba2dddef0634a975fdd96de480923c003f419eac575b3887337bb049281f1b41795ac7
|
7
|
+
data.tar.gz: d065f52a673872c4493612f2d350fd78deed5e6b00947e18fa747d2042d3e907cd7f0577306d9a9e5e98c48dd4854b5df1ee9595b82fea5e4411eaefd149a8bd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 1.28.2 (2023-06-17)
|
4
|
+
|
5
|
+
* Update `node_query` to 1.13.5
|
6
|
+
|
7
|
+
## 1.28.1 (2023-06-14)
|
8
|
+
|
9
|
+
* Do not use keyword options in `call_helper`
|
10
|
+
* Update `node_query` to 1.13.3 and `node_mutation` to 1.18.3
|
11
|
+
* Update `parser_node_ext` to 1.2.0 and `syntax_tree_ext` to 0.6.0
|
12
|
+
|
3
13
|
## 1.28.0 (2023-06-01)
|
4
14
|
|
5
15
|
* Add `Synvert::Core::Helper`
|
data/Gemfile.lock
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (1.28.
|
4
|
+
synvert-core (1.28.2)
|
5
5
|
activesupport (< 7.0.0)
|
6
|
-
node_mutation (>= 1.18.
|
7
|
-
node_query (>= 1.13.
|
6
|
+
node_mutation (>= 1.18.3)
|
7
|
+
node_query (>= 1.13.5)
|
8
8
|
parallel
|
9
9
|
parser
|
10
|
-
parser_node_ext (>= 1.
|
10
|
+
parser_node_ext (>= 1.2.0)
|
11
11
|
syntax_tree
|
12
|
-
syntax_tree_ext (>= 0.
|
12
|
+
syntax_tree_ext (>= 0.6.0)
|
13
13
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
@@ -41,29 +41,31 @@ GEM
|
|
41
41
|
guard (~> 2.1)
|
42
42
|
guard-compat (~> 1.1)
|
43
43
|
rspec (>= 2.99.0, < 4.0)
|
44
|
-
i18n (1.
|
44
|
+
i18n (1.14.1)
|
45
45
|
concurrent-ruby (~> 1.0)
|
46
46
|
listen (3.7.1)
|
47
47
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
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.18.
|
51
|
+
minitest (5.18.1)
|
52
52
|
nenv (0.3.0)
|
53
|
-
node_mutation (1.18.
|
54
|
-
node_query (1.13.
|
53
|
+
node_mutation (1.18.3)
|
54
|
+
node_query (1.13.5)
|
55
55
|
notiffany (0.1.3)
|
56
56
|
nenv (~> 0.1)
|
57
57
|
shellany (~> 0.0)
|
58
58
|
parallel (1.23.0)
|
59
|
-
parser (3.2.2.
|
59
|
+
parser (3.2.2.3)
|
60
60
|
ast (~> 2.4.1)
|
61
|
-
|
61
|
+
racc
|
62
|
+
parser_node_ext (1.2.0)
|
62
63
|
parser
|
63
64
|
prettier_print (1.2.1)
|
64
65
|
pry (0.14.1)
|
65
66
|
coderay (~> 1.1)
|
66
67
|
method_source (~> 1.0)
|
68
|
+
racc (1.7.1)
|
67
69
|
rake (13.0.6)
|
68
70
|
rb-fsevent (0.11.1)
|
69
71
|
rb-inotify (0.10.1)
|
@@ -84,7 +86,7 @@ GEM
|
|
84
86
|
shellany (0.0.1)
|
85
87
|
syntax_tree (6.1.1)
|
86
88
|
prettier_print (>= 1.2.0)
|
87
|
-
syntax_tree_ext (0.
|
89
|
+
syntax_tree_ext (0.6.0)
|
88
90
|
syntax_tree
|
89
91
|
thor (1.2.1)
|
90
92
|
tzinfo (2.0.6)
|
@@ -41,12 +41,13 @@ module Synvert::Core
|
|
41
41
|
attr_accessor :current_node
|
42
42
|
|
43
43
|
# Process the instance.
|
44
|
-
# It
|
44
|
+
# It executes the block code, rewrites the original code,
|
45
45
|
# then writes the code back to the original file.
|
46
46
|
def process
|
47
47
|
puts @file_path if Configuration.show_run_process
|
48
48
|
|
49
49
|
absolute_file_path = File.join(Configuration.root_path, @file_path)
|
50
|
+
# It keeps running until no conflict.
|
50
51
|
loop do
|
51
52
|
source = read_source(absolute_file_path)
|
52
53
|
encoded_source = Engine.encode(File.extname(file_path), source)
|
@@ -75,7 +76,7 @@ module Synvert::Core
|
|
75
76
|
end
|
76
77
|
|
77
78
|
# Test the instance.
|
78
|
-
# It
|
79
|
+
# It executes the block code, tests the original code,
|
79
80
|
# then returns the actions.
|
80
81
|
def test
|
81
82
|
absolute_file_path = File.join(Configuration.root_path, file_path)
|
@@ -236,7 +236,7 @@ module Synvert::Core
|
|
236
236
|
@gem_spec = Rewriter::GemSpec.new(name, version)
|
237
237
|
end
|
238
238
|
|
239
|
-
# It finds specified files.
|
239
|
+
# It finds specified files, and for each file, it will delegate to {Synvert::Core::Rewriter::Instance} to rewrite code.
|
240
240
|
# It creates a {Synvert::Core::Rewriter::Instance} to rewrite code.
|
241
241
|
# @example
|
242
242
|
# Synvert::Rewriter.new 'rspec', 'be_close_to_be_within' do
|
@@ -360,13 +360,13 @@ module Synvert::Core
|
|
360
360
|
# It calls a shared rewriter.
|
361
361
|
# @example
|
362
362
|
# Synvert::Rewriter.new 'rails', 'upgrade_6_0_to_6_1' do
|
363
|
-
# call_helper 'rails/set_load_defaults',
|
364
|
-
# add_snippet '/Users/flyerhzm/.synvert-ruby/lib/rails/set_load_defaults.rb',
|
365
|
-
# add_snippet 'https://github.com/xinminlabs/synvert-snippets-ruby/blob/main/lib/rails/set_load_defaults.rb',
|
363
|
+
# call_helper 'rails/set_load_defaults', rails_version: '6.1'
|
364
|
+
# add_snippet '/Users/flyerhzm/.synvert-ruby/lib/rails/set_load_defaults.rb', rails_version: '6.1'
|
365
|
+
# add_snippet 'https://github.com/xinminlabs/synvert-snippets-ruby/blob/main/lib/rails/set_load_defaults.rb', rails_version: '6.1'
|
366
366
|
# end
|
367
367
|
# @param name [String] name of helper.
|
368
368
|
# @param options [Hash] options to pass to helper.
|
369
|
-
def call_helper(name, options
|
369
|
+
def call_helper(name, options = {})
|
370
370
|
helper = Synvert::Core::Helper.fetch(name) || Utils.eval_snippet(name)
|
371
371
|
return unless helper && helper.is_a?(Synvert::Core::Helper)
|
372
372
|
|
data/lib/synvert/core/version.rb
CHANGED
@@ -320,7 +320,7 @@ module Synvert::Core
|
|
320
320
|
end
|
321
321
|
rewriter =
|
322
322
|
Rewriter.new 'group', 'rewriter' do
|
323
|
-
call_helper('helper',
|
323
|
+
call_helper('helper', foo: 'bar')
|
324
324
|
end
|
325
325
|
rewriter.process
|
326
326
|
expect(block_receiver).to eq 'Synvert::Core::Rewriter'
|
data/synvert-core-ruby.gemspec
CHANGED
@@ -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.
|
24
|
-
spec.add_runtime_dependency "node_mutation", ">= 1.18.
|
23
|
+
spec.add_runtime_dependency "node_query", ">= 1.13.5"
|
24
|
+
spec.add_runtime_dependency "node_mutation", ">= 1.18.3"
|
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.2.0"
|
27
27
|
spec.add_runtime_dependency "syntax_tree"
|
28
|
-
spec.add_runtime_dependency "syntax_tree_ext", ">= 0.
|
28
|
+
spec.add_runtime_dependency "syntax_tree_ext", ">= 0.6.0"
|
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
|
+
version: 1.28.2
|
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-06-17 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.5
|
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.5
|
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.18.
|
47
|
+
version: 1.18.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.18.
|
54
|
+
version: 1.18.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: parser
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.2.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.2.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: syntax_tree
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.6.0
|
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.
|
110
|
+
version: 0.6.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: parallel
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.4.
|
212
|
+
rubygems_version: 3.4.13
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: convert ruby code to better syntax.
|