synvert-core 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/stale.yml +29 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +12 -12
- data/lib/synvert/core/rewriter/instance.rb +9 -0
- data/lib/synvert/core/rewriter.rb +15 -0
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/rewriter_spec.rb +15 -0
- data/synvert-core-ruby.gemspec +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8de6e08c31aaa4768912559d7192f5eb447a5f7e4110f09b8bac0363e0df253
|
4
|
+
data.tar.gz: 57eb0b68bf973e02a83589ea9ae6b06b955aa07cd4400000604845f10cd8e4c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 167371f72e5abf567047a57b9af8ac7765b34f9ffff99092094cf92635dd54345cc6dac800b928ab16223aa5ed003c4d16464f3b856810a822b19a65ee038a25
|
7
|
+
data.tar.gz: 31248d3db71575585065e364e5130d6313474d6df3e86bf3667b451b3a9ffdceea7a125bc8c995faf8162bc367f7571320187f5404d78e84836e4aa0c81b09d3
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Close stale issues
|
2
|
+
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
stale:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/stale@v9
|
12
|
+
with:
|
13
|
+
# Issues
|
14
|
+
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
|
15
|
+
close-issue-message: 'This issue was closed because it has been stale for 30 days with no activity.'
|
16
|
+
days-before-issue-stale: 60
|
17
|
+
days-before-issue-close: 30
|
18
|
+
|
19
|
+
# Pull Requests
|
20
|
+
stale-pr-message: 'This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
|
21
|
+
close-pr-message: 'This pull request was closed because it has been stale for 30 days with no activity.'
|
22
|
+
days-before-pr-stale: 60
|
23
|
+
days-before-pr-close: 30
|
24
|
+
|
25
|
+
# General settings
|
26
|
+
exempt-issue-labels: 'pinned,security'
|
27
|
+
exempt-pr-labels: 'pinned,security'
|
28
|
+
stale-issue-label: 'stale'
|
29
|
+
stale-pr-label: 'stale'
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (2.2.
|
5
|
-
activesupport
|
4
|
+
synvert-core (2.2.1)
|
5
|
+
activesupport (= 7.1.3.4)
|
6
6
|
node_mutation (>= 1.24.4)
|
7
7
|
node_query (>= 1.15.4)
|
8
8
|
node_visitor (>= 1.1.0)
|
@@ -29,9 +29,9 @@ GEM
|
|
29
29
|
tzinfo (~> 2.0)
|
30
30
|
ast (2.4.2)
|
31
31
|
base64 (0.2.0)
|
32
|
-
bigdecimal (3.1.
|
32
|
+
bigdecimal (3.1.9)
|
33
33
|
coderay (1.1.3)
|
34
|
-
concurrent-ruby (1.3.
|
34
|
+
concurrent-ruby (1.3.4)
|
35
35
|
connection_pool (2.4.1)
|
36
36
|
diff-lcs (1.5.1)
|
37
37
|
drb (2.2.1)
|
@@ -52,36 +52,36 @@ GEM
|
|
52
52
|
guard (~> 2.1)
|
53
53
|
guard-compat (~> 1.1)
|
54
54
|
rspec (>= 2.99.0, < 4.0)
|
55
|
-
i18n (1.14.
|
55
|
+
i18n (1.14.6)
|
56
56
|
concurrent-ruby (~> 1.0)
|
57
57
|
listen (3.9.0)
|
58
58
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
59
59
|
rb-inotify (~> 0.9, >= 0.9.10)
|
60
60
|
lumberjack (1.2.10)
|
61
61
|
method_source (1.1.0)
|
62
|
-
minitest (5.
|
63
|
-
mutex_m (0.
|
62
|
+
minitest (5.25.4)
|
63
|
+
mutex_m (0.3.0)
|
64
64
|
nenv (0.3.0)
|
65
65
|
node_mutation (1.24.4)
|
66
|
-
node_query (1.
|
66
|
+
node_query (1.16.0)
|
67
67
|
node_visitor (1.1.0)
|
68
68
|
notiffany (0.1.3)
|
69
69
|
nenv (~> 0.1)
|
70
70
|
shellany (~> 0.0)
|
71
|
-
parallel (1.
|
72
|
-
parser (3.3.
|
71
|
+
parallel (1.26.3)
|
72
|
+
parser (3.3.6.0)
|
73
73
|
ast (~> 2.4.1)
|
74
74
|
racc
|
75
75
|
parser_node_ext (1.4.2)
|
76
76
|
parser
|
77
77
|
prettier_print (1.2.1)
|
78
|
-
prism (
|
78
|
+
prism (1.3.0)
|
79
79
|
prism_ext (0.4.2)
|
80
80
|
prism
|
81
81
|
pry (0.14.2)
|
82
82
|
coderay (~> 1.1)
|
83
83
|
method_source (~> 1.0)
|
84
|
-
racc (1.8.
|
84
|
+
racc (1.8.1)
|
85
85
|
rake (13.0.6)
|
86
86
|
rb-fsevent (0.11.2)
|
87
87
|
rb-inotify (0.10.1)
|
@@ -15,6 +15,15 @@ module Synvert::Core
|
|
15
15
|
class Rewriter::Instance
|
16
16
|
include Rewriter::Helper
|
17
17
|
|
18
|
+
DSL_METHODS = %i[
|
19
|
+
within_node with_node find_node goto_node
|
20
|
+
if_exist_node unless_exist_node
|
21
|
+
append prepend insert insert_after insert_before replace delete remove wrap replace_with warn replace_erb_stmt_with_expr noop group add_action
|
22
|
+
add_callback
|
23
|
+
wrap_with_quotes add_leading_spaces
|
24
|
+
file_path node mutation_adapter
|
25
|
+
].freeze
|
26
|
+
|
18
27
|
# Initialize an Instance.
|
19
28
|
#
|
20
29
|
# @param rewriter [Synvert::Core::Rewriter]
|
@@ -416,6 +416,21 @@ module Synvert::Core
|
|
416
416
|
Configuration.with_temporary_configurations(configurations, &block)
|
417
417
|
end
|
418
418
|
|
419
|
+
# Raise error to notify user instance method should not be called in Rewriter.
|
420
|
+
(Rewriter::Instance::DSL_METHODS - %i[group]).each do |method|
|
421
|
+
define_method(method) do |**|
|
422
|
+
raise NoMethodError, "#{method} must be called within within_files or within_file block."
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
def group
|
427
|
+
if block_given?
|
428
|
+
raise NoMethodError, 'group must be called within rewriter block.'
|
429
|
+
else
|
430
|
+
@group
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
419
434
|
private
|
420
435
|
|
421
436
|
# Handle one file.
|
data/lib/synvert/core/version.rb
CHANGED
@@ -91,6 +91,21 @@ module Synvert::Core
|
|
91
91
|
expect(File.read("code.rb")).to eq output
|
92
92
|
end
|
93
93
|
end
|
94
|
+
|
95
|
+
it 'does not rewrite the file if within_files is not called' do
|
96
|
+
rewriter =
|
97
|
+
Rewriter.new('group', 'name') do
|
98
|
+
with_node node_type: 'class', name: 'Foobar' do
|
99
|
+
replace :name, with: 'Synvert'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
input = "class Foobar\nend"
|
103
|
+
output = "class Synvert\nend"
|
104
|
+
FakeFS do
|
105
|
+
File.write("code.rb", input)
|
106
|
+
expect { rewriter.process }.to raise_error(NoMethodError, 'with_node must be called within within_files or within_file block.')
|
107
|
+
end
|
108
|
+
end
|
94
109
|
end
|
95
110
|
|
96
111
|
describe '#test' do
|
data/synvert-core-ruby.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_runtime_dependency "activesupport"
|
22
|
+
spec.add_runtime_dependency "activesupport", '7.1.3.4' # to support ruby 2.7
|
23
23
|
spec.add_runtime_dependency "node_query", ">= 1.15.4"
|
24
24
|
spec.add_runtime_dependency "node_mutation", ">= 1.24.4"
|
25
25
|
spec.add_runtime_dependency "node_visitor", ">= 1.1.0"
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.1.3.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.1.3.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: node_query
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,6 +172,7 @@ extensions: []
|
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
174
|
- ".github/workflows/main.yml"
|
175
|
+
- ".github/workflows/stale.yml"
|
175
176
|
- ".gitignore"
|
176
177
|
- ".rspec"
|
177
178
|
- ".vscode/settings.json"
|
@@ -249,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
250
|
- !ruby/object:Gem::Version
|
250
251
|
version: '0'
|
251
252
|
requirements: []
|
252
|
-
rubygems_version: 3.5.
|
253
|
+
rubygems_version: 3.5.22
|
253
254
|
signing_key:
|
254
255
|
specification_version: 4
|
255
256
|
summary: convert ruby code to better syntax.
|