control-repo/scripts/config_version.rb

24 lines
448 B
Ruby
Raw Normal View History

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