Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions scripts/config_version.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
require 'rugged'
begin
require 'rugged'
rescue LoadError => e
t = Time.new
puts t.to_i
else

environmentpath = ARGV[0]
environment = ARGV[1]
environmentpath = ARGV[0]
environment = ARGV[1]

repo = Rugged::Repository.discover(File.join(environmentpath, environment))
head = repo.head
repo = Rugged::Repository.discover(File.join(environmentpath, environment))
head = repo.head

#sha1 hash of the newest commit
head_sha = head.target_id
#sha1 hash of the newest commit
head_sha = head.target_id

#the commit message associated the newest commit
commit = repo.lookup(head_sha)
#the commit message associated the newest commit
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
6 changes: 4 additions & 2 deletions scripts/config_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ if [ -e /opt/puppetlabs/server/pe_version ]
then
/opt/puppetlabs/puppet/bin/ruby $1/$2/scripts/config_version.rb $1 $2
else
/usr/bin/git --git-dir $1/$2/.git rev-parse HEAD
fi
/usr/bin/git --version > /dev/null 2>&1 &&
/usr/bin/git --git-dir $1/$2/.git rev-parse HEAD ||
date +%s
fi