You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/07/31 20:45:11 UTC
[1/3] git commit: [#6456] Refactored ProjectImporterDispatcher to
Allura to remove dependency on FI
Updated Branches:
refs/heads/master 868694ecb -> 158cd46bc
[#6456] Refactored ProjectImporterDispatcher to Allura to remove dependency on FI
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/4ed7af81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/4ed7af81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/4ed7af81
Branch: refs/heads/master
Commit: 4ed7af81a3f595f4081f966f7d2547671e73f8b5
Parents: 868694e
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue Jul 23 18:26:48 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 31 18:44:34 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/project.py | 14 ++++++++++++--
ForgeImporters/forgeimporters/base.py | 15 ++++-----------
2 files changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ed7af81/Allura/allura/controllers/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/project.py b/Allura/allura/controllers/project.py
index 8af4396..d2b8510 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -20,6 +20,7 @@ import logging
from datetime import datetime, timedelta
from urllib import unquote
from itertools import chain, islice
+from pkg_resources import iter_entry_points
from bson import ObjectId
from tg import expose, flash, redirect, validate, request, response, config
@@ -47,7 +48,6 @@ from allura.lib.widgets import forms as ff
from allura.lib.widgets import form_fields as ffw
from allura.lib.widgets import project_list as plw
from allura.lib import plugin, exceptions
-from forgeimporters.base import ProjectImporterDispatcher
from .auth import AuthController
from .search import SearchController, ProjectBrowseController
from .static import NewForgeController
@@ -74,7 +74,7 @@ class NeighborhoodController(object):
self.browse = NeighborhoodProjectBrowseController(neighborhood=self.neighborhood)
self._admin = NeighborhoodAdminController(self.neighborhood)
self._moderate = NeighborhoodModerateController(self.neighborhood)
- self.import_project = ProjectImporterDispatcher(self.neighborhood)
+ self.import_project = ProjectImporterController(self.neighborhood)
def _check_security(self):
require_access(self.neighborhood, 'read')
@@ -919,3 +919,13 @@ class GrantController(object):
with h.push_context(self.project._id):
g.post_event('project_updated')
redirect(request.referer)
+
+class ProjectImporterController(object):
+ def __init__(self, neighborhood, *a, **kw):
+ super(ProjectImporterController, self).__init__(*a, **kw)
+ self.neighborhood = neighborhood
+
+ @expose()
+ def _lookup(self, source, *rest):
+ for ep in iter_entry_points('allura.project_importers', source):
+ return ep.load()(self.neighborhood), rest
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/4ed7af81/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index 777eb8a..bf22f8a 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -25,18 +25,9 @@ from ming.utils import LazyProperty
from allura.controllers import BaseController
-class ProjectImporterDispatcher(BaseController):
- def __init__(self, neighborhood, *a, **kw):
- super(ProjectImporterDispatcher, self).__init__(*a, **kw)
- self.neighborhood = neighborhood
-
- @expose()
- def _lookup(self, source, *rest):
- for ep in iter_entry_points('allura.project_importers', source):
- return ep.load()(self.neighborhood), rest
-
-
class ProjectImporter(BaseController):
+ """
+ """
source = None
@LazyProperty
@@ -73,6 +64,8 @@ class ProjectImporter(BaseController):
class ToolImporter(object):
+ """
+ """
target_app = None # app or list of apps
source = None # string description of source, must match project importer
controller = None
[2/3] git commit: [#6456] Added documentation for ForgeImporters
package
Posted by br...@apache.org.
[#6456] Added documentation for ForgeImporters package
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/227396fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/227396fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/227396fa
Branch: refs/heads/master
Commit: 227396fa98c0b7d00fffc52552e30a1198273116
Parents: 4ed7af8
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Tue Jul 23 22:34:53 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 31 18:44:35 2013 +0000
----------------------------------------------------------------------
.gitignore | 2 +-
ForgeImporters/docs/Makefile | 105 +++++++++
ForgeImporters/docs/conf.py | 215 +++++++++++++++++++
ForgeImporters/docs/framework.rst | 46 ++++
ForgeImporters/docs/importers/google.rst | 30 +++
ForgeImporters/docs/index.rst | 50 +++++
ForgeImporters/docs/make.bat | 130 +++++++++++
ForgeImporters/forgeimporters/base.py | 60 +++++-
ForgeImporters/forgeimporters/google/project.py | 7 +
9 files changed, 642 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 7b76704..658b4d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,7 +12,7 @@ tags
*~
*.swp
.dbshell
-Allura/docs/_build/*
+*/docs/_build/*
mail/logs/*
sandbox-env/*
download/*
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/docs/Makefile
----------------------------------------------------------------------
diff --git a/ForgeImporters/docs/Makefile b/ForgeImporters/docs/Makefile
new file mode 100644
index 0000000..b3ca8af
--- /dev/null
+++ b/ForgeImporters/docs/Makefile
@@ -0,0 +1,105 @@
+# 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.
+
+# Makefile for Sphinx documentation
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/allura.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/allura.qhc"
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/docs/conf.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/docs/conf.py b/ForgeImporters/docs/conf.py
new file mode 100644
index 0000000..07430a5
--- /dev/null
+++ b/ForgeImporters/docs/conf.py
@@ -0,0 +1,215 @@
+# -*- coding: utf-8 -*-
+
+# 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.
+
+# allura documentation build configuration file, created by
+# sphinx-quickstart on Tue Nov 10 15:32:38 2009.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'Apache Allura (incubating)'
+copyright = '2012-2013 The Apache Software Foundation'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+#version = '0.1'
+# The full version, including alpha/beta/rc tags.
+#release = '0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'sphinxdoc'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+html_title = 'ForgeImporters for Allura documentation'
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'alluradoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+ ('index', 'allura.tex', u'allura Documentation',
+ u'Cory Johns, Tim Van Steenburgh, Dave Brondsema', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/docs/framework.rst
----------------------------------------------------------------------
diff --git a/ForgeImporters/docs/framework.rst b/ForgeImporters/docs/framework.rst
new file mode 100644
index 0000000..496f59d
--- /dev/null
+++ b/ForgeImporters/docs/framework.rst
@@ -0,0 +1,46 @@
+.. 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.
+
+:mod:`forgeimporters.base`
+==========================
+
+The following classes make up the base framework for
+importers.
+
+These can be used to create additional importers
+for Allura, which can be made available by creating an
+appropriate entry-point under `allura.project_importers` or
+`allura.importers` for project importers or tool importers,
+respectively.
+
+:class:`~forgeimporters.base.ProjectImporter`
+---------------------------------------------
+
+.. autoclass:: forgeimporters.base.ProjectImporter
+ :members:
+
+:class:`~forgeimporters.base.ToolImporter`
+------------------------------------------
+
+.. autoclass:: forgeimporters.base.ToolImporter
+ :members:
+
+:class:`~forgeimporters.base.ToolsValidator`
+--------------------------------------------
+
+.. autoclass:: forgeimporters.base.ToolsValidator
+ :members:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/docs/importers/google.rst
----------------------------------------------------------------------
diff --git a/ForgeImporters/docs/importers/google.rst b/ForgeImporters/docs/importers/google.rst
new file mode 100644
index 0000000..5ed7306
--- /dev/null
+++ b/ForgeImporters/docs/importers/google.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.
+
+Google Code
+===========
+
+This importer imports projects and tools from Google Code.
+
+:mod:`forgeimporters.google`
+----------------------------
+
+.. autoclass:: forgeimporters.google.project.GoogleCodeProjectImporter
+ :members:
+
+.. autoclass:: forgeimporters.google.tracker.GoogleCodeTrackerImporter
+ :members:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/docs/index.rst
----------------------------------------------------------------------
diff --git a/ForgeImporters/docs/index.rst b/ForgeImporters/docs/index.rst
new file mode 100644
index 0000000..37cfdcb
--- /dev/null
+++ b/ForgeImporters/docs/index.rst
@@ -0,0 +1,50 @@
+.. 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.
+
+The *ForgeImporters* Package
+============================
+
+This package contains the base framework for project and
+tool importers, as well as the core importers, for the
+Allura platform.
+
+Project importers will be available at
+:file:`/{nbhd-prefix}/import_project/{importer-name}/`,
+while individual tool importers will be available under the
+Import sidebar entry on the project admin page.
+
+Available Importers
+===================
+
+The following importers are available in this package for
+use with an Allura system.
+
+.. toctree::
+ :maxdepth: 1
+ :glob:
+
+ importers/*
+
+Importer Framework
+==================
+
+The following classes make up the base framework for
+importers.
+
+.. toctree::
+
+ framework
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/docs/make.bat
----------------------------------------------------------------------
diff --git a/ForgeImporters/docs/make.bat b/ForgeImporters/docs/make.bat
new file mode 100644
index 0000000..611d010
--- /dev/null
+++ b/ForgeImporters/docs/make.bat
@@ -0,0 +1,130 @@
+@ECHO OFF
+
+REM Licensed to the Apache Software Foundation (ASF) under one
+REM or more contributor license agreements. See the NOTICE file
+REM distributed with this work for additional information
+REM regarding copyright ownership. The ASF licenses this file
+REM to you under the Apache License, Version 2.0 (the
+REM "License"); you may not use this file except in compliance
+REM with the License. You may obtain a copy of the License at
+
+REM http://www.apache.org/licenses/LICENSE-2.0
+
+REM Unless required by applicable law or agreed to in writing,
+REM software distributed under the License is distributed on an
+REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+REM KIND, either express or implied. See the License for the
+REM specific language governing permissions and limitations
+REM under the License.
+
+REM Command file for Sphinx documentation
+
+set SPHINXBUILD=sphinx-build
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^<target^>` where ^<target^> is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\allura.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\allura.ghc
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+:end
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/forgeimporters/base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index bf22f8a..034a580 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -27,11 +27,19 @@ from allura.controllers import BaseController
class ProjectImporter(BaseController):
"""
+ Base class for project importers.
+
+ Subclases are required to implement the :meth:`index()` and
+ :meth:`process()` views described below.
"""
source = None
@LazyProperty
def tool_importers(self):
+ """
+ List of all tool importers that import from the same source
+ as this project importer.
+ """
tools = {}
for ep in iter_entry_points('allura.importers'):
epv = ep.load()
@@ -43,7 +51,7 @@ class ProjectImporter(BaseController):
"""
Override and expose this view to present the project import form.
- The template used by this view should extend the base template in:
+ The template used by this view should extend the base template in::
jinja:forgeimporters:templates/project_base.html
@@ -65,6 +73,29 @@ class ProjectImporter(BaseController):
class ToolImporter(object):
"""
+ Base class for tool importers.
+
+ Subclasses are required to implement :meth:`import_tool()` described
+ below and define the following attributes:
+
+ .. py:attribute:: target_app
+
+ A reference or list of references to the tool(s) that this imports
+ to. E.g.::
+
+ target_app = [forgegit.ForgeGitApp, forgehg.ForgeHgApp]
+
+ .. py:attribute:: source
+
+ A string indicating where this imports from. This must match the
+ `source` value of the :class:`ProjectImporter` for this importer to
+ be discovered during full-project imports. E.g.::
+
+ source = 'Google Code'
+
+ .. py:attribute:: controller
+
+ The controller for this importer, to handle single tool imports.
"""
target_app = None # app or list of apps
source = None # string description of source, must match project importer
@@ -72,11 +103,17 @@ class ToolImporter(object):
@classmethod
def by_name(self, name):
+ """
+ Return a ToolImporter subclass instance given its entry-point name.
+ """
for ep in iter_entry_points('allura.importers', name):
return ep.load()()
@classmethod
def by_app(self, app):
+ """
+ Return a ToolImporter subclass instance given its target_app class.
+ """
importers = {}
for ep in iter_entry_points('allura.importers'):
importer = ep.load()
@@ -84,18 +121,31 @@ class ToolImporter(object):
importers[ep.name] = importer()
return importers
- def import_tool(self, project=None, mount_point=None):
+ def import_tool(self, project, project_name, mount_point=None, mount_label=None):
"""
Override this method to perform the tool import.
+
+ :param project: the Allura project to import to
+ :param project_name: the name of the remote project to import from
+ :param mount_point: the mount point name, to override the default
+ :param mount_label: the mount label name, to override the default
"""
raise NotImplementedError
@property
def tool_label(self):
+ """
+ The label for this tool importer. Defaults to the `tool_label` from
+ the `target_app`.
+ """
return getattr(aslist(self.target_app)[0], 'tool_label', None)
@property
def tool_description(self):
+ """
+ The description for this tool importer. Defaults to the `tool_description`
+ from the `target_app`.
+ """
return getattr(aslist(self.target_app)[0], 'tool_description', None)
def tool_icon(self, theme, size):
@@ -103,6 +153,12 @@ class ToolImporter(object):
class ToolsValidator(fev.Set):
+ """
+ Validates the list of tool importers during a project import.
+
+ This verifies that the tools selected are available and valid
+ for this source.
+ """
def __init__(self, source, *a, **kw):
super(ToolsValidator, self).__init__(*a, **kw)
self.source = source
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/227396fa/ForgeImporters/forgeimporters/google/project.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/project.py b/ForgeImporters/forgeimporters/google/project.py
index 32b1976..d579606 100644
--- a/ForgeImporters/forgeimporters/google/project.py
+++ b/ForgeImporters/forgeimporters/google/project.py
@@ -47,6 +47,13 @@ class GoogleCodeProjectForm(schema.Schema):
class GoogleCodeProjectImporter(base.ProjectImporter):
+ """
+ Project importer for Google Code.
+
+ This imports project metadata, including summary, icon, and license,
+ as well as providing the UI for importing individual tools during project
+ import.
+ """
source = 'Google Code'
def __init__(self, neighborhood, *a, **kw):
[3/3] git commit: [#6456] Add project_update event to GC project and
code importer
Posted by br...@apache.org.
[#6456] Add project_update event to GC project and code importer
Signed-off-by: Cory Johns <cj...@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/158cd46b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/158cd46b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/158cd46b
Branch: refs/heads/master
Commit: 158cd46bcd01c271baa11569361583c0408b56cd
Parents: 227396f
Author: Cory Johns <cj...@slashdotmedia.com>
Authored: Thu Jul 25 15:10:42 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Jul 31 18:44:35 2013 +0000
----------------------------------------------------------------------
ForgeImporters/forgeimporters/google/code.py | 5 ++++-
ForgeImporters/forgeimporters/google/tasks.py | 2 ++
ForgeImporters/forgeimporters/tests/test_base.py | 11 -----------
3 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/158cd46b/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index 1ce51de..8e047fb 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -19,6 +19,7 @@ import formencode as fe
from formencode import validators as fev
from pylons import tmpl_context as c
+from pylons import app_globals as g
from tg import (
expose,
redirect,
@@ -111,9 +112,11 @@ class GoogleRepoImporter(ToolImporter):
repo_type = extractor.get_repo_type()
repo_url = get_repo_url(project.get_tool_data('google-code',
'project_name'), repo_type)
- return project.install_app(
+ app = project.install_app(
REPO_ENTRY_POINTS[repo_type],
mount_point=mount_point or 'code',
mount_label=mount_label or 'Code',
init_from_url=repo_url,
)
+ g.post_event('project_updated')
+ return app
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/158cd46b/ForgeImporters/forgeimporters/google/tasks.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tasks.py b/ForgeImporters/forgeimporters/google/tasks.py
index 834dc9d..65dd126 100644
--- a/ForgeImporters/forgeimporters/google/tasks.py
+++ b/ForgeImporters/forgeimporters/google/tasks.py
@@ -16,6 +16,7 @@
# under the License.
from pylons import tmpl_context as c
+from pylons import app_globals as g
from ming.orm import ThreadLocalORMSession
@@ -32,6 +33,7 @@ def import_project_info():
extractor.get_icon()
extractor.get_license()
ThreadLocalORMSession.flush_all()
+ g.post_event('project_updated')
@task
def import_tool(importer_name, mount_point=None, mount_label=None):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/158cd46b/ForgeImporters/forgeimporters/tests/test_base.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/test_base.py b/ForgeImporters/forgeimporters/tests/test_base.py
index 303570d..1558db4 100644
--- a/ForgeImporters/forgeimporters/tests/test_base.py
+++ b/ForgeImporters/forgeimporters/tests/test_base.py
@@ -35,17 +35,6 @@ def ep(name, source=None, importer=None, **kw):
return mep
-class TestProjectImporterDispatcher(TestCase):
- @mock.patch.object(base, 'iter_entry_points')
- def test_lookup(self, iep):
- eps = iep.return_value = [ep('ep1', 'first'), ep('ep2', 'second')]
- nbhd = mock.Mock(name='neighborhood')
- result = base.ProjectImporterDispatcher(nbhd)._lookup('source', 'rest1', 'rest2')
- self.assertEqual(result, (eps[0].lv, ('rest1', 'rest2')))
- iep.assert_called_once_with('allura.project_importers', 'source')
- eps[0].load.return_value.assert_called_once_with(nbhd)
-
-
class TestProjectImporter(TestCase):
@mock.patch.object(base, 'iter_entry_points')
def test_tool_importers(self, iep):