Skip to content
Browse files

Merge pull request #7 from cpatuzzo/master

Skip regular expression matcher deprecation warning
  • Loading branch information...
2 parents 45b0be3 + 4abb0b5 commit 0e7153e36afb2b6a499b2e04995f94eddbd5374e @grosser committed Jul 14, 2012
Showing with 9 additions and 2 deletions.
  1. +0 −1 Readme.md
  2. +9 −1 lib/rubygems/dependent.rb
View
1 Readme.md
@@ -38,7 +38,6 @@ Output
TODO
=====
- - NOTE: Dependency.new w/ a regexp is deprecated. Dependency.new called from gem-dependent/lib/rubygems/dependent.rb:70
- include nested dependencies (a > b > c --> a = [b,c])
- add tests for cli interface
- add `--type development` support
View
10 lib/rubygems/dependent.rb
@@ -66,7 +66,7 @@ def self.all_specs_and_sources(options={})
all = true
matching_platform = false
prerelease = false
- matcher = Gem::Dependency.new(//, Gem::Requirement.default) # any name, any version
+ matcher = without_deprecation_warning { Gem::Dependency.new(//, Gem::Requirement.default) } # any name, any version
specs_and_sources = fetcher.find_matching matcher, all, matching_platform, prerelease
if options[:all_versions]
@@ -76,6 +76,14 @@ def self.all_specs_and_sources(options={})
end
end
+ def self.without_deprecation_warning(&block)
+ previous = Gem::Deprecate.skip
+ Gem::Deprecate.skip = true
+ yield
+ ensure
+ Gem::Deprecate.skip = previous
+ end
+
# get unique elements from an array (last found is used)
# http://drawohara.com/post/146659159/ruby-enumerable-uniq-by
def self.uniq_by(array, &block)

0 comments on commit 0e7153e

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