synvert-core 2.2.2 → 2.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eddbc1300819ded0467537a3fae16ccba0531e530a8c206d5d5eb5793ba0fa0
4
- data.tar.gz: 1e8240da12a5ef2ed9fa836317f60dd53fab6cf11f154ea07e9b5c2bb5a890a9
3
+ metadata.gz: d217e429027267134087b0ff88ebb0f407b4f4b12834cc3561e45a4fec59355e
4
+ data.tar.gz: f94351f2512d862e01f45defc64fdc4fa11e597f0993d702390af1fa55b47e8e
5
5
  SHA512:
6
- metadata.gz: 6064bbf993bbbbc194de3a42f3d46fa96bb0002b78b2cf38b94ed9b55baa08f6ca77aeb9256efda5003960fb14a1a1ba64e13a10b05b974d8709ae4f07e07b91
7
- data.tar.gz: a28d3d8ab17f732c953c1a04ba88708f06e351850a0e13aa29b9670a8bc93fff0a3f6989057c8aa43517cdcefe86907850e7c510d40d45ee1b9ff6fe281c3af7
6
+ metadata.gz: 639e821a2f043b3714d98ce889d86eedbc0574df1f1faf7f2fd6f16b301b9179d0ee4f438911ce0ffb4c8cf82b62081f28124e0ceff107cfcd1924773cb6f77a
7
+ data.tar.gz: 0d200b63e29540f1999cb0284a3152248ffc7c5d6359194e19f0548a612cf9e2296a327f5d1ba8c832a5c2a39e76c67c5590e3c219c6f80d6748ad763c779c2e
@@ -11,10 +11,10 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3']
14
+ ruby-version: ['3.2', '3.3', '3.4', '4.0']
15
15
 
16
16
  steps:
17
- - uses: actions/checkout@v3
17
+ - uses: actions/checkout@v4
18
18
  - name: Set up Ruby
19
19
  uses: ruby/setup-ruby@v1
20
20
  with:
@@ -26,15 +26,24 @@ jobs:
26
26
  deploy:
27
27
  runs-on: ubuntu-latest
28
28
  needs: test
29
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
29
30
  name: Update gh-pages to docs
30
31
  steps:
31
- - uses: actions/checkout@v3
32
+ - uses: actions/checkout@v4
32
33
  - uses: ruby/setup-ruby@v1
33
34
  with:
34
- ruby-version: '3.2'
35
+ ruby-version: '4.0'
35
36
  bundler-cache: true
37
+ - name: Cache YARD gems
38
+ uses: actions/cache@v3
39
+ with:
40
+ path: vendor/bundle
41
+ key: ${{ runner.os }}-yard-gems-${{ hashFiles('**/Gemfile.lock') }}
42
+ restore-keys: |
43
+ ${{ runner.os }}-yard-gems-
36
44
  - name: Install required gem dependencies
37
- run: gem install yard redcarpet github-markup --no-document
45
+ run: |
46
+ gem install yard redcarpet github-markup --no-document
38
47
  - name: Build YARD Ruby Documentation
39
48
  run: yardoc --output-dir docs
40
49
  - name: Deploy
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.3.0 (2025-12-30)
4
+
5
+ * Support ruby 4.0
6
+ * Drop ruby 2.7, 3.0 and 3.1 support
7
+ * Update `node_query` to 1.17.0
8
+ * Update `node_mutation` to 1.25.0
9
+
3
10
  ## 2.2.2 (2024-12-27)
4
11
 
5
12
  * Do not restrict activesupport version
data/Gemfile CHANGED
@@ -5,10 +5,11 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in synvert.gemspec
6
6
  gemspec
7
7
 
8
- gem "activesupport", "7.1.3.4" # support ruby 2.7
9
8
  gem "fakefs", require: "fakefs/safe"
10
9
  gem "guard"
11
10
  gem "guard-rspec"
11
+ gem "irb"
12
+ gem "ostruct"
12
13
  gem "rake"
13
14
  gem "rspec"
14
15
  gem "rspec-mocks"
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (2.2.2)
4
+ synvert-core (2.3.0)
5
5
  activesupport
