зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Only validate resolution info in Bundler
This commit switches out the full gemspec validation for a partial one which only performs resolution related checks. This will allow gem authors to run `bundle` commands immediately after creating a new gem with Bundler, rather than having to fix metadata validation issues in the default gemspec. https://github.com/rubygems/rubygems/commit/d5aa9cae9d
This commit is contained in:
Родитель
39951293b4
Коммит
b88ac94eec
|
@ -52,7 +52,7 @@ module Bundler
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate(spec)
|
def validate(spec)
|
||||||
Bundler.ui.silence { spec.validate(false) }
|
Bundler.ui.silence { spec.validate_for_resolution }
|
||||||
rescue Gem::InvalidSpecificationException => e
|
rescue Gem::InvalidSpecificationException => e
|
||||||
error_message = "The gemspec at #{spec.loaded_from} is not valid. Please fix this gemspec.\n" \
|
error_message = "The gemspec at #{spec.loaded_from} is not valid. Please fix this gemspec.\n" \
|
||||||
"The validation error was '#{e.message}'\n"
|
"The validation error was '#{e.message}'\n"
|
||||||
|
|
|
@ -11,14 +11,14 @@ RSpec.describe Bundler::RubygemsIntegration do
|
||||||
end
|
end
|
||||||
subject { Bundler.rubygems.validate(spec) }
|
subject { Bundler.rubygems.validate(spec) }
|
||||||
|
|
||||||
it "validates with packaging mode disabled" do
|
it "validates for resolution" do
|
||||||
expect(spec).to receive(:validate).with(false)
|
expect(spec).to receive(:validate_for_resolution)
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with an invalid spec" do
|
context "with an invalid spec" do
|
||||||
before do
|
before do
|
||||||
expect(spec).to receive(:validate).with(false).
|
expect(spec).to receive(:validate_for_resolution).
|
||||||
and_raise(Gem::InvalidSpecificationException.new("TODO is not an author"))
|
and_raise(Gem::InvalidSpecificationException.new("TODO is not an author"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -674,6 +674,7 @@ RSpec.describe "bundle exec" do
|
||||||
s.version = '1.0'
|
s.version = '1.0'
|
||||||
s.summary = 'TODO: Add summary'
|
s.summary = 'TODO: Add summary'
|
||||||
s.authors = 'Me'
|
s.authors = 'Me'
|
||||||
|
s.rubygems_version = nil
|
||||||
end
|
end
|
||||||
G
|
G
|
||||||
end
|
end
|
||||||
|
@ -686,7 +687,7 @@ RSpec.describe "bundle exec" do
|
||||||
bundle "exec irb", raise_on_error: false
|
bundle "exec irb", raise_on_error: false
|
||||||
|
|
||||||
expect(err).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid")
|
expect(err).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid")
|
||||||
expect(err).to match('"TODO" is not a summary')
|
expect(err).to match(/missing value for attribute rubygems_version|rubygems_version must not be nil/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче