1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/e4dbcc06df53/ Changeset: e4dbcc06df53 User: martenson Date: 2014-11-19 17:53:33+00:00 Summary: add remote_repo_url and homepage_url to repository model and TS forms that show/modify it, database migration included Affected #: 7 files diff -r ee4e0a07aea2305927f5215fdecd049fbb80031b -r e4dbcc06df53f4a47717ddd047dd85911bab888e lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -1063,6 +1063,8 @@ message=message, status=status ) ) name = kwd.get( 'name', '' ).strip() + remote_repository_url = kwd.get( 'remote_repository_url', '' ) + homepage_url = kwd.get( 'homepage_url', '' ) description = kwd.get( 'description', '' ) long_description = kwd.get( 'long_description', '' ) category_ids = util.listify( kwd.get( 'category_id', '' ) ) @@ -1082,6 +1084,8 @@ repository, message = repository_util.create_repository( trans.app, name, repository_type, + remote_repository_url, + homepage_url, description, long_description, user_id=trans.user.id, @@ -1093,6 +1097,8 @@ repository_type_select_field = rt_util.build_repository_type_select_field( trans ) return trans.fill_template( '/webapps/tool_shed/repository/create_repository.mako', name=name, + remote_repository_url=remote_repository_url, + homepage_url=homepage_url, description=description, long_description=long_description, selected_categories=selected_categories, @@ -2242,6 +2248,8 @@ repo = hg_util.get_repo_for_repository( trans.app, repository=None, repo_path=repo_dir, create=False ) repo_name = kwd.get( 'repo_name', repository.name ) changeset_revision = kwd.get( 'changeset_revision', repository.tip( trans.app ) ) + remote_repository_url = kwd.get( 'remote_repository_url', repository.remote_repository_url ) + homepage_url = kwd.get( 'homepage_url', repository.homepage_url ) description = kwd.get( 'description', repository.description ) long_description = kwd.get( 'long_description', repository.long_description ) avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model ) @@ -2271,6 +2279,12 @@ if repository_type != repository.type: repository.type = repository_type flush_needed = True + if remote_repository_url != repository.remote_repository_url: + repository.remote_repository_url = remote_repository_url + flush_needed = True + if homepage_url != repository.homepage_url: + repository.homepage_url = homepage_url + flush_needed = True if description != repository.description: repository.description = description flush_needed = True @@ -2470,6 +2484,8 @@ deprecated_only=True ) return trans.fill_template( '/webapps/tool_shed/repository/manage_repository.mako', repo_name=repo_name, + remote_repository_url=remote_repository_url, + homepage_url=homepage_url, description=description, long_description=long_description, current_allow_push_list=current_allow_push_list, diff -r ee4e0a07aea2305927f5215fdecd049fbb80031b -r e4dbcc06df53f4a47717ddd047dd85911bab888e lib/galaxy/webapps/tool_shed/model/__init__.py --- a/lib/galaxy/webapps/tool_shed/model/__init__.py +++ b/lib/galaxy/webapps/tool_shed/model/__init__.py @@ -144,9 +144,9 @@ class Repository( object, Dictifiable ): - dict_collection_visible_keys = ( 'id', 'name', 'type', 'description', 'user_id', 'private', 'deleted', + dict_collection_visible_keys = ( 'id', 'name', 'type', 'remote_repository_url', 'homepage_url', 'description', 'user_id', 'private', 'deleted', 'times_downloaded', 'deprecated' ) - dict_element_visible_keys = ( 'id', 'name', 'type', 'description', 'long_description', 'user_id', 'private', + dict_element_visible_keys = ( 'id', 'name', 'type', 'remote_repository_url', 'homepage_url', 'description', 'long_description', 'user_id', 'private', 'deleted', 'times_downloaded', 'deprecated' ) file_states = Bunch( NORMAL = 'n', NEEDS_MERGING = 'm', @@ -154,11 +154,14 @@ MARKED_FOR_ADDITION = 'a', NOT_TRACKED = '?' ) - def __init__( self, id=None, name=None, type=None, description=None, long_description=None, user_id=None, private=False, - deleted=None, email_alerts=None, times_downloaded=0, deprecated=False ): + def __init__( self, id=None, name=None, type=None, remote_repository_url=None, homepage_url=None, + description=None, long_description=None, user_id=None, private=False, + deleted=None, email_alerts=None, times_downloaded=0, deprecated=False ): self.id = id self.name = name or "Unnamed repository" self.type = type + self.remote_repository_url = remote_repository_url + self.homepage_url = homepage_url self.description = description self.long_description = long_description self.user_id = user_id diff -r ee4e0a07aea2305927f5215fdecd049fbb80031b -r e4dbcc06df53f4a47717ddd047dd85911bab888e lib/galaxy/webapps/tool_shed/model/mapping.py --- a/lib/galaxy/webapps/tool_shed/model/mapping.py +++ b/lib/galaxy/webapps/tool_shed/model/mapping.py @@ -100,6 +100,8 @@ Column( "update_time", DateTime, default=now, onupdate=now ), Column( "name", TrimmedString( 255 ), index=True ), Column( "type", TrimmedString( 255 ), index=True ), + Column( "remote_repository_url", TrimmedString( 255 ) ), + Column( "homepage_url", TrimmedString( 255 ) ), Column( "description" , TEXT ), Column( "long_description" , TEXT ), Column( "user_id", Integer, ForeignKey( "galaxy_user.id" ), index=True ), diff -r ee4e0a07aea2305927f5215fdecd049fbb80031b -r e4dbcc06df53f4a47717ddd047dd85911bab888e lib/galaxy/webapps/tool_shed/model/migrate/versions/0023_add_repository_url_and_hompeage_url.py --- /dev/null +++ b/lib/galaxy/webapps/tool_shed/model/migrate/versions/0023_add_repository_url_and_hompeage_url.py @@ -0,0 +1,49 @@ +""" +Migration script to add the remote_repository_url and homepage_url +columns to the repository table. +""" + +from sqlalchemy import * +from sqlalchemy.orm import * +from migrate import * +from migrate.changeset import * + +import sys, logging + +log = logging.getLogger( __name__ ) +log.setLevel(logging.DEBUG) +handler = logging.StreamHandler( sys.stdout ) +format = "%(name)s %(levelname)s %(asctime)s %(message)s" +formatter = logging.Formatter( format ) +handler.setFormatter( formatter ) +log.addHandler( handler ) + +metadata = MetaData() + +def upgrade( migrate_engine ): + print __doc__ + metadata.bind = migrate_engine + metadata.reflect() + Repository_table = Table( "repository", metadata, autoload=True ) + c_remote = Column( "remote_repository_url", TrimmedString( 255 ) ) + c_homepage = Column( "homepage_url", TrimmedString( 255 ) ) + try: + # Create + c_remote.create( Repository_table ) + c_homepage.create( Repository_table ) + assert c_remote is Repository_table.c.remote_repository_url + assert c_homepage is Repository_table.c.homepage_url + except Exception, e: + print "Adding remote_repository_url and homepage_url columns to the repository table failed: %s" % str( e ) + migrate_engine.execute( cmd ) + +def downgrade( migrate_engine ): + metadata.bind = migrate_engine + metadata.reflect() + # Drop type column from repository table. + Repository_table = Table( "repository", metadata, autoload=True ) + try: + Repository_table.c..drop() + Repository_table.c.homepage_url.drop() + except Exception, e: + print "Dropping columns remote_repository_url and homepage_url from the repository table failed: %s" % str( e ) diff -r ee4e0a07aea2305927f5215fdecd049fbb80031b -r e4dbcc06df53f4a47717ddd047dd85911bab888e lib/tool_shed/util/repository_util.py --- a/lib/tool_shed/util/repository_util.py +++ b/lib/tool_shed/util/repository_util.py @@ -120,11 +120,14 @@ tool_dependencies ) return repo_info_dict -def create_repository( app, name, type, description, long_description, user_id, category_ids=[] ): +def create_repository( app, name, type, remote_repository_url, homepage_url, description, long_description, user_id, category_ids=[] ): + """Create a new ToolShed repository""" sa_session = app.model.context.current # Add the repository record to the database. repository = app.model.Repository( name=name, type=type, + remote_repository_url=remote_repository_url, + homepage_url=homepage_url, description=description, long_description=long_description, user_id=user_id ) diff -r ee4e0a07aea2305927f5215fdecd049fbb80031b -r e4dbcc06df53f4a47717ddd047dd85911bab888e templates/webapps/tool_shed/repository/create_repository.mako --- a/templates/webapps/tool_shed/repository/create_repository.mako +++ b/templates/webapps/tool_shed/repository/create_repository.mako @@ -25,6 +25,24 @@ <div style="clear: both"></div></div> ${render_repository_type_select_field( repository_type_select_field, render_help=True )} + + <div class="form-row"> + <label>Remote repository URL:</label> + <input name="remote_repository_url" placeholder="optional" type="textfield" value="${remote_repository_url | h}" size="80"/> + <div class="toolParamHelp" style="clear: both;"> + A link to your public development repository. + </div> + <div style="clear: both"></div> + </div> + <div class="form-row"> + <label>Homepage URL:</label> + <input name="homepage_url" placeholder="optional" type="textfield" value="${homepage_url | h}" size="80"/> + <div class="toolParamHelp" style="clear: both;"> + Link to tool's homepage. + </div> + <div style="clear: both"></div> + </div> + <div class="form-row"><label>Synopsis:</label><input name="description" type="textfield" value="${description | h}" size="80"/> diff -r ee4e0a07aea2305927f5215fdecd049fbb80031b -r e4dbcc06df53f4a47717ddd047dd85911bab888e templates/webapps/tool_shed/repository/manage_repository.mako --- a/templates/webapps/tool_shed/repository/manage_repository.mako +++ b/templates/webapps/tool_shed/repository/manage_repository.mako @@ -184,6 +184,16 @@ </div> ${render_repository_type_select_field( repository_type_select_field, render_help=True )} <div class="form-row"> + <label>Remote repository URL:</label> + <input name="remote_repository_url" type="textfield" value="${remote_repository_url | h}" size="80"/> + <div style="clear: both"></div> + </div> + <div class="form-row"> + <label>Homepage URL:</label> + <input name="homepage_url" type="textfield" value="${homepage_url | h}" size="80"/> + <div style="clear: both"></div> + </div> + <div class="form-row"><label>Synopsis:</label><input name="description" type="textfield" value="${description | h}" size="80"/><div style="clear: both"></div> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.