6
- node_mutation (>= 1.24.4)
7
- node_query (>= 1.15.4)
6
+ node_mutation (>= 1.25.0)
7
+ node_query (>= 1.17.0)
8
8
  node_visitor (>= 1.1.0)
9
9
  parallel
10
10
  parser
@@ -17,24 +17,30 @@ PATH
17
17
  GEM
18
18
  remote: https://rubygems.org/
19
19
  specs:
20
- activesupport (7.1.3.4)
20
+ activesupport (8.1.1)
21
21
  base64
22
22
  bigdecimal
23
- concurrent-ruby (~> 1.0, >= 1.0.2)
23
+ concurrent-ruby (~> 1.0, >= 1.3.1)
24
24
  connection_pool (>= 2.2.5)
25
25
  drb
26
26
  i18n (>= 1.6, < 2)
27
+ json
28
+ logger (>= 1.4.2)
27
29
  minitest (>= 5.1)
28
- mutex_m
29
- tzinfo (~> 2.0)
30
- ast (2.4.2)
31
- base64 (0.2.0)
32
- bigdecimal (3.1.9)
30
+ securerandom (>= 0.3)
31
+ tzinfo (~> 2.0, >= 2.0.5)
32
+ uri (>= 0.13.1)
33
+ ast (2.4.3)
34
+ base64 (0.3.0)
35
+ bigdecimal (4.0.1)
33
36
  coderay (1.1.3)
34
- concurrent-ruby (1.3.4)
35
- connection_pool (2.4.1)
37
+ concurrent-ruby (1.3.6)
38
+ connection_pool (3.0.2)
39
+ date (3.5.1)
36
40
  diff-lcs (1.5.1)
37
- drb (2.2.1)
41
+ docile (1.4.1)
42
+ drb (2.2.3)
43
+ erb (6.0.1)
38
44
  fakefs (2.4.0)
39
45
  ffi (1.16.3)
40
46
  formatador (1.1.0)
@@ -52,40 +58,60 @@ GEM
52
58
  guard (~> 2.1)
53
59
  guard-compat (~> 1.1)
54
60
  rspec (>= 2.99.0, < 4.0)
55
- i18n (1.14.6)
61
+ i18n (1.14.8)
56
62
  concurrent-ruby (~> 1.0)
63
+ io-console (0.8.2)
64
+ irb (1.16.0)
65
+ pp (>= 0.6.0)
66
+ rdoc (>= 4.0.0)
67
+ reline (>= 0.4.2)
68
+ json (2.18.0)
57
69
  listen (3.9.0)
58
70
  rb-fsevent (~> 0.10, >= 0.10.3)
59
71
  rb-inotify (~> 0.9, >= 0.9.10)
72
+ logger (1.7.0)
60
73
  lumberjack (1.2.10)
61
74
  method_source (1.1.0)
62
- minitest (5.25.4)
63
- mutex_m (0.3.0)
75
+ minitest (6.0.1)
76
+ prism (~> 1.5)
64
77
  nenv (0.3.0)
65
- node_mutation (1.24.4)
66
- node_query (1.16.0)
78
+ node_mutation (1.25.0)
79
+ node_query (1.17.0)
67
80
  node_visitor (1.1.0)
68
81
  notiffany (0.1.3)
69
82
  nenv (~> 0.1)
70
83
  shellany (~> 0.0)
71
- parallel (1.26.3)
72
- parser (3.3.6.0)
84
+ ostruct (0.6.3)
85
+ parallel (1.27.0)
86
+ parser (3.3.10.0)
73
87
  ast (~> 2.4.1)
74
88
  racc
75
89
  parser_node_ext (1.4.2)
76
90
  parser
91
+ pp (0.6.3)
92
+ prettyprint
77
93
  prettier_print (1.2.1)
78
- prism (1.3.0)
94
+ prettyprint (0.2.0)
95
+ prism (1.7.0)
79
96
  prism_ext (0.4.2)
80
97
  prism
81
98
  pry (0.14.2)
82
99
  coderay (~> 1.1)
