git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authormail_redacted_for_web 2015-11-20 14:12:47 +0000
committermail_redacted_for_web 2015-11-20 14:13:17 +0000
commitc2bd0d3ca1fd4e9f2fce24196201835272fd1e21 (patch)
treec45f792f412d66f9ccf83b31ec46eefc4c040299 /scripts
parentf765903e25e2b7720a3cf52b78700275eb0197d5 (diff)
downloadcontrol-repo-template-c2bd0d3ca1fd4e9f2fce24196201835272fd1e21.tar.bz2
Check for rugged or output UNIX epoch
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/config_version.rb28
1 files changed, 17 insertions, 11 deletions
diff --git a/scripts/config_version.rb b/scripts/config_version.rb
index b61e929..30b6b67 100755
--- a/scripts/config_version.rb
+++ b/scripts/config_version.rb
@@ -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