2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ceace0f609c0/
Changeset: ceace0f609c0
User: devteam
Date: 2014-04-30 21:35:57
Summary: Moved API tests to live under test/ rather than test/functional/. Removed test for DNAse flanked genes. Added test for UCSC table browser.
Affected #: 32 files
This diff is so big that we needed to truncate the remainder.
https://bitbucket.org/galaxy/galaxy-central/commits/c05ab2ae3a58/
Changeset: c05ab2ae3a58
User: devteam
Date: 2014-04-30 21:43:21
Summary: Add options to the shell script wrappers to run the API tests.
Affected #: 2 files
diff -r ceace0f609c00b15a28b1737b8782beed92bd927 -r c05ab2ae3a58938e07c33193a7a52a89cbd43056 run_functional_tests.sh
--- a/run_functional_tests.sh
+++ b/run_functional_tests.sh
@@ -10,6 +10,7 @@
echo "'run_functional_tests.sh aaa' for testing one test case of 'aaa' ('aaa' is the file name with path)"
echo "'run_functional_tests.sh -id bbb' for testing one tool with id 'bbb' ('bbb' is the tool id)"
echo "'run_functional_tests.sh -sid ccc' for testing one section with sid 'ccc' ('ccc' is the string after 'section::')"
+ echo "'run_functional_tests.sh -api' for running API functional tests"
echo "'run_functional_tests.sh -list' for listing all the tool ids"
echo "'run_functional_tests.sh -toolshed' for running all the test scripts in the ./test/tool_shed/functional directory"
echo "'run_functional_tests.sh -toolshed testscriptname' for running one test script named testscriptname in the .test/tool_shed/functional directory"
@@ -50,6 +51,12 @@
else
python ./test/tool_shed/functional_tests.py -v --with-nosehtml --html-report-file ./test/tool_shed/run_functional_tests.html $2
fi
+elif [ $1 = '-api' ]; then
+ if [ ! $2 ]; then
+ python ./scripts/functional_tests.py -v --with-nosehtml --html-report-file run_api_tests.html ./test/api
+ else
+ python ./scripts/functional_tests.py -v --with-nosehtml --html-report-file run_api_tests.html $2
+ fi
elif [ $1 = '-workflow' ]; then
python ./scripts/functional_tests.py -v functional.workflow:WorkflowTestCase --with-nosehtml --html-report-file ./test/tool_shed/run_functional_tests.html -workflow $2
elif [ $1 = '-data_managers' ]; then
diff -r ceace0f609c00b15a28b1737b8782beed92bd927 -r c05ab2ae3a58938e07c33193a7a52a89cbd43056 run_tests.sh
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -10,6 +10,7 @@
'${0##*/} -id bbb' for testing one tool with id 'bbb' ('bbb' is the tool id)
'${0##*/} -sid ccc' for testing one section with sid 'ccc' ('ccc' is the string after 'section::')
'${0##*/} -list' for listing all the tool ids
+'${0##*/} -api' for running all the test scripts in the ./test/api directory
'${0##*/} -toolshed' for running all the test scripts in the ./test/tool_shed/functional directory
'${0##*/} -toolshed testscriptname' for running one test script named testscriptname in the .test/tool_shed/functional directory
'${0##*/} -workflow test.xml' for running a workflow test case as defined by supplied workflow xml test file (experimental)
@@ -65,6 +66,17 @@
exit 1
fi
;;
+ -a|-api|--api)
+ test_script="./scripts/functional_tests.py"
+ report_file="./run_api_tests.html"
+ if [ $# -gt 1 ]; then
+ api_script=$2
+ shift 2
+ else
+ api_script="./test/api"
+ shift 1
+ fi
+ ;;
-t|-toolshed|--toolshed)
test_script="./test/tool_shed/functional_tests.py"
report_file="./test/tool_shed/run_functional_tests.html"
@@ -76,7 +88,7 @@
shift 1
fi
;;
- -with_framework_test_tools|--with_framework_test_tools)
+ -with_framework_test_tools|--with_framework_test_tools)
with_framework_test_tools_arg="-with_framework_test_tools"
shift
;;
@@ -182,6 +194,8 @@
extra_args="functional.workflow:WorkflowTestCase $workflow_file"
elif [ -n "$toolshed_script" ]; then
extra_args="$toolshed_script"
+elif [ -n "$api_script" ]; then
+ extra_args="$api_script"
elif [ -n "$section_id" ]; then
extra_args=`python tool_list.py $section_id`
elif [ -n "$test_id" ]; then
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ff4e42dde384/
Changeset: ff4e42dde384
User: carlfeberhard
Date: 2014-04-30 18:04:10
Summary: Fix to 197878e: properly send in html insertions to grid_config
Affected #: 1 file
diff -r a56b3687e778c308b7bf47776a4973d0a9a9040b -r ff4e42dde38421d749b431b18c5ab23d7c180e08 templates/grid_base.mako
--- a/templates/grid_base.mako
+++ b/templates/grid_base.mako
@@ -73,7 +73,7 @@
// load grid viewer
require(['mvc/grid/grid-view'], function(GridView) {
$(function() {
- gridView = new GridView( ${ h.to_json_string( self.get_grid_config() ) } );
+ gridView = new GridView( ${ h.to_json_string( self.get_grid_config( embedded=embedded, insert=insert ) ) } );
});
});
</script>
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a56b3687e778/
Changeset: a56b3687e778
User: trevorw
Date: 2014-04-30 02:24:47
Summary: selected_file -> repo_file
Affected #: 1 file
diff -r 1e76ef6d002830675756f617b334e824abf894c4 -r a56b3687e778c308b7bf47776a4973d0a9a9040b lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -184,10 +184,10 @@
commands.remove( repo.ui, repo, repo_file, force=True )
except Exception, e:
log.debug( "Error removing files using the mercurial API, so trying a different approach, the error was: %s" % str( e ))
- relative_selected_file = selected_file.split( 'repo_%d' % repository.id )[1].lstrip( '/' )
+ relative_selected_file = repo_file.split( 'repo_%d' % repository.id )[1].lstrip( '/' )
repo.dirstate.remove( relative_selected_file )
repo.dirstate.write()
- absolute_selected_file = os.path.abspath( selected_file )
+ absolute_selected_file = os.path.abspath( repo_file )
if os.path.isdir( absolute_selected_file ):
try:
os.rmdir( absolute_selected_file )
@@ -451,7 +451,7 @@
if last_actions_package_altered:
last_actions_elem[ last_actions_elem_package_index ] = last_actions_elem_package_elem
actions_group_elem[ last_actions_index ] = last_actions_elem
- else:
+ else:
# Inspect the sub elements of last_actions_elem to locate all <repository> tags and
# populate them with toolshed and changeset_revision attributes if necessary.
last_actions_package_altered, altered, last_actions_elem, message = \
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/b34eaa5eaa31/
Changeset: b34eaa5eaa31
User: greg
Date: 2014-04-29 21:11:46
Summary: Add a Tool Shed API script that can be used to retrieve the current set of categories from a Tool Shed (e.g. the test Tool Shed) and create each of them in a local development Tool Shed. This script can be used to streamline the process of creating a new development Tool Shed, populating it with categories expected in a public Tool Shed, and creating a new repository hierarchy that can be exported into a capsule and imported into the public Tool Shed.
Affected #: 1 file
diff -r 87bf6a0324f3182ccf16ad18b662f80272f187bc -r b34eaa5eaa3176bc7498adcda597e7fa58996a2b lib/tool_shed/scripts/api/create_categories.py
--- /dev/null
+++ b/lib/tool_shed/scripts/api/create_categories.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+"""
+This script will retrieve a list of dictionaries (one for each category) from the Tool Shed defined
+by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the category
+name and description from each dictionary and create a new category with that name and description in
+the Tool Shed defined by the --to_tool_shed parameter (a different base Tool Shed URL). Categories
+that already exist with a specified name in the Tool Shed in which the categories are being created
+will not be affected.
+
+This script is very useful for populating a new development Tool Shed with the set of categories that
+currently exist in either the test or main public Galaxy Tool Sheds. This will streamline building
+new repository hierarchies in the development Tool Shed and exportin gthem into a capsule that can be
+imported into one of the public Tool Sheds.
+
+Here is a working example of how to use this script to retrieve the current set of repositories that are
+available in the test public Tool Shed and create each of them in a local development Tool Shed.
+
+./create_categories.py -a <api key> -f http://testtoolshed.g2.bx.psu.edu -t http://localhost:9009
+"""
+
+import os
+import sys
+import argparse
+sys.path.insert( 0, os.path.dirname( __file__ ) )
+from common import get
+from common import submit
+
+def main( options ):
+ api_key = options.api
+ from_tool_shed = options.from_tool_shed.rstrip( '/' )
+ to_tool_shed = options.to_tool_shed.rstrip( '/' )
+ # Get the categories from the specified Tool Shed.
+ url = '%s/api/categories' % from_tool_shed
+ category_dicts = get( url )
+ create_response_dicts = []
+ for category_dict in category_dicts:
+ name = category_dict.get( 'name', None )
+ description = category_dict.get( 'description', None )
+ if name is not None and description is not None:
+ data = dict( name=name,
+ description=description )
+ url = '%s/api/categories/new/create_category' % to_tool_shed
+ try:
+ response = submit( url, data, api_key )
+ except Exception, e:
+ response = str( e )
+ log.exception( str( e ) )
+ create_response_dict = dict( response=response )
+ create_response_dicts.append( create_response_dict )
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser( description='Retrieve a list of categories from a Tool Shed and create them in another Tool Shed.' )
+ parser.add_argument( "-a", "--api", dest="api", required=True, help="API Key for Tool Shed in which categories will be created" )
+ parser.add_argument( "-f", "--from_tool_shed", dest="from_tool_shed", required=True, help="URL of Tool Shed from which to retrieve the categories" )
+ parser.add_argument( "-t", "--to_tool_shed", dest="to_tool_shed", required=True, help="URL of Tool Shed in which to create the categories" )
+ options = parser.parse_args()
+ main( options )
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/87bf6a0324f3/
Changeset: 87bf6a0324f3
User: greg
Date: 2014-04-29 20:58:21
Summary: Enhance the Tool Shed API to provide functions for retrieving and creating categories.
Affected #: 3 files
diff -r 0fee9a84cec6dd78774f30bd60ab7d41d2efc619 -r 87bf6a0324f3182ccf16ad18b662f80272f187bc lib/galaxy/webapps/tool_shed/api/categories.py
--- /dev/null
+++ b/lib/galaxy/webapps/tool_shed/api/categories.py
@@ -0,0 +1,103 @@
+import logging
+import os
+
+from galaxy import util
+from galaxy import web
+from galaxy.web.base.controller import BaseAPIController
+import tool_shed.util.shed_util_common as suc
+
+log = logging.getLogger( __name__ )
+
+
+class CategoriesController( BaseAPIController ):
+ """RESTful controller for interactions with categories in the Tool Shed."""
+
+ def __get_value_mapper( self, trans ):
+ value_mapper = { 'id' : trans.security.encode_id }
+ return value_mapper
+
+ @web.expose_api
+ def create_category( self, trans, payload, **kwd ):
+ """
+ POST /api/categories/create_category
+ Returns a dictionary of information about the created category.
+
+: param key: the current Galaxy admin user's API key
+
+ The following parameters are included in the payload.
+ :param name (required): the name of the category
+ :param description (optional): the description of the category (if not provided, the name will be used)
+ """
+ category_dict = dict( message = '',
+ status = 'ok' )
+ # Make sure the current user's API key proves he is an admin user in this Tool Shed.
+ if trans.user_is_admin():
+ # Get the information about the category to be created from the payload.
+ name = payload.get( 'name', '' )
+ if name:
+ description = payload.get( 'description', '' )
+ if not description:
+ # Default the description to the name.
+ description = name
+ if suc.get_category_by_name( trans, name ):
+ category_dict[ 'message' ] = 'A category with that name already exists'
+ category_dict[ 'status' ] = 'error'
+ else:
+ # Create the category
+ category = trans.app.model.Category( name=name, description=description )
+ trans.sa_session.add( category )
+ trans.sa_session.flush()
+ category_dict = category.to_dict( view='element',
+ value_mapper=self.__get_value_mapper( trans ) )
+ category_dict[ 'message' ] = "Category '%s' has been created" % str( category.name )
+ category_dict[ 'url' ] = web.url_for( controller='categories',
+ action='show',
+ id=trans.security.encode_id( category.id ) )
+ else:
+ category_dict[ 'message' ] = "Missing required parameter 'name'."
+ category_dict[ 'status' ] = 'error'
+ else:
+ category_dict[ 'message' ] = 'You are not authorized to create a category in this Tool Shed.'
+ category_dict[ 'status' ] = 'error'
+ return category_dict
+
+ @web.expose_api_anonymous
+ def index( self, trans, deleted=False, **kwd ):
+ """
+ GET /api/categories
+ Returns a list of dictionaries that contain information about each category.
+ """
+ # Example URL: http://localhost:9009/api/categories
+ category_dicts = []
+ deleted = util.asbool( deleted )
+ for category in trans.sa_session.query( trans.app.model.Category ) \
+ .filter( trans.app.model.Category.table.c.deleted == deleted ) \
+ .order_by( trans.app.model.Category.table.c.name ):
+ category_dict = category.to_dict( view='collection',
+ value_mapper=self.__get_value_mapper( trans ) )
+ category_dict[ 'url' ] = web.url_for( controller='categories',
+ action='show',
+ id=trans.security.encode_id( category.id ) )
+ category_dicts.append( category_dict )
+ return category_dicts
+
+ @web.expose_api_anonymous
+ def show( self, trans, id, **kwd ):
+ """
+ GET /api/categories/{encoded_category_id}
+ Returns a dictionary of information about a category.
+
+ :param id: the encoded id of the Repository object
+ """
+ # Example URL: http://localhost:9009/api/categories/f9cad7b01a472135
+ category = suc.get_category( trans, id )
+ if category is None:
+ category_dict = dict( message = 'Unable to locate category record for id %s.' % ( str( id ) ),
+ status = 'error' )
+ return category_dict
+ category_dict = category.to_dict( view='element',
+ value_mapper=self.__get_value_mapper( trans ) )
+ category_dict[ 'url' ] = web.url_for( controller='categories',
+ action='show',
+ id=trans.security.encode_id( category.id ) )
+ return category_dict
diff -r 0fee9a84cec6dd78774f30bd60ab7d41d2efc619 -r 87bf6a0324f3182ccf16ad18b662f80272f187bc lib/galaxy/webapps/tool_shed/buildapp.py
--- a/lib/galaxy/webapps/tool_shed/buildapp.py
+++ b/lib/galaxy/webapps/tool_shed/buildapp.py
@@ -80,6 +80,13 @@
webapp.add_route( '/repos/*path_info', controller='hg', action='handle_request', path_info='/' )
# Add the web API. # A good resource for RESTful services - http://routes.readthedocs.org/en/latest/restful.html
webapp.add_api_controllers( 'galaxy.webapps.tool_shed.api', app )
+ webapp.mapper.resource( 'category',
+ 'categories',
+ controller='categories',
+ name_prefix='category_',
+ path_prefix='/api',
+ new={ 'create_category' : 'POST' },
+ parent_resources=dict( member_name='category', collection_name='categories' ) )
webapp.mapper.resource( 'repository',
'repositories',
controller='repositories',
diff -r 0fee9a84cec6dd78774f30bd60ab7d41d2efc619 -r 87bf6a0324f3182ccf16ad18b662f80272f187bc lib/tool_shed/util/common_install_util.py
--- a/lib/tool_shed/util/common_install_util.py
+++ b/lib/tool_shed/util/common_install_util.py
@@ -470,9 +470,9 @@
# lists of discovered repository dependencies, but these lists will be empty in the
# required_repo_info_dict since dependency discovery has not yet been performed for these
# dictionaries.
- required_repo_infor_dict_key = required_repo_info_dict.keys()[ 0 ]
+ required_repo_info_dict_key = required_repo_info_dict.keys()[ 0 ]
all_repo_info_dicts_keys = [ d.keys()[ 0 ] for d in all_repo_info_dicts ]
- if required_repo_infor_dict_key not in all_repo_info_dicts_keys:
+ if required_repo_info_dict_key not in all_repo_info_dicts_keys:
all_repo_info_dicts.append( required_repo_info_dict )
all_required_repo_info_dict[ 'all_repo_info_dicts' ] = all_repo_info_dicts
return all_required_repo_info_dict
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.