Skip to content

Instantly share code, notes, and snippets.

@mikz
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikz/88d993f89af68239a39a to your computer and use it in GitHub Desktop.
Save mikz/88d993f89af68239a39a to your computer and use it in GitHub Desktop.
module CodeclimateRails
module Git
def info
{
committed_at: git_timestamp,
head: head,
branch: branch
}
end
def service_data
@service_data ||= CodeClimate::TestReporter::Ci.service_data
end
private
def git(*)
''
end
def head
service_data[:commit_sha]
end
def branch
service_data[:branch].to_s.strip.sub(/^origin\//, '')
end
def git_timestamp
(timestamp = ENV['GIT_TIMESTAMP']) ? timestamp.to_i : nil
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment