Change task rule based on build_dir so main rules don't clobber gem rules

It seems like the build task regex for mruby is hiding the build task regexes for gems. I added a check to see if the task is for mruby or gems and change the regex accordingly.