Skip to content

Commit db181ef

Browse files
committed
Readme and general housekeeping
1 parent 169d0d0 commit db181ef

4 files changed

Lines changed: 65 additions & 24 deletions

File tree

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
nodejs 24.13.0
22
ruby 3.4.7
3+
bun 1.3.11

gem/.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,11 @@ Gemspec/DevelopmentDependencies:
1212
Metrics:
1313
Enabled: false
1414

15+
RSpec/ExampleLength:
16+
Enabled: false
17+
18+
RSpec/MultipleExpectations:
19+
Enabled: false
20+
1521
Style/StringLiteralsInInterpolation:
1622
EnforcedStyle: double_quotes

gem/README.md

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,77 @@
1-
# Triangulum
1+
# Triangulum Ruby Gem
22

3-
TODO: Delete this and the text below, and describe your gem
4-
5-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/triangulum`. To experiment with that code, run `bin/console` for an interactive prompt.
3+
Ruby bindings for the [Triangulum](https://github.com/code0-tech/triangulum) validation layer. This gem wraps the TypeScript library and a bundled [Bun](https://bun.sh) runtime to validate flows using the TypeScript compiler.
64

75
## Installation
86

9-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10-
11-
Install the gem and add to the application's Gemfile by executing:
7+
Add to your Gemfile:
128

13-
```bash
14-
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
9+
```ruby
10+
gem 'triangulum'
1511
```
1612

17-
If bundler is not being used to manage dependencies, install the gem by executing:
13+
Platform-specific gems are published for:
14+
15+
- `arm64-darwin` (macOS Apple Silicon)
16+
- `x86_64-darwin` (macOS Intel)
17+
- `x86_64-linux-gnu` (Linux x64)
18+
- `x86_64-linux-musl` (Linux x64 musl)
19+
- `aarch64-linux-gnu` (Linux ARM64)
20+
- `aarch64-linux-musl` (Linux ARM64 musl)
21+
22+
If Bundler doesn't automatically select the correct platform gem, add your platform:
1823

1924
```bash
20-
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
25+
bundle lock --add-platform x86_64-linux-gnu
2126
```
2227

2328
## Usage
2429

25-
TODO: Write usage instructions here
30+
```ruby
31+
result = Triangulum::Validation.new(flow, runtime_function_definitions, data_types).validate
32+
33+
result.valid? # => true / false
34+
result.return_type # => "void"
35+
result.diagnostics # => [Triangulum::Validation::Diagnostic, ...]
36+
```
37+
38+
The arguments are [Tucana](https://github.com/code0-tech/tucana) protobuf objects:
39+
40+
- `flow``Tucana::Shared::ValidationFlow`
41+
- `runtime_function_definitions``Array<Tucana::Shared::RuntimeFunctionDefinition>`
42+
- `data_types``Array<Tucana::Shared::DefinitionDataType>`
43+
44+
### Diagnostics
45+
46+
Each diagnostic contains:
47+
48+
| Field | Description |
49+
|---|---|
50+
| `message` | Human-readable error description |
51+
| `code` | TypeScript diagnostic code |
52+
| `severity` | `"error"` or `"warning"` |
53+
| `node_id` | ID of the node that caused the error |
54+
| `parameter_index` | Index of the parameter that caused the error |
2655

2756
## Development
2857

29-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
58+
Prerequisites: [Bun](https://bun.sh) installed locally for building the entrypoint.
59+
60+
```bash
61+
cd gem
62+
bundle install
63+
bundle exec rake prepare_build # downloads bun binaries + builds JS entrypoint
64+
bundle exec rake # run tests and rubocop
65+
```
66+
67+
### Building platform gems
68+
69+
```bash
70+
bundle exec rake package
71+
```
3072

31-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
73+
This will download bun binaries (with SHA256 checksum verification) for all supported platforms and build a `.gem` file for each.
3274

33-
## Contributing
75+
## License
3476

35-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/triangulum.
77+
See [LICENSE](../LICENSE).

gem/bin/setup

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)