proto-convert 0.4.0 → 0.4.1
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 +13 -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: f5838325797314e221a75028304dad6529875a0313bc0c718b8a85fd6a39c000
|
4
|
+
data.tar.gz: 59ca7099f09e630d907bd61557c3ede9149d2a183b55a8c819949d02be35e1f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f36c7eaac6931d92299889d86ce4fc9858cc2461e5f05a0f4e0a9ebfc3805ea46a2ec3b95368c2a21b3722e4a6ca90cc5c51deef1519a29882bc0a3b46099957
|
7
|
+
data.tar.gz: ab63c7fc6ee12cac7e7f6b837c4c672ba41551bc985780052c2a3d42ce3820ea594d4e9913621be55a3a61afb8f4b33697a0940055a690902c99556d39cdd501
|
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.1'
|
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,21 @@ 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
|
-
if line.
|
84
|
-
extracted_msg_type = line[/"([^"]*)"/, 1].freeze
|
73
|
+
if line.include?('::Google::Protobuf::DescriptorPool.generated_pool.lookup')
|
74
|
+
extracted_msg_type = line[/"([^"]*)"/, 1].freeze
|
85
75
|
msg_types.push(extracted_msg_type) unless extracted_msg_type.nil?
|
86
76
|
end
|
87
77
|
end
|
88
78
|
|
79
|
+
if $verbose
|
80
|
+
puts "\n>> Validate msgtype"
|
81
|
+
puts " msgtype : #{msg_type}"
|
82
|
+
puts " pb file : #{compiled_proto}"
|
83
|
+
puts " pb types: #{msg_types}"
|
84
|
+
end
|
85
|
+
|
89
86
|
is_valid = msg_types.include?(msg_type)
|
90
87
|
unless is_valid
|
91
88
|
puts "ERROR: Invalid msgtype! [#{msg_type}]"
|
@@ -173,7 +170,7 @@ def start
|
|
173
170
|
args[:mode] = mode
|
174
171
|
end
|
175
172
|
|
176
|
-
opts.on('-p', '--proto [FILENAME]', String, 'protobuf schema (.proto)') do |filename|
|
173
|
+
opts.on('-p', '--proto [FILENAME]', String, 'protobuf schema (.proto file)') do |filename|
|
177
174
|
abort 'ERROR: Missing schema filename!' if filename.nil?
|
178
175
|
abort "ERROR: Protobuf schema not found! [#{filename}]" unless File.file?(filename)
|
179
176
|
|
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.1
|
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-08-11 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]
|