The theoretical framework of quasi-optical propagation power absorption and driven current of a Gaussian beam of electron cyclotron (EC) waves in a general tokamak equilibrium implemented in the code GRAY is presented. Within the framework of the complex eikonal approach, the propagation of a general astigmatic Gaussian beam is described in terms of a set of coupled rays, allowing for diffraction effects. The computation of the EC wave absorption and current drive is performed for each ray of the beam, by means of a relativistic dispersion relation for EC waves and of a neoclassical response function for the current. The code has been designed and tested for calculations of propagation, power absorption, and current drive of realistic EC beams in ITER.