proto-convert 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/proto-convert +14 -16
- metadata +12 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 220848a40cd878c344d691e50d67579e73b41bfb650c6fdb8f2572c5a2cb262a
|
|
4
|
+
data.tar.gz: d3bdb5b6097182ef7988be3e05607a548ce03ec98c33b339b8581464b9f0185e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da1981ab5bee08c2ade94f8ebfd9ed56a2d71872ea25ea835d6ba7dfdb9fac01bfc7d8977a9f1fdab1fdaa8c87a4ab80ac1cd5ae5b8a8807a386a14f8c4e2d5e
|
|
7
|
+
data.tar.gz: a17b91557fc355ea5a6ae55f6e1e5526cb19f8ff1900571cf52e825ba999fe051e64981d764421bcf1223ebbc847a941cc160b4cbdc8f830703eb940fcdf8383
|
data/bin/proto-convert
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
require 'optparse'
|
|
33
33
|
require 'English'
|
|
34
34
|
|
|
35
|
-
VERSION = '0.4.
|
|
35
|
+
VERSION = '0.4.2'
|
|
36
36
|
AUTHOR_NAME = 'Azeem Sajid'
|
|
37
37
|
AUTHOR_EMAIL = '<azeem.sajid@gmail.com>'
|
|
38
38
|
AUTHOR_INFO = "Author: #{AUTHOR_NAME} #{AUTHOR_EMAIL}"
|
|
@@ -52,13 +52,9 @@ def compile_proto(filename)
|
|
|
52
52
|
puts " proto file path : #{file_path}"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
protoc_cmd =
|
|
56
|
-
" protoc \\\n" \
|
|
57
|
-
" --ruby_out=#{file_dir} \\\n" \
|
|
58
|
-
" --proto_path=#{file_dir} \\\n" \
|
|
59
|
-
" #{file_path}"
|
|
55
|
+
protoc_cmd = "protoc --ruby_out=\"#{file_dir}\" --proto_path=\"#{file_dir}\" \"#{file_path}\""
|
|
60
56
|
|
|
61
|
-
puts "\n#{protoc_cmd}" if $verbose
|
|
57
|
+
puts "\n #{protoc_cmd}" if $verbose
|
|
62
58
|
|
|
63
59
|
`#{protoc_cmd}`
|
|
64
60
|
abort "ERROR: Invalid schema! [#{filename}] Resolve error(s)." unless $CHILD_STATUS.success?
|
|
@@ -72,20 +68,22 @@ def compile_proto(filename)
|
|
|
72
68
|
end
|
|
73
69
|
|
|
74
70
|
def valid_msgtype?(compiled_proto, msg_type)
|
|
75
|
-
if $verbose
|
|
76
|
-
puts "\n>> Validate msgtype"
|
|
77
|
-
puts " msgtype : #{msg_type}"
|
|
78
|
-
puts " pb file : #{compiled_proto}"
|
|
79
|
-
end
|
|
80
|
-
|
|
81
71
|
msg_types = []
|
|
82
72
|
File.foreach(compiled_proto) do |line|
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
line.strip!
|
|
74
|
+
if line.include?('::Google::Protobuf::DescriptorPool.generated_pool.lookup') && line.end_with?('.msgclass')
|
|
75
|
+
extracted_msg_type = line[/"([^"]*)"/, 1].freeze
|
|
85
76
|
msg_types.push(extracted_msg_type) unless extracted_msg_type.nil?
|
|
86
77
|
end
|
|
87
78
|
end
|
|
88
79
|
|
|
80
|
+
if $verbose
|
|
81
|
+
puts "\n>> Validate msgtype"
|
|
82
|
+
puts " msgtype : #{msg_type}"
|
|
83
|
+
puts " pb file : #{compiled_proto}"
|
|
84
|
+
puts " pb types: #{msg_types}"
|
|
85
|
+
end
|
|
86
|
+
|
|
89
87
|
is_valid = msg_types.include?(msg_type)
|
|
90
88
|
unless is_valid
|
|
91
89
|
puts "ERROR: Invalid msgtype! [#{msg_type}]"
|
|
@@ -173,7 +171,7 @@ def start
|
|
|
173
171
|
args[:mode] = mode
|
|
174
172
|
end
|
|
175
173
|
|
|
176
|
-
opts.on('-p', '--proto [FILENAME]', String, 'protobuf schema (.proto)') do |filename|
|
|
174
|
+
opts.on('-p', '--proto [FILENAME]', String, 'protobuf schema (.proto file)') do |filename|
|
|
177
175
|
abort 'ERROR: Missing schema filename!' if filename.nil?
|
|
178
176
|
abort "ERROR: Protobuf schema not found! [#{filename}]" unless File.file?(filename)
|
|
179
177
|
|
metadata
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: proto-convert
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Azeem Sajid
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-09-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '2.1'
|
|
20
17
|
- - ">="
|
|
21
18
|
- !ruby/object:Gem::Version
|
|
22
19
|
version: 2.1.0
|
|
20
|
+
- - "~>"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '2.1'
|
|
23
23
|
type: :development
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
|
-
- - "~>"
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
version: '2.1'
|
|
30
27
|
- - ">="
|
|
31
28
|
- !ruby/object:Gem::Version
|
|
32
29
|
version: 2.1.0
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.1'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: google-protobuf
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -37,9 +37,6 @@ dependencies:
|
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '3.12'
|
|
40
|
-
- - ">="
|
|
41
|
-
- !ruby/object:Gem::Version
|
|
42
|
-
version: 3.12.2
|
|
43
40
|
type: :runtime
|
|
44
41
|
prerelease: false
|
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -47,11 +44,8 @@ dependencies:
|
|
|
47
44
|
- - "~>"
|
|
48
45
|
- !ruby/object:Gem::Version
|
|
49
46
|
version: '3.12'
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
version: 3.12.2
|
|
53
|
-
description: A command-line tool to convert protobuf messages from binary to JSON
|
|
54
|
-
and vice versa
|
|
47
|
+
description: a CLI tool to convert protobuf messages from binary to JSON and vice
|
|
48
|
+
versa
|
|
55
49
|
email:
|
|
56
50
|
- azeem.sajid@gmail.com
|
|
57
51
|
executables:
|
|
@@ -64,7 +58,7 @@ homepage: https://github.com/iamAzeem/proto-convert
|
|
|
64
58
|
licenses:
|
|
65
59
|
- MIT
|
|
66
60
|
metadata: {}
|
|
67
|
-
post_install_message:
|
|
61
|
+
post_install_message:
|
|
68
62
|
rdoc_options: []
|
|
69
63
|
require_paths:
|
|
70
64
|
- lib
|
|
@@ -79,8 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
79
73
|
- !ruby/object:Gem::Version
|
|
80
74
|
version: '0'
|
|
81
75
|
requirements: []
|
|
82
|
-
|
|
83
|
-
rubygems_version: 2.7.6
|
|
76
|
+
rubygems_version: 3.0.9
|
|
84
77
|
signing_key:
|
|
85
78
|
specification_version: 4
|
|
86
79
|
summary: Protobuf Message Converter [Binary <-> JSON]
|