summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-08 10:53:11 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-08 10:53:11 +0000
commit54ecf81ffc498acb47f025be471fe5177f89b24c (patch)
tree58d16174ec2e337181fb86298c376afc9b54f517 /lib
parent370a64cf10a3212106cfb7317fd908296e9ac7ca (diff)
merge revision(s) 33386:
* lib/rubygems: Update to RubyGems 1.8.11. Move Deprecate into the Gem namespace. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb6
-rw-r--r--lib/rubygems/commands/dependency_command.rb2
-rw-r--r--lib/rubygems/commands/query_command.rb2
-rw-r--r--lib/rubygems/dependency.rb2
-rw-r--r--lib/rubygems/dependency_list.rb2
-rw-r--r--lib/rubygems/deprecate.rb82
-rw-r--r--lib/rubygems/gem_path_searcher.rb2
-rw-r--r--lib/rubygems/indexer.rb2
-rw-r--r--lib/rubygems/platform.rb2
-rw-r--r--lib/rubygems/server.rb2
-rw-r--r--lib/rubygems/source_index.rb12
-rw-r--r--lib/rubygems/specification.rb4
12 files changed, 61 insertions, 59 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 632b5e0a60..c8f969224c 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -118,7 +118,7 @@ require "rubygems/deprecate"
# -The RubyGems Team
module Gem
- VERSION = '1.8.10'
+ VERSION = '1.8.11'
##
# 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
+ @@source_index ||= Gem::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
+ extend Gem::Deprecate
deprecate :activate_dep, "Specification#activate", 2011, 6
deprecate :activate_spec, "Specification#activate", 2011, 6
deprecate :cache, "Gem::source_index", 2011, 8
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index f493d40289..67cbbc1d5e 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -59,7 +59,7 @@ class Gem::Commands::DependencyCommand < Gem::Command
end
# TODO: deprecate for real damnit
- dependency = Deprecate.skip_during {
+ dependency = Gem::Deprecate.skip_during {
Gem::Dependency.new pattern, options[:version]
}
dependency.prerelease = options[:prerelease]
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 1033b83447..725da8787b 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -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 }
+ dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }
if local? then
if prerelease and not both? then
diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb
index 1e1663678e..0caf65c6c4 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -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
+ warn msg.join("\n") unless Gem::Deprecate.skip
end
type = Symbol === requirements.last ? requirements.pop : :runtime
diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb
index d54b659b66..9f1da9166c 100644
--- a/lib/rubygems/dependency_list.rb
+++ b/lib/rubygems/dependency_list.rb
@@ -246,7 +246,7 @@ end
class Gem::DependencyList
class << self
- extend Deprecate
+ extend Gem::Deprecate
deprecate :from_source_index, "from_specs", 2011, 11
end
end
diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index 4827a05ad4..a78208ec24 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -11,58 +11,60 @@
# # ...
# end
#
-# extend Deprecate
+# extend Gem::Deprecate
# deprecate :instance_method, "X.z", 2011, 4
#
# class << self
-# extend Deprecate
+# extend Gem::Deprecate
# deprecate :klass_method, :none, 2011, 4
# end
# end
-module Deprecate
+module Gem
+ module Deprecate
- def self.skip # :nodoc:
- @skip ||= false
- end
+ def self.skip # :nodoc:
+ @skip ||= false
+ end
- def self.skip= v # :nodoc:
- @skip = v
- end
+ def self.skip= v # :nodoc:
+ @skip = v
+ end
- ##
- # Temporarily turn off warnings. Intended for tests only.
+ ##
+ # Temporarily turn off warnings. Intended for tests only.
- def skip_during
- Deprecate.skip, original = true, Deprecate.skip
- yield
- ensure
- Deprecate.skip = original
- end
+ def skip_during
+ Gem::Deprecate.skip, original = true, Gem::Deprecate.skip
+ yield
+ ensure
+ Gem::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.
+ ##
+ # 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
+ 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 Gem::Deprecate.skip
+ send old, *args, &block
+ end
+ }
+ end
- module_function :deprecate, :skip_during
+ module_function :deprecate, :skip_during
+ end
end
diff --git a/lib/rubygems/gem_path_searcher.rb b/lib/rubygems/gem_path_searcher.rb
index 1d67d75149..814b5fb0e5 100644
--- a/lib/rubygems/gem_path_searcher.rb
+++ b/lib/rubygems/gem_path_searcher.rb
@@ -160,7 +160,7 @@ class Gem::GemPathSearcher
spec.require_paths
end
- extend Deprecate
+ extend Gem::Deprecate
deprecate :initialize, :none, 2011, 10
deprecate :find, :none, 2011, 10
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index 23c0167be8..e87e5a3632 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -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
+ Gem::Deprecate.skip_during do
index = Gem::SourceIndex.new
map_gems_to_specs(gems).each do |spec|
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 4b5b6ef81a..4a4e3c1b35 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -186,7 +186,7 @@ class Gem::Platform
CURRENT = 'current'
- extend Deprecate
+ extend Gem::Deprecate
deprecate :empty?, :none, 2011, 11
end
diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb
index 9c49d1ff85..47fa7c562d 100644
--- a/lib/rubygems/server.rb
+++ b/lib/rubygems/server.rb
@@ -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 }
+ index = Gem::Deprecate.skip_during { Marshal.dump Gem.source_index }
if req.request_method == 'HEAD' then
res['content-length'] = index.length
diff --git a/lib/rubygems/source_index.rb b/lib/rubygems/source_index.rb
index 7ddbc23485..1fe92c0a80 100644
--- a/lib/rubygems/source_index.rb
+++ b/lib/rubygems/source_index.rb
@@ -72,7 +72,7 @@ class Gem::SourceIndex
# loaded spec.
def self.load_specification(file_name)
- Deprecate.skip_during do
+ Gem::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
+ gemspec = Gem::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::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
+ Gem::Deprecate.skip_during do
search dep
end
end
@@ -364,7 +364,7 @@ module Gem
end
class Gem::SourceIndex
- extend Deprecate
+ extend Gem::Deprecate
deprecate :all_gems, :none, 2011, 10
@@ -394,7 +394,7 @@ class Gem::SourceIndex
deprecate :specification, "Specification.find", 2011, 11
class << self
- extend Deprecate
+ extend Gem::Deprecate
deprecate :from_gems_in, :none, 2011, 10
deprecate :from_installed_gems, :none, 2011, 10
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 2059e0762d..97db19e69a 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -329,7 +329,7 @@ class Gem::Specification
def self.all
warn "NOTE: Specification.all called from #{caller.first}" unless
- Deprecate.skip
+ Gem::Deprecate.skip
_all
end
@@ -2104,7 +2104,7 @@ class Gem::Specification
self.platform = Gem::Platform.new @platform
end
- extend Deprecate
+ extend Gem::Deprecate
deprecate :test_suite_file, :test_file, 2011, 10
deprecate :test_suite_file=, :test_file=, 2011, 10