[jenkinscat-docs] master: Exec function should be placed in its own namespace. (19eb13f)

immanetize at fedoraproject.org immanetize at fedoraproject.org
Fri Feb 6 07:39:59 UTC 2015


Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git

On branch  : master

>---------------------------------------------------------------

commit 19eb13f1b95c3ec0d6f3ce94f8e1fc9914bd6288
Author: Pavel Tisnovsky <ptisnovs at redhat.com>
Date:   Tue Dec 2 11:32:35 2014 +0100

    Exec function should be placed in its own namespace.


>---------------------------------------------------------------

 ChangeLog                               |    5 +++
 src/jenkinscat/{config.clj => exec.clj} |   52 +++++++++++++++++-------------
 2 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf58944..9a644ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-12-02  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
+	* src/jenkinscat/exec.clj:
+	Exec function should be placed in its own namespace.
+
+2014-12-02  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
 	* test/jenkinscat/test_exec.clj:
 	Added new test: test_exec.clj.
 
diff --git a/src/jenkinscat/config.clj b/src/jenkinscat/exec.clj
similarity index 55%
copy from src/jenkinscat/config.clj
copy to src/jenkinscat/exec.clj
index 8ad5fda..f0c279f 100644
--- a/src/jenkinscat/config.clj
+++ b/src/jenkinscat/exec.clj
@@ -1,3 +1,6 @@
+;;;
+;;; Jenkinscat HTTP server that handles all requests send from clients/browsers.
+;;;
 ;;; Copyright (c) 2014  Pavel Tisnovsky, Red Hat
 ;;; All rights reserved.
 ;;;
@@ -22,30 +25,33 @@
 ;;; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;;;
 
-(ns jenkinscat.config)
-
-(def hostname
-    "Hostname of this computer"
-    (.getHostName (java.net.InetAddress/getLocalHost)))
-
-(def jobs-dir-prefix
-    "Path to the directory where are stored all Jenkins jobs."
-    "/var/lib/jenkins/jobs/")
-
-(def jobs-href-prefix
-    "URL prefix for all Jenkins jobs."
-    (str "http://" hostname ":8080/job/"))
-
-(def json-url
-    "URL prefix for all requests based on JSON."
-    (str "http://" hostname ":8080/"))
 
-(def test-results-url-prefix
-    "URL prefix for all tests (ie.test jobs)."
-    (str "http://" hostname "/tests/"))
 
-(def test-results-prefix
-    "Path where test results will be stored."
-    "/var/www/html/tests/")
+(ns jenkinscat.exec)
+
+(defn exec
+    "Execute external command."
+    ; command without parameters
+    ([command]
+     (.waitFor (. (Runtime/getRuntime) exec command)))
+    ; command with one parameter
+    ([command param1]
+     (.waitFor (. (Runtime/getRuntime) exec (str command " " param1))))
+    ; command with two parameters
+    ([command param1 param2]
+     (.waitFor (. (Runtime/getRuntime) exec (str command " " param1 " " param2))))
+    ; command with three parameters
+    ([command param1 param2 param3]
+     (.waitFor (. (Runtime/getRuntime) exec (str command " " param1 " " param2 " " param3))))
+    ; command with four parameters
+    ([command param1 param2 param3 param4]
+     (.waitFor (. (Runtime/getRuntime) exec (str command " " param1 " " param2 " " param3 " " param4))))
+    ; command with five parameters
+    ([command param1 param2 param3 param4 param5]
+     (.waitFor (. (Runtime/getRuntime) exec (str command " " param1 " " param2 " " param3 " " param4 " " param5))))
+    ; command with six parameters
+    ([command param1 param2 param3 param4 param5 param6]
+     (.waitFor (. (Runtime/getRuntime) exec (str command " " param1 " " param2 " " param3 " " param4 " " param5 " " param6)))))
 



More information about the docs-commits mailing list