I have written a Sinatra app (web site), and I would like to collect code coverage information for the site's code. I'm new to Ruby, but Google tells me that rcov is a good code coverage tool. Unfortunately, all the information I can find online shows only how to get code coverage information about test cases - I want code coverage information about my site itself.
The particular site files I want to profile are in the "sdk" and "sdk/vendor" directories, so where I would normally run my site with "ruby site.rb" I instead tried the following:
rcov -Isdk -Isdk/vendor site.rb
It showed the Sinatra start-up text, but then immediately exited instead of waiting for web requests like my Sinatra app normally would.
Can someone tell me the trick of running my site with code coverage enabled? I want to run the site, hit it with a series of requests, and then stop the site; after which I want to look at the accumulated code coverage stats from the whole series of requests.
I'm currently using Ruby 1.8.7.
Maybe you could take a look at SimpleCov, which advertises its simple usage for any kind of coverage analysis.