diff options
-rw-r--r-- | lib/bundler/cli.rb | 1 | ||||
-rw-r--r-- | spec/commands/licenses_spec.rb | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 18a478619b..8475b198fd 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -302,6 +302,7 @@ module Bundler desc "licenses", "Prints the license of all gems in the bundle" def licenses + auto_install Bundler.load.specs.sort_by { |s| s.license.to_s }.reverse.each do |s| gem_name = s.name license = s.license || s.licenses diff --git a/spec/commands/licenses_spec.rb b/spec/commands/licenses_spec.rb index c8d5ff739e..e2aba5a717 100644 --- a/spec/commands/licenses_spec.rb +++ b/spec/commands/licenses_spec.rb @@ -15,4 +15,17 @@ describe "bundle licenses" do expect(out).to include("actionpack: Unknown") expect(out).to include("with_license: MIT") end + + it "performs an automatic bundle install" do + gemfile <<-G + source "file://#{gem_repo1}" + gem "rails" + gem "with_license" + gem "foo" + G + + bundle "config auto_install 1" + bundle :licenses + expect(out).to include("Installing foo 1.0") + end end |