diff options
author | Evan Phoenix <evan@fallingsnow.net> | 2011-06-02 14:40:27 -0700 |
---|---|---|
committer | Evan Phoenix <evan@fallingsnow.net> | 2011-06-02 14:40:27 -0700 |
commit | 4a441565010ae22cb76fbf2ffb78bd3297f1a88f (patch) | |
tree | 733a7a4b62d9120ba114d96c9e4d2f58258b8324 /lib | |
parent | daff916275a3efa0298677dd90d6f5ae9b0555e6 (diff) | |
download | bundler-4a441565010ae22cb76fbf2ffb78bd3297f1a88f.tar.gz |
Add code to silence deprecation warnings
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index d4aa8255..643e325f 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -157,6 +157,16 @@ module Bundler end end + if defined? ::Deprecate + Deprecate = ::Deprecate + elsif defined? Gem::Deprecate + Deprecate = Gem::Deprecate + else + class Deprecate + def skip_during; yield; end + end + end + def stub_source_index137(specs) # Rubygems versions lower than 1.7 use SourceIndex#from_gems_in source_index_class = (class << Gem::SourceIndex ; self ; end) @@ -172,8 +182,17 @@ module Bundler def stub_source_index170(specs) Gem::SourceIndex.send(:define_method, :initialize) do |*args| @gems = {} - self.spec_dirs = *args - add_specs(*specs) + # You're looking at this thinking: Oh! This is how I make those + # rubygems deprecations go away! + # + # You'd be correct BUT using of this method in production code + # must be approved by the rubygems team itself! + # + # This is your warning. If you use this and don't have approval + Deprecate.skip_during do + self.spec_dirs = *args + add_specs(*specs) + end end end |