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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79e9fa512dd92b847aa01994b793aae940e2bfecead906f1dd085795f969905c
4
- data.tar.gz: bac800d7f8501f008139875f3c51a2302055e9013e9e00458d10e53874819636
3
+ metadata.gz: c5bc451c7e131ce0ea0ce597a7a592e31fadd538bb4ae860f721319eac48c8c8
4
+ data.tar.gz: 60f3428852aff347925f4f73d6d72e4f2ce7fff20a1df32329c48f4b73124369
5
5
  SHA512:
6
- metadata.gz: 075bdfcbd282f4f7e06192879ffb5f940c94b81e71ef6f246050a0146ca06445b13bedd0b8e2d75c338cca863c708dc04af6d925c57dbe97e4ee3ec192bddfe5
7
- data.tar.gz: e1bb347de2121ffb638e68f49d9fbe95f27e905d43f7b7390b03b6b632c620299d8f02fd8f5521d12c2285018357b7e2d6143c036b12139c1d2670b5899abe2c
6
+ metadata.gz: 37eb6b2c48a04ed7036697d3c04312da7764f87d27bf6bcd2f6891701627c87af65695918464123e8dbacee9db2361fc5ce8c6c0b8a4fcb81d90b39c5b4420a1
7
+ data.tar.gz: '09ee8a0157777bf69675c9306f9d90e9f9c98f11afb8c80bfbaf593b72e1561c5e83b6fc5f19d4f8be76c107dfaeee9da002b0c658b19783452b76b86f95c457'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.10.0 (2024-02-24)
4
+
5
+ * Add `--check-bundle-gems` flag to check code in all bundle gems
6
+ * Update `synvert-core` to 1.33.2
7
+
3
8
  ## 1.9.0 (2024-02-20)
4
9
 
5
10
  * Fix query available rewriters
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert (1.9.0)
5
- synvert-core (>= 1.31.0)
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.6)
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.2)
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.0)
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
@@ -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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert
4
- VERSION = '1.9.0'
4
+ VERSION = '1.10.0'
5
5
  end
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.31.0'
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.9.0
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-20 00:00:00.000000000 Z
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.31.0
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.31.0
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