incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [01/33] git commit: [#5822] add generic task for installing an app
Date Tue, 24 Sep 2013 19:37:37 GMT
Updated Branches:
  refs/heads/cj/6695 0c4c12ac5 -> fa64f26d4 (forced update)


[#5822] add generic task for installing an app


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/9f878800
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/9f878800
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/9f878800

Branch: refs/heads/cj/6695
Commit: 9f8788007445a2016454a4629864dbe065e60041
Parents: a897dc7
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Tue Sep 17 17:58:30 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Mon Sep 23 16:27:12 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tasks/admin_tasks.py | 37 +++++++++++++++++++++++++++++++++
 Allura/allura/tests/test_tasks.py  |  8 ++++++-
 Allura/docs/administration.rst     | 11 +++++++++-
 Allura/docs/api/tasks.rst          | 30 ++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9f878800/Allura/allura/tasks/admin_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/admin_tasks.py b/Allura/allura/tasks/admin_tasks.py
new file mode 100644
index 0000000..e8b67c0
--- /dev/null
+++ b/Allura/allura/tasks/admin_tasks.py
@@ -0,0 +1,37 @@
+#       Licensed to the Apache Software Foundation (ASF) under one
+#       or more contributor license agreements.  See the NOTICE file
+#       distributed with this work for additional information
+#       regarding copyright ownership.  The ASF licenses this file
+#       to you under the Apache License, Version 2.0 (the
+#       "License"); you may not use this file except in compliance
+#       with the License.  You may obtain a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#       Unless required by applicable law or agreed to in writing,
+#       software distributed under the License is distributed on an
+#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#       KIND, either express or implied.  See the License for the
+#       specific language governing permissions and limitations
+#       under the License.
+
+import inspect
+
+from pylons import tmpl_context as c
+
+from allura import model as M
+from allura.lib.decorators import task
+
+
+@task
+def install_app(*args, **kwargs):
+    '''
+    Install an application directly onto c.project, bypassing the UI and any app
+    constraints like installable=False
+    '''
+    c.project.install_app(*args, **kwargs)
+
+install_app.__doc__ += '''
+    Arguments: ''' + inspect.formatargspec(*inspect.getargspec(
+        M.Project.install_app
+    )).replace('self, ','')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9f878800/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index af7898e..dcbde71 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -47,6 +47,7 @@ from allura.tasks import mail_tasks
 from allura.tasks import notification_tasks
 from allura.tasks import repo_tasks
 from allura.tasks import export_tasks
+from allura.tasks import admin_tasks
 from allura.tests import decorators as td
 from allura.lib.decorators import event_handler, task
 
@@ -372,7 +373,7 @@ class TestExportTasks(unittest.TestCase):
         project_json.assert_called_once()
         temp = '/tmp/bulk_export/p/test/test'
         zipfn = '/tmp/bulk_export/p/test/test.zip'
-        zipdir.assert_caled_with(temp, temp + '/test.zip')
+        zipdir.assert_called_with(temp, zipfn)
         shutil.rmtree.assert_called_once_with(temp)
         # check notification
         M.MonQTask.run_ready()
@@ -410,4 +411,9 @@ class TestExportTasks(unittest.TestCase):
         assert_equal(c.project.bulk_export_status(), 'busy')
 
 
+class TestAdminTasks(unittest.TestCase):
+
+    def test_install_app_docstring(self):
+        assert_in('ep_name, mount_point=None', admin_tasks.install_app.__doc__)
+
 Mapper.compile_all()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9f878800/Allura/docs/administration.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/administration.rst b/Allura/docs/administration.rst
index b58339f..3874179 100644
--- a/Allura/docs/administration.rst
+++ b/Allura/docs/administration.rst
@@ -49,8 +49,17 @@ Scripts are in the `scripts/` directory and run via `paster script`.  An
extra
 
     (env-allura) Allura$ paster script development.ini ../scripts/create-allura-sitemap.py
-- -u 100
 
+TODO:   explain important scripts, commands
 
-TODO: explain how to run tasks, explain important scripts, commands and tasks here
+Tasks can be run via the web interface at /nf/admin/task_manager  You must know
+the full task name, e.g. `allura.tasks.admin_tasks.install_app`  You can
+optionally provide a username and project and app which will get set on the
+current context (`c`).  You should specify what args and kwargs will be passed
+as parameters to the task.  They are specified in JSON format on the form.
+
+See the listing of :mod:`some available tasks <allura.tasks.admin_tasks>`.
+
+TODO: explain how to run scripttasks and commandtasks
 
 
 Client Scripts

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9f878800/Allura/docs/api/tasks.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/api/tasks.rst b/Allura/docs/api/tasks.rst
new file mode 100644
index 0000000..d49b8af
--- /dev/null
+++ b/Allura/docs/api/tasks.rst
@@ -0,0 +1,30 @@
+..     Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+
+.. _tasks_module:
+
+:mod:`allura.tasks`
+--------------------------------
+
+.. automodule:: allura.tasks
+
+  .. automodule:: allura.tasks.admin_tasks
+        :members:
+
+  .. automodule:: allura.tasks.export_tasks
+
+        .. autofunction:: allura.tasks.export_tasks.bulk_export


Mime
View raw message