From f3181ff851436318ffd9af96d5ca63713463f186 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Mon, 24 Dec 2007 10:38:57 +0000 Subject: Added devtools that could come in handy when developing ACF-files. This 'acfupdate' devtool is useful for checking out all latest updates to the running system. git-svn-id: svn://svn.alpinelinux.org/acf/devtools/trunk@452 ab2d0c66-481e-0410-8bed-d214d4d58bed --- acfupdate-controller.lua | 28 ++++++++++++++++++++++++++++ acfupdate-html.lsp | 30 ++++++++++++++++++++++++++++++ acfupdate-model.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ acfupdate.menu | 2 ++ 4 files changed, 104 insertions(+) create mode 100644 acfupdate-controller.lua create mode 100644 acfupdate-html.lsp create mode 100644 acfupdate-model.lua create mode 100644 acfupdate.menu diff --git a/acfupdate-controller.lua b/acfupdate-controller.lua new file mode 100644 index 0000000..ff4b740 --- /dev/null +++ b/acfupdate-controller.lua @@ -0,0 +1,28 @@ +module (..., package.seeall) + +-- Cause an http redirect to our "read" action +-- We use the self.conf table because it already has prefix,controller,etc +-- The redir code is defined in the application error handler (acf-controller) +local list_redir = function (self) + self.conf.action = "read" + self.conf.type = "redir" + error (self.conf) +end + +mvc={} +mvc.on_load = function(self, parent) + if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then + self.worker[self.conf.action] = list_redir(self) + end +end + +-- Public methods + +read = function (self ) + return ({projects = self.model:get(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} ) +end + +update = function (self ) + return ({projects = self.model:get(),updates = self.model:update(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller} ) +end + diff --git a/acfupdate-html.lsp b/acfupdate-html.lsp new file mode 100644 index 0000000..0b61e7f --- /dev/null +++ b/acfupdate-html.lsp @@ -0,0 +1,30 @@ + + +

Fetch ACF updates

+ +

Click on the tab update to fetch/update all available projects.

+

The 'sandbox' project is not automatically fetched/checked out!
+But if you have manually checked it out, you will get a update on it by pressing the update tab.

+ + +

Available projects

+
+ + +

New updates

+ + +

+
+ + +

Summary

+
-- End of updates --
+ + + diff --git a/acfupdate-model.lua b/acfupdate-model.lua new file mode 100644 index 0000000..88c819e --- /dev/null +++ b/acfupdate-model.lua @@ -0,0 +1,44 @@ +-- acf model for displaying logfiles recusivly +module (..., package.seeall) + +require("fs") +-- no initializer in model - use controller.init for that + +-- ############################################################### +-- Private functions +local function querycmd ( cmdline ) + local cmd = io.popen( cmdline ) + local cmd_result = cmd:read("*a") or "unknown" + cmd:close() + return cmd_result +end + +-- ############################################################### +-- Public functions + +get = function (self) + local svnurl = "svn://svn.alpinelinux.org/acf/" + return querycmd("/usr/bin/svn list -v " .. svnurl ) +end + +update = function (self) + local svnurl = "svn://svn.alpinelinux.org/acf/" + local updates = {} + local cmdresult = {} + updates.svnurl = svnurl + for list in string.gmatch((querycmd("/usr/bin/svn list " .. svnurl )), "%S+") do + local updateresult = "" + if (list == "core/") then + updateresult = querycmd("/usr/bin/svn up /usr/share/acf/") + elseif ( fs.is_dir("/usr/share/acf/app/" .. list)) then + updateresult = querycmd("/usr/bin/svn up /usr/share/acf/app/" .. list) + elseif (list ~= "sandbox/") then + updateresult = querycmd("/usr/bin/svn co " .. svnurl .. list .."trunk/ /usr/share/acf/app/" .. list) + end + -- Hide projects without updates + if (string.match(updateresult, "^At revision.*")) then updateresult = "" end + table.insert(cmdresult, {name=list, updates=updateresult}) + end + updates.cmdresult = cmdresult + return updates +end diff --git a/acfupdate.menu b/acfupdate.menu new file mode 100644 index 0000000..eaacc5a --- /dev/null +++ b/acfupdate.menu @@ -0,0 +1,2 @@ +#CAT GROUP/DESC TAB ACTION +99DevTools 98Fetch_ACF_updates Fetch_ACF_updates read -- cgit v1.2.3