mirror of https://github.com/grpc/grpc.git
Merge pull request #172 from tbetbetbe/grpc_ruby_cleanup_readme_remove_internal_references
Grpc ruby cleanup readme remove internal referencespull/173/head
commit
e9312dda6e
12 changed files with 58 additions and 130 deletions
@ -1,64 +1,63 @@ |
||||
Ruby for GRPC |
||||
============= |
||||
gRPC Ruby |
||||
========= |
||||
|
||||
LAYOUT |
||||
------ |
||||
A Ruby implementation of gRPC, Google's RPC library. |
||||
|
||||
Directory structure is the recommended layout for [ruby extensions](http://guides.rubygems.org/gems-with-extensions/) |
||||
|
||||
* ext: the extension code |
||||
* lib: the entrypoint grpc ruby library to be used in a 'require' statement |
||||
* test: tests |
||||
INSTALLATION PREREQUISITES |
||||
-------------------------- |
||||
|
||||
This requires Ruby 2.x, as the rpc api surface uses keyword args. |
||||
|
||||
DEPENDENCIES |
||||
------------ |
||||
|
||||
INSTALLING |
||||
---------- |
||||
|
||||
* Extension |
||||
- Install the gRPC core library |
||||
TODO: describe this, once the core distribution mechanism is defined. |
||||
|
||||
The extension can be built and tested using |
||||
[rake](https://rubygems.org/gems/rake). However, the rake-extensiontask rule |
||||
is not supported on older versions of rubygems, and the necessary version of |
||||
rubygems. |
||||
$ gem install grpc |
||||
|
||||
This is resolved by using [RVM](https://rvm.io/) instead; install a single-user |
||||
ruby environment, and develop on the latest stable version of ruby (2.1.5). |
||||
|
||||
Installing from source |
||||
---------------------- |
||||
|
||||
INSTALLATION PREREQUISITES |
||||
-------------------------- |
||||
|
||||
Install RVM |
||||
- Build or Install the gRPC core |
||||
E.g, from the root of the grpc [git repo](https://github.com/google/grpc) |
||||
$ cd ../.. |
||||
$ make && sudo make install |
||||
|
||||
- Install Ruby 2.x. Consider doing this with [RVM](http://rvm.io), it's a nice way of controlling |
||||
the exact ruby version that's used. |
||||
$ command curl -sSL https://rvm.io/mpapis.asc | gpg --import - |
||||
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby |
||||
$ |
||||
$ # follow the instructions to ensure that your're using the latest stable version of Ruby |
||||
$ # and that the rvm command is installed |
||||
$ |
||||
$ gem install bundler # install bundler, the standard ruby package manager |
||||
|
||||
HACKING |
||||
------- |
||||
- Install [bundler](http://bundler.io/) |
||||
$ gem install bundler |
||||
|
||||
The extension can be built and tested using the Rakefile. |
||||
- Finally, install grpc ruby locally. |
||||
$ cd <install_dir> |
||||
$ bundle install |
||||
$ rake # compiles the extension, runs the unit tests, see rake -T for other options |
||||
|
||||
$ # create a workspace |
||||
$ git5 start <your-git5-branch> net/grpc |
||||
$ |
||||
$ # build the C library and install it in $HOME/grpc_dev |
||||
$ <google3>/net/grpc/c/build_gyp/build_grpc_dev.sh |
||||
$ |
||||
$ # build the ruby extension and test it. |
||||
$ cd google3_dir/net/grpc/ruby |
||||
$ rake |
||||
|
||||
Finally, install grpc ruby locally. |
||||
CONTENTS |
||||
-------- |
||||
|
||||
$ cd <this_dir> |
||||
$ |
||||
$ # update the Gemfile, modify the line beginning # gem 'beefcake' to refer to |
||||
$ # the patched beefcake dir |
||||
$ |
||||
$ bundle install |
||||
Directory structure is the layout for [ruby extensions](http://guides.rubygems.org/gems-with-extensions/) |
||||
|
||||
* ext: the extension code |
||||
* lib: the entrypoint grpc ruby library to be used in a 'require' statement |
||||
* spec: tests |
||||
* bin: example gRPC clients and servers, e.g, |
||||
```ruby |
||||
# client |
||||
stub = Math::Math::Stub.new('my.test.math.server.com:8080') |
||||
req = Math::DivArgs.new(dividend: 7, divisor: 3) |
||||
logger.info("div(7/3): req=#{req.inspect}") |
||||
resp = stub.div(req, INFINITE_FUTURE) |
||||
logger.info("Answer: #{resp.inspect}") |
||||
``` |
||||
|
@ -1,11 +1,8 @@ |
||||
Interop test protos |
||||
=================== |
||||
|
||||
These were generated by a patched version of beefcake and a patched version of |
||||
protoc. |
||||
These ruby classes were generated with protoc v3, using grpc's ruby compiler |
||||
plugin. |
||||
|
||||
- set up and access of the patched versions is described in ../../README.md |
||||
|
||||
The actual test proto is found in Google3 at |
||||
|
||||
- third_party/stubby/testing/proto/test.proto |
||||
- As of 2015/01 protoc v3 is available in the |
||||
[google-protobuf](https://github.com/google/protobuf) repo |
||||
|
@ -1,57 +0,0 @@ |
||||
# Copyright 2014, Google Inc. |
||||
# All rights reserved. |
||||
# |
||||
# Redistribution and use in source and binary forms, with or without |
||||
# modification, are permitted provided that the following conditions are |
||||
# met: |
||||
# |
||||
# * Redistributions of source code must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# * Redistributions in binary form must reproduce the above |
||||
# copyright notice, this list of conditions and the following disclaimer |
||||
# in the documentation and/or other materials provided with the |
||||
# distribution. |
||||
# * Neither the name of Google Inc. nor the names of its |
||||
# contributors may be used to endorse or promote products derived from |
||||
# this software without specific prior written permission. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
require 'beefcake' |
||||
|
||||
module Beefcake |
||||
# Re-open the beefcake message module to add a static encode |
||||
# |
||||
# This is a temporary measure while beefcake is used as the default proto |
||||
# library for developing grpc ruby. Once that changes to the official proto |
||||
# library this can be removed. It's necessary to allow the update the service |
||||
# module to assume a static encode method. |
||||
# TODO(temiola): remove this. |
||||
module Message |
||||
# additional mixin module that adds static encode method when include |
||||
module StaticEncode |
||||
# encodes o with its instance#encode method |
||||
def encode(o) |
||||
o.encode |
||||
end |
||||
end |
||||
|
||||
# extend self.included in Beefcake::Message to include StaticEncode |
||||
def self.included(o) |
||||
o.extend StaticEncode |
||||
o.extend Dsl |
||||
o.extend Decode |
||||
o.send(:include, Encode) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue