(maint) Improve the template loop to check for suffix

Previously we would iterate over a list of erbs and blindly chop off the last 4
characters to form the new filename. This commit improves this slightly by
first checking to see if the suffix actually is erb, and then gsubs off the
.erb suffix. If non-erb files are encountered, warnings are issued for each
instance.