I'm trying to get CruiseControl.rb to run rcov during a build. It's currently failing with the following error:
sh: rcov: not found
Since I can run rcov
from the shell when I log in, I figure that this is a PATH problem. (Additionally, I can run both rake test:rcov
and rake cruise
from the shell without errors). I added a p 'echo $PATH'
statement (with the correct backticks to execute the command; thanks Markdown) to my cruise.rake and discovered that the path was indeed incorrect:
"/usr/local/bin:/usr/bin:/bin\n"
The rcov executable is at /var/lib/gems/1.8/bin/rcov, so it's no wonder that CC.rb can't find it.
However, I can't figure out how to set the path properly. I have this set at the bottom of my .profile:
PATH="$PATH:/var/lib/gems/1.8/bin/"
This is what makes it work interactively, but it's not being picked up by CC.
I'm running CruiseControl.rb under Passenger Phusion (and thus under apache). I've checked as many files as I can think of, but nothing looks like a PATH to me.
Where can I set the path and/or determine where the path is being set?
First of all, your .profile is wrong. You need to export the environment variable before it's visible to other processes. Like this:
export PATH=....
or
PATH=...
export PATH
Non-exported environment variable values can only be accessed from within the same shell process.
But that's not your problem since you're running Phusion Passenger. .profile is only read by the shell, and since Apache is not started from the shell, but from the system init process, whatever you put in .profile is ignored. For Phusion Passenger you have to set your PATH with mod_env and the SetEnv directive, like this:
<VirtualHost *:80>
ServerName something.test
DocumentRoot /somewhere/to/cruisecontrol/public
SetEnv PATH /usr/bin:/usr/local/bin:/bin:/var/lib/gems/1.8/bin # <---- add this
</VirtualHost>