synvert 1.9.0 → 1.10.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 +5 -5
- data/lib/synvert/cli.rb +7 -0
- data/lib/synvert/command.rb +30 -0
- data/lib/synvert/version.rb +1 -1
- data/synvert-ruby.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5bc451c7e131ce0ea0ce597a7a592e31fadd538bb4ae860f721319eac48c8c8
|
4
|
+
data.tar.gz: 60f3428852aff347925f4f73d6d72e4f2ce7fff20a1df32329c48f4b73124369
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37eb6b2c48a04ed7036697d3c04312da7764f87d27bf6bcd2f6891701627c87af65695918464123e8dbacee9db2361fc5ce8c6c0b8a4fcb81d90b39c5b4420a1
|
7
|
+
data.tar.gz: '09ee8a0157777bf69675c9306f9d90e9f9c98f11afb8c80bfbaf593b72e1561c5e83b6fc5f19d4f8be76c107dfaeee9da002b0c658b19783452b76b86f95c457'
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert (1.
|
5
|
-
synvert-core (>= 1.
|
4
|
+
synvert (1.10.0)
|
5
|
+
synvert-core (>= 1.33.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (6.1.7.
|
10
|
+
activesupport (6.1.7.7)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
@@ -42,7 +42,7 @@ GEM
|
|
42
42
|
method_source (1.0.0)
|
43
43
|
minitest (5.22.2)
|
44
44
|
nenv (0.3.0)
|
45
|
-
node_mutation (1.23.
|
45
|
+
node_mutation (1.23.3)
|
46
46
|
node_query (1.15.1)
|
47
47
|
notiffany (0.1.3)
|
48
48
|
nenv (~> 0.1)
|
@@ -83,7 +83,7 @@ GEM
|
|
83
83
|
prettier_print (>= 1.2.0)
|
84
84
|
syntax_tree_ext (0.7.2)
|
85
85
|
syntax_tree
|
86
|
-
synvert-core (1.33.
|
86
|
+
synvert-core (1.33.2)
|
87
87
|
activesupport (< 7.0.0)
|
88
88
|
node_mutation (>= 1.23.2)
|
89
89
|
node_query (>= 1.15.1)
|
data/lib/synvert/cli.rb
CHANGED
@@ -57,6 +57,10 @@ module Synvert
|
|
57
57
|
Command.read_helpers
|
58
58
|
rewriter = Synvert::Core::Utils.eval_snippet(@options[:snippet_name])
|
59
59
|
Command.run_snippet(rewriter, @options[:format])
|
60
|
+
when 'test_bundle_gems'
|
61
|
+
Command.read_helpers
|
62
|
+
rewriter = Synvert::Core::Utils.eval_snippet(@options[:snippet_name])
|
63
|
+
Command.test_snippet_in_bundle_gems(rewriter)
|
60
64
|
else
|
61
65
|
# nothing to do
|
62
66
|
end
|
@@ -155,6 +159,9 @@ module Synvert
|
|
155
159
|
'result format of test, it can be actions or new_source, action is by default' do |test_result|
|
156
160
|
Core::Configuration.test_result = test_result
|
157
161
|
end
|
162
|
+
opts.on '--check-bundle-gems', 'check code in all bundle gems' do
|
163
|
+
@options[:command] = 'test_bundle_gems'
|
164
|
+
end
|
158
165
|
opts.on '-v', '--version', 'show this version' do
|
159
166
|
puts "#{VERSION} (with synvert-core #{Core::VERSION} and parser #{Parser::VERSION})"
|
160
167
|
exit
|
data/lib/synvert/command.rb
CHANGED
@@ -199,6 +199,36 @@ module Synvert
|
|
199
199
|
raise
|
200
200
|
end
|
201
201
|
|
202
|
+
def test_snippet_in_bundle_gems(rewriter)
|
203
|
+
Dir.chdir(Core::Configuration.root_path) do
|
204
|
+
bundle_list_output = `/bin/bash -c -l 'BUNDLE_GEMFILE=./Gemfile bundle list'`
|
205
|
+
raise bundle_list_output unless bundle_list_output.start_with?('Gems included by the bundle:')
|
206
|
+
|
207
|
+
bundle_list_output.lines.each do |line|
|
208
|
+
next unless line.start_with?(' * ')
|
209
|
+
|
210
|
+
_, gem_name, gem_version_with_parentheses = line.split(' ')
|
211
|
+
path = `/bin/bash -c -l 'BUNDLE_GEMFILE=./Gemfile bundle info #{gem_name} --path'`.strip
|
212
|
+
|
213
|
+
Core::Configuration.root_path = path
|
214
|
+
rewriter.reset
|
215
|
+
test_results = rewriter.test
|
216
|
+
affected_file_paths = test_results.filter { |result| result.affected? }
|
217
|
+
.map { |result| result.file_path }
|
218
|
+
if affected_file_paths.size > 0
|
219
|
+
puts "#{gem_name} #{gem_version_with_parentheses}"
|
220
|
+
affected_file_paths.each { |affected_file_path| puts " #{affected_file_path}" }
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
rescue StandardError => e
|
225
|
+
if ENV['DEBUG']
|
226
|
+
puts e.backtrace.join("\n")
|
227
|
+
end
|
228
|
+
puts "Error: #{e.message}"
|
229
|
+
raise
|
230
|
+
end
|
231
|
+
|
202
232
|
def default_snippets_home
|
203
233
|
# ENV['HOME'] may use \ as file separator,
|
204
234
|
# but File.join always uses / as file separator.
|
data/lib/synvert/version.rb
CHANGED
data/synvert-ruby.gemspec
CHANGED
@@ -20,5 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
spec.post_install_message = 'Please run `synvert-ruby --sync` first to sync snippets remotely.'
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'synvert-core', '>= 1.
|
23
|
+
spec.add_runtime_dependency 'synvert-core', '>= 1.33.2'
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.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: 2024-02-
|
11
|
+
date: 2024-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: synvert-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.33.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.33.2
|
27
27
|
description: synvert is used to convert ruby code to better syntax.
|
28
28
|
email:
|
29
29
|
- flyerhzm@gmail.com
|