What caused Ruka to change?
It was the D-Mail Ruka sent that changed Ruka to a girl. 

When Okabe sees Ruka, he doesn't realize Ruka has in fact become a girl. He only realizes after Faris' D-Mail that Ruka has become a girl.

Also to support this, Faris' D-Mail wasn't sent that long back to have affected Ruka's gender, as Ruka was born well before Faris' D-Mail was sent.