Extract project.bash from rails.bash

and other refactoring of the profile.