Greg Von Kuster avatar Greg Von Kuster committed e08716d

Add a guid to tool shed repository tool metadata and add some fixes for previewing tool shed repository tools.

Comments (0)

Files changed (5)

lib/galaxy/webapps/community/app.py

         self.config = config.Configuration( **kwargs )
         self.config.check()
         config.configure_logging( self.config )
+        # Set up datatypes registry
+        self.datatypes_registry = galaxy.datatypes.registry.Registry( self.config.root, self.config.datatypes_config )
         # Determine the database url
         if self.config.database_connection:
             db_url = self.config.database_connection

lib/galaxy/webapps/community/config.py

         self.file_path = resolve_path( kwargs.get( "file_path", "database/files" ), self.root )
         self.new_file_path = resolve_path( kwargs.get( "new_file_path", "database/tmp" ), self.root )
         self.cookie_path = kwargs.get( "cookie_path", "/" )
+        self.datatypes_config = kwargs.get( 'datatypes_config_file', 'datatypes_conf.xml' )
         self.test_conf = resolve_path( kwargs.get( "test_conf", "" ), self.root )
         self.id_secret = kwargs.get( "id_secret", "USING THE DEFAULT IS NOT SECURE!" )
+        # Tool stuff
         self.tool_secret = kwargs.get( "tool_secret", "" )
         self.tool_data_path = resolve_path( kwargs.get( "tool_data_path", "tool-data" ), os.getcwd() )
         self.tool_data_table_config_path = resolve_path( kwargs.get( 'tool_data_table_config_path', 'tool_data_table_conf.xml' ), self.root )
+        self.ftp_upload_dir = kwargs.get( 'ftp_upload_dir', None )
+        # Location for dependencies
+        if 'tool_dependency_dir' in kwargs:
+            self.tool_dependency_dir = resolve_path( kwargs.get( "tool_dependency_dir" ), self.root )
+            self.use_tool_dependencies = True
+        else:
+            self.tool_dependency_dir = None
+            self.use_tool_dependencies = False
         self.use_remote_user = string_as_bool( kwargs.get( "use_remote_user", "False" ) )
         self.remote_user_maildomain = kwargs.get( "remote_user_maildomain", None )
         self.remote_user_logout_href = kwargs.get( "remote_user_logout_href", None )

lib/galaxy/webapps/community/controllers/common.py

     # The received metadata_dict includes no metadata for workflows, so a new repository_metadata table
     # record is not needed.
     return False
+def generate_tool_guid( trans, repository, tool ):
+    """
+    Generate a guid for the received tool.  The form of the guid is    
+    <tool shed host>/repos/<tool shed username>/<tool shed repo name>/<tool id>/<tool version>
+    """
+    return '%s/repos/%s/%s/%s/%s' % ( trans.request.host,
+                                      repository.user.username,
+                                      repository.name,
+                                      tool.id,
+                                      tool.version )
 def generate_tool_metadata( trans, id, changeset_revision, root, name, tool, metadata_dict ):
     """
     Update the received metadata_dict with changes that have been
     applied to the received tool.
     """
+    repository = get_repository( trans, id )
     tool_requirements = []
     for tr in tool.requirements:
         requirement_dict = dict( name=tr.name,
                               outputs=ttb.outputs )
             tool_tests.append( test_dict )
     tool_dict = dict( id=tool.id,
+                      guid = generate_tool_guid( trans, repository, tool ),
                       name=tool.name,
                       version=tool.version,
                       description=tool.description,

templates/webapps/community/repository/tool_form.mako

 <%
     from galaxy.util.expressions import ExpressionContext
     from galaxy import util
-    from galaxy.tools.parameters.basic import DataToolParameter, ColumnListParameter, SelectToolParameter
+    from galaxy.tools.parameters.basic import DataToolParameter, ColumnListParameter, GenomeBuildParameter, SelectToolParameter
     from galaxy.web.form_builder import SelectField
 
     is_admin = trans.user_is_admin()
                     %endif
                 %elif input.type == "upload_dataset":
                     %if input.get_datatype( trans, other_values ).composite_type is None:
-                        # Have non-composite upload appear as before
-                        ${do_inputs( input.inputs, tool_state[input.name][0], prefix + input.name + "_" + str( 0 ) + "|", other_values )}
+                        ## Have non-composite upload appear as before
+                        ${do_inputs( input.inputs, 'files', prefix + input.name + "_" + str( 0 ) + "|", other_values )}
                     %else:
                         <div class="repeat-group">
                             <div class="form-title-row">
         <%def name="row_for_param( prefix, param, parent_state, other_values )">
             <%
                 label = param.get_label()
-                if isinstance( param, DataToolParameter ) or isinstance( param, ColumnListParameter ):
+                if isinstance( param, DataToolParameter ) or isinstance( param, ColumnListParameter ) or isinstance( param, GenomeBuildParameter ):
                     field = SelectField( param.name )
                     field.add_option( param.name, param.name )
                     field_html = field.get_html()

templates/webapps/community/repository/view_tool_metadata.mako

                     <div style="clear: both"></div>
                 </div>
             %endif
+            %if 'guid' in metadata:
+                <div class="form-row">
+                    <label>Guid:</label>
+                    ${metadata[ 'guid' ]}
+                    <div style="clear: both"></div>
+                </div>
+            %endif
             %if 'version' in metadata:
                 <div class="form-row">
                     <label>Version:</label>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.