protobuf 3.8.1 → 3.8.2

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
- SHA1:
3
- metadata.gz: a83d5de57b9c6a5360694475d248d6e0fc10ae50
4
- data.tar.gz: 8d662211209d4d768f48247e4088c0c2d3248df2
2
+ SHA256:
3
+ metadata.gz: ef917148ada7494b0e7924434b0faa4e3a36155ac0893f687360f01b55b829d6
4
+ data.tar.gz: be5ae5cb6ff72a6c9151834da970137c0382f7177a2c8792458115c8a5d53df7
5
5
  SHA512:
6
- metadata.gz: f160e7baed1d88bf0afc04850217140e0f50121c8e3ca0ca08daa564ee9f09f82f8f3b39da79cd3f6d1b1e05001ef20be69c2362f7dd4df44a6953e43562da96
7
- data.tar.gz: c307c334b2a68a97d0dd86c4560177df02c75990e80f3cace69406a8d50f3948a83651ca2bbc873c6efbd17eb8102786cbbd50b5a649181271e5405df6b6e895
6
+ metadata.gz: 5594c91e41d5d0787874210f81865d39a5931b27ddf3a66178bce2e7125c6c293414492ad3e9ec9c02eda898e6c106874b2656549d61ffeb1f982fd596637a00
7
+ data.tar.gz: 2f6b14d78465a055be950fa1ba49a24f49e75548f28625ef8830eb8b77386a4a95266664693cac3ae02079071d27e44bc9e2e0f73ef32e56f7a4861003f5dfdd
@@ -22,6 +22,7 @@ rvm:
22
22
  - 2.2
23
23
  - 2.2.2
24
24
  - 2.3
25
+ - 2.4
25
26
  - jruby-9.1.7.0
26
27
  - rbx-2
27
28
  env:
@@ -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 a Fixnum
262
+ # Overriding the class so ActiveRecord/Arel visitor will visit the enum as an
263
+ # Integer.
263
264
  #
264
265
  def class
265
- Fixnum
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 'fileutils'
1
+ require "fileutils"
2
2
 
3
3
  namespace :protobuf do
4
4
 
5
- desc 'Clean & Compile the protobuf source to ruby classes. Pass PB_NO_CLEAN=1 if you do not want to force-clean first.'
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
- args.with_defaults(:destination => 'lib')
8
- args.with_defaults(:source => 'definitions')
9
- args.with_defaults(:plugin => 'ruby')
10
- args.with_defaults(:file_extension => '.pb.rb')
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 << "--#{args[:plugin]}_out=#{args[:destination]}"
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 'Clean the generated *.pb.rb files from the destination package. Pass PB_FORCE_CLEAN=1 to skip confirmation step.'
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 => 'lib')
31
- args.with_defaults(:file_extension => '.pb.rb')
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], '**', "*.#{file_extension}")
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?('PB_NO_CLEAN')
64
+ ! ::ENV.key?("PB_NO_CLEAN")
45
65
  end
46
66
 
47
67
  def force_clean?
48
- ::ENV.key?('PB_FORCE_CLEAN')
68
+ ::ENV.key?("PB_FORCE_CLEAN")
49
69
  end
50
70
 
51
71
  def force_clean!
52
- ::ENV['PB_FORCE_CLEAN'] = '1'
72
+ ::ENV["PB_FORCE_CLEAN"] = "1"
53
73
  end
54
74
 
55
75
  def permission_to_clean?(files_to_clean)
@@ -1,3 +1,3 @@
1
1
  module Protobuf
2
- VERSION = '3.8.1' # rubocop:disable Style/MutableConstant
2
+ VERSION = '3.8.2' # rubocop:disable Style/MutableConstant
3
3
  end
@@ -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(Fixnum) }
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.1
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: 2017-09-21 00:00:00.000000000 Z
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.6.13
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.