Skip to content
Browse files

Based on deprecation message replaced Gem.available? with Gem::Specif…

…ication.find_by_name and also handled exception.
  • Loading branch information...
1 parent 8848392 commit 282b6c01aa206fadbfea412c840878049e00c7af @BogdanSV BogdanSV committed Nov 21, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/predicated/gem_check.rb
View
4 lib/predicated/gem_check.rb
@@ -1,6 +1,8 @@
module Predicated
def self.require_gem_version(gem_name, minimum_version, require_name=gem_name)
- unless Gem.available?(gem_name, Gem::Requirement.create(">= #{minimum_version}"))
+ begin
+ Gem::Specification.find_by_name(gem_name, Gem::Requirement.create(">= #{minimum_version}"))
+ rescue StandardError => exc
raise %{
Gem: #{gem_name} >=#{minimum_version}
Does not appear to be installed. Please install it.

0 comments on commit 282b6c0

Please sign in to comment.
Something went wrong with that request. Please try again.