chore(env): Use Capistrano.stages and improve variable handling