1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Add --version parameter to bundle info command.

https://github.com/rubygems/rubygems/commit/7d9fdd908d
This commit is contained in:
Josef Šimánek 2021-12-06 01:42:43 +01:00 committed by git
parent 5ce3272e51
commit 25423f0918
3 changed files with 11 additions and 0 deletions

View file

@ -331,6 +331,7 @@ module Bundler
desc "info GEM [OPTIONS]", "Show information for the given gem"
method_option "path", :type => :boolean, :banner => "Print full path to gem"
method_option "version", :type => :boolean, :banner => "Print gem version"
def info(gem_name)
require_relative "cli/info"
Info.new(options, gem_name).run

View file

@ -18,6 +18,7 @@ module Bundler
if spec
return print_gem_path(spec) if @options[:path]
return print_gem_version(spec) if @options[:version]
print_gem_info(spec)
end
end
@ -39,6 +40,10 @@ module Bundler
raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(gem_name, Bundler.definition.dependencies)
end
def print_gem_version(spec)
Bundler.ui.info spec.version.to_s
end
def print_gem_path(spec)
name = spec.name
if name == "bundler"

View file

@ -50,6 +50,11 @@ RSpec.describe "bundle info" do
expect(out).to eq(root.to_s)
end
it "prints gem version if exists in bundle" do
bundle "info rails --version"
expect(out).to eq("2.3.2")
end
it "doesn't claim that bundler has been deleted, even if using a custom path without bundler there" do
bundle "config set --local path vendor/bundle"
bundle "install"