Last Updated: February 25, 2016
·
1.327K
· sickill

What has changed since the last deploy of a Rails app?

Here's a simple technique for getting a listing of all new commits that have been added to the master branch since the last deployment of a Rails application.
It assumes you're using master branch for production deploys and that you deploy with capistrano.

Add following lines to your config/deploy.rb file:

after "deploy:update_code", "deploy:symlink_revision"

namespace :deploy do
  task :symlink_revision do
    run "ln -nfs #{release_path}/REVISION #{release_path}/public/REVISION"
  end
end

Create a script new-release-log (and put it in your $PATH) with following contents:

git fetch origin >/dev/null 2>&1
git log --reverse --no-merges --oneline $(curl -s http://yourappname.com/REVISION)..origin/master

Now when you run new-release-log inside of your repository you'll get a list of all commits that will go to production when you type cap deploy next time.