Detect Rails and open/create lib files accordingly.