refactor condition evaluation in rake file