summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh Wilson <ash.wilson@rackspace.com>2014-01-08 17:32:19 -0500
committerGabriel Jaldon <gjaldon85@gmail.com>2014-04-19 01:24:13 +0800
commit1e048c7cc5080a8794bcf1c730d4551df5e0ec73 (patch)
treed892ead6daa361c1abb5714bbec79aba13f47e04
parent7e6fc3aba9ce38cbbc193e6288b6865451f3ddfd (diff)
downloadbundler-1e048c7cc5080a8794bcf1c730d4551df5e0ec73.tar.gz
Autoinstall for "bundle license".
-rw-r--r--lib/bundler/cli.rb1
-rw-r--r--spec/commands/licenses_spec.rb13
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