synvert-core 1.9.0 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa46b311ec4eb71e3a23d060e1a23dcceffe1b0ddea066a64043aea29635d143
4
- data.tar.gz: 7dd8b27cfc88e3d98a876da7592e1df466e00a6c1b79309d34abc475e287b5a7
3
+ metadata.gz: 0bd7dcc7605d1a18cc68ebfba86d5947960bd1320da0b5f7ae41abc8638fed62
4
+ data.tar.gz: 3023d5fb8a740da0ce0191bdd08f7435cc931e690714d2195391cf03586efa70
5
5
  SHA512:
6
- metadata.gz: 46b2babf63c196c428173cac102fc55d7968e8bfee9ba484a8c25ffa3c2da711502c172a5c60ae84155e0fef7ab1e2bcad1b70367f36612550bceee010f2ac43
7
- data.tar.gz: ca19136ae935ab915d498ab71fb286b9cf30469dbc4503e5f5fb754863cefaa290e1a833b35cedfa0b2533bf64d55987d031514be60b32884145b8df8cc42de7
6
+ metadata.gz: a3c7f43d890a491a7bb3356ec1695a79278a8c19cf61df4f296a1ea6562cbbcfa27764b36cbb22e06f9f27cd53157e2276392bba42856d58212fddb68e92ffac
7
+ data.tar.gz: 9959f0f8290157b96c83011ef770d59b40b845b236e0f8facf24cb6795cd7a837936a8969e380910df2892604dd25f569c66b9ff0c7aa5649e441b5ddf72b32a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.9.1 (2022-09-23)
4
+
5
+ * Read / write absolute path
6
+
3
7
  ## 1.9.0 (2022-09-20)
4
8
 
5
9
  * Add `noop` dsl
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (1.9.0)
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.0)
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(file_path)
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(file_path, result.new_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(file_path)
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(file_path, source)
399
+ node = parse_code(@current_file, source)
400
400
 
401
401
  process_with_node(node) do
402
402
  instance_eval(&@block)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.9.0'
5
+ VERSION = '1.9.1'
6
6
  end
7
7
  end
@@ -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.0
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-20 00:00:00.000000000 Z
11
+ date: 2022-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport