File tree Expand file tree Collapse file tree 2 files changed +21
-13
lines changed Expand file tree Collapse file tree 2 files changed +21
-13
lines changed Original file line number Diff line number Diff line change 1- require 'rugged'
1+ begin
2+ require 'rugged'
3+ rescue LoadError => e
4+ t = Time . new
5+ puts t . to_i
6+ else
27
3- environmentpath = ARGV [ 0 ]
4- environment = ARGV [ 1 ]
8+ environmentpath = ARGV [ 0 ]
9+ environment = ARGV [ 1 ]
510
6- repo = Rugged ::Repository . discover ( File . join ( environmentpath , environment ) )
7- head = repo . head
11+ repo = Rugged ::Repository . discover ( File . join ( environmentpath , environment ) )
12+ head = repo . head
813
9- #sha1 hash of the newest commit
10- head_sha = head . target_id
14+ #sha1 hash of the newest commit
15+ head_sha = head . target_id
1116
12- #the commit message associated the newest commit
13- commit = repo . lookup ( head_sha )
17+ #the commit message associated the newest commit
18+ commit = repo . lookup ( head_sha )
1419
15- #add something to find the remote url
20+ #add something to find the remote url
1621
17- puts head_sha
22+ puts head_sha
23+ end
Original file line number Diff line number Diff line change @@ -3,5 +3,7 @@ if [ -e /opt/puppetlabs/server/pe_version ]
33then
44 /opt/puppetlabs/puppet/bin/ruby $1 /$2 /scripts/config_version.rb $1 $2
55else
6- /usr/bin/git --git-dir $1 /$2 /.git rev-parse HEAD
7- fi
6+ /usr/bin/git --version > /dev/null 2>&1 &&
7+ /usr/bin/git --git-dir $1 /$2 /.git rev-parse HEAD ||
8+ date +%s
9+ fi
You can’t perform that action at this time.
0 commit comments