For ruby-bindgen features and capabilities, see the docs/ directory (classes, methods, enums, templates, default_values, filtering, include_header, operators, iterators).
For configuration options, see docs/configuration.md.
lib/ruby-bindgen/generators/generator.rb- Base class for all generatorslib/ruby-bindgen/generators/rice/rice.rb- Rice generator that walks the ASTlib/ruby-bindgen/generators/rice/*.erb- ERB templates that generate Rice C++ codetest/headers/cpp/*.hpp- Test input headerstest/bindings/cpp/*-rb.cpp- Expected output (golden files)
# Run all tests
bundle exec ruby -Ilib -Itest test/rice_test.rb
bundle exec ruby -Ilib -Itest test/cmake_test.rb
# Run a specific test
bundle exec ruby -Ilib -Itest test/rice_test.rb --name test_classes
# Regenerate expected files after making changes
UPDATE_EXPECTED=1 bundle exec ruby -Ilib -Itest test/rice_test.rb
UPDATE_EXPECTED=1 bundle exec ruby -Ilib -Itest test/cmake_test.rbNOTE: cmake_test must run after rice_test because it scans for *-rb.cpp files generated by rice_test.
All 16 Rice tests: classes, enums, functions, inheritance, template, constructors, operators, default_values, iterators, template_inheritance, overloads, incomplete_types, filtering, template_defaults, buffers, cross_file_typedef
IMPORTANT: Before using UPDATE_EXPECTED=1 or committing any changes, you MUST first run ALL tests to verify your changes don't break existing functionality. Never blindly update expected files without checking for regressions.
NEVER manually edit expected output files in test/bindings/cpp/. Always use UPDATE_EXPECTED=1 to regenerate them.
Every bug fix MUST include test coverage. Write a failing test FIRST, then implement the fix. Add test cases to the appropriate header file in test/headers/cpp/ and update the expected output in test/bindings/cpp/.
Mocks are NEVER allowed in tests. All tests must use real headers and real generator output.
For typedef-related issues, use cross_file_base.hpp and cross_file_derived.hpp.
One commit per fix. Do not batch multiple unrelated fixes into a single commit.
Do not add Co-Authored-By or any other author attribution to commit messages.
See /mnt/c/Source/opencv-ruby/ext/rice-bindings.yaml for the full configuration. Use the match field to configure what .h/.hpp files are processed and thus generate bindings for.
cd /mnt/c/Source/ruby-bindgen
# 1. Generate Rice C++ source files
bundle exec ruby -Ilib bin/ruby-bindgen /mnt/c/Source/opencv-ruby/ext/rice-bindings.yaml
# 2. Generate CMake build files (must run after Rice generation)
bundle exec ruby -Ilib bin/ruby-bindgen /mnt/c/Source/opencv-ruby/ext/cmake-bindings.yaml