Permalink
Browse files

Fix gem dep bugs #20716 and #20717.

git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1784 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information...
drbrain
drbrain committed Jun 19, 2008
1 parent 997587f commit 2aaea351ce8892cfe68305f8e80921f59a89a2c3
Showing with 68 additions and 3 deletions.
  1. +7 −1 ChangeLog
  2. +9 −2 lib/rubygems/commands/dependency_command.rb
  3. +52 −0 test/test_gem_commands_dependency_command.rb
View
@@ -1,9 +1,15 @@
+2008-06-18 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/dependency_command.rb: Restore matching
+ everything when no name is specified, regexp matching. Fixes bug
+ #20716, bug #20717 by Chad Wooley.
+
2008-06-18 Chad Woolley <thewoolleyman@gmail.com>
* lib/rubygems/config_file.rb: Fix --config-file option with no
equals and subsequent options to properly assign config file.
Previously config file was overwritten by subsequent option.
- Fixes Bug 16688.
+ Fixes bug #16688.
2008-06-17 Eric Hodel <drbrain@segment7.net>
@@ -43,14 +43,21 @@ def usage # :nodoc:
end
def execute
- options[:args] << '.' if options[:args].empty?
+ options[:args] << '' if options[:args].empty?
specs = {}
source_indexes = Hash.new do |h, source_uri|
h[source_uri] = Gem::SourceIndex.new
end
- pattern = /\A#{Regexp.union(*options[:args])}/
+ pattern = if options[:args].length == 1 and
+ options[:args].first =~ /\A\/(.*)\/(i)?\z/m then
+ flags = $2 ? Regexp::IGNORECASE : nil
+ Regexp.new $1, flags
+ else
+ /\A#{Regexp.union(*options[:args])}/
+ end
+
dependency = Gem::Dependency.new pattern, options[:version]
if options[:reverse_dependencies] and remote? and not local? then
@@ -30,6 +30,34 @@ def test_execute
assert_equal '', @ui.error
end
+ def test_execute_no_args
+ Gem.source_index = nil
+
+ @cmd.options[:args] = []
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+Gem a-1
+
+Gem a-2
+
+Gem a_evil-9
+
+Gem b-2
+
+Gem c-1.2
+
+Gem pl-1-x86-linux
+
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_no_match
@cmd.options[:args] = %w[foo]
@@ -59,6 +87,30 @@ def test_execute_pipe_format
assert_equal '', @ui.error
end
+ def test_execute_regexp
+ Gem.source_index = nil
+
+ @cmd.options[:args] = %w[/[ab]/]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+Gem a-1
+
+Gem a-2
+
+Gem a_evil-9
+
+Gem b-2
+
+ EOF
+
+ assert_equal expected, @ui.output
+ assert_equal '', @ui.error
+ end
+
def test_execute_reverse
quick_gem 'foo' do |gem|
gem.add_dependency 'bar', '> 1'

0 comments on commit 2aaea35

Please sign in to comment.