File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,7 @@ def list
331331
332332 desc "info GEM [OPTIONS]" , "Show information for the given gem"
333333 method_option "path" , :type => :boolean , :banner => "Print full path to gem"
334+ method_option "version" , :type => :boolean , :banner => "Print gem version"
334335 def info ( gem_name )
335336 require_relative "cli/info"
336337 Info . new ( options , gem_name ) . run
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ def run
1818
1919 if spec
2020 return print_gem_path ( spec ) if @options [ :path ]
21+ return print_gem_version ( spec ) if @options [ :version ]
2122 print_gem_info ( spec )
2223 end
2324 end
@@ -39,6 +40,10 @@ def spec_not_found(gem_name)
3940 raise GemNotFound , Bundler ::CLI ::Common . gem_not_found_message ( gem_name , Bundler . definition . dependencies )
4041 end
4142
43+ def print_gem_version ( spec )
44+ Bundler . ui . info spec . version . to_s
45+ end
46+
4247 def print_gem_path ( spec )
4348 name = spec . name
4449 if name == "bundler"
Original file line number Diff line number Diff line change 5050 expect ( out ) . to eq ( root . to_s )
5151 end
5252
53+ it "prints gem version if exists in bundle" do
54+ bundle "info rails --version"
55+ expect ( out ) . to eq ( "2.3.2" )
56+ end
57+
5358 it "doesn't claim that bundler has been deleted, even if using a custom path without bundler there" do
5459 bundle "config set --local path vendor/bundle"
5560 bundle "install"
You can’t perform that action at this time.
0 commit comments