From e21a4b897a19cffb479e4b0e1686ba77b777e0e9 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Tue, 2 Nov 2010 14:25:14 -0400 Subject: [PATCH] minor: extra rake tasks for tests. don't show C ext warning when testing --- Rakefile | 23 ++++++++++++++++++++--- lib/bson.rb | 10 ++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 6a85881..fe8c246 100644 --- a/Rakefile +++ b/Rakefile @@ -176,23 +176,40 @@ namespace :gem do desc "Install the gem locally" task :install do + sh "gem install --no-rdoc --no-ri json" + + sh "gem uninstall -x -a -I bson" sh "gem build bson.gemspec" - sh "gem install bson-*.gem" + sh "gem install --no-rdoc --no-ri bson-*.gem" + + sh "gem uninstall -x -a -I mongo" sh "gem build mongo.gemspec" - sh "gem install mongo-*.gem" + sh "gem install --no-rdoc --no-ri mongo-*.gem" + sh "rm mongo-*.gem" sh "rm bson-*.gem" end desc "Install the optional c extensions" task :install_extensions do + sh "gem uninstall -x -a -I bson_ext" sh "gem build bson_ext.gemspec" - sh "gem install bson_ext-*.gem" + sh "gem install --no-rdoc --no-ri bson_ext-*.gem" sh "rm bson_ext-*.gem" end end +namespace :ci do + namespace :test do + task :c do + Rake::Task['gem:install'].invoke + Rake::Task['gem:install_extensions'].invoke + Rake::Task['test:c'].invoke + end + end +end + task :default => :list task :list do diff --git a/lib/bson.rb b/lib/bson.rb index 37e0569..ee538f8 100644 --- a/lib/bson.rb +++ b/lib/bson.rb @@ -60,10 +60,12 @@ else module BSON BSON_CODER = BSON_RUBY end - warn "\n**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance." - warn " You can install the extension as follows:\n gem install bson_ext\n" - warn " If you continue to receive this message after installing, make sure that the" - warn " bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.\n" + unless ENV['TEST_MODE'] + warn "\n**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance." + warn " You can install the extension as follows:\n gem install bson_ext\n" + warn " If you continue to receive this message after installing, make sure that the" + warn " bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.\n" + end end end