Fix self dependency of gems while installing parallely.

Thanks to @schneems for reporting and fixing the problem.We now detect
if gem has a dependency with same name and proceed with installation if
that is the case and that is the only dependency left.