matthewford (owner)

Forks

Revisions

  • 304757 deimos1986 Mon Jan 19 04:14:32 -0800 2009
gist: 48967 Download_button fork
public
Description:
Git SHA1 of HEAD in your Rails App
Public Clone URL: git://gist.github.com/48967.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 --heads --hash=7 > #{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