protoc-gen-twirp_ruby 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/README.md +57 -36
- data/lib/twirp/protoc_plugin/version.rb +1 -1
- metadata +5 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61fb4daca3b43bb74a7dd7d55604ee44120f94fd414a8e800aec9c75796b1bcd
|
4
|
+
data.tar.gz: ff8f5d616e451c35df3f3d5439386c8d2f61b1f80df12c396f8b3ff6a77be88d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54051cb2108ebf06765b8dd80477b10486bae2db1b79db945ea7e3b10238560d6c0bf84c768799e70c9b22c62bd3976017426d2f8a0d6097088af98b2885bc28
|
7
|
+
data.tar.gz: 1766042ae8e9d6012bd99f9829c630ccf99b67173920bca4ee763b7888e676557f1e196516b88516d127f0015121db2bfeac1da12943c1bbbf4cc9a471a67b3a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,13 +2,20 @@
|
|
2
2
|
[![Build](https://github.com/collectiveidea/protoc-gen-twirp_ruby/actions/workflows/main.yml/badge.svg)](https://github.com/collectiveidea/protoc-gen-twirp_ruby/actions/workflows/main.yml)
|
3
3
|
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
|
4
4
|
|
5
|
-
# protoc-gen-twirp_ruby
|
5
|
+
# protoc-gen-twirp_ruby - A `protoc` plugin for Twirp-Ruby.
|
6
6
|
|
7
|
-
This gem
|
7
|
+
This gem is a `protoc` plugin that generates [Twirp-Ruby](https://github.com/arthurnn/twirp-ruby) services and clients.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
## Why use this?
|
10
|
+
|
11
|
+
Twirp-Ruby [already does this](https://github.com/arthurnn/twirp-ruby/tree/main/protoc-gen-twirp_ruby)
|
12
|
+
via a `go` module. So why use this version?
|
13
|
+
|
14
|
+
* Easier install (just add the gem).
|
15
|
+
* You already know and love Ruby.
|
16
|
+
* We're committed to keeping it up to date.
|
17
|
+
|
18
|
+
The Go version works fine (we used it for years) but it was missing features that we wanted. Building in Ruby allows us to iterate quicker and makes it easier for others to contribute.
|
12
19
|
|
13
20
|
## Installation
|
14
21
|
|
@@ -25,41 +32,17 @@ the `--ruby_out` option). It does not generate Twirp services and clients; that
|
|
25
32
|
|
26
33
|
### Install the `protoc-gen-twirp_ruby` plugin
|
27
34
|
|
28
|
-
|
35
|
+
Run `gem install protoc-gen-twirp_ruby` or add it to your Gemfile:
|
29
36
|
|
30
37
|
```ruby
|
31
|
-
|
32
|
-
"protoc-gen-twirp_ruby"
|
33
|
-
end
|
34
|
-
````
|
35
|
-
|
36
|
-
Alternatively, install the gem on your system:
|
37
|
-
|
38
|
-
```bash
|
39
|
-
gem install protoc-gen-twirp_ruby
|
38
|
+
gem "protoc-gen-twirp_ruby", group: :development
|
40
39
|
```
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
If you have previously installed the `go` version of the plugin via the [Twirp-Ruby Code Generation wiki page](https://github.com/arthurnn/twirp-ruby/wiki/Code-Generation)
|
45
|
-
instructions, then you'll want to uninstall it before invoking the `protoc` command.
|
46
|
-
|
47
|
-
```bash
|
48
|
-
rm `go env GOPATH`/bin/protoc-gen-twirp_ruby
|
49
|
-
```
|
50
|
-
|
51
|
-
### Notable plugin differences
|
52
|
-
|
53
|
-
This gem generates nearly identical Twirp-Ruby output as the go version plugin. Some notable differences
|
54
|
-
that might affect migration include:
|
55
|
-
|
56
|
-
* Generated output code is in [standardrb style](https://github.com/standardrb/standard).
|
57
|
-
* Generated service and client class names are improved for well-named protobuf services. See [#6](https://github.com/collectiveidea/protoc-gen-twirp_ruby/pull/6).
|
58
|
-
* Supports various protoc command line [configuration options](https://github.com/collectiveidea/protoc-gen-twirp_ruby?tab=readme-ov-file#options).
|
41
|
+
If you previously used the Go version, see our [Migration Instructions](#migrating-from-the-go-module).
|
59
42
|
|
60
43
|
## Usage
|
61
44
|
|
62
|
-
|
45
|
+
Pass `--twirp_ruby_out` to `protoc` to generate Twirp-Ruby code:
|
63
46
|
|
64
47
|
```bash
|
65
48
|
protoc --proto_path=. --ruby_out=. --twirp_ruby_out=. ./path/to/service.proto
|
@@ -67,8 +50,7 @@ protoc --proto_path=. --ruby_out=. --twirp_ruby_out=. ./path/to/service.proto
|
|
67
50
|
|
68
51
|
### Options
|
69
52
|
|
70
|
-
|
71
|
-
specifying `--twirp_ruby_opt=<option>` on the `protoc` command line.
|
53
|
+
You can configure the code generation. Pass options by specifying `--twirp_ruby_opt=<option>` on the `protoc` command line.
|
72
54
|
|
73
55
|
* `skip-empty`: Avoid generating a `_twirp.rb` for a `.proto` with no service definitions. By default, a `_twirp.rb`
|
74
56
|
file is generated for every proto file listed on the command line, even if the file is empty scaffolding.
|
@@ -78,6 +60,32 @@ specifying `--twirp_ruby_opt=<option>` on the `protoc` command line.
|
|
78
60
|
* `generate=both` - generate both services and clients. This is the default option to preserve
|
79
61
|
backwards compatibility.
|
80
62
|
|
63
|
+
Example (with two options):
|
64
|
+
|
65
|
+
```bash
|
66
|
+
protoc --proto_path=. --ruby_out=. --twirp_ruby_out=. --twirp_ruby_opt=generate=client --twirp_ruby_opt=skip-empty ./path/to/service.proto
|
67
|
+
```
|
68
|
+
|
69
|
+
## Migrating from the Go module
|
70
|
+
|
71
|
+
If you previously installed the `protoc-gen-twirp_ruby` Go module via the [Twirp-Ruby's Code Generation wiki page](https://github.com/arthurnn/twirp-ruby/wiki/Code-Generation)
|
72
|
+
instructions, then you'll want to uninstall it before invoking the `protoc` command.
|
73
|
+
|
74
|
+
```bash
|
75
|
+
rm `go env GOPATH`/bin/protoc-gen-twirp_ruby
|
76
|
+
```
|
77
|
+
|
78
|
+
### Differences from the Go module
|
79
|
+
|
80
|
+
This gem generates nearly identical Twirp-Ruby output as the Go version. Some notable differences
|
81
|
+
that might affect migration include:
|
82
|
+
|
83
|
+
* Generated output code is in [standardrb style](https://github.com/standardrb/standard).
|
84
|
+
* Generated service and client class names are improved for well-named protobuf services. See [#6](https://github.com/collectiveidea/protoc-gen-twirp_ruby/pull/6).
|
85
|
+
* Supports `ruby_package` in `.proto` files
|
86
|
+
* Supports various protoc command line [configuration options](https://github.com/collectiveidea/protoc-gen-twirp_ruby?tab=readme-ov-file#options).
|
87
|
+
|
88
|
+
|
81
89
|
## Development
|
82
90
|
|
83
91
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -97,7 +105,20 @@ protoc --ruby_out=. --twirp_ruby_out=. ./example/hello_world.proto
|
|
97
105
|
|
98
106
|
## Releasing
|
99
107
|
|
100
|
-
To release a new version
|
108
|
+
To release a new version:
|
109
|
+
|
110
|
+
* Submit a PR with the following changes (see [#30](https://github.com/collectiveidea/protoc-gen-twirp_ruby/pull/30)):
|
111
|
+
* Update the version number in `version.rb`
|
112
|
+
* Update the CHANGELOG.md
|
113
|
+
* Create a section for the new version and move the unreleased version there
|
114
|
+
* Re-generate the example:
|
115
|
+
* `protoc --plugin=protoc-gen-twirp_ruby=./exe/protoc-gen-twirp_ruby --ruby_out=. --twirp_ruby_out=. ./example/hello_world.proto`
|
116
|
+
* Once merged, run the release task from main. Note that we prepend `gem_push=no` to avoid
|
117
|
+
pushing to RubyGems directly; our GitHub publish action will do this for us.
|
118
|
+
* `gem_push=no bundle exec rake release`
|
119
|
+
* Create a GitHub release:
|
120
|
+
* `gh release create v<version>`
|
121
|
+
* Edit the release notes to link to the notes in the CHANGELOG.md for the version
|
101
122
|
|
102
123
|
## Contributing
|
103
124
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protoc-gen-twirp_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darron Schall
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-05-
|
13
|
+
date: 2024-05-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: google-protobuf
|
@@ -26,20 +26,6 @@ dependencies:
|
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: racc
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '0'
|
36
|
-
type: :runtime
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '0'
|
43
29
|
- !ruby/object:Gem::Dependency
|
44
30
|
name: rake
|
45
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +82,8 @@ dependencies:
|
|
96
82
|
- - ">="
|
97
83
|
- !ruby/object:Gem::Version
|
98
84
|
version: '0'
|
99
|
-
description: A
|
85
|
+
description: A protoc plugin that generates Twirp-Ruby services and clients. A pure
|
86
|
+
Ruby alternative to the Go version that ships with Twirp-Ruby.
|
100
87
|
email: info@collectiveidea.com
|
101
88
|
executables:
|
102
89
|
- protoc-gen-twirp_ruby
|
@@ -147,5 +134,5 @@ requirements: []
|
|
147
134
|
rubygems_version: 3.5.9
|
148
135
|
signing_key:
|
149
136
|
specification_version: 4
|
150
|
-
summary: A
|
137
|
+
summary: A protoc plugin for generating Twirp-Ruby clients and/or services
|
151
138
|
test_files: []
|