control-repo/scripts/config_version.rb
Nick Walker c9931ceef7 Add ruby shebang to config_version scripts
Prior to this commit, if you used windows bash git when you clone
down the repo these files would get incorrect permissions which
make them unexecutable.

After this commit, due to some windows bash git magic I don't
understand it appears that adding the shebang to the beginning of
the file causes windows bash git to change the permissions to
so the file is executable.

This resolves https://github.com/puppetlabs/control-repo/issues/40
2016-11-22 13:20:15 -08:00

25 lines
468 B
Ruby
Executable File

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