Permalink
Browse files

Bug #20876

git-svn-id: http://rubygems.rubyforge.org/svn/trunk@1836 3d4018f9-ac1a-0410-99e9-8a154d859a19
  • Loading branch information...
drbrain
drbrain committed Jul 1, 2008
1 parent a1cd0f5 commit 047835eeb73fead41bd313e6a9a232a6fa90ea81
View
@@ -7,6 +7,10 @@
* lib/rubygems/uninstaller.rb: Add #gem_home, #bin_dir for hooks.
* lib/rubygems/commands/query_command.rb: Don't print LOCAL/REMOTE
gems if stdout is not a TTY.
+ * lib/rubygems/commands/query_command.rb: Use the regexp we already
+ have for `gem list --installed`. Bug #20876 by Nick Hoffman.
+ * lib/rubygems/commands/which_command.rb: Clarify what `gem which` is
+ for.
2008-06-30 Eric Hodel <drbrain@segment7.net>
@@ -59,7 +59,7 @@ def execute
if name.source.empty? then
alert_error "You must specify a gem name"
exit_code |= 4
- elsif installed? name.source, options[:version] then
+ elsif installed? name, options[:version] then
say "true"
else
say "false"
@@ -3,10 +3,10 @@
class Gem::Commands::WhichCommand < Gem::Command
- EXT = %w[.rb .rbw .so .dll] # HACK
+ EXT = %w[.rb .rbw .so .dll .bundle] # HACK
def initialize
- super 'which', 'Find the location of a library',
+ super 'which', 'Find the location of a library file you can require',
:search_gems_first => false, :show_all => false
add_option '-a', '--[no-]all', 'show all matching files' do |show_all, options|
@@ -52,7 +52,7 @@ def execute
paths = find_paths arg, dirs
if paths.empty? then
- say "Can't find #{arg}"
+ say "Can't find ruby library file or shared library #{arg}"
else
say paths
end
@@ -84,3 +84,4 @@ def usage # :nodoc:
end
end
+
@@ -270,7 +270,7 @@ def search(gem_pattern, platform_only = false)
specs = @gems.values.select do |spec|
spec.name =~ gem_pattern and
- version_requirement.satisfied_by? spec.version
+ version_requirement.satisfied_by? spec.version
end
if only_platform then
@@ -0,0 +1,37 @@
+require 'test/unit'
+require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
+require 'rubygems/commands/list_command'
+
+class TestGemCommandsListCommand < RubyGemTestCase
+
+ def setup
+ super
+
+ @cmd = Gem::Commands::ListCommand.new
+
+ util_setup_fake_fetcher
+
+ @si = util_setup_spec_fetcher @a1, @a2, @pl1
+
+ @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
+ raise Gem::RemoteFetcher::FetchError
+ end
+ end
+
+ def test_execute_installed
+ @cmd.handle_options %w[c --installed]
+
+ e = assert_raise Gem::SystemExitException do
+ use_ui @ui do
+ @cmd.execute
+ end
+ end
+
+ assert_equal 0, e.exit_code
+
+ assert_equal "true\n", @ui.output
+
+ assert_equal '', @ui.error
+ end
+
+end

0 comments on commit 047835e

Please sign in to comment.