Fight back
If you're face-to-face with it, do what others on this thread have said... whatever you can do to disconcert it and induce it to think twice and leave.
If you tangle with it, fight like hell. I gather that Cougars are mainly neck and skull-bite killers, so keep it away from your head, neck and throat. If you carry a knife, it should be non-folding, or able to be opened with one hand. (Myself, I'd pick folding. I wouldn't want to take the sort of tumble we bike riders do while carrying a sheath knife on my person. Carrying a sheath knife along the seat tube might be OK though, but it wouldn't be handy when you're not on the bike.) One guy suffered serious, permanent damage to his head and face because he needed both hands to open his knife. I think he lost an eye when the cougar bit his skull. He did kill the cat, but I saw a photo of him... you don't want to end up like that.
One thing to remember: if you are actually fighting it, don't expect to be able to run it off. You have to be able to kill it, and that means having a weapon. There's a misperception that cougars are skittish, shy animals. In fact they are bold and distainful of us. For example, someone left a tavern at night and was riding his bike down a blacktop road. He listened to a steady clicking behind him, and eventually realized that something was chasing him, just before he was dragged down from behind and found himself grappling with a cougar. After a while a car came along, and stopped, but the car and headlights affected the cougar not at all. The driver got out and tried to get the cat off the fellow on the ground, but it wouldn't budge. As I remember it, the cat didn't leave until the driver picked up the bike and started hitting the cougar with it. (Or it could have been that even that didn't work, and the cougar only left after the driver got something solid from the car trunk to beat it with. If you google the topic you'll probably come across the report for this attack.) Anyway, the point is that the cougar was outnumbered 3:1 by two full-grown men and an automobile, and didn't give a damn.
If a cougar tackles you from behind you won't have seen it first and won't have the standoff distance to use your spray. So, I'd say that a knife but no spray is OK, but spray with no knife isn't.
If it happens to any of us I hope we have our ff helmet on at the time...