This guide explains how to publish and validate the QuickFIX Ruby gem to RubyGems.
-
Install required tools:
# Ubuntu/Debian sudo apt-get install build-essential ruby-dev libssl-dev # macOS xcode-select --install
-
Set up a RubyGems account:
- Production: https://rubygems.org
- Test: https://test.rubygems.org
-
Configure authentication:
- Generate an API key: https://rubygems.org/profile/api_keys
- Save credentials by running
gem pushonce — it will prompt for your key and save it to~/.gem/credentials
# Step 1: Build the gem
./package-ruby.sh --build-only
# Step 2: Validate locally (MUST pass before publishing)
./validate-local-ruby-build.sh
# Step 3: Publish to test repository
./publish-rubygems.sh --test
# Step 4: Validate the published gem
./validate-rubygems.sh --test# Step 1: Ensure local validation passes
./validate-local-ruby-build.sh
# Step 2: Publish to production RubyGems
./publish-rubygems.sh
# Step 3: Validate production publication
./validate-rubygems.shPrepares and builds the gem.
./package-ruby.sh [--build-only | --rubygems]- Copies C++ source files, headers, SWIG files, and config files from
quickfix/ - Builds the gem using
gem build quickfix.gemspec - Output:
quickfix-ruby/*.gem
Validates the locally built gem, including a full C++ compilation test. This is the most important step — it proves the package will work when installed by users.
./validate-local-ruby-build.sh [path-to-gem-file]Runs 5 tests:
- Gem file integrity — verifies the gem can be read by RubyGems
- Gem contents — checks for required
lib/,ext/directories andquickfix.gemspec - Gem specification — validates gemspec metadata
- Extension files — verifies
extconf.rband 50+ C++ source files are present - C++ compilation — installs the gem to a temp directory and actually compiles the native extension
Compiler output is saved to /tmp/quickfix_compile_*.log for debugging.
Publishes the gem to RubyGems.org or the test repository.
./publish-rubygems.sh [path-to-gem-file] [--test]- Default: publishes to RubyGems.org (production)
--test: publishes to test.rubygems.org
Requires credentials in ~/.gem/credentials.
Validates the gem after it has been published and installed from a repository.
./validate-rubygems.sh [--test]- Default: validates from RubyGems.org
--test: validates from test.rubygems.org
Runs 3 tests:
- Installation check — installs gem if needed, displays version
- Core classes — verifies
Quickfix::Session,SocketInitiator,SocketAcceptor,Message, etc. are importable - Native extension functional — creates a QuickFIX message and sets a field to confirm compiled code works
# Check the detailed error log
cat /tmp/quickfix_compile_*.log
# Install missing build dependencies
sudo apt-get install build-essential ruby-dev libssl-dev # Ubuntu/Debian
xcode-select --install # macOS
# Clear build artifacts and retry
rm -rf quickfix-ruby/ext/quickfix/*.o quickfix-ruby/ext/quickfix/*.so
./validate-local-ruby-build.sh# Run gem push manually — it will prompt for your API key and save credentials
gem push path/to/gem.gem
# Then retry
./publish-rubygems.sh path/to/gem.gem# May be an architecture mismatch — clean and rebuild
gem uninstall quickfix_ruby -a
./validate-local-ruby-build.sh
gem install quickfix_ruby --localBefore publishing to production:
-
./validate-local-ruby-build.shpasses all 5 tests including C++ compilation -
./publish-rubygems.sh --testsucceeds -
./validate-rubygems.sh --testpasses - No errors in
/tmp/quickfix_compile_*.log - Version number is correct and unique
-
./publish-rubygems.shsucceeds for production
| Command | Purpose |
|---|---|
./package-ruby.sh --build-only |
Build gem only |
./validate-local-ruby-build.sh |
Validate locally built gem (includes C++ compilation) |
./validate-local-ruby-build.sh FILE |
Validate a specific gem file |
./publish-rubygems.sh |
Publish to production RubyGems |
./publish-rubygems.sh --test |
Publish to test.rubygems.org |
./validate-rubygems.sh |
Validate gem from production |
./validate-rubygems.sh --test |
Validate gem from test repository |
- RubyGems: https://rubygems.org
- Test RubyGems: https://test.rubygems.org
- RubyGems Publishing Guide: https://guides.rubygems.org/publishing/
- SWIG Ruby Documentation: http://www.swig.org/Doc4.2/Ruby.html