cbor-diag 0.5.15 → 0.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cbor2diag.rb +5 -1
- data/bin/cbor2json.rb +10 -0
- data/bin/cbor2u8.rb +9 -0
- data/bin/cbor2yaml.rb +10 -0
- data/bin/cborleader2diag.rb +13 -1
- data/bin/cborseq2diag.rb +5 -1
- data/bin/cborseq2json.rb +10 -0
- data/bin/cborseq2neatjson.rb +10 -0
- data/bin/cborseq2yaml.rb +11 -0
- data/bin/json2cbor.rb +10 -4
- data/bin/json2json.rb +17 -0
- data/bin/json2neatjson.rb +19 -0
- data/bin/json2yaml.rb +25 -0
- data/bin/yaml2cbor.rb +10 -4
- data/bin/yaml2json.rb +19 -0
- data/cbor-diag.gemspec +3 -1
- metadata +40 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce766a02a4e89480afebeacc8d954f187bed26e306e4100529cc7174a3a7493e
|
4
|
+
data.tar.gz: ade034f6ae05df4ddc29a100b523c6ed19127cfc7b83ee37e2f5482c6212fb49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61c8f2391568315618435c2470d442b7d0d1baf378f302dcbaf089179d4fc3a3af818ff95dba546264d86d44f1da8a4abc8e5450e121d557796eb07f16064571
|
7
|
+
data.tar.gz: b4f20f51b47a6b2771d2c1a42668dcdf6a25b49e8d7a020254e1ae5a60f2c896cdd972b80a416d3f3026ddbf89d29d03f67ea9cc97be7045a5e48d9c4b5a9b00
|
data/bin/cbor2diag.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'cbor-diagnostic'
|
3
|
+
require 'cbor-deterministic'
|
4
|
+
require 'cbor-canonical'
|
3
5
|
|
4
6
|
options = ''
|
5
|
-
while /\A-([
|
7
|
+
while /\A-([cdetu]+)\z/ === ARGV[0]
|
6
8
|
options << $1
|
7
9
|
ARGV.shift
|
8
10
|
end
|
@@ -10,6 +12,8 @@ end
|
|
10
12
|
ARGF.binmode
|
11
13
|
i = ARGF.read
|
12
14
|
o = CBOR.decode(i)
|
15
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
16
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
13
17
|
puts o.cbor_diagnostic(try_decode_embedded: /e/ === options,
|
14
18
|
bytes_as_text: /t/ === options,
|
15
19
|
utf8: /u/ === options)
|
data/bin/cbor2json.rb
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'json'
|
3
3
|
require 'cbor-pure'
|
4
|
+
require 'cbor-deterministic'
|
5
|
+
require 'cbor-canonical'
|
6
|
+
|
7
|
+
options = ''
|
8
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
9
|
+
options << $1
|
10
|
+
ARGV.shift
|
11
|
+
end
|
4
12
|
|
5
13
|
ARGF.binmode
|
6
14
|
i = ARGF.read
|
7
15
|
o = CBOR.decode(i)
|
16
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
17
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
8
18
|
puts JSON.pretty_generate(o)
|
data/bin/cbor2u8.rb
ADDED
data/bin/cbor2yaml.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require 'psych.rb' # WTF
|
3
3
|
require 'yaml'
|
4
4
|
require 'cbor-pure'
|
5
|
+
require 'cbor-deterministic'
|
6
|
+
require 'cbor-canonical'
|
5
7
|
|
6
8
|
class Array
|
7
9
|
def to_yaml_style()
|
@@ -9,7 +11,15 @@ class Array
|
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
14
|
+
options = ''
|
15
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
16
|
+
options << $1
|
17
|
+
ARGV.shift
|
18
|
+
end
|
19
|
+
|
12
20
|
ARGF.binmode
|
13
21
|
i = ARGF.read
|
14
22
|
o = CBOR.decode(i)
|
23
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
24
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
15
25
|
puts YAML.dump(o)
|
data/bin/cborleader2diag.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'cbor-diagnostic'
|
3
|
+
require 'cbor-deterministic'
|
4
|
+
require 'cbor-canonical'
|
5
|
+
|
6
|
+
options = ''
|
7
|
+
while /\A-([cdetu]+)\z/ === ARGV[0]
|
8
|
+
options << $1
|
9
|
+
ARGV.shift
|
10
|
+
end
|
3
11
|
|
4
12
|
ARGF.binmode
|
5
13
|
i = ARGF.read
|
@@ -7,4 +15,8 @@ o,r = CBOR.decode_with_rest(i)
|
|
7
15
|
if r != ''
|
8
16
|
warn "** ignoring rest of #{r.bytesize} bytes after first CBOR data item"
|
9
17
|
end
|
10
|
-
|
18
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
19
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
20
|
+
puts o.cbor_diagnostic(try_decode_embedded: /e/ === options,
|
21
|
+
bytes_as_text: /t/ === options,
|
22
|
+
utf8: /u/ === options)
|
data/bin/cborseq2diag.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'cbor-diagnostic'
|
3
|
+
require 'cbor-deterministic'
|
4
|
+
require 'cbor-canonical'
|
3
5
|
|
4
6
|
options = ''
|
5
|
-
while /\A-([
|
7
|
+
while /\A-([cdetu]+)\z/ === ARGV[0]
|
6
8
|
options << $1
|
7
9
|
ARGV.shift
|
8
10
|
end
|
@@ -11,6 +13,8 @@ ARGF.binmode
|
|
11
13
|
i = ARGF.read
|
12
14
|
while !i.empty?
|
13
15
|
o, i = CBOR.decode_with_rest(i)
|
16
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
17
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
14
18
|
out = o.cbor_diagnostic(try_decode_embedded: /e/ === options,
|
15
19
|
bytes_as_text: /t/ === options,
|
16
20
|
utf8: /u/ === options)
|
data/bin/cborseq2json.rb
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'json'
|
3
3
|
require 'cbor-pure'
|
4
|
+
require 'cbor-deterministic'
|
5
|
+
require 'cbor-canonical'
|
6
|
+
|
7
|
+
options = ''
|
8
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
9
|
+
options << $1
|
10
|
+
ARGV.shift
|
11
|
+
end
|
4
12
|
|
5
13
|
ARGF.binmode
|
6
14
|
i = ARGF.read
|
7
15
|
while i != ''
|
8
16
|
o, i = CBOR.decode_with_rest(i)
|
17
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
18
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
9
19
|
puts JSON.pretty_generate(o)
|
10
20
|
end
|
data/bin/cborseq2neatjson.rb
CHANGED
@@ -2,10 +2,20 @@
|
|
2
2
|
require 'json'
|
3
3
|
require 'cbor-pure'
|
4
4
|
require 'neatjson'
|
5
|
+
require 'cbor-deterministic'
|
6
|
+
require 'cbor-canonical'
|
7
|
+
|
8
|
+
options = ''
|
9
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
10
|
+
options << $1
|
11
|
+
ARGV.shift
|
12
|
+
end
|
5
13
|
|
6
14
|
ARGF.binmode
|
7
15
|
i = ARGF.read
|
8
16
|
while i != ''
|
9
17
|
o, i = CBOR.decode_with_rest(i)
|
18
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
19
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
10
20
|
puts JSON.neat_generate(o, after_comma: 1, after_colon: 1)
|
11
21
|
end
|
data/bin/cborseq2yaml.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
require 'psych.rb' # WTF
|
3
3
|
require 'yaml'
|
4
4
|
require 'cbor-pure'
|
5
|
+
require 'cbor-deterministic'
|
6
|
+
require 'cbor-canonical'
|
5
7
|
|
6
8
|
class Array
|
7
9
|
def to_yaml_style()
|
@@ -9,10 +11,19 @@ class Array
|
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
14
|
+
options = ''
|
15
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
16
|
+
options << $1
|
17
|
+
ARGV.shift
|
18
|
+
end
|
19
|
+
|
20
|
+
|
12
21
|
ARGF.binmode
|
13
22
|
i = ARGF.read
|
14
23
|
while i != ''
|
15
24
|
o, i = CBOR.decode_with_rest(i)
|
25
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
26
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
16
27
|
puts YAML.dump(o)
|
17
28
|
end
|
18
29
|
|
data/bin/json2cbor.rb
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'json'
|
3
3
|
require 'cbor-pure'
|
4
|
+
require 'cbor-deterministic'
|
5
|
+
require 'cbor-canonical'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
options = ''
|
8
|
+
while /\A-([cdv]+)\z/ === ARGV[0]
|
9
|
+
options << $1
|
7
10
|
ARGV.shift
|
8
11
|
end
|
9
12
|
|
10
13
|
$stdout.binmode
|
11
14
|
i = ARGF.read
|
12
|
-
o =
|
15
|
+
o = JSON.load(i)
|
16
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
17
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
18
|
+
o = CBOR.encode(o)
|
13
19
|
print o
|
14
|
-
warn "JSON size: #{i.size} bytes, CBOR size: #{o.size} bytes." if
|
20
|
+
warn "JSON size: #{i.size} bytes, CBOR size: #{o.size} bytes." if /v/ === options
|
data/bin/json2json.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'json'
|
3
|
+
require 'cbor-pure'
|
4
|
+
require 'cbor-deterministic'
|
5
|
+
require 'cbor-canonical'
|
6
|
+
|
7
|
+
options = ''
|
8
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
9
|
+
options << $1
|
10
|
+
ARGV.shift
|
11
|
+
end
|
12
|
+
|
13
|
+
i = ARGF.read
|
14
|
+
o = JSON.load(i)
|
15
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
16
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
17
|
+
puts JSON.pretty_generate(o)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'json'
|
3
|
+
require 'cbor-pure'
|
4
|
+
require 'neatjson'
|
5
|
+
require 'cbor-deterministic'
|
6
|
+
require 'cbor-canonical'
|
7
|
+
|
8
|
+
options = ''
|
9
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
10
|
+
options << $1
|
11
|
+
ARGV.shift
|
12
|
+
end
|
13
|
+
|
14
|
+
$stdout.binmode
|
15
|
+
i = ARGF.read
|
16
|
+
o = JSON.load(i)
|
17
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
18
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
19
|
+
puts JSON.neat_generate(o, after_comma: 1, after_colon: 1)
|
data/bin/json2yaml.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'psych.rb' # WTF
|
3
|
+
require 'yaml'
|
4
|
+
require 'json'
|
5
|
+
require 'cbor-pure'
|
6
|
+
require 'cbor-deterministic'
|
7
|
+
require 'cbor-canonical'
|
8
|
+
|
9
|
+
class Array
|
10
|
+
def to_yaml_style()
|
11
|
+
all? {|x| Integer === x } && length < 20 ? :inline : super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
options = ''
|
16
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
17
|
+
options << $1
|
18
|
+
ARGV.shift
|
19
|
+
end
|
20
|
+
|
21
|
+
i = ARGF.read
|
22
|
+
o = JSON.load(i)
|
23
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
24
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
25
|
+
puts YAML.dump(o)
|
data/bin/yaml2cbor.rb
CHANGED
@@ -2,14 +2,20 @@
|
|
2
2
|
require 'psych.rb' # WTF
|
3
3
|
require 'yaml'
|
4
4
|
require 'cbor-pure'
|
5
|
+
require 'cbor-deterministic'
|
6
|
+
require 'cbor-canonical'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
options = ''
|
9
|
+
while /\A-([cdv]+)\z/ === ARGV[0]
|
10
|
+
options << $1
|
8
11
|
ARGV.shift
|
9
12
|
end
|
10
13
|
|
11
14
|
$stdout.binmode
|
12
15
|
i = ARGF.read
|
13
|
-
o =
|
16
|
+
o = YAML.load(i)
|
17
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
18
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
19
|
+
o = CBOR.encode(o)
|
14
20
|
print o
|
15
|
-
warn "YAML size: #{i.size} bytes, CBOR size: #{o.size} bytes." if
|
21
|
+
warn "YAML size: #{i.size} bytes, CBOR size: #{o.size} bytes." if /v/ === options
|
data/bin/yaml2json.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'json'
|
3
|
+
require 'psych.rb' # WTF
|
4
|
+
require 'yaml'
|
5
|
+
require 'cbor-pure'
|
6
|
+
require 'cbor-deterministic'
|
7
|
+
require 'cbor-canonical'
|
8
|
+
|
9
|
+
options = ''
|
10
|
+
while /\A-([cd]+)\z/ === ARGV[0]
|
11
|
+
options << $1
|
12
|
+
ARGV.shift
|
13
|
+
end
|
14
|
+
|
15
|
+
i = ARGF.read
|
16
|
+
o = YAML.load(i)
|
17
|
+
o = o.cbor_pre_canonicalize if /c/ === options
|
18
|
+
o = o.cbor_prepare_deterministic if /d/ === options
|
19
|
+
puts JSON.pretty_generate(o)
|
data/cbor-diag.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cbor-diag"
|
3
|
-
s.version = "0.5.
|
3
|
+
s.version = "0.5.17"
|
4
4
|
s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
|
5
5
|
s.description = %q{cbor-diag implements diagnostic notation for CBOR, RFC 8949 and RFC 8742}
|
6
6
|
s.author = "Carsten Bormann"
|
@@ -20,4 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.add_dependency 'treetop', '~>1'
|
21
21
|
s.add_dependency 'json'
|
22
22
|
s.add_dependency 'neatjson'
|
23
|
+
s.add_dependency 'cbor-deterministic'
|
24
|
+
s.add_dependency 'cbor-canonical'
|
23
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbor-diag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,12 +66,41 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cbor-deterministic
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: cbor-canonical
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
description: cbor-diag implements diagnostic notation for CBOR, RFC 8949 and RFC 8742
|
70
98
|
email: cabo@tzi.org
|
71
99
|
executables:
|
72
100
|
- cbor2diag.rb
|
73
101
|
- cbor2json.rb
|
74
102
|
- cbor2pretty.rb
|
103
|
+
- cbor2u8.rb
|
75
104
|
- cbor2yaml.rb
|
76
105
|
- cborleader2diag.rb
|
77
106
|
- cborseq2diag.rb
|
@@ -82,16 +111,21 @@ executables:
|
|
82
111
|
- diag2cbor.rb
|
83
112
|
- diag2pretty.rb
|
84
113
|
- json2cbor.rb
|
114
|
+
- json2json.rb
|
115
|
+
- json2neatjson.rb
|
85
116
|
- json2pretty.rb
|
117
|
+
- json2yaml.rb
|
86
118
|
- pretty2cbor.rb
|
87
119
|
- pretty2diag.rb
|
88
120
|
- yaml2cbor.rb
|
121
|
+
- yaml2json.rb
|
89
122
|
extensions: []
|
90
123
|
extra_rdoc_files: []
|
91
124
|
files:
|
92
125
|
- bin/cbor2diag.rb
|
93
126
|
- bin/cbor2json.rb
|
94
127
|
- bin/cbor2pretty.rb
|
128
|
+
- bin/cbor2u8.rb
|
95
129
|
- bin/cbor2yaml.rb
|
96
130
|
- bin/cborleader2diag.rb
|
97
131
|
- bin/cborseq2diag.rb
|
@@ -102,10 +136,14 @@ files:
|
|
102
136
|
- bin/diag2cbor.rb
|
103
137
|
- bin/diag2pretty.rb
|
104
138
|
- bin/json2cbor.rb
|
139
|
+
- bin/json2json.rb
|
140
|
+
- bin/json2neatjson.rb
|
105
141
|
- bin/json2pretty.rb
|
142
|
+
- bin/json2yaml.rb
|
106
143
|
- bin/pretty2cbor.rb
|
107
144
|
- bin/pretty2diag.rb
|
108
145
|
- bin/yaml2cbor.rb
|
146
|
+
- bin/yaml2json.rb
|
109
147
|
- cbor-diag.gemspec
|
110
148
|
- lib/cbor-diag-parser.rb
|
111
149
|
- lib/cbor-diagnostic.rb
|