Skip to content

Commit c2bd0d3

Browse files
committed
Check for rugged or output UNIX epoch
1 parent f765903 commit c2bd0d3

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

scripts/config_version.rb

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
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

0 commit comments

Comments
 (0)