Skip to content

Commit 85cacc2

Browse files
bleythingdrbrain
authored andcommitted
Revert "! gem search now defaults to --remote and is anchored like gem list. Fixes #166"
This reverts commit cefe716.
1 parent 7d7cb52 commit 85cacc2

File tree

3 files changed

+22
-35
lines changed

3 files changed

+22
-35
lines changed

lib/rubygems/commands/list_command.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
99

10-
def initialize(name = 'list',
11-
summary = 'Display gems whose name starts with STRING')
12-
super name, summary
10+
def initialize
11+
super 'list', 'Display gems whose name starts with STRING'
1312

1413
remove_option('--name-matches')
1514
end
@@ -27,9 +26,8 @@ def usage # :nodoc:
2726
end
2827

2928
def execute
30-
name = get_one_optional_argument || ''
31-
options[:name] = /^#{name}/i
32-
29+
string = get_one_optional_argument || ''
30+
options[:name] = /^#{string}/i
3331
super
3432
end
3533

lib/rubygems/commands/search_command.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
require 'rubygems/command'
2-
require 'rubygems/commands/list_command'
2+
require 'rubygems/commands/query_command'
33

4-
class Gem::Commands::SearchCommand < Gem::Commands::ListCommand
4+
class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
55

66
def initialize
77
super 'search', 'Display all gems whose name contains STRING'
88

9-
@defaults[:domain] = :remote
9+
remove_option '--name-matches'
10+
end
11+
12+
def arguments # :nodoc:
13+
"STRING fragment of gem name to search for"
1014
end
1115

1216
def defaults_str # :nodoc:
13-
"--remote --no-details"
17+
"--local --no-details"
18+
end
19+
20+
def usage # :nodoc:
21+
"#{program_name} [STRING]"
22+
end
23+
24+
def execute
25+
string = get_one_optional_argument
26+
options[:name] = /#{string}/i
27+
super
1428
end
1529

1630
end

test/rubygems/test_gem_commands_search_command.rb

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)