diff options
author | Mika Havela <mika.havela@gmail.com> | 2007-12-24 10:38:57 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2007-12-24 10:38:57 +0000 |
commit | f3181ff851436318ffd9af96d5ca63713463f186 (patch) | |
tree | a6c25721c8500bcea6aa38e64a3d69c319f37428 | |
download | acf-devtools-f3181ff851436318ffd9af96d5ca63713463f186.tar.bz2 acf-devtools-f3181ff851436318ffd9af96d5ca63713463f186.tar.xz |
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
-rw-r--r-- | acfupdate-controller.lua | 28 | ||||
-rw-r--r-- | acfupdate-html.lsp | 30 | ||||
-rw-r--r-- | acfupdate-model.lua | 44 | ||||
-rw-r--r-- | acfupdate.menu | 2 |
4 files changed, 104 insertions, 0 deletions
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 @@ +<? local view = ... ?> + +<h1>Fetch ACF updates</h1> + +<p>Click on the tab <B>update</B> to fetch/update all available projects.</p> +<p>The 'sandbox' project is not automatically fetched/checked out!<BR> +But if you have manually checked it out, you will get a update on it by pressing the <B>update</B> tab.</p> + + +<h2>Available projects</h2> +<pre><?= view.projects ?></pre> + +<? if (view.updates) then ?> + <h2>New updates</h2> + <? for i = 1, table.maxn(view["updates"]["cmdresult"]) do ?> + <? if (view["updates"]["cmdresult"][i]["updates"] ~= "") then ?> + <h3><?= view["updates"]["cmdresult"][i]["name"] ?></h3> + <pre><?= view["updates"]["cmdresult"][i]["updates"] ?></pre> + <? end ?> + <? end ?> + <h3>Summary</h3> + <pre>-- End of updates --</pre> +<? end ?> + +<? +--[[ DEBUG INFORMATION +require("debugs") +io.write(debugs.variables(view)) +--]] +?> 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 |