83
100
  method_source (~> 1.0)
101
+ psych (5.3.1)
102
+ date
103
+ stringio
84
104
  racc (1.8.1)
85
105
  rake (13.0.6)
86
106
  rb-fsevent (0.11.2)
87
107
  rb-inotify (0.10.1)
88
108
  ffi (~> 1.0)
109
+ rdoc (7.0.3)
110
+ erb
111
+ psych (>= 4.0.0)
112
+ tsort
113
+ reline (0.6.3)
114
+ io-console (~> 0.5)
89
115
  rspec (3.13.0)
90
116
  rspec-core (~> 3.13.0)
91
117
  rspec-expectations (~> 3.13.0)
@@ -99,27 +125,39 @@ GEM
99
125
  diff-lcs (>= 1.2.0, < 2.0)
100
126
  rspec-support (~> 3.13.0)
101
127
  rspec-support (3.13.1)
128
+ securerandom (0.4.1)
102
129
  shellany (0.0.1)
103
- syntax_tree (6.2.0)
130
+ simplecov (0.22.0)
131
+ docile (~> 1.1)
132
+ simplecov-html (~> 0.11)
133
+ simplecov_json_formatter (~> 0.1)
134
+ simplecov-html (0.13.2)
135
+ simplecov_json_formatter (0.1.4)
136
+ stringio (3.2.0)
137
+ syntax_tree (6.3.0)
104
138
  prettier_print (>= 1.2.0)
105
139
  syntax_tree_ext (0.9.2)
106
140
  syntax_tree
107
141
  thor (1.3.1)
142
+ tsort (0.2.0)
108
143
  tzinfo (2.0.6)
109
144
  concurrent-ruby (~> 1.0)
145
+ uri (1.1.1)
110
146
 
111
147
  PLATFORMS
112
148
  ruby
113
149
 
114
150
  DEPENDENCIES
115
- activesupport (= 7.1.3.4)
116
151
  fakefs
117
152
  guard
118
153
  guard-rspec
154
+ irb
155
+ ostruct
119
156
  rake
120
157
  rspec
121
158
  rspec-mocks
159
+ simplecov
122
160
  synvert-core!
123
161
 
124
162
  BUNDLED WITH
125
- 2.3.7
163
+ 2.6.9
@@ -26,7 +26,7 @@ module Synvert::Core
26
26
  def match?
27
27
  return true unless Configuration.strict
28
28
 
29
- gemfile_lock_path = File.expand_path(File.join(Configuration.root_path, 'Gemfile.lock'))
29
+ gemfile_lock_path = File.expand_path(File.join(Configuration.root_path, gemfile_lock_name))
30
30
 
31
31
  # if Gemfile.lock does not exist, just ignore this check
32
32
  return true unless File.exist?(gemfile_lock_path)
@@ -35,5 +35,13 @@ module Synvert::Core
35
35
  parser = Bundler::LockfileParser.new(File.read(gemfile_lock_path))
36
36
  parser.specs.any? { |spec| Gem::Dependency.new(@name, @version).match?(spec) }
37
37
  end
38
+
39
+ private
40
+
41
+ def gemfile_lock_name
42
+ return "#{File.basename(ENV['BUNDLE_GEMFILE'])}.lock" if File.exist?(ENV['BUNDLE_GEMFILE'])
43
+
44
+ 'Gemfile.lock'
45
+ end
38
46
  end
39
47
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '2.2.2'
5
+ VERSION = '2.3.0'
6
6
  end
7
7
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'simplecov'
4
+ SimpleCov.start do
5
+ add_filter '/spec/'
6
+
7
+ add_group 'Core', 'lib/synvert/core'
8
+ end
9
+
3
10
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
11
 
5
12
  require 'pp' # rubocop:disable Lint/RedundantRequireStatement
@@ -15,49 +15,52 @@ module Synvert::Core
15
15
  rake (10.1.1)
16
16
  slop (3.4.7)
17
17
  EOS
