Ejemplo n.º 1
0
    This plugin serves as an example as to how to load plugins into Augur
    """
    def __init__(self, augur):
        self.__githubapi = None
        # _augur will be set by the super init
        super().__init__(augur)

    def __call__(self):
        from .githubapi import GitHubAPI
        if self.__githubapi is None:
            logger.debug('Initializing GitHub API')
            api_key = self._augur.read_config('GitHub', 'apikey',
                                              'AUGUR_GITHUB_API_KEY', 'None')
            self.__githubapi = GitHubAPI(api_key=api_key)
        return self.__githubapi

    def create_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        from .routes import create_routes
        create_routes(flask_app)


GitHubAPIPlugin.augur_plugin_meta = {
    'datasource': True,
    'name': 'githubapi',
}
Application.register_plugin(GitHubAPIPlugin)

__all__ = ['GitHubAPIPlugin']
Ejemplo n.º 2
0
# SPDX-License-Identifier: MIT
from augur.augurplugin import AugurPlugin
from augur.application import Application


class ExamplePlugin(AugurPlugin):
    """
    This plugin serves as an example as to how to load plugins into Augur
    """
    def __init__(self, augur_app):
        super().__init__(augur_app)

    def __call__(self):
        from .example_datasource import ExampleDatasource
        return ExampleDatasource()

    def add_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        pass


ExamplePlugin.augur_plugin_meta = {
    'name': 'example_plugin',
    'datasource': True
}
Application.register_plugin(ExamplePlugin)

__all__ = ['ExamplePlugin']
Ejemplo n.º 3
0
    def __call__(self):
        from .ghtorrent import GHTorrent
        if self.__ghtorrent is None:
            logger.debug('Initializing GHTorrent')
            self.__ghtorrent = GHTorrent(
                user=self._augur.read_config('GHTorrent', 'user',
                                             'AUGUR_DB_USER', 'root'),
                password=self._augur.read_config('GHTorrent', 'pass',
                                                 'AUGUR_DB_PASS', 'password'),
                host=self._augur.read_config('GHTorrent', 'host',
                                             'AUGUR_DB_HOST', '127.0.0.1'),
                port=self._augur.read_config('GHTorrent', 'port',
                                             'AUGUR_DB_PORT', '3306'),
                dbname=self._augur.read_config('GHTorrent', 'name',
                                               'AUGUR_DB_NAME', 'msr14'))
        return self.__ghtorrent

    def create_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        from .routes import create_routes
        create_routes(flask_app)


GHTorrentPlugin.augur_plugin_meta = {'name': 'ghtorrent', 'datasource': True}
Application.register_plugin(GHTorrentPlugin)

__all__ = ['GHTorrentPlugin']
Ejemplo n.º 4
0
from augur import logger


class DownloadsPlugin(AugurPlugin):
    """
    This plugin serves as an example as to how to load plugins into Augur
    """
    def __init__(self, augur):
        self.__downloads = None
        # _augur will be set by the super init
        super().__init__(augur)

    def __call__(self):
        from .downloads import Downloads
        if self.__downloads is None:
            logger.debug('Initializing Downloads')
            self.__downloads = Downloads(self._augur['githubapi']())
        return self.__downloads

    def create_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        from .routes import create_routes
        create_routes(flask_app)


DownloadsPlugin.augur_plugin_meta = {'name': 'downloads', 'datasource': True}
Application.register_plugin(DownloadsPlugin)

__all__ = ['DownloadsPlugin']
Ejemplo n.º 5
0
            logger.debug('Initializing Facade')
            self.__facade = Facade(
                user=self._augur.read_config('Facade', 'user',
                                             'AUGUR_FACADE_DB_USER', 'root'),
                password=self._augur.read_config('Facade', 'pass',
                                                 'AUGUR_FACADE_DB_PASS', ''),
                host=self._augur.read_config('Facade', 'host',
                                             'AUGUR_FACADE_DB_HOST',
                                             '127.0.0.1'),
                port=self._augur.read_config('Facade', 'port',
                                             'AUGUR_FACADE_DB_PORT', '3306'),
                dbname=self._augur.read_config('Facade', 'name',
                                               'AUGUR_FACADE_DB_NAME',
                                               'facade'),
                projects=self._augur.read_config('Facade', 'projects', None,
                                                 []))
        return self.__facade

    def create_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        from .routes import create_routes

        create_routes(flask_app)


FacadePlugin.augur_plugin_meta = {'name': 'facade', 'datasource': True}
Application.register_plugin(FacadePlugin)

__all__ = ['FacadePlugin']
Ejemplo n.º 6
0
    def __init__(self, augur):
        self.__metrics_status = None
        self.__githubapi = None
        # _augur will be set by the super init
        super().__init__(augur)

    def __call__(self):
        from .metrics_status import MetricsStatus
        from augur.datasources.githubapi.githubapi import GitHubAPI
        if self.__metrics_status is None:
            logger.debug('Initializing MetricsStatus')
            api_key = self._augur.read_config('GitHub', 'apikey', 'AUGUR_GITHUB_API_KEY', 'None')
            self.__githubapi = GitHubAPI(api_key=api_key)
            self.__metrics_status = MetricsStatus(self.__githubapi)
        return self.__metrics_status

    def create_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        from .routes import create_routes
        create_routes(flask_app)

MetricsStatusPlugin.augur_plugin_meta = {
    'name': 'metrics_status',
    'datasource': True
}
Application.register_plugin(MetricsStatusPlugin)

__all__ = ['MetricsStatusPlugin']
Ejemplo n.º 7
0
from augur import logger


class LocalCSVPlugin(AugurPlugin):
    """
    Plugin that can read local CSV files
    """
    def __init__(self, augur):
        self.__localCSV = None
        # _augur will be set by the super init
        super().__init__(augur)

    def __call__(self):
        from augur.localcsv import LocalCSV
        if self.__localCSV is None:
            logger.debug('Initializing LocalCSV')
            self.__localCSV = LocalCSV()
        return self.__localCSV

    def create_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        from .routes import create_routes
        create_routes(flask_app)


LocalCSVPlugin.augur_plugin_meta = {'name': 'localcsv', 'datasource': True}
Application.register_plugin(LocalCSVPlugin)

__all__ = ['LocalCSVPlugin']
Ejemplo n.º 8
0
                                             'AUGUR_LIBRARIESIO_DB_USER',
                                             'root'),
                password=self._augur.read_config('Database', 'pass',
                                                 'AUGUR_LIBRARIESIO_DB_PASS',
                                                 'password'),
                host=self._augur.read_config('Database', 'host',
                                             'AUGUR_LIBRARIESIO_DB_HOST',
                                             '127.0.0.1'),
                port=self._augur.read_config('Database', 'port',
                                             'AUGUR_LIBRARIESIO_DB_PORT',
                                             '3306'),
                dbname=self._augur.read_config('Database', 'name',
                                               'AUGUR_LIBRARIESIO_DB_NAME',
                                               'librariesio'))
        return self.__librariesio

    def create_routes(self, flask_app):
        """
        Responsible for adding this plugin's data sources to the API
        """
        from .routes import create_routes
        create_routes(flask_app)


LibrariesIOPlugin.augur_plugin_meta = {
    'datasource': True,
    'name': 'librariesio'
}
Application.register_plugin(LibrariesIOPlugin)

__all__ = ['LibrariesIOPlugin']