summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands')
-rw-r--r--lib/rubygems/commands/open_command.rb2
-rw-r--r--lib/rubygems/commands/query_command.rb2
-rw-r--r--lib/rubygems/commands/sources_command.rb2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb
index a89b7421e3..059635e835 100644
--- a/lib/rubygems/commands/open_command.rb
+++ b/lib/rubygems/commands/open_command.rb
@@ -72,7 +72,7 @@ class Gem::Commands::OpenCommand < Gem::Command
end
def spec_for name
- spec = Gem::Specification.find_all_by_name(name, @version).last
+ spec = Gem::Specification.find_all_by_name(name, @version).first
return spec if spec
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index f25d120b88..70f8127292 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -86,7 +86,7 @@ is too hard to use.
name = Array(options[:name])
else
args = options[:args].to_a
- name = options[:exact] ? args : args.map{|arg| /#{arg}/i }
+ name = options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
end
prerelease = options[:prerelease]
diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb
index 9832afd214..7e46963a4c 100644
--- a/lib/rubygems/commands/sources_command.rb
+++ b/lib/rubygems/commands/sources_command.rb
@@ -44,7 +44,7 @@ class Gem::Commands::SourcesCommand < Gem::Command
source = Gem::Source.new source_uri
begin
- if Gem.sources.include? source_uri then
+ if Gem.sources.include? source then
say "source #{source_uri} already present in the cache"
else
source.load_specs :released