File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e # Exit immediately if any command fails
4+
5+ # Path to Rust repo
6+ RUST_REPO_DIR=" ../valkey-glide"
7+ RUBY_GEM_LIB_DIR=" ../../valkey-glide-ruby/lib/valkey"
8+
9+ echo " 🔄 Updating Valkey Glide FFI..."
10+
11+ # Clone or update Rust repo
12+ if [ ! -d " $RUST_REPO_DIR " ]; then
13+ echo " 📦 Cloning valkey-glide..."
14+ git clone https://github.com/valkey-io/valkey-glide.git " $RUST_REPO_DIR "
15+ else
16+ echo " 📥 Pulling latest valkey-glide updates..."
17+ cd " $RUST_REPO_DIR " && git pull origin main && cd -
18+ fi
19+
20+ # Build Rust ffi
21+ echo " 🔧 Building Rust FFI..."
22+ cd " $RUST_REPO_DIR /ffi"
23+ cargo build --release
24+
25+ # Copy built .so or .dylib to Ruby gem lib folder
26+ cp target/release/libglide_ffi.* " $RUBY_GEM_LIB_DIR "
27+
28+ echo " ✅ Done! Copied shared library to:"
29+ ls -lh " $RUBY_GEM_LIB_DIR " /libglide_ffi.*
Original file line number Diff line number Diff line change @@ -4,7 +4,13 @@ class Valkey
44 module Bindings
55 extend FFI ::Library
66
7- ffi_lib File . expand_path ( "./libglide_ffi.so" , __dir__ )
7+ ffi_lib_path = if RUBY_PLATFORM =~ /darwin/
8+ File . expand_path ( "./libglide_ffi.dylib" , __dir__ )
9+ else
10+ File . expand_path ( "./libglide_ffi.so" , __dir__ )
11+ end
12+
13+ ffi_lib ffi_lib_path
814
915 class ClientType < FFI ::Struct
1016 layout (
You can’t perform that action at this time.
0 commit comments