From 6faa097de6e2179c0c0ed6d87a0ad1a1aea68bb1 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Mon, 24 May 2010 11:43:28 -0400 Subject: [PATCH] allow variable bson_ext versions (cont.) --- lib/bson.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/bson.rb b/lib/bson.rb index 8b0d518..b9bfc21 100644 --- a/lib/bson.rb +++ b/lib/bson.rb @@ -2,8 +2,10 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) +MINIMUM_BSON_EXT_VERSION = "1.0.1" + module BSON - VERSION = "1.0.1" + VERSION = "1.0.2" def self.serialize(obj, check_keys=false, move_id=false) BSON_CODER.serialize(obj, check_keys, move_id) end @@ -18,7 +20,11 @@ begin # Need this for running test with and without c ext in Ruby 1.9. raise LoadError if ENV['TEST_MODE'] && !ENV['C_EXT'] require 'bson_ext/cbson' - raise LoadError unless defined?(CBson::VERSION) && CBson::VERSION == BSON::VERSION + raise LoadError unless defined?(CBson::VERSION) + if CBson::VERSION < MINIMUM_BSON_EXT_VERSION + puts "Able to load bson_ext version #{CBson::VERSION}, but >= #{MINIMUM_BSON_EXT_VERSION} is required." + raise LoadError + end require 'bson/bson_c' module BSON BSON_CODER = BSON_C