synvert-core 1.8.0 → 1.9.0

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: 00661750a3522a9983d5eec1f064f62bf0d335e05e3b2a9cb7bb7222b04e20a2
4
- data.tar.gz: 5a35b831ca678486f4a51db2ae8a57bed58617299a0c26c9cbc0c462351ffd3d
3
+ metadata.gz: aa46b311ec4eb71e3a23d060e1a23dcceffe1b0ddea066a64043aea29635d143
4
+ data.tar.gz: 7dd8b27cfc88e3d98a876da7592e1df466e00a6c1b79309d34abc475e287b5a7
5
5
  SHA512:
6
- metadata.gz: b18bcf0f9f344c2c8661d7e4edf1a4f768d67175f45b34d2bb37b321f38681840c29b8e9a0fa61ee295329909f3093de4b7703e6dec21066190336ee8ceb1b5a
7
- data.tar.gz: 0f334dc34d82d15235381f3a9be7651707b5a7a0e5614e29f48310407c70384ac6f1594f2b8643dc97577e0e55a4b6165f3174071e2887f424a76ed4d5f3b3cb
6
+ metadata.gz: 46b2babf63c196c428173cac102fc55d7968e8bfee9ba484a8c25ffa3c2da711502c172a5c60ae84155e0fef7ab1e2bcad1b70367f36612550bceee010f2ac43
7
+ data.tar.gz: ca19136ae935ab915d498ab71fb286b9cf30469dbc4503e5f5fb754863cefaa290e1a833b35cedfa0b2533bf64d55987d031514be60b32884145b8df8cc42de7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.9.0 (2022-09-20)
4
+
5
+ * Add `noop` dsl
6
+
7
+ ## 1.8.1 (2022-09-17)
8
+
9
+ * Fix test snippet, return test results
10
+
3
11
  ## 1.8.0 (2022-09-17)
4
12
 
5
13
  * Rename config `path` to `root_path`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (1.8.0)
4
+ synvert-core (1.9.0)
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.3.3)
52
+ node_mutation (1.4.0)
53
53
  activesupport (< 7.0.0)
54
54
  erubis
55
55
  node_query (1.6.0)
data/README.md CHANGED
@@ -96,3 +96,4 @@ Actions:
96
96
  * [replace_with](./Synvert/Core/Rewriter/Instance.html#replace_with-instance_method) - replace the whole code of current node
97
97
  * [warn](./Synvert/Core/Rewriter/Instance.html#warn-instance_method) - warn message
98
98
  * [replace_erb_stmt_with_expr](./Synvert/Core/Rewriter/Instance.html#replace_erb_stmt_with_expr-instance_method) - replace erb stmt code to expr code
99
+ * [noop](./Synvert/Core/Rewriter/Instance.html#noop-instance_method) - no operation
@@ -41,7 +41,7 @@ module Synvert::Core
41
41
  # It finds specified files, for each file, it executes the block code, tests the original code,
42
42
  # then returns the actions.
43
43
  def test
44
- get_file_paths.each do |file_path|
44
+ get_file_paths.map do |file_path|
45
45
  test_file(file_path)
46
46
  end
47
47
  end
@@ -325,6 +325,11 @@ module Synvert::Core
325
325
  @current_mutation.wrap(@current_node, with: with)
326
326
  end
327
327
 
328
+ # Parse +noop dsl.
329
+ def noop
330
+ @current_mutation.noop(@current_node)
331
+ end
332
+
328
333
  # Parse +warn+ dsl, it creates a {Synvert::Core::Rewriter::Warning} to save warning message.
329
334
  # @example
330
335
  # within_files 'vendor/plugins' do
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.8.0'
5
+ VERSION = '1.9.0'
6
6
  end
7
7
  end
@@ -176,6 +176,13 @@ module Synvert::Core
176
176
  instance.wrap with: 'module Foobar'
177
177
  end
178
178
 
179
+ it 'parses noop' do
180
+ instance.current_mutation = double
181
+ instance.current_node = double
182
+ expect(instance.current_mutation).to receive(:noop).with(instance.current_node)
183
+ instance.noop
184
+ end
185
+
179
186
  it 'parses warn' do
180
187
  expect(Rewriter::Warning).to receive(:new).with(instance, 'foobar')
181
188
  instance.warn 'foobar'
@@ -205,7 +212,7 @@ module Synvert::Core
205
212
  assert post.valid?
206
213
  end
207
214
  EOS
208
- expect(Dir).to receive(:glob).with('./spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb'])
215
+ expect(Dir).to receive(:glob).with('spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb'])
209
216
  expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
210
217
  expect(File).to receive(:write).with('spec/models/post_spec.rb', output)
211
218
  instance.process
@@ -230,7 +237,7 @@ module Synvert::Core
230
237
  config.include FactoryGirl::Syntax::Methods
231
238
  end
232
239
  EOS
233
- expect(Dir).to receive(:glob).with('./spec/spec_helper.rb').and_return(['spec/spec_helper.rb'])
240
+ expect(Dir).to receive(:glob).with('spec/spec_helper.rb').and_return(['spec/spec_helper.rb'])
234
241
  expect(File).to receive(:read).with('spec/spec_helper.rb', encoding: 'UTF-8').and_return(input)
235
242
  expect(File).not_to receive(:write).with('spec/spec_helper.rb', output)
236
243
  instance.process
@@ -257,7 +264,7 @@ module Synvert::Core
257
264
  assert post.valid?
258
265
  end
259
266
  EOS
260
- expect(Dir).to receive(:glob).with('./spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb']).twice
267
+ expect(Dir).to receive(:glob).with('spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb']).twice
261
268
  expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
262
269
  expect(File).to receive(:write).with('spec/models/post_spec.rb', output)
263
270
  expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(output)
@@ -284,7 +291,7 @@ module Synvert::Core
284
291
  assert post.valid?
285
292
  end
286
293
  EOS
287
- expect(Dir).to receive(:glob).with('./spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb'])
294
+ expect(Dir).to receive(:glob).with('spec/**/*_spec.rb').and_return(['spec/models/post_spec.rb'])
288
295
  expect(File).to receive(:read).with('spec/models/post_spec.rb', encoding: 'UTF-8').and_return(input)
289
296
  results = instance.test
290
297
  expect(results[0].file_path).to eq 'spec/models/post_spec.rb'
@@ -308,7 +315,7 @@ module Synvert::Core
308
315
  config.include FactoryGirl::Syntax::Methods
309
316
  end
310
317
  EOS
311
- expect(Dir).to receive(:glob).with('./spec/spec_helper.rb').and_return(['spec/spec_helper.rb'])
318
+ expect(Dir).to receive(:glob).with('spec/spec_helper.rb').and_return(['spec/spec_helper.rb'])
312
319
  expect(File).to receive(:read).with('spec/spec_helper.rb', encoding: 'UTF-8').and_return(input)
313
320
  result = instance.test
314
321
  expect(result[0].file_path).to eq 'spec/spec_helper.rb'
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.8.0
4
+ version: 1.9.0
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-17 00:00:00.000000000 Z
11
+ date: 2022-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport