aboutsummaryrefslogtreecommitdiff
path: root/project/VersionWithSHA.scala
diff options
context:
space:
mode:
authoradelio <adelio@despegar.com>2014-03-30 23:05:17 -0300
committeradelio <adelio@despegar.com>2014-04-03 10:59:25 -0300
commita6e7752525c70bb316ceb09f8daed56cdc0f05d5 (patch)
treeb049ca32bbfe2d07b5774360df7bef6cd74d2e98 /project/VersionWithSHA.scala
parent1f6a3f3bb9c59da198df302193ddf5c29c4e42d6 (diff)
downloadKamon-a6e7752525c70bb316ceb09f8daed56cdc0f05d5.tar.gz
Kamon-a6e7752525c70bb316ceb09f8daed56cdc0f05d5.tar.bz2
Kamon-a6e7752525c70bb316ceb09f8daed56cdc0f05d5.zip
commit SHA support, signed publish support, sonatype support
Diffstat (limited to 'project/VersionWithSHA.scala')
-rw-r--r--project/VersionWithSHA.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/project/VersionWithSHA.scala b/project/VersionWithSHA.scala
new file mode 100644
index 00000000..4479b88f
--- /dev/null
+++ b/project/VersionWithSHA.scala
@@ -0,0 +1,13 @@
+import sbt.Process
+
+object VersionWithSHA {
+
+ private lazy val VersionWithShaRegex = """(?:\d+\.)?(?:\d+\.)?(?:\d+)-[0-9a-f]{5,40}"""
+
+ /** Don't use this. You should use version.value instead. */
+ def kamonVersionWithSHA(version: String) = version.takeWhile(_ != '-') + "-" + Process("git rev-parse HEAD").lines.head
+
+ /** Don't use this. You should use isSnapshot.value instead. */
+ def kamonIsSnapshot(version: String) = (version matches VersionWithShaRegex) || (version endsWith "-SNAPSHOT")
+
+} \ No newline at end of file