synvert 0.17.0 → 0.18.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 +4 -0
- data/lib/synvert/cli.rb +27 -0
- data/lib/synvert/version.rb +1 -1
- data/synvert.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbc4490f4b48111cb658dbdf8d86f63f881a137fa40ef5c6050fa57d24392e09
|
4
|
+
data.tar.gz: d5ebc66ea45897622f6ed40e7838817c8dada422d92cd8898feadfb471d47bab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a48d72c516eb52854102bb8620585317295b188d50a0dfb1184e2f548eac20489713932a3fadbcd0e56526f5b8f97c045a2d8a783e4c56ed481c56619733151
|
7
|
+
data.tar.gz: ac409e15e3f22fd082f222c19542418af0d78573066302f293fd0b025108bda0e7eaa401eecba6ff0b4bac1a0ffeb2b9958865a960130859d26f79b51f025cd7
|
data/CHANGELOG.md
CHANGED
data/lib/synvert/cli.rb
CHANGED
@@ -40,6 +40,8 @@ module Synvert
|
|
40
40
|
sync_snippets
|
41
41
|
when 'generate'
|
42
42
|
generate_snippet
|
43
|
+
when 'execute'
|
44
|
+
execute_snippet
|
43
45
|
else
|
44
46
|
# run
|
45
47
|
load_rewriters
|
@@ -94,6 +96,9 @@ module Synvert
|
|
94
96
|
opts.on '--sync', 'sync snippets' do
|
95
97
|
@options[:command] = 'sync'
|
96
98
|
end
|
99
|
+
opts.on '--execute', 'execute snippet' do
|
100
|
+
@options[:command] = 'execute'
|
101
|
+
end
|
97
102
|
opts.on '-r', '--run SNIPPET_NAME', 'run specified snippet, e.g. ruby/new_hash_syntax' do |snippet_name|
|
98
103
|
@options[:snippet_name] = snippet_name
|
99
104
|
end
|
@@ -250,6 +255,28 @@ module Synvert
|
|
250
255
|
end
|
251
256
|
end
|
252
257
|
|
258
|
+
# execute snippet
|
259
|
+
def execute_snippet
|
260
|
+
input = STDIN.read
|
261
|
+
if plain_output?
|
262
|
+
puts "===== execute started ====="
|
263
|
+
rewriter = eval(input)
|
264
|
+
rewriter.warnings.each do |warning|
|
265
|
+
puts '[Warn] ' + warning.message
|
266
|
+
end
|
267
|
+
puts rewriter.todo if rewriter.todo
|
268
|
+
puts "===== execute done ====="
|
269
|
+
elsif json_output?
|
270
|
+
rewriter = eval(input)
|
271
|
+
output = {
|
272
|
+
affected_files: rewriter.affected_files.union(rewriter.sub_snippets.sum([], &:affected_files)).to_a,
|
273
|
+
warnings: rewriter.warnings.union(rewriter.sub_snippets.sum([], &:warnings)),
|
274
|
+
todo: rewriter.todo
|
275
|
+
}
|
276
|
+
puts JSON.generate(output)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
253
280
|
# generate a new snippet
|
254
281
|
def generate_snippet
|
255
282
|
group, name = @options[:snippet_name].split('/')
|
data/lib/synvert/version.rb
CHANGED
data/synvert.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 --sync` first to sync snippets remotely.'
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'synvert-core', '>= 0.
|
23
|
+
spec.add_runtime_dependency 'synvert-core', '>= 0.42.1'
|
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: 0.
|
4
|
+
version: 0.18.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: 2021-
|
11
|
+
date: 2021-07-14 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: 0.
|
19
|
+
version: 0.42.1
|
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: 0.
|
26
|
+
version: 0.42.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
rubygems_version: 3.1.
|
126
|
+
rubygems_version: 3.1.6
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: synvert = syntax + convert.
|