Check for rugged or output UNIX epoch

This commit is contained in:
Ranjit Viswakumar 2015-11-20 14:12:47 +00:00
parent f765903e25
commit c2bd0d3ca1

View File

@ -1,17 +1,23 @@
require 'rugged' begin
require 'rugged'
rescue LoadError => e
t = Time.new
puts t.to_i
else
environmentpath = ARGV[0] environmentpath = ARGV[0]
environment = ARGV[1] environment = ARGV[1]
repo = Rugged::Repository.discover(File.join(environmentpath, environment)) repo = Rugged::Repository.discover(File.join(environmentpath, environment))
head = repo.head head = repo.head
#sha1 hash of the newest commit #sha1 hash of the newest commit
head_sha = head.target_id head_sha = head.target_id
#the commit message associated the newest commit #the commit message associated the newest commit
commit = repo.lookup(head_sha) commit = repo.lookup(head_sha)
#add something to find the remote url #add something to find the remote url
puts head_sha puts head_sha
end