summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAgis- <corestudiosinc@gmail.com>2015-08-30 13:34:28 +0300
committerAgis- <corestudiosinc@gmail.com>2015-08-30 17:56:10 +0300
commit6d23012ad385ce51235d0610b30ca3c3952596b5 (patch)
treeba3cd9762a8dd6bafb86a547ac74304c13af0f27
parentfa9c4e2343ebeaaa4e0eb62c41327eba37cca9ee (diff)
downloadbundler-6d23012ad385ce51235d0610b30ca3c3952596b5.tar.gz
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 a299a2adc7..e45bcf6c37 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -398,7 +398,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