Create a controller that provides a landing page to import a project from Google Code hosting. The landing page should ask for a project name and provide a list of all the tools (wiki, downloads, tracker, etc) supported for import, with a checkbox for each. When submitted, it should pull the basic project info (description, icon, license) from the summary page (e.g., https://code.google.com/p/modwsgi/) and create a stub project with that data.
The description and icon values have itemprop
attributes of "description" and "image", respectively, but the license will take a little bit of processing to extract.
The importers for the tools will be done in separate tickets. The list of supported tools should be discovered by iterating the entry-points in the group allura.importers
looking for importers with a source
attribute equal to "Google Code". Use the importer's target_app
attribute to get the tool_label
(and possibly icon?) for display. See the mailing list for more information.
The project importer should register itself as an entry point under the allura.project_importers
group, and should expose a source
attribute with the value of "Google Code". I'm thinking the controller should be under an app-less tool called ForgeImporters
, e.g. ForgeImporters/forgeimporters/google/project.py
or such.
Some example code parsing out project information is available here.
We'll also need to surface this new project import view via a parameter to the add_project page, i.e.,
/p/add_project?import=Google+Code
. TheNeighborhoodController
will need to do discovery of available project importers in__init__()
andadd_project()
will need to redispatch based on the discovery mapping and parameter.The base framework is ready for review in
allura:cj/6456
. We could merge that one commit so that the other tickets could be started in parallel.The commit was amended with some improvements, and tests were added.
allura:cj/6456
sftheme:cj/6456
The
project_unixname
variable name isn't a great name. Unix name is a SF-specific thing (and includes the nbhd suffix). Better to call itshortname
GoogleCodeProjectImporter
only works for/p/
nbhd. Shouldn't it be able to work with any neighborhood?"SourceForge" is used in a flash message, which isn't appropriate for other sites using Allura. I know we have the same text during regular project registration (site note: are we copying too much from that logic? will we have to copy it all again for other importers?) Lets not further the SourceForge hard-coding here. Perhaps we need a .ini setting for site name?
!important
in css isn't a good thing.Validation of the google code project name has an error message that says "Usernames must include only..."
Functionality works well.
Also, login should be required for the import page. And
I used
project_unixname
to match theadd_project
form. I can change it, though; I do likeshortname
better. I think was originally going to use the same form andcheck_names
AJAX call, but didn't anyway.Right about the neighborhood, and there's no reason for it to have been hard-coded. I'll fix.
+1 to .ini setting for site name.
Copy/paste error. I really wanted to re-use
add_project.css
but could figure out how to reference the file since I'm not using EW. Help is appreciated there.That's a standard FormEncode validation message. What should it say instead?
Upon further discussion with Tim, I also need to change how the tool importers are dispatched to not assume that
import_tool
will manage tasking.Oh, and regarding re-copying logic for other project importers, I expect most of the logic in
GoogleCodeProjectImporter
andgoogle/templates/project.html
could be moved up tobase.ProjectImporter
andtemplates/project_base.html
but I was deferring that until we have another project importer to actually see how much overlap there is.It should say "Google Code project names only" instead of "usernames"
Oh, I missed the "usernames" bit.
Force-pushed to:
allura:cj/6456
sftheme:cj/6456
Merged because the code looks all good, but not closing the ticket because I think it's important to document the importer classes. I see some good docstrings already, so let's expose those in the API docs (perhaps we'll want/need to move the base importer into Allura? and leave ForgeImporters for the specific instances). A bit of narrative high-level explanation might be good too.
Refactored the dispatcher to remove the dependency on
forgeimporters
fromallura
and added docs for theForgeImporter
package. It's not currently integrated with the docs inAllura
because I'm still not sure how to organize the docs directory structure nor how to tie the different packages' docs together.Force-pushed to:
allura:cj/6456
Force-pushed with project_updated events for project and code importers, a test fix, and updates from master:
allura:cj/6456