synvert-core 1.10.0 → 1.10.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: 16de1af456b15373297aebe409711e1725bb329e3da7d4fa8d84023348ceb236
4
- data.tar.gz: e034ccf44cfce96335f10a38d5aa36793faa08c84e8d75509fc658824cf64676
3
+ metadata.gz: 966c0db8262c57bb94be47d44c5638c9c9607728da335b4bde9d39c49f7bc665
4
+ data.tar.gz: e2be9da04e58da3b236d03006883778f6e202d9bbb5a8fa922dd6339117a6a2a
5
5
  SHA512:
6
- metadata.gz: 3f745e87c308b417c5938c2731af00254abe5beba70472bca1ebfdf534127b7df8f6ab33261b8eb5d31d33deaa471927a780a14720f0ee406eea44f5a7e06495
7
- data.tar.gz: ac2c35d21a4e6558b14c861966c6326446926bc27cc9e2d278757df31cf68a33142e62d47f9d40e5ec72c1d3fd8efde6574046e00506c9a12d0a800580a00023
6
+ metadata.gz: 1e1f6a8a25817ebe46c03bdbf6e7982f559c426bf5537c2ae28549215ad77a03c45768af6b3f74ba84e34105c6d1e8c9cbb365cb1f431220b59028678c373dcd
7
+ data.tar.gz: 44f57f854c537825acb57217b216294f226df391b1eb185fd1558f463084a91ad9fcc296f54eba05c5b66e1d995a40c897d267fff662ff5bf85472d83d993be1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.10.1 (2022-10-09)
4
+
5
+ * Do not reset `@options`
6
+ * `Rewriter.fetch` does not raise error if rewriter not found
7
+
3
8
  ## 1.10.0 (2022-10-09)
4
9
 
5
10
  * Eval snippet by http url, file path or snippet name
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (1.10.0)
4
+ synvert-core (1.10.1)
5
5
  activesupport (< 7.0.0)
6
6
  erubis
7
7
  node_mutation
@@ -51,14 +51,10 @@ module Synvert::Core
51
51
  # @param group [String] rewrtier group.
52
52
  # @param name [String] rewrtier name.
53
53
  # @return [Synvert::Core::Rewriter] the matching rewriter.
54
- # @raise [Synvert::Core::RewriterNotFound] if the registered rewriter is not found.
55
54
  def fetch(group, name)
56
55
  group = group.to_s
57
56
  name = name.to_s
58
- rewriter = rewriters.dig(group, name)
59
- raise RewriterNotFound, "Rewriter #{group} #{name} not found" unless rewriter
60
-
61
- rewriter
57
+ rewriters.dig(group, name)
62
58
  end
63
59
 
64
60
  # Get all available rewriters
@@ -136,24 +132,16 @@ module Synvert::Core
136
132
  # It will call the block but doesn't change any file.
137
133
  def process_with_sandbox
138
134
  @options[:run_instance] = false
139
- begin
140
- process
141
- ensure
142
- @options[:run_instance] = true
143
- end
135
+ process
144
136
  end
145
137
 
146
138
  def test
147
139
  @options[:write_to_file] = false
148
- begin
149
- @affected_files = Set.new
150
- instance_eval(&@block)
140
+ @affected_files = Set.new
141
+ instance_eval(&@block)
151
142
 
152
- if !@affected_files.empty? && @redo_until_no_change # redo
153
- test
154
- end
155
- ensure
156
- @options[:write_to_file] = true
143
+ if !@affected_files.empty? && @redo_until_no_change # redo
144
+ test
157
145
  end
158
146
  @test_results
159
147
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.10.0'
5
+ VERSION = '1.10.1'
6
6
  end
7
7
  end
data/lib/synvert/core.rb CHANGED
@@ -17,8 +17,6 @@ module Synvert
17
17
  autoload :Configuration, 'synvert/core/configuration'
18
18
  autoload :Rewriter, 'synvert/core/rewriter'
19
19
  autoload :Engine, 'synvert/core/engine'
20
- autoload :RewriterNotFound, 'synvert/core/exceptions'
21
- autoload :MethodNotSupported, 'synvert/core/exceptions'
22
20
  autoload :Utils, 'synvert/core/utils'
23
21
  end
24
22
  end
@@ -238,15 +238,6 @@ module Synvert::Core
238
238
  rewriter.process
239
239
  expect(Rewriter.fetch('group', 'sub_rewriter')).not_to be_nil
240
240
  end
241
-
242
- it 'raises RewriterNotFound' do
243
- rewriter =
244
- Rewriter.new 'group', 'name' do
245
- add_snippet :group, :not_exist
246
- end
247
- expect { rewriter.process }
248
- .to raise_error(RewriterNotFound)
249
- end
250
241
  end
251
242
 
252
243
  it 'parses helper_method' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
@@ -116,7 +116,6 @@ files:
116
116
  - lib/synvert/core/configuration.rb
117
117
  - lib/synvert/core/engine.rb
118
118
  - lib/synvert/core/engine/erb.rb
119
- - lib/synvert/core/exceptions.rb
120
119
  - lib/synvert/core/node_ext.rb
121
120
  - lib/synvert/core/rewriter.rb
122
121
  - lib/synvert/core/rewriter/action/replace_erb_stmt_with_expr_action.rb
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Synvert::Core
4
- # Rewriter not found exception.
5
- class RewriterNotFound < RuntimeError
6
- end
7
-
8
- # Method not supported exception.
9
- class MethodNotSupported < RuntimeError
10
- end
11
- end