Skip to content

Commit

Permalink
Merge pull request #613 from martenson/expose-api-ts-version
Browse files Browse the repository at this point in the history
expose TS version through API
  • Loading branch information
dannon committed Aug 18, 2015
2 parents b6e0ba2 + 5d0b2b5 commit 5c26341
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/galaxy/webapps/tool_shed/api/configuration.py
@@ -0,0 +1,28 @@
"""
API operations allowing clients to determine Tool Shed instance's
capabilities and configuration settings.
"""

from galaxy.web import _future_expose_api_anonymous_and_sessionless as expose_api_anonymous_and_sessionless
from galaxy.web.base.controller import BaseAPIController

import logging
log = logging.getLogger( __name__ )


class ConfigurationController( BaseAPIController ):

def __init__( self, app ):
super( ConfigurationController, self ).__init__( app )

@expose_api_anonymous_and_sessionless
def version( self, trans, **kwds ):
"""
GET /api/version
Return a description of the version_major and version of Galaxy Tool Shed
(e.g. 15.07 and 15.07.dev).
:rtype: dict
:returns: dictionary with versions keyed as 'version_major' and 'version'
"""
return {"version_major": self.app.config.version_major, "version": self.app.config.version }
1 change: 1 addition & 0 deletions lib/galaxy/webapps/tool_shed/buildapp.py
Expand Up @@ -153,6 +153,7 @@ def app_factory( global_conf, **kwargs ):
controller='tools',
action='index',
conditions=dict( method=[ "GET" ] ) )
webapp.mapper.connect( "version", "/api/version", controller="configuration", action="version", conditions=dict( method=[ "GET" ] ) )

webapp.finalize_config()
# Wrap the webapp in some useful middleware
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/webapps/tool_shed/config.py
Expand Up @@ -9,6 +9,7 @@
import ConfigParser
from galaxy import eggs
from galaxy.util import string_as_bool, listify
from galaxy.version import VERSION, VERSION_MAJOR

log = logging.getLogger( __name__ )

Expand Down Expand Up @@ -37,6 +38,8 @@ def __init__( self, **kwargs ):
self.umask = os.umask( 077 ) # get the current umask
os.umask( self.umask ) # can't get w/o set, so set it back
self.gid = os.getgid() # if running under newgrp(1) we'll need to fix the group of data created on the cluster
self.version_major = VERSION_MAJOR
self.version = VERSION
# Database related configuration
self.database = resolve_path( kwargs.get( "database_file", "database/community.sqlite" ), self.root )
self.database_connection = kwargs.get( "database_connection", False )
Expand Down

0 comments on commit 5c26341

Please sign in to comment.