summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2015-08-31 04:55:47 +0900
committerHomu <homu@barosl.com>2015-08-31 04:55:47 +0900
commit4cc8417a68c72e61d477b4f7d8feaeab692025ea (patch)
treec9e8775f27835ef6f8287fd67b3557b149ff8152
parentce13e4eef34600926ce6a6d4f3027aeb86be408c (diff)
parent6d23012ad385ce51235d0610b30ca3c3952596b5 (diff)
downloadbundler-4cc8417a68c72e61d477b4f7d8feaeab692025ea.tar.gz
Auto merge of #3969 - agis-:issue-3895, r=segiddins
Output gemspec validation errors on exec commands Fixes #3895.
-rw-r--r--lib/bundler.rb2
-rw-r--r--spec/commands/exec_spec.rb27
2 files changed, 28 insertions, 1 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index eacee447e0..b7b43ed8e0 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -409,7 +409,7 @@ module Bundler
spec
end
rescue Gem::InvalidSpecificationException => e
- Bundler.ui.warn "The gemspec at #{file} is not valid. " \
+ UI::Shell.new.warn "The gemspec at #{file} is not valid. " \
"The validation error was '#{e.message}'"
nil
end
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index e11b075aee..3dd3e882e0 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -318,4 +318,31 @@ describe "bundle exec" do
bundle "exec rackup"
expect(out).to include("Installing foo 1.0")
end
+
+ describe "with gems bundled via :path with invalid gemspecs" do
+ it "outputs the gemspec validation errors", :rubygems => ">= 1.7.2" do
+ build_lib "foo"
+
+ gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s
+ File.open(gemspec, "w") do |f|
+ f.write <<-G
+ Gem::Specification.new do |s|
+ s.name = 'foo'
+ s.version = '1.0'
+ s.summary = 'TODO: Add summary'
+ s.authors = 'Me'
+ end
+ G
+ end
+
+ install_gemfile <<-G, :expect_err => true
+ gem "foo", :path => "#{lib_path("foo-1.0")}"
+ G
+
+ bundle "exec irb", :expect_err => true
+
+ expect(out).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid")
+ expect(out).to match('"TODO" is not a summary')
+ end
+ end
end