Skip to content

Instantly share code, notes, and snippets.

@ebenoist
Created March 15, 2017 23:46
Show Gist options
  • Save ebenoist/7e9de05de51f0690cf18db91e2b8ccda to your computer and use it in GitHub Desktop.
Save ebenoist/7e9de05de51f0690cf18db91e2b8ccda to your computer and use it in GitHub Desktop.
commit c8ef5485f93636fd3bdef74de19c96471452d66e
Author: Erik Benoist <[email protected]>
Date: Tue Oct 25 15:26:23 2016 -0500
Makes the compiler compatible with protoc version 3
diff --git a/Rakefile b/Rakefile
index 8df9895..bda79e4 100644
--- a/Rakefile
+++ b/Rakefile
@@ -22,7 +22,7 @@ namespace :compile do
task :spec do
proto_path = ::File.expand_path('../spec/support/', __FILE__)
proto_files = Dir[File.join(proto_path, '**', '*.proto')]
- cmd = %(protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{proto_path} -I #{proto_path} #{proto_files.join(' ')})
+ cmd = %(protoc --plugin=./bin/protoc-gen-ruby2 --ruby2_out=#{proto_path} -I #{proto_path} #{proto_files.join(' ')})
puts cmd
system(cmd)
@@ -35,7 +35,7 @@ namespace :compile do
output_dir = ::File.expand_path('../tmp/rpc', __FILE__)
::FileUtils.mkdir_p(output_dir)
- cmd = %(protoc --plugin=./bin/protoc-gen-ruby --ruby_out=#{output_dir} -I #{proto_path} #{proto_files.join(' ')})
+ cmd = %(protoc --plugin=./bin/protoc-gen-ruby2 --ruby2_out=#{output_dir} -I #{proto_path} #{proto_files.join(' ')})
puts cmd
system(cmd)
diff --git a/bin/protoc-gen-ruby b/bin/protoc-gen-ruby
deleted file mode 100755
index c0f7d37..0000000
--- a/bin/protoc-gen-ruby
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env ruby
-
-# Before requiring protobuf, ensure that we will not load any
-# server or client code.
-#
-ENV['PB_NO_NETWORKING'] = '1'
-
-$LOAD_PATH << ::File.expand_path("../../lib", __FILE__)
-require 'protobuf'
-require 'protobuf/descriptors'
-require 'protobuf/code_generator'
-
-request_bytes = STDIN.read
-code_generator = ::Protobuf::CodeGenerator.new(request_bytes)
-response_bytes = code_generator.response_bytes
-STDOUT.print(response_bytes)
diff --git a/bin/protoc-gen-ruby2 b/bin/protoc-gen-ruby2
new file mode 100755
index 0000000..c0f7d37
--- /dev/null
+++ b/bin/protoc-gen-ruby2
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+
+# Before requiring protobuf, ensure that we will not load any
+# server or client code.
+#
+ENV['PB_NO_NETWORKING'] = '1'
+
+$LOAD_PATH << ::File.expand_path("../../lib", __FILE__)
+require 'protobuf'
+require 'protobuf/descriptors'
+require 'protobuf/code_generator'
+
+request_bytes = STDIN.read
+code_generator = ::Protobuf::CodeGenerator.new(request_bytes)
+response_bytes = code_generator.response_bytes
+STDOUT.print(response_bytes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment