Fork Of

gist: 48967 by matthew... Git SHA1 of HEAD in your Ra...

Revisions

gist: 49178 Download_button fork
public
Public Clone URL: git://gist.github.com/49178.git
Embed All Files: show embed
deploy.rb #
1
2
3
4
5
6
7
after "deploy:update_code", "deploy:write_sha1"
namespace :deploy do
  desc "write sha1 to file"
  task :write_sha1 do
    run "cd #{latest_release} && git show-ref --hash -- refs/heads/master > #{latest_release}/config/HEAD"
  end
end
production.rb #
1
2
3
4
git_sha1_path = "#{RAILS_ROOT}/config/HEAD"
GIT_SHA1 = if File.file?(git_sha1_path)
             File.open(git_sha1_path).readlines[0]
           end