Hi, I want to add a revision counter to my rails app.
Not the number of commits necessary but the number of live pushes/deployments for example.
I'm using github as my remote repo.
Any suggestions?
Thanks
Hi, I want to add a revision counter to my rails app.
Not the number of commits necessary but the number of live pushes/deployments for example.
I'm using github as my remote repo.
Any suggestions?
Thanks
There's not one magic solution.
But basically, you should execute some code every time you deploy your application that increments the number of deployments by one.
One solution would be to create a capistrano task which would increment this.
namespace :deploy do
desc "Increments the number of deployments"
task :increment do
Config.find_by_key('deployments').update('value = value + 1'
end
end
It will take the uplet "deployments" in a config database (which you have to implement, this way or an other).
And in your capistrano recipes, you add the following :
after "deploy", "deploy:increment"
Every time you deploy your application, the deployment value in the config model will be updated by one.
This is only one example of a possible implementation. You might want to store the number of deployments somewhere else.
The main idea is to have the code executed every time you deploy.