[jenkinscat-docs] master: Added special job processing. (5b5b55d)

immanetize at fedoraproject.org immanetize at fedoraproject.org
Fri Feb 6 07:40:58 UTC 2015


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

On branch  : master

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

commit 5b5b55d28a6a548a98a3d313f2ef21bd470b6d74
Author: Pavel Tisnovsky <ptisnovs at 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 at redhat.com>
+
+	* tools/create_books_clj_file.lua:
+	Added special job processing.
+
 2015-01-16  Pavel Tisnovsky  <ptisnovs at 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()



More information about the docs-commits mailing list