From 73f9acf4fb67ab592baf06bd07bb08a872cfeb94 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Tue, 28 Feb 2012 12:04:49 -0500 Subject: [PATCH] Cleaned up BSON gem versioning. --- lib/bson.rb | 11 +++-------- lib/bson/version.rb | 3 +++ 2 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 lib/bson/version.rb diff --git a/lib/bson.rb b/lib/bson.rb index d8fe52a..e010c7c 100644 --- a/lib/bson.rb +++ b/lib/bson.rb @@ -16,11 +16,9 @@ # limitations under the License. # ++ -MINIMUM_BSON_EXT_VERSION = "1.6.0" +require 'bson/version' module BSON - VERSION = "1.6.0" - if defined? Mongo::DEFAULT_MAX_BSON_SIZE DEFAULT_MAX_BSON_SIZE = Mongo::DEFAULT_MAX_BSON_SIZE else @@ -65,15 +63,12 @@ else # Need this for running test with and without c ext in Ruby 1.9. raise LoadError if ENV['TEST_MODE'] && !ENV['C_EXT'] - # Raise LoadError unless little endian + # Raise LoadError unless little endian, since the C extensions + # only work on little-endian architectures. raise LoadError unless "\x01\x00\x00\x00".unpack("i").first == 1 require 'bson_ext/cbson' 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 diff --git a/lib/bson/version.rb b/lib/bson/version.rb new file mode 100644 index 0000000..624f8a1 --- /dev/null +++ b/lib/bson/version.rb @@ -0,0 +1,3 @@ +module BSON + VERSION = "1.6.1" +end