diff options
-rw-r--r-- | lib/rubygems.rb | 6 | ||||
-rw-r--r-- | lib/rubygems/commands/dependency_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/query_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/dependency.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/dependency_list.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/deprecate.rb | 82 | ||||
-rw-r--r-- | lib/rubygems/gem_path_searcher.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/indexer.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/platform.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/server.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/source_index.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 4 |
12 files changed, 61 insertions, 59 deletions
@@ -118,7 +118,7 @@ require "rubygems/deprecate" # -The RubyGems Team module Gem - VERSION = '1.8.10' ## # Raised when RubyGems is unable to load or activate a gem. Contains the @@ -956,7 +956,7 @@ module Gem # Returns the Gem::SourceIndex of specifications that are in the Gem.path def self.source_index - @@source_index ||= Deprecate.skip_during do SourceIndex.new Gem::Specification.dirs end end @@ -1262,7 +1262,7 @@ require 'rubygems/custom_require' module Gem class << self - extend Deprecate deprecate :activate_dep, "Specification#activate", 2011, 6 deprecate :activate_spec, "Specification#activate", 2011, 6 deprecate :cache, "Gem::source_index", 2011, 8 @@ -59,7 +59,7 @@ class Gem::Commands::DependencyCommand < Gem::Command end # TODO: deprecate for real damnit - dependency = Deprecate.skip_during { Gem::Dependency.new pattern, options[:version] } dependency.prerelease = options[:prerelease] @@ -79,7 +79,7 @@ class Gem::Commands::QueryCommand < Gem::Command req = Gem::Requirement.default # TODO: deprecate for real - dep = Deprecate.skip_during { Gem::Dependency.new name, req } if local? then if prerelease and not both? then @@ -35,7 +35,7 @@ class Gem::Dependency if Regexp === name then msg = ["NOTE: Dependency.new w/ a regexp is deprecated.", "Dependency.new called from #{Gem.location_of_caller.join(":")}"] - warn msg.join("\n") unless Deprecate.skip end type = Symbol === requirements.last ? requirements.pop : :runtime @@ -246,7 +246,7 @@ end class Gem::DependencyList class << self - extend Deprecate deprecate :from_source_index, "from_specs", 2011, 11 end end @@ -11,58 +11,60 @@ # # ... # end # -# extend Deprecate # deprecate :instance_method, "X.z", 2011, 4 # # class << self -# extend Deprecate # deprecate :klass_method, :none, 2011, 4 # end # end -module Deprecate - def self.skip # :nodoc: - @skip ||= false - end - def self.skip= v # :nodoc: - @skip = v - end - ## - # Temporarily turn off warnings. Intended for tests only. - def skip_during - Deprecate.skip, original = true, Deprecate.skip - yield - ensure - Deprecate.skip = original - end - ## - # Simple deprecation method that deprecates +name+ by wrapping it up - # in a dummy method. It warns on each call to the dummy method - # telling the user of +repl+ (unless +repl+ is :none) and the - # year/month that it is planned to go away. - def deprecate name, repl, year, month - class_eval { - old = "_deprecated_#{name}" - alias_method old, name - define_method name do |*args, &block| # TODO: really works on 1.8.7? - klass = self.kind_of? Module - target = klass ? "#{self}." : "#{self.class}#" - msg = [ "NOTE: #{target}#{name} is deprecated", - repl == :none ? " with no replacement" : ", use #{repl}", - ". It will be removed on or after %4d-%02d-01." % [year, month], - "\n#{target}#{name} called from #{Gem.location_of_caller.join(":")}", - ] - warn "#{msg.join}." unless Deprecate.skip - send old, *args, &block - end - } - end - module_function :deprecate, :skip_during end @@ -160,7 +160,7 @@ class Gem::GemPathSearcher spec.require_paths end - extend Deprecate deprecate :initialize, :none, 2011, 10 deprecate :find, :none, 2011, 10 @@ -377,7 +377,7 @@ class Gem::Indexer # Collect specifications from .gem files from the gem directory. def collect_specs(gems = gem_file_list) - Deprecate.skip_during do index = Gem::SourceIndex.new map_gems_to_specs(gems).each do |spec| @@ -186,7 +186,7 @@ class Gem::Platform CURRENT = 'current' - extend Deprecate deprecate :empty?, :none, 2011, 11 end @@ -462,7 +462,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } add_date res - index = Deprecate.skip_during { Marshal.dump Gem.source_index } if req.request_method == 'HEAD' then res['content-length'] = index.length @@ -72,7 +72,7 @@ class Gem::SourceIndex # loaded spec. def self.load_specification(file_name) - Deprecate.skip_during do Gem::Specification.load Gem::Path.new(file_name) end end @@ -121,7 +121,7 @@ class Gem::SourceIndex spec_files = Dir[File.join(spec_dir, "*.gemspec")] spec_files.each do |spec_file| - gemspec = Deprecate.skip_during do Gem::Specification.load spec_file end add_spec gemspec if gemspec @@ -193,7 +193,7 @@ class Gem::SourceIndex # Add gem specifications to the source index. def add_specs(*gem_specs) - Deprecate.skip_during do gem_specs.each do |spec| add_spec spec end @@ -251,7 +251,7 @@ class Gem::SourceIndex def find_name(gem_name, requirement = Gem::Requirement.default) dep = Gem::Dependency.new gem_name, requirement - Deprecate.skip_during do search dep end end @@ -364,7 +364,7 @@ module Gem end class Gem::SourceIndex - extend Deprecate deprecate :all_gems, :none, 2011, 10 @@ -394,7 +394,7 @@ class Gem::SourceIndex deprecate :specification, "Specification.find", 2011, 11 class << self - extend Deprecate deprecate :from_gems_in, :none, 2011, 10 deprecate :from_installed_gems, :none, 2011, 10 @@ -329,7 +329,7 @@ class Gem::Specification def self.all warn "NOTE: Specification.all called from #{caller.first}" unless - Deprecate.skip _all end @@ -2104,7 +2104,7 @@ class Gem::Specification self.platform = Gem::Platform.new @platform end - extend Deprecate deprecate :test_suite_file, :test_file, 2011, 10 deprecate :test_suite_file=, :test_file=, 2011, 10 |