Skip to content

Commit b9f5a81

Browse files
author
RouterBase Contributors
committed
Add RubyGems client starter
1 parent 69dee1a commit b9f5a81

20 files changed

Lines changed: 426 additions & 2 deletions

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020
with:
2121
go-version: "1.22"
2222
cache: false
23+
- uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: "3.3"
2326
- run: npm run verify
2427
- run: go test ./...
2528
working-directory: packages/go-routerbase
29+
- run: ruby -Ilib test/client_test.rb
30+
working-directory: packages/ruby-routerbase
31+
- run: gem build routerbase-client.gemspec
32+
working-directory: packages/ruby-routerbase
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish RubyGems
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: packages/ruby-routerbase
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: "3.3"
20+
- run: ruby -Ilib test/client_test.rb
21+
- run: gem build routerbase-client.gemspec
22+
- run: |
23+
mkdir -p ~/.gem
24+
printf -- "---\n:rubygems_api_key: %s\n" "$RUBYGEMS_API_KEY" > ~/.gem/credentials
25+
chmod 0600 ~/.gem/credentials
26+
env:
27+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
28+
- run: gem push routerbase-client-*.gem

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.3.0 - 2026-06-30
4+
5+
- Added a RubyGems-ready `routerbase-client` gem starter.
6+
- Added Ruby client, CLI, tests, and gem build verification.
7+
- Added a manual `Publish RubyGems` workflow.
8+
39
## 0.2.0 - 2026-06-30
410

511
- Added a Go SDK starter with chat completions, model listing, tests, and an example.

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ cd packages/go-routerbase
2323
go test ./...
2424
```
2525

26+
Run Ruby checks from the Ruby gem directory:
27+
28+
```bash
29+
cd packages/ruby-routerbase
30+
ruby -Ilib test/client_test.rb
31+
gem build routerbase-client.gemspec
32+
```
33+
2634
## Example Guidelines
2735

2836
- Keep examples small and runnable.

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This repository is a practical starter kit for developers who want to test Route
1010
- `packages/python-routerbase`: a small Python SDK starter with tests and a CLI.
1111
- `packages/jsr-routerbase`: a JSR-ready TypeScript package draft.
1212
- `packages/go-routerbase`: a Go SDK starter with tests and a runnable example.
13+
- `packages/ruby-routerbase`: a RubyGems-ready client gem starter with tests and a CLI.
1314
- `examples/docker`: a tiny containerized prompt runner example.
1415
- `.github/workflows/ci.yml`: CI for Node and Python tests.
1516
- `docs`: rollout plan, publishing checklist, and maintenance notes.
@@ -74,6 +75,19 @@ response, err := client.ChatCompletion(context.Background(), routerbase.ChatComp
7475
})
7576
```
7677

78+
## Ruby Example
79+
80+
```ruby
81+
require "routerbase"
82+
83+
client = RouterBase::Client.new(api_key: ENV.fetch("ROUTERBASE_API_KEY"))
84+
response = client.chat_completion(
85+
messages: [
86+
{ role: "user", content: "Explain RouterBase in one sentence." }
87+
]
88+
)
89+
```
90+
7791
## Published npm Packages
7892

7993
These companion packages are already published:
@@ -87,8 +101,9 @@ These companion packages are already published:
87101
## SDK Starters
88102

89103
- Go module: `github.com/RouterBase/routerbase-examples/packages/go-routerbase`
90-
- Python package draft: `routerbase-client`
104+
- PyPI package draft: `routerbase-client`
91105
- JSR package draft: `@routerbase/client`
106+
- RubyGems package draft: `routerbase-client`
92107

93108
## Links
94109

docs/batch-plan.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,6 @@ Status:
9090
- Go tests added and wired into CI.
9191
- Module path prepared for pkg.go.dev discovery:
9292
`github.com/RouterBase/routerbase-examples/packages/go-routerbase`.
93+
- Ruby gem starter added at `packages/ruby-routerbase`.
94+
- Ruby tests and gem build added to CI.
95+
- Manual RubyGems publish workflow added: `.github/workflows/publish-rubygems.yml`.

docs/publishing-checklist.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Use this checklist before publishing any RouterBase package or repository.
2525
- For npm packages, run `npm pack --dry-run`.
2626
- For PyPI packages, run `python3 -m build` in the package directory.
2727
- For Go modules, run `go test ./...` in the module directory and confirm pkg.go.dev can index the public module path.
28+
- For Ruby gems, run `ruby -Ilib test/client_test.rb` and `gem build routerbase-client.gemspec`.
2829
- For Docker images, build locally before pushing.
2930

3031
## Maintenance

docs/rubygems.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# RubyGems Package
2+
3+
The Ruby client starter lives in:
4+
5+
```text
6+
packages/ruby-routerbase
7+
```
8+
9+
Gem name:
10+
11+
```text
12+
routerbase-client
13+
```
14+
15+
The gem metadata points to [RouterBase](https://routerbase.com), the RouterBase docs, and the GitHub source directory.
16+
17+
## Local Checks
18+
19+
```bash
20+
cd packages/ruby-routerbase
21+
ruby -Ilib test/client_test.rb
22+
gem build routerbase-client.gemspec
23+
```
24+
25+
## Publish
26+
27+
Add `RUBYGEMS_API_KEY` to GitHub repository secrets, then run:
28+
29+
```text
30+
Publish RubyGems
31+
```
32+
33+
from GitHub Actions.

docs/trusted-publishing.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,31 @@ Before running:
8282
## Link Policy
8383

8484
Keep links natural and developer-focused. The first README link uses `[RouterBase](https://routerbase.com)`, and package metadata points to the RouterBase homepage.
85+
86+
## RubyGems
87+
88+
Workflow:
89+
90+
```text
91+
.github/workflows/publish-rubygems.yml
92+
```
93+
94+
Package:
95+
96+
```text
97+
packages/ruby-routerbase
98+
```
99+
100+
Before running:
101+
102+
- Create a RubyGems API key with permission to push `routerbase-client`.
103+
- Add it to GitHub repository secrets as `RUBYGEMS_API_KEY`.
104+
- Run the `Publish RubyGems` workflow manually.
105+
106+
Local verification:
107+
108+
```bash
109+
cd packages/ruby-routerbase
110+
ruby -Ilib test/client_test.rb
111+
gem build routerbase-client.gemspec
112+
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "routerbase-examples",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Examples, SDK starters, and publishing assets for RouterBase.",
55
"private": true,
66
"type": "module",

0 commit comments

Comments
 (0)