Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #3969 - agis-:issue-3895, r=segiddins
Browse files Browse the repository at this point in the history
Output gemspec validation errors on exec commands

Fixes #3895.
  • Loading branch information
homu committed Aug 30, 2015
2 parents 21059b4 + 6d23012 commit 27550a5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def load_gemspec_uncached(file, validate = false)
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
Expand Down
27 changes: 27 additions & 0 deletions spec/commands/exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,31 @@
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

0 comments on commit 27550a5

Please sign in to comment.