Created
September 1, 2011 00:04
-
-
Save benhoskings/1185085 to your computer and use it in GitHub Desktop.
A git ref in every response!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter { | |
headers['X-Refspec'] = TC::Services.refspec | |
} | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TC | |
class Services | |
# The git ref that's currently running. Using ||= in a class method | |
# means we only shell out once, when the instance is booted. | |
def self.refspec | |
@_refspec ||= `git rev-parse --short HEAD 2>/dev/null`.strip | |
end | |
# ... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment