2016-11-19 00:30:28 +00:00
|
|
|
#!/usr/bin/env ruby
|
2015-11-20 14:12:47 +00:00
|
|
|
begin
|
|
|
|
require 'rugged'
|
|
|
|
rescue LoadError => e
|
|
|
|
t = Time.new
|
|
|
|
puts t.to_i
|
|
|
|
else
|
2015-08-25 18:47:19 +00:00
|
|
|
|
2015-11-20 14:12:47 +00:00
|
|
|
environmentpath = ARGV[0]
|
|
|
|
environment = ARGV[1]
|
2015-08-25 18:47:19 +00:00
|
|
|
|
2015-11-20 14:12:47 +00:00
|
|
|
repo = Rugged::Repository.discover(File.join(environmentpath, environment))
|
|
|
|
head = repo.head
|
2015-08-25 18:47:19 +00:00
|
|
|
|
2015-11-20 14:12:47 +00:00
|
|
|
#sha1 hash of the newest commit
|
|
|
|
head_sha = head.target_id
|
2015-08-25 18:47:19 +00:00
|
|
|
|
2015-11-20 14:12:47 +00:00
|
|
|
#the commit message associated the newest commit
|
|
|
|
commit = repo.lookup(head_sha)
|
2015-08-25 18:47:19 +00:00
|
|
|
|
2015-11-20 14:12:47 +00:00
|
|
|
#add something to find the remote url
|
2015-08-25 18:47:19 +00:00
|
|
|
|
2015-11-20 14:12:47 +00:00
|
|
|
puts head_sha
|
|
|
|
end
|