public
Description: git version of the rubygems svn repo
Homepage: http://rubygems.rubyforge.org
Clone URL: git://github.com/lstoll/rubygems.git
Fix gem dep bugs #20716 and #20717.

git-svn-id: svn+ssh://rubyforge.org/var/svn/rubygems/trunk@1784 
3d4018f9-ac1a-0410-99e9-8a154d859a19
drbrain (author)
Wed Jun 18 17:32:16 -0700 2008
commit  8ab6e9ec55102d875ee60655755301492e6c361a
tree    d5423d0b2d179810ce34015b01d75b942ee4e2ee
parent  1b6f5b476f70c950d11d639984a6b765f557150b
...
 
 
 
 
 
 
1
2
3
4
5
6
 
7
8
9
...
1
2
3
4
5
6
7
8
9
10
11
 
12
13
14
15
0
@@ -1,9 +1,15 @@
0
+2008-06-18 Eric Hodel <drbrain@segment7.net>
0
+
0
+ * lib/rubygems/commands/dependency_command.rb: Restore matching
0
+ everything when no name is specified, regexp matching. Fixes bug
0
+ #20716, bug #20717 by Chad Wooley.
0
+
0
 2008-06-18 Chad Woolley <thewoolleyman@gmail.com>
0
 
0
   * lib/rubygems/config_file.rb: Fix --config-file option with no
0
   equals and subsequent options to properly assign config file.
0
   Previously config file was overwritten by subsequent option.
0
- Fixes Bug 16688.
0
+ Fixes bug #16688.
0
 
0
 2008-06-17 Eric Hodel <drbrain@segment7.net>
0
 
...
43
44
45
46
 
47
48
49
50
51
52
53
 
 
 
 
 
 
 
 
54
55
56
...
43
44
45
 
46
47
48
49
50
51
52
 
53
54
55
56
57
58
59
60
61
62
63
0
@@ -43,14 +43,21 @@ class Gem::Commands::DependencyCommand < Gem::Command
0
   end
0
 
0
   def execute
0
- options[:args] << '.' if options[:args].empty?
0
+ options[:args] << '' if options[:args].empty?
0
     specs = {}
0
 
0
     source_indexes = Hash.new do |h, source_uri|
0
       h[source_uri] = Gem::SourceIndex.new
0
     end
0
 
0
- pattern = /\A#{Regexp.union(*options[:args])}/
0
+ pattern = if options[:args].length == 1 and
0
+ options[:args].first =~ /\A\/(.*)\/(i)?\z/m then
0
+ flags = $2 ? Regexp::IGNORECASE : nil
0
+ Regexp.new $1, flags
0
+ else
0
+ /\A#{Regexp.union(*options[:args])}/
0
+ end
0
+
0
     dependency = Gem::Dependency.new pattern, options[:version]
0
 
0
     if options[:reverse_dependencies] and remote? and not local? then
...
30
31
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
34
35
...
59
60
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
63
64
...
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
0
@@ -30,6 +30,34 @@ class TestGemCommandsDependencyCommand < RubyGemTestCase
0
     assert_equal '', @ui.error
0
   end
0
 
0
+ def test_execute_no_args
0
+ Gem.source_index = nil
0
+
0
+ @cmd.options[:args] = []
0
+
0
+ use_ui @ui do
0
+ @cmd.execute
0
+ end
0
+
0
+ expected = <<-EOF
0
+Gem a-1
0
+
0
+Gem a-2
0
+
0
+Gem a_evil-9
0
+
0
+Gem b-2
0
+
0
+Gem c-1.2
0
+
0
+Gem pl-1-x86-linux
0
+
0
+ EOF
0
+
0
+ assert_equal expected, @ui.output
0
+ assert_equal '', @ui.error
0
+ end
0
+
0
   def test_execute_no_match
0
     @cmd.options[:args] = %w[foo]
0
 
0
@@ -59,6 +87,30 @@ class TestGemCommandsDependencyCommand < RubyGemTestCase
0
     assert_equal '', @ui.error
0
   end
0
 
0
+ def test_execute_regexp
0
+ Gem.source_index = nil
0
+
0
+ @cmd.options[:args] = %w[/[ab]/]
0
+
0
+ use_ui @ui do
0
+ @cmd.execute
0
+ end
0
+
0
+ expected = <<-EOF
0
+Gem a-1
0
+
0
+Gem a-2
0
+
0
+Gem a_evil-9
0
+
0
+Gem b-2
0
+
0
+ EOF
0
+
0
+ assert_equal expected, @ui.output
0
+ assert_equal '', @ui.error
0
+ end
0
+
0
   def test_execute_reverse
0
     quick_gem 'foo' do |gem|
0
       gem.add_dependency 'bar', '> 1'

Comments

    No one has commented yet.