aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-01 21:50:14 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-01 21:50:14 +0000
commit7bf7a4a33be8387d9ff1ddfb762f97caeb8021f5 (patch)
treec8410a18cbbe7ad013470fc06fef0c75ce0fd230 /lib/rubygems/commands
parentd3ae99642eb6111e0a210e1e7dba32403a498335 (diff)
downloadruby-7bf7a4a33be8387d9ff1ddfb762f97caeb8021f5.tar.gz
* lib/rubygems: Update to RubyGems HEAD(c202db2).
this version contains many enhancements see http://git.io/vtNwF * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r--lib/rubygems/commands/dependency_command.rb40
-rw-r--r--lib/rubygems/commands/install_command.rb2
-rw-r--r--lib/rubygems/commands/list_command.rb2
-rw-r--r--lib/rubygems/commands/pristine_command.rb2
-rw-r--r--lib/rubygems/commands/query_command.rb2
5 files changed, 29 insertions, 19 deletions
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index 4a54a3e385..9d4b3e0f50 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -61,10 +61,16 @@ use with other commands.
ss.map { |spec, _| spec }
end
- def fetch_specs dependency # :nodoc:
+ def fetch_specs name_pattern, dependency # :nodoc:
specs = []
- specs.concat dependency.matching_specs if local?
+ if local?
+ specs.concat Gem::Specification.stubs.find_all { |spec|
+ name_pattern =~ spec.name and
+ dependency.requirement.satisfied_by? spec.version
+ }.map(&:to_spec)
+ end
+
specs.concat fetch_remote_specs dependency if remote?
ensure_specs specs
@@ -72,16 +78,7 @@ use with other commands.
specs.uniq.sort
end
- def gem_dependency args, version, prerelease # :nodoc:
- args << '' if args.empty?
-
- pattern = if args.length == 1 and args.first =~ /\A\/(.*)\/(i)?\z/m then
- flags = $2 ? Regexp::IGNORECASE : nil
- Regexp.new $1, flags
- else
- /\A#{Regexp.union(*args)}/
- end
-
+ def gem_dependency pattern, version, prerelease # :nodoc:
dependency = Gem::Deprecate.skip_during {
Gem::Dependency.new pattern, version
}
@@ -121,10 +118,12 @@ use with other commands.
def execute
ensure_local_only_reverse_dependencies
+ pattern = name_pattern options[:args]
+
dependency =
- gem_dependency options[:args], options[:version], options[:prerelease]
+ gem_dependency pattern, options[:version], options[:prerelease]
- specs = fetch_specs dependency
+ specs = fetch_specs pattern, dependency
reverse = reverse_dependencies specs
@@ -203,5 +202,16 @@ use with other commands.
result
end
-end
+ private
+ def name_pattern args
+ args << '' if args.empty?
+
+ if args.length == 1 and args.first =~ /\A\/(.*)\/(i)?\z/m then
+ flags = $2 ? Regexp::IGNORECASE : nil
+ Regexp.new $1, flags
+ else
+ /\A#{Regexp.union(*args)}/
+ end
+ end
+end
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 1bf5928ebb..7e3a953d19 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -275,7 +275,7 @@ to write the specification by hand. For example:
gem = fetcher.download_to_cache dependency
end
- inst = Gem::Installer.new gem, options
+ inst = Gem::Installer.at gem, options
inst.install
require 'rubygems/dependency_installer'
diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb
index c6ff237311..1842aaacca 100644
--- a/lib/rubygems/commands/list_command.rb
+++ b/lib/rubygems/commands/list_command.rb
@@ -33,7 +33,7 @@ To search for remote gems use the search command.
end
def usage # :nodoc:
- "#{program_name} [STRING ...]"
+ "#{program_name} [REGEXP ...]"
end
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 91308d83f6..5a36b12358 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -156,7 +156,7 @@ extensions will be restored.
install_defaults.to_s['--env-shebang']
end
- installer = Gem::Installer.new(gem,
+ installer = Gem::Installer.at(gem,
:wrappers => true,
:force => true,
:install_dir => spec.base_dir,
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 432250e033..0d28711de8 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -227,7 +227,7 @@ is too hard to use.
name_tuple, spec = detail_tuple
- spec = spec.fetch_spec name_tuple unless Gem::Specification === spec
+ spec = spec.fetch_spec name_tuple if spec.respond_to? :fetch_spec
entry << "\n"