tomograph 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +5 -0
- data/exe/tomograph +19 -3
- data/lib/tomograph/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72667f1617b3f8b16e2c237632c8b90055da3f8a
|
4
|
+
data.tar.gz: 8afa64e08a53277018cd9369b4d6d1e1aaf74a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 405ae4d521121f17e3ddfa7fe5a11872507db656c2f8432694e9c36ff3282421f52c62682c51c91b34069db0e87a6df9aee99125f0f0f56f230ef730073e83df
|
7
|
+
data.tar.gz: 63b54fc46fdda347372b85405a85a66789296a6f11da63bd913d89a6900ab3bfd853b0b93ec5b6d304b7bfd82163482890ff998f3882da115d61a7083821cd4e
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.0
|
data/CHANGELOG.md
CHANGED
data/exe/tomograph
CHANGED
@@ -14,6 +14,16 @@ description 'Converts API Blueprint to JSON Schema'
|
|
14
14
|
on('-f INPUT_FORMAT', '--format', 'Force input format: "apib" or "yaml". Default: detect by file extension.')
|
15
15
|
arg :input, 'path/to/doc.apib (API Blueprint) or path/to/doc.yaml (API Elements)'
|
16
16
|
arg :output, 'path/to/doc.json'
|
17
|
+
on('--exclude-description', 'Exclude "description" keys.')
|
18
|
+
|
19
|
+
def prune!(obj, unwanted_key)
|
20
|
+
if obj.is_a?(Hash)
|
21
|
+
obj.delete(unwanted_key)
|
22
|
+
obj.each_value { |value| prune!(value, unwanted_key) }
|
23
|
+
elsif obj.is_a?(Array)
|
24
|
+
obj.each { |value| prune!(value, unwanted_key) }
|
25
|
+
end
|
26
|
+
end
|
17
27
|
|
18
28
|
main do |input, output|
|
19
29
|
opt_format = options['format']
|
@@ -34,7 +44,6 @@ main do |input, output|
|
|
34
44
|
else
|
35
45
|
fail 'Unsupported input format!'
|
36
46
|
end
|
37
|
-
|
38
47
|
format_key = case format
|
39
48
|
when :apib
|
40
49
|
:apib_path
|
@@ -44,8 +53,15 @@ main do |input, output|
|
|
44
53
|
fail 'Unimplemented!'
|
45
54
|
end
|
46
55
|
tomogram = Tomograph::Tomogram.new({format_key => input})
|
47
|
-
|
48
|
-
|
56
|
+
json = if options['exclude-description']
|
57
|
+
actions = tomogram.to_a.map(&:to_hash)
|
58
|
+
prune!(actions, 'description')
|
59
|
+
MultiJson.dump(actions, pretty: true)
|
60
|
+
else
|
61
|
+
tomogram.to_json
|
62
|
+
end
|
63
|
+
File.open(output, 'w') do |file|
|
64
|
+
file.write(json)
|
49
65
|
end
|
50
66
|
0
|
51
67
|
end
|
data/lib/tomograph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomograph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.efimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: methadone
|
@@ -168,6 +168,7 @@ extra_rdoc_files: []
|
|
168
168
|
files:
|
169
169
|
- ".gitignore"
|
170
170
|
- ".rubocop.yml"
|
171
|
+
- ".ruby-version"
|
171
172
|
- ".travis.yml"
|
172
173
|
- CHANGELOG.md
|
173
174
|
- CODE_OF_CONDUCT.md
|