Commit 8d6d99a0 authored by Samuel Giddins's avatar Samuel Giddins

Merge pull request #5252 from CocoaPods/seg-validate-resource-bundles

[Validator] Validate that resource bundles contain resources
parents 14f7ec3c 2c51e0d5
......@@ -8,7 +8,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* None.
* Validate that resource bundles declared in the podspec contain resources.
[Samuel Giddins](https://github.com/segiddins)
[#5218](https://github.com/CocoaPods/CocoaPods/issues/5218)
##### Bug Fixes
......
......@@ -556,6 +556,13 @@ module Pod
end
end
def _validate_resource_bundles
file_accessor.resource_bundles.each do |bundle, resource_paths|
next unless resource_paths.empty?
error('file patterns', "The `resource_bundles` pattern for `#{bundle}` did not match any file.")
end
end
# Ensures that a list of header files only contains header files.
#
def _validate_header_files(attr_name)
......
......@@ -642,6 +642,23 @@ module Pod
validator.results.map(&:to_s).first.should.match /Unexpected file extension for modulemap file \(JSONKit\.m\)/
validator.result_type.should == :error
end
it 'checks resource bundles have resources' do
file = write_podspec(stub_podspec(/.*source_files.*/, <<-JSON))
"source_files": "JSONKit.*",
"resource_bundles": {
"bundle1": ["CHANGELOG.md", "*.md"],
"bundle2": "foo.bar*"
},
JSON
validator = Validator.new(file, config.sources_manager.master.map(&:url))
validator.stubs(:build_pod)
validator.stubs(:validate_url)
validator.validate
validator.results.map(&:to_s).first.should.include 'The `resource_bundles` pattern for `bundle2` did not match any file'
validator.result_type.should == :error
end
end
it 'validates a podspec with dependencies' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment