You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Mark McLoughlin <ma...@redhat.com> on 2011/08/18 10:51:51 UTC
[PATCH 3/3] 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.
---
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
Re: [PATCH 3/3] Client: fix Gem.available? deprecation warning
Posted by Michal Fojtik <mf...@redhat.com>.
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