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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bbbc30c0b54bf90c58e8f8f5248673d0052a74c
4
- data.tar.gz: 099337cd6e0cdcc9d0cdb323cfcfa14cb2d649f7
3
+ metadata.gz: 72667f1617b3f8b16e2c237632c8b90055da3f8a
4
+ data.tar.gz: 8afa64e08a53277018cd9369b4d6d1e1aaf74a2e
5
5
  SHA512:
6
- metadata.gz: 96f3eef614a44ccb70e809a66a6a35d2d4ede03cab5ac9abd441fac640fad0624b247bcb71245e7a448930337265ebf1e9cf81f2121e2388475e69bc1b26e71b
7
- data.tar.gz: 1ec43d46a0889ed787a109a2ac599239deb3bb7ac7aff1b368118c9c39a5f36ae054f3da7adb63c78f67ee626c248e55da2b050182bc4c2a0a185d349b1e4273
6
+ metadata.gz: 405ae4d521121f17e3ddfa7fe5a11872507db656c2f8432694e9c36ff3282421f52c62682c51c91b34069db0e87a6df9aee99125f0f0f56f230ef730073e83df
7
+ data.tar.gz: 63b54fc46fdda347372b85405a85a66789296a6f11da63bd913d89a6900ab3bfd853b0b93ec5b6d304b7bfd82163482890ff998f3882da115d61a7083821cd4e
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ### 2.3.0 - 2018-09-27
4
+
5
+ * features
6
+ * add exclude-description option for command-line tool
7
+
3
8
  ### 2.2.1 - 2018-07-06
4
9
 
5
10
  * bug fixes
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
- File.open(output, 'w') do |f|
48
- f.write(tomogram.to_json)
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
@@ -1,3 +1,3 @@
1
1
  module Tomograph
2
- VERSION = '2.2.1'.freeze
2
+ VERSION = '2.3.0'.freeze
3
3
  end
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.2.1
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-07-06 00:00:00.000000000 Z
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