incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1159109 - /incubator/deltacloud/trunk/client/Rakefile
Date Thu, 18 Aug 2011 09:18:14 GMT
Author: mfojtik
Date: Thu Aug 18 09:18:14 2011
New Revision: 1159109

URL: http://svn.apache.org/viewvc?rev=1159109&view=rev
Log:
Client: fix Gem.available? deprecation warning

Gem.available? was deprecated by RubyGems 1.8 in favour of
the recently introducted Gem::Specification.find_by_name.

Modified:
    incubator/deltacloud/trunk/client/Rakefile

Modified: incubator/deltacloud/trunk/client/Rakefile
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/Rakefile?rev=1159109&r1=1159108&r2=1159109&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/Rakefile (original)
+++ incubator/deltacloud/trunk/client/Rakefile Thu Aug 18 09:18:14 2011
@@ -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|



Mime
View raw message