incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark McLoughlin <mar...@redhat.com>
Subject [PATCH 3/3] Client: fix Gem.available? deprecation warning
Date Thu, 18 Aug 2011 08:51:51 GMT
Gem.available? was deprecated by RubyGems 1.8 in favour of
the recently introducted Gem::Specification.find_by_name.
---
 client/Rakefile |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/client/Rakefile b/client/Rakefile
index 25e99cb..4fed388 100644
--- a/client/Rakefile
+++ b/client/Rakefile
@@ -32,7 +32,15 @@ Gem::PackageTask.new(spec) do |pkg|
   pkg.need_tar = true
 end
 
-if Gem.available?('rspec')
+def available?(name)
+  Gem::Specification.find_by_name(name)
+rescue Gem::LoadError
+  false
+rescue
+  Gem.available?(name)
+end
+
+if available?('rspec')
   require 'spec/rake/spectask'
   desc "Run all examples"
   Spec::Rake::SpecTask.new('spec') do |t|
-- 
1.7.4.4


Mime
View raw message