Project

ffi-gdbm

0.0
No commit activity in last 3 years
No release in over 3 years
This library provides a gdbm library compatible with the MRI standard library, but using Ruby-FFI rather than a C extension. This allows gdbm to easily be used from alternative Ruby implementations, such as JRuby. It can also be used with MRI, if there is some kind of need for that.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

ffi-gdbm

An attempt to make gdbm available beyond the C Ruby implementation.

Faithfully mimics MRI's standard library and is compatible with gdbm files produced by that version.

Installing

You can download and use gdbm.rb anyhow you would like.

You can also install it using Ruby Gems:

gem install ffi-gdbm

or, if using JRuby:

jgem install ffi-gdbm

JRuby does not require further installation, but other implementations may need the FFI gem:

gem install ffi

Notes

  • Conforms to tests from MRI 1.8.7, 1.9.1, 2.6.1 and follows the C library for MRI if there are contradictions with the documentation
  • Should be compatible with gdbm files created with MRI's standard library
  • Certainly works with JRuby, may work with other alternative Ruby implementations

Status

Tests passing on 64 bit Linux with

  • JRuby 1.7.21 and 9.1.7.0

Tests passing on OSX (High Sierra) with

  • JRuby 9.2.5.0

Older Tests

Passing all tests with JRuby 1.4, 1.5.3, 1.6 on 32-bit Linux.

Passing all tests with MRI Ruby 1.8.7, 1.9.1, 1.9.2 with Ruby-FFI 0.5.4, 0.6.3, 1.0.7 on 32-bit Linux.

Further testing on other systems is welcome!

Testing

Three sets of tests are included, copied straight from the MRI distribution. However, they do require the use of ObjectSpace, so this is how to run them with JRuby:

jruby --1.8 -X+O -r lib/gdbm test/test_gdbm-1.8.7.rb (Note: these tests only work with JRuby prior to 9.0.0.0)

jruby -X+O -r ./lib/gdbm test/test_gdbm-1.9.1.rb

jruby -X+O -r ./lib/gdbm test/test_gdbm-2.6.rb

License

Copyright (c), Justin Collins

This library is released under the same tri-license (GPL/LGPL/CPL) as JRuby. Please see the COPYING file distributed with JRuby for details.