incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH 3/3] Client: fix Gem.available? deprecation warning
Date Thu, 18 Aug 2011 09:15:48 GMT
On Aug 18, 2011, at 10:51 AM, Mark McLoughlin wrote:

ACK.

  -- Michal

> 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
> 

------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org


Mime
View raw message