synvert-core 1.20.0 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/README.md +1 -0
- data/lib/synvert/core/configuration.rb +6 -1
- data/lib/synvert/core/rewriter/instance.rb +8 -1
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/rewriter/instance_spec.rb +6 -0
- data/synvert-core-ruby.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df27af331a60def04866041f84ae64b9fe15555996ec2289015eb2c97d965f68
|
4
|
+
data.tar.gz: '092e9456741b2b43516146756ba738f6997a5252ba03dff226bde042333b4bf4'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05aea1fff55d3a96596dc54de49db457ffe4fac87677bc9dada1d8af4ec6f45397b586207a0e8214fbbedbeed42f58a4fe92934a6095a610c834332632c1901a
|
7
|
+
data.tar.gz: ed6ab4c13e2aa0f406de8f4eff041f4fdb39ba37430902284994eb7ed303352bb4a1b459416a73fd049196646eed95bd332721a7f9b9f6da8dcf6a119fdb25e2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (1.
|
4
|
+
synvert-core (1.21.0)
|
5
5
|
activesupport (< 7.0.0)
|
6
6
|
erubis
|
7
|
-
node_mutation (>= 1.
|
7
|
+
node_mutation (>= 1.9.0)
|
8
8
|
node_query (>= 1.12.0)
|
9
9
|
parallel
|
10
10
|
parser
|
@@ -50,7 +50,7 @@ GEM
|
|
50
50
|
method_source (1.0.0)
|
51
51
|
minitest (5.17.0)
|
52
52
|
nenv (0.3.0)
|
53
|
-
node_mutation (1.
|
53
|
+
node_mutation (1.9.0)
|
54
54
|
erubis
|
55
55
|
node_query (1.12.0)
|
56
56
|
notiffany (0.1.3)
|
data/README.md
CHANGED
@@ -104,6 +104,7 @@ Actions:
|
|
104
104
|
Others:
|
105
105
|
|
106
106
|
* [wrap_with_quotes](https://xinminlabs.github.io/synvert-core-ruby/Synvert/Core/Rewriter/Instance.html#wrap_with_quotes-instance_method) - wrap string code with single or doulbe quotes
|
107
|
+
* [add_leading_spaces](https://xinminlabs.github.io/synvert-core-ruby/Synvert/Core/Rewriter/Instance.html#add_leading_spaces-instance_method) - add leading spaces before the string code
|
107
108
|
|
108
109
|
|
109
110
|
Attributes:
|
@@ -10,7 +10,8 @@ module Synvert::Core
|
|
10
10
|
# @!attribute [w] show_run_process
|
11
11
|
# @!attribute [w] number_of_workers
|
12
12
|
# @!attribute [w] single_quote
|
13
|
-
|
13
|
+
# @!attribute [w] tab_width
|
14
|
+
attr_writer :root_path, :skip_paths, :only_paths, :show_run_process, :number_of_workers, :single_quote, :tab_width
|
14
15
|
|
15
16
|
# Get the path.
|
16
17
|
#
|
@@ -53,6 +54,10 @@ module Synvert::Core
|
|
53
54
|
def single_quote
|
54
55
|
@single_quote.nil? ? true : @single_quote
|
55
56
|
end
|
57
|
+
|
58
|
+
def tab_width
|
59
|
+
@tab_width || 2
|
60
|
+
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
end
|
@@ -22,7 +22,7 @@ module Synvert::Core
|
|
22
22
|
if rewriter.options[:strategy] == Strategy::ALLOW_INSERT_AT_SAME_POSITION
|
23
23
|
strategy |= NodeMutation::Strategy::ALLOW_INSERT_AT_SAME_POSITION
|
24
24
|
end
|
25
|
-
NodeMutation.configure({ strategy: strategy })
|
25
|
+
NodeMutation.configure({ strategy: strategy, tab_width: Configuration.tab_width })
|
26
26
|
rewriter.helpers.each { |helper| singleton_class.send(:define_method, helper[:name], &helper[:block]) }
|
27
27
|
end
|
28
28
|
|
@@ -423,6 +423,13 @@ module Synvert::Core
|
|
423
423
|
quote + escaped_str + quote
|
424
424
|
end
|
425
425
|
|
426
|
+
# Add leading spaces before the str according to Configuration.tab_width.
|
427
|
+
# @param str [String]
|
428
|
+
# @return [String]
|
429
|
+
def add_leading_spaces(str)
|
430
|
+
" " * Configuration.tab_width + str;
|
431
|
+
end
|
432
|
+
|
426
433
|
private
|
427
434
|
|
428
435
|
# Read file source.
|
data/lib/synvert/core/version.rb
CHANGED
data/synvert-core-ruby.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_runtime_dependency "activesupport", "< 7.0.0"
|
23
23
|
spec.add_runtime_dependency "erubis"
|
24
24
|
spec.add_runtime_dependency "node_query", ">= 1.12.0"
|
25
|
-
spec.add_runtime_dependency "node_mutation", ">= 1.
|
25
|
+
spec.add_runtime_dependency "node_mutation", ">= 1.9.0"
|
26
26
|
spec.add_runtime_dependency "parser"
|
27
27
|
spec.add_runtime_dependency "parser_node_ext", ">= 0.9.0"
|
28
28
|
spec.add_runtime_dependency "parallel"
|
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.
|
4
|
+
version: 1.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.9.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.9.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: parser
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|