Use Regex to search for author

This commit is contained in:
Brenda Wallace
2019-02-09 09:04:24 +13:00
parent bffbd94462
commit cde61a1c4f

View File

@@ -29,7 +29,10 @@ Please set it using
end
end
unless File.read('CONTRIBUTORS.md').include? author
# Escape chars in name, and make case insensitive
author_to_search_for = Regexp.new(Regexp.escape(author), Regexp::IGNORECASE)
unless File.read('CONTRIBUTORS.md').match?(author_to_search_for)
abort %(
Thanks for your contribution, #{author}!
Please add your name and GitHub handle to the file CONTRIBUTORS.md,