protobuf 3.8.1 → 3.8.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 +5 -5
- data/.travis.yml +1 -0
- data/lib/protobuf/enum.rb +8 -2
- data/lib/protobuf/tasks/compile.rake +36 -16
- data/lib/protobuf/version.rb +1 -1
- data/spec/lib/protobuf/enum_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ef917148ada7494b0e7924434b0faa4e3a36155ac0893f687360f01b55b829d6
|
4
|
+
data.tar.gz: be5ae5cb6ff72a6c9151834da970137c0382f7177a2c8792458115c8a5d53df7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5594c91e41d5d0787874210f81865d39a5931b27ddf3a66178bce2e7125c6c293414492ad3e9ec9c02eda898e6c106874b2656549d61ffeb1f982fd596637a00
|
7
|
+
data.tar.gz: 2f6b14d78465a055be950fa1ba49a24f49e75548f28625ef8830eb8b77386a4a95266664693cac3ae02079071d27e44bc9e2e0f73ef32e56f7a4861003f5dfdd
|
data/.travis.yml
CHANGED
data/lib/protobuf/enum.rb
CHANGED
@@ -259,10 +259,16 @@ module Protobuf
|
|
259
259
|
super(tag)
|
260
260
|
end
|
261
261
|
|
262
|
-
# Overriding the class so ActiveRecord/Arel visitor will visit the enum as
|
262
|
+
# Overriding the class so ActiveRecord/Arel visitor will visit the enum as an
|
263
|
+
# Integer.
|
263
264
|
#
|
264
265
|
def class
|
265
|
-
|
266
|
+
# This is done for backward compatibility for < 2.4.0. This ensures that
|
267
|
+
# if Ruby version >= 2.4.0, this will return Integer. If below, then will
|
268
|
+
# return Fixnum.
|
269
|
+
#
|
270
|
+
# This prevents the constant deprecation warnings on Fixnum.
|
271
|
+
tag.class
|
266
272
|
end
|
267
273
|
|
268
274
|
def inspect
|
@@ -1,13 +1,32 @@
|
|
1
|
-
require
|
1
|
+
require "fileutils"
|
2
2
|
|
3
3
|
namespace :protobuf do
|
4
4
|
|
5
|
-
desc
|
5
|
+
desc "Clean & Compile the protobuf source to ruby classes. Pass PB_NO_CLEAN=1 if you do not want to force-clean first."
|
6
6
|
task :compile, [:package, :source, :destination, :plugin, :file_extension] do |_tasks, args|
|
7
|
-
|
8
|
-
|
9
|
-
args.with_defaults(:
|
10
|
-
args.with_defaults(:
|
7
|
+
binpath = ::File.expand_path("../../../../bin", __FILE__)
|
8
|
+
|
9
|
+
args.with_defaults(:destination => "lib")
|
10
|
+
args.with_defaults(:source => "definitions")
|
11
|
+
args.with_defaults(:plugin => "protoc-gen-ruby-protobuf=#{binpath}/protoc-gen-ruby")
|
12
|
+
args.with_defaults(:file_extension => ".pb.rb")
|
13
|
+
|
14
|
+
# The local Ruby generator collides with the builtin Ruby generator
|
15
|
+
#
|
16
|
+
# From the protoc docs:
|
17
|
+
#
|
18
|
+
# --plugin=EXECUTABLE
|
19
|
+
#
|
20
|
+
# ...EXECUTABLE may be of the form NAME=PATH, in which case the given plugin name
|
21
|
+
# is mapped to the given executable even if the executable"s own name differs.
|
22
|
+
#
|
23
|
+
# Use the NAME=PATH form to specify an alternative plugin name that avoids the name collision
|
24
|
+
#
|
25
|
+
plugin_name, _plugin_path = args[:plugin].split("=")
|
26
|
+
|
27
|
+
# The plugin name MUST have the protoc-gen- prefix in order to work, but that prefix is dropped
|
28
|
+
# when using the plugin to generate definitions
|
29
|
+
plugin_name.gsub!("protoc-gen-", "")
|
11
30
|
|
12
31
|
unless do_not_clean?
|
13
32
|
force_clean!
|
@@ -16,22 +35,23 @@ namespace :protobuf do
|
|
16
35
|
|
17
36
|
command = []
|
18
37
|
command << "protoc"
|
19
|
-
command << "
|
38
|
+
command << "--plugin=#{args[:plugin]}"
|
39
|
+
command << "--#{plugin_name}_out=#{args[:destination]}"
|
20
40
|
command << "-I #{args[:source]}"
|
21
41
|
command << Dir["#{args[:source]}/#{args[:package]}/**/*.proto"].join(" ")
|
22
|
-
full_command = command.join(
|
42
|
+
full_command = command.join(" ")
|
23
43
|
|
24
44
|
puts full_command
|
25
45
|
system(full_command)
|
26
46
|
end
|
27
47
|
|
28
|
-
desc
|
48
|
+
desc "Clean the generated *.pb.rb files from the destination package. Pass PB_FORCE_CLEAN=1 to skip confirmation step."
|
29
49
|
task :clean, [:package, :destination, :file_extension] do |_task, args|
|
30
|
-
args.with_defaults(:destination =>
|
31
|
-
args.with_defaults(:file_extension =>
|
50
|
+
args.with_defaults(:destination => "lib")
|
51
|
+
args.with_defaults(:file_extension => ".pb.rb")
|
32
52
|
|
33
|
-
file_extension = args[:file_extension].sub(/\*?\.+/,
|
34
|
-
files_to_clean = ::File.join(args[:destination], args[:package],
|
53
|
+
file_extension = args[:file_extension].sub(/\*?\.+/, "")
|
54
|
+
files_to_clean = ::File.join(args[:destination], args[:package], "**", "*.#{file_extension}")
|
35
55
|
|
36
56
|
if force_clean? || permission_to_clean?(files_to_clean)
|
37
57
|
::Dir.glob(files_to_clean).each do |file|
|
@@ -41,15 +61,15 @@ namespace :protobuf do
|
|
41
61
|
end
|
42
62
|
|
43
63
|
def do_not_clean?
|
44
|
-
! ::ENV.key?(
|
64
|
+
! ::ENV.key?("PB_NO_CLEAN")
|
45
65
|
end
|
46
66
|
|
47
67
|
def force_clean?
|
48
|
-
::ENV.key?(
|
68
|
+
::ENV.key?("PB_FORCE_CLEAN")
|
49
69
|
end
|
50
70
|
|
51
71
|
def force_clean!
|
52
|
-
::ENV[
|
72
|
+
::ENV["PB_FORCE_CLEAN"] = "1"
|
53
73
|
end
|
54
74
|
|
55
75
|
def permission_to_clean?(files_to_clean)
|
data/lib/protobuf/version.rb
CHANGED
@@ -214,7 +214,7 @@ RSpec.describe Protobuf::Enum do
|
|
214
214
|
end
|
215
215
|
|
216
216
|
subject { Test::EnumTestType::ONE }
|
217
|
-
specify { expect(subject.class).to eq(
|
217
|
+
specify { expect(subject.class).to eq(1.class) }
|
218
218
|
specify { expect(subject.parent_class).to eq(Test::EnumTestType) }
|
219
219
|
specify { expect(subject.name).to eq(:ONE) }
|
220
220
|
specify { expect(subject.tag).to eq(1) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BJ Neilsen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2018-02-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
@@ -468,7 +468,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
468
468
|
version: '0'
|
469
469
|
requirements: []
|
470
470
|
rubyforge_project:
|
471
|
-
rubygems_version: 2.
|
471
|
+
rubygems_version: 2.7.4
|
472
472
|
signing_key:
|
473
473
|
specification_version: 4
|
474
474
|
summary: Google Protocol Buffers serialization and RPC implementation for Ruby.
|