From d190b9e224bf0705391ee4587de9c4fe262613e1 Mon Sep 17 00:00:00 2001
From: bow <bow@bow.web.id>
Date: Mon, 23 Mar 2015 10:39:18 +0100
Subject: [PATCH] Add nl.lumc.sasc.biopet package object to store package-wide
 information

---
 .../scala/nl/lumc/sasc/biopet/package.scala   | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/package.scala

diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/package.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/package.scala
new file mode 100644
index 000000000..78f531196
--- /dev/null
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/package.scala
@@ -0,0 +1,43 @@
+/**
+ * Biopet is built on top of GATK Queue for building bioinformatic
+ * pipelines. It is mainly intended to support LUMC SHARK cluster which is running
+ * SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
+ * should also be able to execute Biopet tools and pipelines.
+ *
+ * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
+ *
+ * Contact us at: sasc@lumc.nl
+ *
+ * A dual licensing mode is applied. The source code within this project that are
+ * not part of GATK Queue is freely available for non-commercial use under an AGPL
+ * license; For commercial users or users who do not want to follow the AGPL
+ * license, please contact us to obtain a separate license.
+ */
+package nl.lumc.sasc
+
+import java.util.Properties
+
+/**
+ * Common values and functions for the biopet package
+ *
+ * @author Wibowo Arindrarto <w.arindrarto@lumc.nl>
+ */
+package object biopet {
+
+  /** Latest git commit hash, with '-dirty' appended if any uncommited changes were present */
+  val LastCommitHash: String = {
+    val prop = new Properties()
+    prop.load(getClass.getClassLoader.getResourceAsStream("git.properties"))
+
+    val hash = prop.getProperty("git.commit.id.abbrev")
+    if (prop.getProperty("git.commit.id.describe-short").endsWith("-dirty")) s"$hash-dirty"
+    else hash
+  }
+
+  /** Package version */
+  // needs the Option here since the value is `null` when we run from an unpackaged JAR
+  val Version: String = Option(getClass.getPackage.getImplementationVersion).getOrElse("unpackaged")
+
+  /** Full version (raw version and latest commit hash) */
+  val FullVersion: String = s"$Version ($LastCommitHash)"
+}
-- 
GitLab