synvert-core 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/stale.yml +29 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +12 -11
- 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
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eddbc1300819ded0467537a3fae16ccba0531e530a8c206d5d5eb5793ba0fa0
|
4
|
+
data.tar.gz: 1e8240da12a5ef2ed9fa836317f60dd53fab6cf11f154ea07e9b5c2bb5a890a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6064bbf993bbbbc194de3a42f3d46fa96bb0002b78b2cf38b94ed9b55baa08f6ca77aeb9256efda5003960fb14a1a1ba64e13a10b05b974d8709ae4f07e07b91
|
7
|
+
data.tar.gz: a28d3d8ab17f732c953c1a04ba88708f06e351850a0e13aa29b9670a8bc93fff0a3f6989057c8aa43517cdcefe86907850e7c510d40d45ee1b9ff6fe281c3af7
|
@@ -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
@@ -1,5 +1,13 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 2.2.2 (2024-12-27)
|
4
|
+
|
5
|
+
* Do not restrict activesupport version
|
6
|
+
|
7
|
+
## 2.2.1 (2024-12-27)
|
8
|
+
|
9
|
+
* Raise error to notify user instance method should not be called in rewriter
|
10
|
+
|
3
11
|
## 2.2.0 (2024-07-20)
|
4
12
|
|
5
13
|
* Remove `save_data` and `load_data` dsls
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (2.2.
|
4
|
+
synvert-core (2.2.2)
|
5
5
|
activesupport
|
6
6
|
node_mutation (>= 1.24.4)
|
7
7
|
node_query (>= 1.15.4)
|
@@ -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)
|
@@ -112,6 +112,7 @@ PLATFORMS
|
|
112
112
|
ruby
|
113
113
|
|
114
114
|
DEPENDENCIES
|
115
|
+
activesupport (= 7.1.3.4)
|
115
116
|
fakefs
|
116
117
|
guard
|
117
118
|
guard-rspec
|
@@ -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
|
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: 2.2.
|
4
|
+
version: 2.2.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: 2024-
|
11
|
+
date: 2024-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -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.
|