-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Ruby binding #1032
base: main
Are you sure you want to change the base?
Create Ruby binding #1032
Conversation
--- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/tursodatabase/limbo?shareId=XXXX-XXXX-XXXX-XXXX).
Oh sorry, I intended to create PR for my own repo. |
Hey @kuboon! I am more than happy to have Ruby bindings in the Limbo source tree if that's something you're interested in contributing. The test failure is not related to your PR at all so AFAICT we could just merge this. Let me know what your plans are and feel free to drop by the Limbo developer Discord if you want to chat more. |
bindings/ruby/README.md
Outdated
|
||
```ruby | ||
require 'rutie' | ||
require_relative 'path/to/your/shared/library/file' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to hide the rutie
import from applications by providing some wrapper they import? I would encourage to make this gem API-compatible with sqlite3-ruby
to make it easier for applications to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you think using https://github.com/bytecodealliance/wasmtime-rb instead of building native FFI?
Anyway, I will try to implement thin wrapper gem to make compat with sqlite3-ruby
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will use magnus instead rutie.
bindings/ruby/limbo.gemspec
Outdated
@@ -0,0 +1,18 @@ | |||
Gem::Specification.new do |s| | |||
s.name = "limbo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://rubygems.org/gems/limbo has taken. need to change.
I found The biggest problem is |
#[magnus::init(name = "limbo")] | ||
fn init(ruby: &Ruby) -> std::result::Result<(), magnus::Error> { | ||
let module = ruby.define_module("Limbo")?; | ||
module.const_set("CORE_VERSION", "0.0.14")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I get from Cargo.toml metadata?
database_class.define_method("connect", method!(Database::connect, 0))?; | ||
|
||
let connection_class = module.define_class("Connection", ruby.class_object())?; | ||
// connection_class.define_method("prepare", method!(Connection::prepare, 1))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not solve type error here.
} | ||
}, | ||
"onCreateCommand": "pwd; cd bindings/ruby; bundle install" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.devcontainer/bindings-ruby
files are for ruby users (like me) to easily join contributing.
You can add .devcontainer/bindings-python
etc.
https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers#devcontainerjson
if [ ${{ github.event_name }} == "pull_request" ]; then | ||
echo "ruby-versions=[\"3.4\"]" >> $GITHUB_OUTPUT | ||
else | ||
echo "ruby-versions=[\"3.1\",\"3.2\",\"3.3\",\"3.4\"]" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connection
object from rust to ruby.