blob: 88e6008c9a91dee2e60a371864dfd21b93d6db07 [file] [log] [blame] [view]
Tim Emiolaeb158ff2015-02-21 06:29:53 -08001gRPC in 3 minutes (Ruby)
2========================
Tim Emiola49f3ccd2015-02-19 11:09:19 -08003
Dan Cirulibc4b1ce2015-02-25 15:22:58 -08004BACKGROUND
5-------------
6For this sample, we've already generated the server and client stubs from [helloworld.proto](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto).
7
Tim Emiolaeb158ff2015-02-21 06:29:53 -08008PREREQUISITES
9-------------
Tim Emiola49f3ccd2015-02-19 11:09:19 -080010
Tim Emiolaeb158ff2015-02-21 06:29:53 -080011This requires Ruby 2.1, as the gRPC API surface uses keyword args.
Tim Emiola49f3ccd2015-02-19 11:09:19 -080012
Tim Emiola5b5e1462015-02-25 04:18:56 -080013If you don't have that installed locally, you can use [RVM](https://www.rvm.io/) to use Ruby 2.1 for testing without upgrading the version of Ruby on your whole system.
14```sh
15$ command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
16$ \curl -sSL https://get.rvm.io | bash -s stable --ruby=ruby-2.1
17$
18$ # follow the instructions to ensure that your're using the latest stable version of Ruby
19$ # and that the rvm command is installed
20```
21- Make sure your run `source $HOME/.rvm/scripts/rvm` as instructed to complete the set up of RVM
22
Tim Emiola49f3ccd2015-02-19 11:09:19 -080023INSTALL
24-------
25
26- Clone this repository.
27- Follow the instructions in [INSTALL](https://github.com/grpc/grpc/blob/master/INSTALL) to install the gRPC C core.
Tim Emiola8efcb532015-02-26 01:50:44 -080028- *Temporary*
29 - Install the full gRPC distribution from source on your local machine
30 - Build gRPC Ruby as described in [installing from source](https://github.com/grpc/grpc/blob/master/src/ruby/README.md#installing-from-source)
31 - update path: in [Gemfile](https://github.com/grpc/grpc-common/blob/master/ruby/Gemfile) to refer to src/ruby within the gRPC directory
32 - N.B: this is necessary until the gRPC ruby gem is published
Tim Emiola49f3ccd2015-02-19 11:09:19 -080033- Use bundler to install
34```sh
35$ # from this directory
36$ gem install bundler && bundle install
37```
38
Tim Emiolaeb158ff2015-02-21 06:29:53 -080039Try it!
40-------
Tim Emiola49f3ccd2015-02-19 11:09:19 -080041
42- Run the server
43```sh
44$ # from this directory
45$ bundle exec ./greeter_server.rb &
46```
47
48- Run the client
49```sh
50$ # from this directory
51$ bundle exec ./greeter_client.rb
52```