git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authormail_redacted_for_web 2015-08-25 11:47:19 -0700
committermail_redacted_for_web 2015-08-25 11:47:19 -0700
commit568978d76fff65da6879cff285c6e4eb22a94c4e (patch)
tree53ce8e3abd87d7d3a5d7863bfecb18818bbab577 /scripts
parent1e174e6c60e97596e3575f069370018208f16f38 (diff)
downloadcontrol-repo-template-568978d76fff65da6879cff285c6e4eb22a94c4e.tar.bz2
pulling some stuff from npwalker/control-repo
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/config_version.rb17
-rwxr-xr-xscripts/config_version.sh7
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/config_version.rb b/scripts/config_version.rb
new file mode 100755
index 0000000..52f32c5
--- /dev/null
+++ b/scripts/config_version.rb
@@ -0,0 +1,17 @@
+require 'rugged'
+
+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
diff --git a/scripts/config_version.sh b/scripts/config_version.sh
new file mode 100755
index 0000000..543ec26
--- /dev/null
+++ b/scripts/config_version.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+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