synvert-core 1.9.0 → 1.9.1
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/synvert/core/rewriter/instance.rb +6 -6
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/rewriter/instance_spec.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bd7dcc7605d1a18cc68ebfba86d5947960bd1320da0b5f7ae41abc8638fed62
|
4
|
+
data.tar.gz: 3023d5fb8a740da0ce0191bdd08f7435cc931e690714d2195391cf03586efa70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3c7f43d890a491a7bb3356ec1695a79278a8c19cf61df4f296a1ea6562cbbcfa27764b36cbb22e06f9f27cd53157e2276392bba42856d58212fddb68e92ffac
|
7
|
+
data.tar.gz: 9959f0f8290157b96c83011ef770d59b40b845b236e0f8facf24cb6795cd7a837936a8969e380910df2892604dd25f569c66b9ff0c7aa5649e441b5ddf72b32a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (1.9.
|
4
|
+
synvert-core (1.9.1)
|
5
5
|
activesupport (< 7.0.0)
|
6
6
|
erubis
|
7
7
|
node_mutation
|
@@ -49,7 +49,7 @@ GEM
|
|
49
49
|
method_source (1.0.0)
|
50
50
|
minitest (5.16.3)
|
51
51
|
nenv (0.3.0)
|
52
|
-
node_mutation (1.4.
|
52
|
+
node_mutation (1.4.1)
|
53
53
|
activesupport (< 7.0.0)
|
54
54
|
erubis
|
55
55
|
node_query (1.6.0)
|
@@ -356,9 +356,9 @@ module Synvert::Core
|
|
356
356
|
def process_file(file_path)
|
357
357
|
puts file_path if Configuration.show_run_process
|
358
358
|
|
359
|
-
@current_file = file_path
|
359
|
+
@current_file = File.join(Configuration.root_path, file_path)
|
360
360
|
while true
|
361
|
-
source = read_source(
|
361
|
+
source = read_source(@current_file)
|
362
362
|
@current_mutation = NodeMutation.new(source)
|
363
363
|
begin
|
364
364
|
node = parse_code(file_path, source)
|
@@ -378,7 +378,7 @@ module Synvert::Core
|
|
378
378
|
result = @current_mutation.process
|
379
379
|
if result.affected?
|
380
380
|
@rewriter.add_affected_file(file_path)
|
381
|
-
write_source(
|
381
|
+
write_source(@current_file, result.new_source)
|
382
382
|
end
|
383
383
|
break unless result.conflicted?
|
384
384
|
rescue Parser::SyntaxError
|
@@ -392,11 +392,11 @@ module Synvert::Core
|
|
392
392
|
#
|
393
393
|
# @param file_path [String]
|
394
394
|
def test_file(file_path)
|
395
|
-
@current_file = file_path
|
396
|
-
source = read_source(
|
395
|
+
@current_file = File.join(Configuration.root_path, file_path)
|
396
|
+
source = read_source(@current_file)
|
397
397
|
@current_mutation = NodeMutation.new(source)
|
398
398
|
begin
|
399
|
-
node = parse_code(
|
399
|
+
node = parse_code(@current_file, source)
|
400
400
|
|
401
401
|
process_with_node(node) do
|
402
402
|
instance_eval(&@block)
|
data/lib/synvert/core/version.rb
CHANGED
@@ -213,8 +213,8 @@ module Synvert::Core
|
|
213
213
|
end
|
214
214
|
EOS
|
215
215
|
expect(Dir).to receive(:glob).with('spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb'])
|
216
|
-
expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
|
217
|
-
expect(File).to receive(:write).with('spec/models/post_spec.rb', output)
|
216
|
+
expect(File).to receive(:read).with('./spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
|
217
|
+
expect(File).to receive(:write).with('./spec/models/post_spec.rb', output)
|
218
218
|
instance.process
|
219
219
|
end
|
220
220
|
|
@@ -238,8 +238,8 @@ module Synvert::Core
|
|
238
238
|
end
|
239
239
|
EOS
|
240
240
|
expect(Dir).to receive(:glob).with('spec/spec_helper.rb').and_return(['spec/spec_helper.rb'])
|
241
|
-
expect(File).to receive(:read).with('spec/spec_helper.rb', encoding: 'UTF-8').and_return(input)
|
242
|
-
expect(File).not_to receive(:write).with('spec/spec_helper.rb', output)
|
241
|
+
expect(File).to receive(:read).with('./spec/spec_helper.rb', encoding: 'UTF-8').and_return(input)
|
242
|
+
expect(File).not_to receive(:write).with('./spec/spec_helper.rb', output)
|
243
243
|
instance.process
|
244
244
|
end
|
245
245
|
|
@@ -265,9 +265,9 @@ module Synvert::Core
|
|
265
265
|
end
|
266
266
|
EOS
|
267
267
|
expect(Dir).to receive(:glob).with('spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb']).twice
|
268
|
-
expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
|
269
|
-
expect(File).to receive(:write).with('spec/models/post_spec.rb', output)
|
270
|
-
expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(output)
|
268
|
+
expect(File).to receive(:read).with('./spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
|
269
|
+
expect(File).to receive(:write).with('./spec/models/post_spec.rb', output)
|
270
|
+
expect(File).to receive(:read).with('./spec/models/post_spec.rb', encoding: 'UTF-8').and_return(output)
|
271
271
|
instance.process
|
272
272
|
instance.process
|
273
273
|
expect(rewriter.affected_files).to be_include('spec/models/post_spec.rb')
|
@@ -292,7 +292,7 @@ module Synvert::Core
|
|
292
292
|
end
|
293
293
|
EOS
|
294
294
|
expect(Dir).to receive(:glob).with('spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb'])
|
295
|
-
expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
|
295
|
+
expect(File).to receive(:read).with('./spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
|
296
296
|
results = instance.test
|
297
297
|
expect(results[0].file_path).to eq 'spec/models/post_spec.rb'
|
298
298
|
expect(results[0].actions).to eq [
|
@@ -316,7 +316,7 @@ module Synvert::Core
|
|
316
316
|
end
|
317
317
|
EOS
|
318
318
|
expect(Dir).to receive(:glob).with('spec/spec_helper.rb').and_return(['spec/spec_helper.rb'])
|
319
|
-
expect(File).to receive(:read).with('spec/spec_helper.rb', encoding: 'UTF-8').and_return(input)
|
319
|
+
expect(File).to receive(:read).with('./spec/spec_helper.rb', encoding: 'UTF-8').and_return(input)
|
320
320
|
result = instance.test
|
321
321
|
expect(result[0].file_path).to eq 'spec/spec_helper.rb'
|
322
322
|
expect(result[0].actions).to eq []
|
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.9.
|
4
|
+
version: 1.9.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: 2022-09-
|
11
|
+
date: 2022-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|