18
- let(:lock_path) { File.absolute_path('./Gemfile.lock') }
18
+ let(:gemfile_lock_path) { File.absolute_path('./Gemfile.lock') }
19
+ let(:gemfile_path) { File.absolute_path('./Gemfile') }
19
20
 
20
21
  before do
21
- Configuration.root_path = File.dirname(lock_path)
22
- allow(File).to receive(:exist?).with(File.join(ENV['HOME'])).and_return(true)
23
- allow(File).to receive(:exist?).with(File.join(ENV['HOME'], '.gem')).and_return(false)
24
- allow(File).to receive(:exist?).with(File.join(ENV['HOME'], '.gem/specs')).and_return(false)
22
+ Configuration.root_path = File.dirname(gemfile_lock_path)
23
+ @original_bundle_gemfile = ENV['BUNDLE_GEMFILE']
24
+ ENV['BUNDLE_GEMFILE'] = gemfile_path
25
25
  end
26
26
 
27
27
  after do
28
28
  Configuration.root_path = nil
29
+ ENV['BUNDLE_GEMFILE'] = @original_bundle_gemfile
29
30
  end
30
31
 
31
- it 'returns true if version in Gemfile.lock is greater than definition' do
32
- expect(File).to receive(:exist?).with(lock_path).and_return(true)
33
- expect(File).to receive(:read).with(lock_path).and_return(gemfile_lock_content)
34
- gem_spec = Rewriter::GemSpec.new('ast', '~> 1.1')
35
- expect(gem_spec).to be_match
32
+ def mock_gemfile_and_lock(gemfile_path, gemfile_lock_path, exists: true)
33
+ if gemfile_path
34
+ expect(File).to receive(:exist?).with(gemfile_path).and_return(true)
35
+ else
36
+ expect(File).to receive(:exist?).with(nil).and_return(false)
37
+ end
38
+ expect(File).to receive(:exist?).with(gemfile_lock_path).and_return(exists)
39
+ expect(File).to receive(:read).with(gemfile_lock_path).and_return(gemfile_lock_content) if exists
36
40
  end
37
41
 
38
- it 'returns true if version in Gemfile.lock is equal to definition' do
39
- expect(File).to receive(:exist?).with(lock_path).and_return(true)
40
- expect(File).to receive(:read).with(lock_path).and_return(gemfile_lock_content)
41
- gem_spec = Rewriter::GemSpec.new('ast', '1.1.0')
42
- expect(gem_spec).to be_match
42
+ shared_examples 'gem version matching' do |version, expected_match|
43
+ it "returns #{expected_match} for version #{version}" do
44
+ mock_gemfile_and_lock(gemfile_path, gemfile_lock_path)
45
+ gem_spec = Rewriter::GemSpec.new('ast', version)
46
+ expect(gem_spec).send(expected_match ? :to : :not_to, be_match)
47
+ end
43
48
  end
44
49
 
45
- it 'returns false if version in Gemfile.lock is less than definition' do
46
- expect(File).to receive(:exist?).with(lock_path).and_return(true)
47
- expect(File).to receive(:read).with(lock_path).and_return(gemfile_lock_content)
48
- gem_spec = Rewriter::GemSpec.new('ast', '> 1.2.0')
49
- expect(gem_spec).not_to be_match
50
+ context 'when checking gem versions' do
51
+ include_examples 'gem version matching', '~> 1.1', true
52
+ include_examples 'gem version matching', '1.1.0', true
53
+ include_examples 'gem version matching', '> 1.2.0', false
50
54
  end
51
55
 
52
56
  it 'returns false if gem does not exist in Gemfile.lock' do
53
- expect(File).to receive(:exist?).with(lock_path).and_return(true)
54
- expect(File).to receive(:read).with(lock_path).and_return(gemfile_lock_content)
57
+ mock_gemfile_and_lock(gemfile_path, gemfile_lock_path)
55
58
  gem_spec = Rewriter::GemSpec.new('synvert', '1.0.0')
56
59
  expect(gem_spec).not_to be_match
57
60
  end
58
61
 
59
62
  it 'returns true if Gemfile.lock does not exist' do
60
- expect(File).to receive(:exist?).with(lock_path).and_return(false)
63
+ mock_gemfile_and_lock(gemfile_path, gemfile_lock_path, exists: false)
61
64
  gem_spec = Rewriter::GemSpec.new('ast', '1.1.0')
62
65
  expect(gem_spec).to be_match
63
66
  end
@@ -68,5 +71,23 @@ module Synvert::Core
68
71
  expect(gem_spec).to be_match
69
72
  Configuration.strict = true
70
73
  end
74
+
75
+ describe 'gemfile lock name behavior' do
76
+ it 'uses default Gemfile.lock when BUNDLE_GEMFILE is not set' do
77
+ ENV['BUNDLE_GEMFILE'] = nil
78
+ mock_gemfile_and_lock(nil, gemfile_lock_path)
79
+ gem_spec = Rewriter::GemSpec.new('ast', '1.1.0')
80
+ expect(gem_spec).to be_match
81
+ end
82
+
83
+ it 'uses custom Gemfile lock name when BUNDLE_GEMFILE is set' do
84
+ custom_gemfile = File.absolute_path('./Gemfile.next')
85
+ custom_gemfile_lock_path = File.absolute_path('./Gemfile.next.lock')
86
+ ENV['BUNDLE_GEMFILE'] = custom_gemfile
87
+ mock_gemfile_and_lock(custom_gemfile, custom_gemfile_lock_path)
88
+ gem_spec = Rewriter::GemSpec.new('ast', '1.1.0')
89
+ expect(gem_spec).to be_match
90
+ end
91
+ end
71
92
  end
72
93
  end
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_runtime_dependency "activesupport"
23
- spec.add_runtime_dependency "node_query", ">= 1.15.4"
24
- spec.add_runtime_dependency "node_mutation", ">= 1.24.4"
23
+ spec.add_runtime_dependency "node_query", ">= 1.17.0"
24
+ spec.add_runtime_dependency "node_mutation", ">= 1.25.0"
25
25
  spec.add_runtime_dependency "node_visitor", ">= 1.1.0"
26
26
  spec.add_runtime_dependency "parser"
27
27
  spec.add_runtime_dependency "parser_node_ext", ">= 1.4.2"
@@ -30,4 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_runtime_dependency "prism"
31
31
  spec.add_runtime_dependency "prism_ext", ">= 0.4.2"
32
32
  spec.add_runtime_dependency "parallel"
33
+
34
+ spec.add_development_dependency "simplecov"
33
35
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-27 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -30,28 +29,28 @@ dependencies:
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: 1.15.4
32
+ version: 1.17.0
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: 1.15.4
39
+ version: 1.17.0
41
40
  - !ruby/object:Gem::Dependency
42
41
  name: node_mutation
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - ">="
46
45
  - !ruby/object:Gem::Version
47
- version: 1.24.4
46
+ version: 1.25.0
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - ">="
53
52
  - !ruby/object:Gem::Version
54
- version: 1.24.4
53
+ version: 1.25.0
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: node_visitor
57
56
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +163,20 @@ dependencies:
164
163
  - - ">="
165
164
  - !ruby/object:Gem::Version
166
165
  version: '0'
166
+ - !ruby/object:Gem::Dependency
167
+ name: simplecov
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ type: :development
174
+ prerelease: false
175
+ version_requirements: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
167
180
  description: convert ruby code to better syntax automatically.
168
181
  email:
169
182
  - flyerhzm@gmail.com
@@ -235,7 +248,6 @@ homepage: https://github.com/synvert-hq/synvert-core-ruby
235
248
  licenses:
236
249
  - MIT
237
250
  metadata: {}
238
- post_install_message:
239
251
  rdoc_options: []
240
252
  require_paths:
241
253
  - lib
@@ -250,8 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
262
  - !ruby/object:Gem::Version
251
263
  version: '0'
252
264
  requirements: []
253
- rubygems_version: 3.5.22
254
- signing_key:
265
+ rubygems_version: 4.0.3
255
266
  specification_version: 4
256
267
  summary: convert ruby code to better syntax.
257
268
  test_files: