summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-01-27 13:33:12 +1100
committerColby Swandale <colby@taplaboratories.com>2017-01-27 13:33:12 +1100
commit20e7a81f528b0379ae0f31988d8654c151ef8f61 (patch)
tree7f13dd7c33637f5d7251c2b4c0a6bdf7145dc04c
parent8490f5bccc77e2916ac30a1d93d57acac8616ea2 (diff)
downloadbundler-20e7a81f528b0379ae0f31988d8654c151ef8f61.tar.gz
allow info for default gems
-rw-r--r--lib/bundler/cli/info.rb9
-rw-r--r--spec/commands/info_spec.rb8
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/bundler/cli/info.rb b/lib/bundler/cli/info.rb
index 094ae93c55..29eb78f705 100644
--- a/lib/bundler/cli/info.rb
+++ b/lib/bundler/cli/info.rb
@@ -10,7 +10,14 @@ module Bundler
end
def run
- spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match)
+ begin
+ gem = Gem::Specification.find_by_name(gem_name)
+ spec = gem if gem.default_gem?
+ rescue Gem::MissingSpecError
+ end
+
+ spec ||= Bundler::CLI::Common.select_spec(gem_name, :regex_match)
+ return unless spec
return print_gem_path(spec) if @options[:path]
print_gem_info(spec)
end
diff --git a/spec/commands/info_spec.rb b/spec/commands/info_spec.rb
index 1780ae0909..5be60679f5 100644
--- a/spec/commands/info_spec.rb
+++ b/spec/commands/info_spec.rb
@@ -25,6 +25,14 @@ describe "bundle info" do
end
end
+ context "given a default gem shippped in ruby" do
+ it "prints information about the default gem" do
+ bundle "info rdoc"
+ expect(out).to include("* rdoc (5.0.0)")
+ expect(out).to match(%r{gems\/rdoc\-5\.0\.0})
+ end
+ end
+
context "when gem does not have homepage" do
before do
build_repo1 do