lib/review/catalog.rb in review-2.4.0 vs lib/review/catalog.rb in review-2.5.0
- old
+ new
@@ -46,7 +46,37 @@
def postdef
return '' unless @yaml['POSTDEF']
@yaml['POSTDEF'].join("\n")
end
+
+ def validate!(basedir)
+ filenames = []
+ if predef.present?
+ filenames.concat(predef.split(/\n/))
+ end
+ parts_with_chaps.each do |chap|
+ if chap.is_a?(Hash)
+ chap.each_key do |part|
+ if File.extname(part) == '.re'
+ filenames.push(part)
+ end
+ end
+ filenames.concat(chap.values.flatten)
+ else
+ filenames.push(chap)
+ end
+ end
+ if appendix.present?
+ filenames.concat(appendix.split(/\n/))
+ end
+ if postdef.present?
+ filenames.concat(postdef.split(/\n/))
+ end
+ filenames.each do |filename|
+ unless File.exist?(File.join(basedir, filename))
+ raise FileNotFound, "file not found in catalog.yml: #{basedir}/#{filename}"
+ end
+ end
+ end
end
end