synvert 1.2.5 → 1.3.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: 5a5aafd01e044e25452de4751866ae7784b2d094dc00a60aea6b3893001cfdfe
4
- data.tar.gz: feebe5fa35b6d849ac9fae2f9264ed8006739cc97763f5674185d8d2180272af
3
+ metadata.gz: b027ed84abc77affd2b0e62c61bbdee527297588384654e126feef986ca52268
4
+ data.tar.gz: eaa31a0227ddd3c5f1d0cf13a80bb13cd60b87304446883c1a3282c6f56b28ab
5
5
  SHA512:
6
- metadata.gz: 5c374ab4211680408d85ae820eaab5f06ad6a7dd81cb4af5df8cfc9319cd0546526c5718c85346cfdac5a07e789fd48ca8467821a3464e26f0566bcc5ca4ffb5
7
- data.tar.gz: b954b52b313a2dd0fbebe99d43cce2719227f77f1c2714543593f9082c5997a88b180524bcaf43128a0345b5003fd04566a4c63e0659999f291cf6fe27918b26
6
+ metadata.gz: 868a5ed598a7b81add0e4055b0911da95d19afff555cfd6c668a2967f8ee328c7a781792f5f61a1f2faecf486e3d269dead9696d78835f4d9ed531413e5d6b59
7
+ data.tar.gz: 3a8e9f1244604d9dab4a8ffacd9dc99432e9be531d41b3dd907daa21c4f8259947f2177450b193be13aa981d97f72e0f76758dba43968ab19d5a650ee00c0d54
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.3.0 (2023-02-08)
4
+
5
+ * Add `--double-quote` flag
6
+ * Update `synvert-core` to 1.20.0
7
+
8
+ ## 1.2.6 (2023-02-02)
9
+
10
+ * Output error message
11
+
3
12
  ## 1.2.5 (2023-02-01)
4
13
 
5
14
  * Remove `rewriter.todo`
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert (1.2.5)
5
- synvert-core (>= 1.18.0)
4
+ synvert (1.3.0)
5
+ synvert-core (>= 1.20.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -39,7 +39,7 @@ GEM
39
39
  parallel (1.22.1)
40
40
  parser (3.2.0.0)
41
41
  ast (~> 2.4.1)
42
- parser_node_ext (0.9.0)
42
+ parser_node_ext (0.10.0)
43
43
  parser
44
44
  public_suffix (4.0.6)
45
45
  rake (13.0.6)
@@ -63,7 +63,7 @@ GEM
63
63
  simplecov-html (~> 0.10.0)
64
64
  simplecov-html (0.10.2)
65
65
  sync (0.5.0)
66
- synvert-core (1.18.0)
66
+ synvert-core (1.20.0)
67
67
  activesupport (< 7.0.0)
68
68
  erubis
69
69
  node_mutation (>= 1.8.2)
@@ -85,10 +85,7 @@ GEM
85
85
  zeitwerk (2.6.6)
86
86
 
87
87
  PLATFORMS
88
- x86_64-darwin-20
89
- x86_64-darwin-21
90
- x86_64-darwin-22
91
- x86_64-linux
88
+ ruby
92
89
 
93
90
  DEPENDENCIES
94
91
  bundler
data/README.md CHANGED
@@ -47,13 +47,16 @@ Usage: synvert-ruby [project_path]
47
47
  -o, --open SNIPPET_NAME Open a snippet
48
48
  -g, --generate NEW_SNIPPET_NAME generate a new snippet
49
49
  --sync sync snippets
50
- --execute execute snippet
50
+ --execute EXECUTE_COMMAND execute snippet
51
51
  -r, --run SNIPPET_NAME run a snippet with snippet name, e.g. ruby/new_hash_syntax, or remote url, or local file path
52
52
  -t, --test SNIPPET_NAME test a snippet with snippet name, e.g. ruby/new_hash_syntax, or remote url, or local file path
53
53
  --show-run-process show processing files when running a snippet
54
54
  --only-paths DIRECTORIES only specified files or directories, separated by comma, e.g. app/models,app/controllers
55
55
  --skip-paths FILE_PATTERNS skip specified files or directories, separated by comma, e.g. vendor/,lib/**/*.rb
56
56
  -f, --format FORMAT output format
57
+ --number-of-workers NUMBER_OF_WORKERS
58
+ set the number of workers, if it is greater than 1, it tests snippet in parallel
59
+ --double-quote prefer double quote, it uses single quote by default
57
60
  -v, --version show this version
58
61
  ```
59
62
 
data/lib/synvert/cli.rb CHANGED
@@ -60,6 +60,8 @@ module Synvert
60
60
  puts "file #{e.diagnostic.location.source_buffer.name}"
61
61
  puts "line #{e.diagnostic.location.line}"
62
62
  false
63
+ rescue StandardError
64
+ false
63
65
  end
64
66
 
65
67
  private
@@ -122,6 +124,9 @@ module Synvert
122
124
  opts.on '--number-of-workers NUMBER_OF_WORKERS', 'set the number of workers, if it is greater than 1, it tests snippet in parallel' do |number_of_workers|
123
125
  Core::Configuration.number_of_workers = number_of_workers.to_i
124
126
  end
127
+ opts.on '--double-quote', 'prefer double quote, it uses single quote by default' do |double_quote|
128
+ Core::Configuration.single_quote = false
129
+ end
125
130
  opts.on '-v', '--version', 'show this version' do
126
131
  puts "#{VERSION} (with synvert-core #{Core::VERSION} and parser #{Parser::VERSION})"
127
132
  exit
@@ -246,12 +251,22 @@ module Synvert
246
251
  }
247
252
  puts JSON.generate(output)
248
253
  end
254
+ rescue StandardError => e
255
+ if plain_output?
256
+ puts "Error: #{e.message}"
257
+ else
258
+ puts JSON.generate(error: e.message)
259
+ end
260
+ raise
249
261
  end
250
262
 
251
263
  # test a snippet
252
264
  def test_snippet(rewriter)
253
265
  results = rewriter.test
254
266
  puts JSON.generate(results)
267
+ rescue StandardError => e
268
+ puts JSON.generate(error: e.message)
269
+ raise
255
270
  end
256
271
 
257
272
  # execute snippet
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert
4
- VERSION = '1.2.5'
4
+ VERSION = '1.3.0'
5
5
  end
data/synvert-ruby.gemspec CHANGED
@@ -20,7 +20,7 @@ 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.18.0'
23
+ spec.add_runtime_dependency 'synvert-core', '>= 1.20.0'
24
24
 
25
25
  spec.add_development_dependency 'bundler'
26
26
  spec.add_development_dependency 'rake'
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.2.5
4
+ version: 1.3.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: 2023-02-01 00:00:00.000000000 Z
11
+ date: 2023-02-08 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.18.0
19
+ version: 1.20.0
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.18.0
26
+ version: 1.20.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement