From 1e048c7cc5080a8794bcf1c730d4551df5e0ec73 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 Jan 2014 17:32:19 -0500 Subject: Autoinstall for "bundle license". --- lib/bundler/cli.rb | 1 + spec/commands/licenses_spec.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) 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 -- cgit v1.2.1