[jenkinscat-docs] master: Basic support for adding new books. (58a7f98)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 58a7f98025fb5b45c0b78488b43098bcf6d82097
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Tue Jan 20 10:54:47 2015 +0100
Basic support for adding new books.
>---------------------------------------------------------------
ChangeLog | 5 ++++
src/jenkinscat/server.clj | 54 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4b4aecc..8f2ca97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-20 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
+ Basic support for adding new books.
+
2015-01-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* tools/create_books_clj_file.lua:
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index d350ba3..b9babc1 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -688,6 +688,60 @@
(force-to-read-books)
(job-configurations-handler uri params session))
+(defn add-book-step-1-handler
+ "Handler for the 'Add book' command."
+ [uri params session]
+ (read-books-if-not-loaded)
+ (let [product-list (get-products)
+ page-content (add-book-step-1-renderer/render-add-book-step-1-page product-list config/devel-version)]
+ (generate-response-html page-content session)))
+
+(defn get-full-repository-url
+ [repository-type repository-name]
+ (cond
+ (= repository-type "GitHub") (str github-repo-prefix repository-name)
+ (= repository-type "Gerrit (internal GIT)") (str gerrit-repo-prefix repository-name)
+ (= repository-type "Fedora GIT") (str fedora-git-repo-prefix repository-name)
+ (= repository-type "SVN (internal)") (str internal-svn-repo-prefix repository-name)
+ :else false))
+
+(defn get-dvcs
+ [repository-type]
+ (cond
+ (= repository-type "GitHub") "git"
+ (= repository-type "Gerrit (internal GIT)") "git"
+ (= repository-type "Fedora GIT") "git"
+ (= repository-type "SVN (internal)") "svn"
+ :else nil))
+
+(defn check-if-git-repo-exists
+ "Basic check if (external) GIT repo exists by using git ls-remote command."
+ [url]
+ (let [result (exec/exec "git ls-remote" url)]
+ (println "Check if GIT repo exists (0=OK): " result)
+ (= result 0)))
+
+(defn check-if-svn-repo-exists
+ "Basic check if (external) SVN repo exists by using svn ls command."
+ [url]
+ (let [result (exec/exec "svn ls --non-interactive --trust-server-cert" url)]
+ (println "Check if SVN repo exists (0=OK): " result)
+ (= result 0)))
+
+(defn check-if-repo-exists
+ "Returns true if repository of given type exists, nil intstead."
+ [repository-type url]
+ (cond
+ (= repository-type "git") (check-if-git-repo-exists url)
+ (= repository-type "svn") (check-if-svn-repo-exists url)
+ :else nil))
+
+(defn repository-exists?
+ [repository-type repository-name]
+ (let [dvcs (get-dvcs repository-type)
+ url (get-full-repository-url repository-type repository-name)]
+ (check-if-repo-exists dvcs url)))
+
(defn count-books
[books]
(let [out-data (new java.util.TreeSet)]
9 years, 3 months
[jenkinscat-docs] master: Added special job processing. (5b5b55d)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 5b5b55d28a6a548a98a3d313f2ef21bd470b6d74
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Mon Jan 19 10:48:27 2015 +0100
Added special job processing.
>---------------------------------------------------------------
ChangeLog | 5 +++
tools/create_books_clj_file.lua | 77 +++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d79c955..4b4aecc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * tools/create_books_clj_file.lua:
+ Added special job processing.
+
2015-01-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* tools/create_books_clj_file.lua:
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index a55deff..a5ff37a 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -583,6 +583,83 @@ end
--
--
--
+--
+--
+function getSpecialJobBuildRepo(jobName)
+ return getJobBuildRepo(jenkins_dir .. "workspace/" .. jobName)
+end
+
+
+
+--
+--
+--
+function getSpecialJobWorkDir(jobName)
+ return jenkins_dir .. "jobs/" .. jobName .. "/lastSuccessful/archive/output/"
+end
+
+
+
+--
+--
+--
+function createNewSpecialJob(git_repo, jobName, dirname, title, type, productName, productVersion)
+ local newJob = {}
+ newJob.git_repo = git_repo
+ newJob.name = jobName .. "/" .. dirname
+ newJob.documentTitle = title
+ newJob.documentType = type
+ newJob.productName = productName
+ newJob.productVersion = productVersion
+ return newJob
+end
+
+
+
+--
+--
+--
+function processSpecialJob(specialJobs, job)
+ local jobName = job.name
+ print("Processing 'special' job " .. job.name .. ":")
+ local git_repo = getSpecialJobBuildRepo(jobName)
+ local workdir = getSpecialJobWorkDir(jobName)
+ for filename in io.popen('cd "'..workdir ..'"; ls -1 -d */'):lines() do
+ -- remove trailing "/"
+ local dirname = filename:sub(1, -2)
+ local htmlFile = workdir .. dirname .. "/" .. dirname .. ".html"
+ if fileExists(htmlFile) then
+ local formattedHtml = "./work/" .. dirname .. ".html"
+ formatHTML(htmlFile, formattedHtml)
+ print(htmlFile)
+ local title = fetchDocumentTitleFromHTML(formattedHtml)
+ local productName = fetchProductNameFromHTML(formattedHtml)
+ local productVersion = fetchProductVersionFromHTML(formattedHtml)
+ local newJob = createNewSpecialJob(git_repo, job.name, dirname, title, "Book", productName, productVersion)
+ table.insert(specialJobs, newJob)
+ end
+ end
+end
+
+
+
+--
+--
+--
+function processSpecialJobs(allJobs)
+ local specialJobs = {}
+ for i,job in ipairs(allJobs) do
+ local jobName = job.name
+ if job.name == "doc-FuseSource-ActiveMQDocs" then
+ processSpecialJob(specialJobs, job)
+ end
+ end
+ return specialJobs
+end
+
+
+
+--
-- Create work directory (if it does not exists).
--
function createWorkDirectory()
9 years, 3 months
[jenkinscat-docs] master: Added support for autofilling info about known books. (b86fa22)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit b86fa22688896aac3840f7d13e507b79a666c762
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Jan 16 10:44:38 2015 +0100
Added support for autofilling info about known books.
>---------------------------------------------------------------
ChangeLog | 5 ++++
tools/create_books_clj_file.lua | 44 +++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 98ff1c7..d79c955 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2015-01-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* tools/create_books_clj_file.lua:
+ Added support for autofilling info about known books.
+
+2015-01-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * tools/create_books_clj_file.lua:
Disabled books should be handled differently.
2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index 03600c5..a55deff 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -663,6 +663,50 @@ function filterOutDisabledJobs(books, disabledBooks)
return result
end
+function addInfoFromKnownBooks(books, knownBooks)
+ for _,book in pairs(books) do
+ local knownBook = knownBooks[book.name]
+ if knownBook then
+ if not book.git_repo or book.git_repo == "" then
+ book.git_repo = knownBook[1]
+ end
+ if not book.documentTitle or book.documentTitle == "" or knownBook[2]:startsWith("*") then
+ local title = knownBook[2]
+ if title and title:startsWith("*") then
+ title = string.sub(title, 2)
+ end
+ book.documentTitle = title
+ end
+ if not book.documentType or book.documentType == "" then
+ book.documentType = knownBook[3]
+ end
+ if not book.productName or book.productName == "" or knownBook[4]:startsWith("*") then
+ local productName = knownBook[4]
+ if productName and productName:startsWith("*") then
+ productName = string.sub(productName, 2)
+ end
+ book.productName = productName
+ end
+ if not book.productVersion or book.productVersion == "" or knownBook[5]:startsWith("*") then
+ local productVersion = knownBook[5]
+ if productVersion and productVersion:startsWith("*") then
+ productVersion = string.sub(productVersion, 2)
+ end
+ book.productVersion = productVersion
+ end
+ if not book.bugzillaProductName or book.bugzillaProductName == "" then
+ book.bugzillaProductName = knownBook[6]
+ end
+ if not book.bugzillaComponentName or book.bugzillaComponentName == "" then
+ book.bugzillaComponentName = knownBook[7]
+ end
+ if not book.bugzillaUrl or book.bugzillaUrl == "" then
+ book.bugzillaUrl = knownBook[8]
+ end
+ end
+ end
+end
+
--
-- Entry point to this tool.
--
9 years, 3 months
[jenkinscat-docs] master: Disabled books should be handled differently. (b298445)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit b2984457cf7c6f86a37cf4e8ae9bff7b723a29cb
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Jan 16 10:43:16 2015 +0100
Disabled books should be handled differently.
>---------------------------------------------------------------
ChangeLog | 5 +++++
tools/create_books_clj_file.lua | 20 ++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5686117..98ff1c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * tools/create_books_clj_file.lua:
+ Disabled books should be handled differently.
+
2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index 980f14b..03600c5 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -643,6 +643,26 @@ function printKnownBooks(knownBooks)
end
end
+function isDisabledBook(book, disabledBooks)
+ local bookName = book.name
+ for i,disabledBook in ipairs(disabledBooks) do
+ if bookName == disabledBook then
+ return true
+ end
+ end
+ return false
+end
+
+function filterOutDisabledJobs(books, disabledBooks)
+ local result = {}
+ for i, book in ipairs(books) do
+ if not isDisabledBook(book, disabledBooks) then
+ table.insert(result, book)
+ end
+ end
+ return result
+end
+
--
-- Entry point to this tool.
--
9 years, 3 months
[jenkinscat-docs] master: Test results should be shown on the Jenkinscat front page. (5d6b74c)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 5d6b74c1fa738107cc28cfbca862529c5ae9a83c
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Jan 15 09:57:21 2015 +0100
Test results should be shown on the Jenkinscat front page.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7f1dc5c..5686117 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
+ Test results should be shown on the Jenkinscat front page.
+
+2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
Refactored out HTML rendering from the server module.
2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index b294d55..d350ba3 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -504,7 +504,13 @@
(let [last-build-and-duration (get-last-build-and-duration job-name)
last-build (if last-build-and-duration (first last-build-and-duration) nil)
duration (if last-build-and-duration (second last-build-and-duration) nil)
- path-to-log (get-path-to-log job-name book-key)]
+ path-to-log (get-path-to-log job-name book-key)
+ test-results (try-to-read-test-results job-name)
+ test-results-title (nth test-results 0 "")
+ test-results-passed (nth test-results 1 "")
+ test-results-failed (nth test-results 2 "")
+ test-results-url (nth test-results 3 "")
+ ]
(conj! books-for-product {
"name" book-name
"repo" book-repo
@@ -521,6 +527,10 @@
"product-name" book-product
"show_overview" show-overview
"book-product-name" book-product-name
+ "test-results-title" test-results-title
+ "test-results-passed" test-results-passed
+ "test-results-failed" test-results-failed
+ "test-results-url" test-results-url
}))
)
))
9 years, 3 months
[jenkinscat-docs] master: Refactored out HTML rendering from the server module. (c0711f2)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit c0711f2254e66f04fec0f8c374350eae477c5fa2
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Jan 15 09:56:03 2015 +0100
Refactored out HTML rendering from the server module.
>---------------------------------------------------------------
ChangeLog | 5 ++
src/jenkinscat/server.clj | 113 ---------------------------------------------
2 files changed, 5 insertions(+), 113 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d1031e4..7f1dc5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
+ Refactored out HTML rendering from the server module.
+
+2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
GIT/SVN repos added.
2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index d08f8db..b294d55 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -336,119 +336,6 @@
[output-data]
(json/write-str output-data))
-(defn page-header
- [subtitle]
- [:head
- [:title (str "Jenkinscat - " subtitle)]
- [:meta {:name "Author" :content "Pavel Tisnovsky"}]
- [:meta {:name "Generator" :content "Clojure"}]
- [:meta {:http-equiv "Content-type" :content "text/html; charset=utf-8"}]
- (page/include-css "css/bootstrap.min.css")
- (page/include-css "css/Jenkinscat.css")
- (page/include-js "js/bootstrap.min.js")
- ])
-
-(defn render-nav-bar
- [title]
- [:nav {:class "navbar navbar-inverse navbar-fixed-top" :role "navigation"}
- [:div {:class "container-fluid"}
- [:div {:class "navbar-header"}
- [:button {:type "button" :class "navbar-toggle" :data-toggle "collapse"}
- [:span {:class "sr-only"} "Toggle navigation"]
- [:span {:class "icon-bar"}]
- [:span {:class "icon-bar"}]
- [:span {:class "icon-bar"}]
- ]
- [:img {:class "navbar-brand-" :style "float:left" :src "jenkinscat.png"}]
- [:a {:href "/" :class "navbar-brand"} " Jenkinscat"]
- ] ; ./navbar-header
- [:div {:class "col-md-4"}
- [:form {:class "navbar-form navbar-left"}
- [:div {:class "form-group"}
- "<input disabled='disabled' autofocus='autofocus' size='40' type='text' class='form-control' ng-model='search' placeholder='' id='searchinput'>"
- ]
- ]
- ] ; col ends
- [:div {:class "col-md"}
- [:a {:href "/job-configurations" :class "navbar-brand"} "Job configurations"]
- ] ; col ends
- [:div {:class "col-md"}
- [:a {:href "/statistics" :class "navbar-brand"} "Statistics"]
- ] ; col ends
- ] ; row ends
- ] ; /.container-fluid
- ]
-)
-
-(defn render-statistics-page
- "Render page with various statistics."
- [statistics]
- (page/xhtml
- (page-header "statistics")
- [:body
- (render-nav-bar "Statistics")
- [:table {:class "table table-striped table-condensed table-hover table-borderer" :style "width:800px"}
- [:tr
- [:th "Summary"]
- [:th ""]
- [:th ""]
- ]
- [:tr
- [:td "Products:"]
- [:td (:product-count statistics)]
- [:th ""]
- ]
- [:tr
- [:td "Books:"]
- [:td (:book-count statistics)]
- [:th ""]
- ]
- [:tr
- [:td "Jobs:"]
- [:td (:job-count statistics)]
- [:th ""]
- ]
- [:tr [:td " "] [:td " "] [:td " "]]
- [:tr
- [:th "Pages statistics"]
- [:th ""]
- [:th ""]
- ]
- [:tr
- [:td "Total pages:"]
- [:td (:total-pages statistics)]
- [:th ""]
- ]
- [:tr
- [:td "Average pages:"]
- [:td (int (/ (:total-pages statistics) (:book-count statistics))) " per book"]
- [:th ""]
- ]
- [:tr
- [:td "Book with max pages"]
- [:td (:max-pages statistics)]
- [:td (:max-pages-book-name statistics)]
- ]
- [:tr
- [:td "Book with min pages"]
- [:td (:min-pages statistics)]
- [:td (:min-pages-book-name statistics)]
- ]
-]]))
-
-(defn generate-response-html
- "Generate HTTP response for the given request."
- [page-content session]
- (-> (http-response/response page-content)
- (http-response/content-type "text/html; charset=utf-8")
- (assoc :session session)))
-
-(defn generate-response-json
- "Generate HTTP response for the given request."
- [page-content]
- (-> (http-response/response page-content)
- (http-response/content-type "application/json; charset=utf-8")))
-
(defn update-job-name
"Update job names - we don't need the postfix string."
[dirname]
9 years, 3 months
[jenkinscat-docs] master: GIT/SVN repos added. (7efb262)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 7efb2626086edde99bd3d4827918e70fd8893500
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Jan 15 09:54:15 2015 +0100
GIT/SVN repos added.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 6 ++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2cb283a..d1031e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * src/jenkinscat/server.clj:
+ GIT/SVN repos added.
+
+2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* tools/create_books_clj_file.lua:
Added basic support for 'disabled' books.
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index 2789fd4..d08f8db 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -64,6 +64,12 @@
"<span style='color:red'>N/A</span>")
+(def github-repo-prefix
+ "https://github.com/")
+
+(def fedora-git-repo-prefix
+ "git://git.fedorahosted.org/git/docs/")
+
(defn third
[coll]
(nth coll 2))
9 years, 3 months
[jenkinscat-docs] master: Added basic support for 'disabled' books. (144cb9b)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 144cb9bfe66e3ee8f250cf25e97efd4c9df23a12
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Jan 15 09:50:44 2015 +0100
Added basic support for 'disabled' books.
>---------------------------------------------------------------
ChangeLog | 5 +++++
tools/create_books_clj_file.lua | 25 +++++++++++++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7a73176..2cb283a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * tools/create_books_clj_file.lua:
+ Added basic support for 'disabled' books.
+
2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
diff --git a/tools/create_books_clj_file.lua b/tools/create_books_clj_file.lua
index 031e26e..980f14b 100644
--- a/tools/create_books_clj_file.lua
+++ b/tools/create_books_clj_file.lua
@@ -618,6 +618,31 @@ function readBugDescriptionAndBugTemplate()
readBugTemplate()
end
+function readDisabledJobs()
+ return readInputFileInJsonFormat("disabled_jobs.json")
+end
+
+function readKnownBooks()
+ return readInputFileInJsonFormat("known_books.json")
+end
+
+function printDisabledJobs(disabledJobs)
+ print("List of disabled jobs:")
+ for i, disabledJob in ipairs(disabledJobs) do
+ print(i, disabledJob)
+ end
+end
+
+function printKnownBooks(knownBooks)
+ print("List of known books:")
+ for name, config in pairs(knownBooks) do
+ print("", name)
+ for _, cfgline in ipairs(config) do
+ print("", "", cfgline)
+ end
+ end
+end
+
--
-- Entry point to this tool.
--
9 years, 3 months
[jenkinscat-docs] master: File handlers are now handled by different module. (390a50c)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 390a50c42850b211ce87791f1c72b6a84cda6cd8
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Dec 19 16:49:18 2014 +0100
File handlers are now handled by different module.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 43 ++-----------------------------------------
2 files changed, 7 insertions(+), 41 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 564b918..7a73176 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
+ File handlers are now handled by different module.
+
+2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
Job configuration page and build page are now handled by different
modules.
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index e67f31b..2789fd4 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -909,7 +909,7 @@
[uri params session]
(read-books-if-not-loaded)
(let [statistics (compute-statistics books/books)
- page-content (render-statistics-page statistics)]
+ page-content (statistics-page-renderer/render-statistics-page statistics)]
(generate-response-html page-content session)))
(defn print-request-info
@@ -931,46 +931,6 @@
session (request :session)]
(selected-handler uri params session)))
-(defn return-file
- "Return given file with proper content type as a response to a HTTP request."
- [file-name content-type]
- (let [file (new-file "www" file-name)]
- (println "Returning file " (.getAbsolutePath file))
- (println "")
- (-> (http-response/response file)
- (http-response/content-type content-type))))
-
-(def file-handlers
- "Map of file handlers, ie. map of known files included from the generated HTML page."
- {"/" '(jenkinscat.server/return-file "index.html" "text/html")
- "/favicon.ico" '(jenkinscat.server/return-file "favicon.ico" "image/x-icon")
- "/jenkinscat.gif" '(jenkinscat.server/return-file "jenkinscat.gif" "image/gif")
- "/jenkinscat.png" '(jenkinscat.server/return-file "jenkinscat.png" "image/png")
- "/stopwatch2.png" '(jenkinscat.server/return-file "stopwatch2.png" "image/png")
- "/erase-l.gif" '(jenkinscat.server/return-file "erase-l.gif" "image/gif")
- ; this one is there only for test purposes
- ;"/data.json" '(jenkinscat.server/return-file "data.json" "application/json")
-
- "/css/bootstrap.css" '(jenkinscat.server/return-file "/css/bootstrap.css" "text/css")
- "/css/bootstrap.css.map" '(jenkinscat.server/return-file "/css/bootstrap.css.map" "text/css")
- "/css/bootstrap.min.css" '(jenkinscat.server/return-file "/css/bootstrap.min.css" "text/css")
- "/css/bootstrap-theme.css" '(jenkinscat.server/return-file "/css/bootstrap-theme.css" "text/css")
- "/css/bootstrap-theme.css.map" '(jenkinscat.server/return-file "/css/bootstrap-theme.css.map" "text/css")
- "/css/bootstrap-theme.min.css" '(jenkinscat.server/return-file "/css/bootstrap-theme.min.css" "text/css")
- "/css/Jenkinscat.css" '(jenkinscat.server/return-file "/css/Jenkinscat.css" "text/css")
-
- "/js/angular.min.js" '(jenkinscat.server/return-file "/js/angular.min.js" "application/javascript")
- "/js/bootstrap.js" '(jenkinscat.server/return-file "/js/bootstrap.js" "application/javascript")
- "/js/bootstrap.min.js" '(jenkinscat.server/return-file "/js/bootstrap.min.js" "application/javascript")
- "/js/jenkinscat.js" '(jenkinscat.server/return-file "/js/jenkinscat.js" "application/javascript")
- "/js/jquery.min.js" '(jenkinscat.server/return-file "/js/jquery.min.js" "application/javascript")
-
- "/fonts/glyphicons-halflings-regular.eot" '(jenkinscat.server/return-file "/fonts/glyphicons-halflings-regular.eot" "application/vnd.ms-fontobject")
- "/fonts/glyphicons-halflings-regular.svg" '(jenkinscat.server/return-file "/fonts/glyphicons-halflings-regular.svg" "image/svg+xml")
- "/fonts/glyphicons-halflings-regular.ttf" '(jenkinscat.server/return-file "/fonts/glyphicons-halflings-regular.ttf" "application/x-font-ttf")
- "/fonts/glyphicons-halflings-regular.woff" '(jenkinscat.server/return-file "/fonts/glyphicons-halflings-regular.woff" "application/font-woff")
-})
-
(def action-handlers
"Map of action handlers, ie. pages generated dynamically by this tool."
{"/data.json" json-data-handler
@@ -980,6 +940,7 @@
"/reload-book-list" reload-books-list-handler
"/add-book-step-1" add-book-step-1-handler
"/add-book-step-2" add-book-step-2-handler
+ "/add-book-step-3" add-book-step-3-handler
"/build-configuration-help" build-configuration-help-handler
})
9 years, 3 months
[jenkinscat-docs] master: Job configuration page and build page are now handled by different modules. (e696906)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit e6969061413316cf6d73a69dc4c4ffbe00be649c
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Dec 19 16:44:55 2014 +0100
Job configuration page and build page are now handled by different modules.
>---------------------------------------------------------------
ChangeLog | 6 +++
src/jenkinscat/server.clj | 105 ---------------------------------------------
2 files changed, 6 insertions(+), 105 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 707f7b9..564b918 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/server.clj:
+ Job configuration page and build page are now handled by different
+ modules.
+
+2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/server.clj:
Change logic used to read info about middleware books.
2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index 58e3836..e67f31b 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -330,51 +330,6 @@
[output-data]
(json/write-str output-data))
-(defn render-build-page
- "Render page with info about build."
- [job-name]
- (str "
-<html>
- <head>
- <title>Job build started</title>
- <link rel='stylesheet' href='css/bootstrap.min.css'>
-
- <!-- Optional theme -->
- <link rel='stylesheet' href='css/bootstrap-theme.min.css'>
- <link href='css/Jenkinscat.css' rel='stylesheet' type='text/css'>
- </head>
- <body ng-app='jenkinscat' ng-controller='jenkinscatApp'><div class='container-fluid'>
- <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
- <div class='container-fluid'>
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class='navbar-header'>
- <button type='button' class='navbar-toggle' data-toggle='collapse' data-target='#bs-example-navbar-collapse-1'>
- <span class='sr-only'>Toggle navigation</span>
- <span class='icon-bar'></span>
- <span class='icon-bar'></span>
- <span class='icon-bar'></span>
- </button>
- <img class='navbar-brand-' style='float:left' src='jenkinscat.png' />
- <a class='navbar-brand' href='#'> Jenkinscat</a>
- </div>
-
- </div><!-- /.container-fluid -->
- </nav>
- <h3>Build for the job '" job-name "' has been added into job queue.</h3>
- <table class='table table-condensed table-hover table-bordered'>
- <tr>
- <td><a href='http://" hostname ":8080/job/" job-name "%20(html-single)'>Build details for the HTML-single book</a></td>
- </tr>
- <tr>
- <td><a href='http://" hostname ":8080/job/" job-name "%20(PDF)'>Build details for the PDF book</a></td>
- </tr>
- <tr>
- <td><a href='/'>Back to Jenkinscat front page</a></td>
- </tr>
- </table>
- </body>
-</html>"))
-
(defn page-header
[subtitle]
[:head
@@ -475,66 +430,6 @@
]
]]))
-(defn render-job-configurations-page
- "Render page with job configurations."
- [job-list job-configurations]
- (page/xhtml
- (page-header "job configurations")
- [:body
- (render-nav-bar "Job configurations")
-
- [:table {:class "table table-striped table-condensed table-hover table-borderer"}
- [:tr
- [:th {:style "width:25%"} "Job name"]
- [:th {:style "width:20%"} "GIT repo"]
- [:th {:style "width:8%"} "Branch"]
- [:th {:style "width:4%"} "Artifact<br />2keep"]
- [:th {:style "width:5%"} "Trigger"]
- [:th {:style "width:11%"} "Artifacts"]
- [:th {:style "width:10%"} "Exclude"]
- [:th {:style "width:10%"} "IRC"]
- [:th {:style "width:5%"} "Build script"]
- ]
- (for [i (range (count job-list))]
- (let [job-key (nth job-list i)
- job-configuration (get job-configurations job-key)]
- [:tr
- [:td [:a {:href (str jobs-href-prefix (:job-name job-configuration))} job-key]]
- [:td (:git-repo job-configuration)]
- [:td (:branch job-configuration)]
- [:td (:artifacts2keep job-configuration)]
- [:td (:trigger job-configuration)]
- [:td (:artifacts job-configuration)]
- [:td (:exclude job-configuration)]
- [:td (:irc job-configuration)]
- [:td [:a {:href "#" :id (str "code-" i ) :class "btn btn-success" :rel "popover" :title "Build script" :data-placement "left" :data-content (str "<pre>" (:build-script job-configuration) "</pre>")} "Show"]]]))]
- [:script {:src "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"}]
- [:script {:src "http://w3resource.com/twitter-bootstrap/twitter-bootstrap-v2/js/bootstrap..."}]
- [:script {:src "http://w3resource.com/twitter-bootstrap/twitter-bootstrap-v2/js/bootstrap..."}]
- "
- <script>
- $(function (){
- $('#example').popover();
- "
- (for [i (range (count job-list))]
- (let [job-key (nth job-list i)
- job-configuration (get job-configurations job-key)]
- (str "\n$('#code-" i "').popover();")))
-
- "
- });
- </script>
- "
- [:table {:class "table table-striped table-condensed table-hover table-borderer"}
- [:tr
- [:th "Jenkinscat administration"]
- ]
- [:tr
- [:td [:a {:href "/reload-book-list"} "Reload book list"]]
- ]
- ]
-]))
-
(defn generate-response-html
"Generate HTTP response for the given request."
[page-content session]
9 years, 3 months