Move rails setup out and refactory ruby