# # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """Manage redirector module.""" from __future__ import print_function from invenio_ext.script import Manager manager = Manager(usage=__doc__) @manager.command @manager.option("-u", "--update", dest="update_redirection", action="store_true") def create(label, plugin, parameters, update_redirection=False): """Register redirection page.""" from invenio_utils.json import json, json_unicode_to_utf8 from .api import register_redirection parameters = json_unicode_to_utf8(json.loads(parameters)) register_redirection(label, plugin, parameters, update_redirection)
from invenio_ext.script import Manager, change_command_name from flask.ext.script import ( # pylint: disable=no-name-in-module,import-error Command, Option, ) from .api import ( create_task, edit_task, delete_task, run_task, import_task_from_json_file, branch_task, ) manager = Manager(usage=__doc__) # TODO: --force check regardless of timestamp Option = partial(Option, default=None) opt_task_name_pos = Option( 'task_name_pos', metavar='task_name_pos', help='The task name' ) opt_task_name_pos_multi = Option( 'task_name_pos_multi', metavar='task_name_pos_multi', nargs='+', help='Task names to act upon' ) opt_task_name_pos_multi_maybe = Option( 'task_name_pos_multi_maybe', metavar='task_name_pos_multi_maybe', nargs='*',
# along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """Perform classifier operations such as extracting keywords from PDF.""" from __future__ import absolute_import, print_function import os import sys from flask import current_app from invenio_ext.script import Manager from .api import get_keywords_from_local_file manager = Manager(description=__doc__) @manager.option('-f', '--file', dest='filepath', help='load knowledge base from this file.') @manager.option('-k', '--taxonomy', dest='taxonomy', help='the taxonomy file to use.') @manager.option('-o', '--output-mode', dest='output', default="text", help='choose output format (text, dict, raw, html, marcxml).')
import os.path import sys from pprint import pformat from flask import current_app from invenio_ext.script import Manager, change_command_name, \ generate_secret_key try: from StringIO import StringIO except ImportError: from io import StringIO manager = Manager(usage="Perform configuration operations") def default_keys(): """Yield list of default configuration keys.""" yield 'SECRET_KEY' for k in current_app.config.keys(): if k.startswith('CFG_DATABASE'): yield k def get_instance_config_object(filename='invenio.cfg', silent=True): """Get the configuration object from the given filename.""" d = imp.new_module('config') d.__file__ = filename try:
# WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. from __future__ import print_function import os import socket from invenio_ext.script import Manager, change_command_name manager = Manager(usage="Perform Apache operations.") def _detect_ip_address(): """Detect IP address of this computer. Useful for creating Apache vhost conf snippet on RHEL like machines. However, if wanted site is 0.0.0.0, then use that, since we are running inside Docker. :return: IP address, or '*' if cannot detect :rtype: string .. note:: creates socket for real in order to detect real IP address, not the loopback one. """
from .models import CheckerRule from invenio_base.factory import create_app from invenio_ext.script import Manager, change_command_name from flask.ext.script import ( # pylint: disable=no-name-in-module,import-error Command, Option, ) from .api import ( create_task, edit_task, delete_task, run_task, import_task_from_json_file, branch_task, ) manager = Manager(usage=__doc__) # TODO: --force check regardless of timestamp Option = partial(Option, default=None) opt_task_name_pos = Option('task_name_pos', metavar='task_name_pos', help='The task name') opt_task_name_pos_multi = Option('task_name_pos_multi', metavar='task_name_pos_multi', nargs='+', help='Task names to act upon') opt_task_name_pos_multi_maybe = Option('task_name_pos_multi_maybe', metavar='task_name_pos_multi_maybe', nargs='*',
# # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """Database script functions.""" from __future__ import print_function import datetime import warnings from flask import current_app from invenio_ext.script import Manager, change_command_name, print_progress manager = Manager(usage="Perform database operations") # Shortcuts for manager options to keep code DRY. option_yes_i_know = manager.option('--yes-i-know', action='store_true', dest='yes_i_know', help='use with care!') option_quiet = manager.option('--quiet', action='store_true', dest='quiet', help='show less output') option_default_data = manager.option( '--no-data', action='store_false', dest='default_data', help='do not populate tables with default data')
# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. from invenio_ext.script import Manager manager = Manager(usage="Perform upgrade engine operations.") @manager.command def run(): """ Command for applying upgrades """ from invenio_upgrader.commands import cmd_upgrade cmd_upgrade() @manager.command def check(): """ Command for checking upgrades
# WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. """Invenio manager implementation using *Flask-Script*.""" from __future__ import print_function from flask import current_app from .factory import create_app from invenio_ext.script import Manager, change_command_name, register_manager manager = Manager(create_app(), with_default_commands=False) @manager.shell def make_shell_context(): """Extend shell context.""" from invenio_ext.sqlalchemy import db return dict(current_app=current_app, db=db) @manager.command def version(): """Get running version of Invenio.""" return current_app.config.get('CFG_VERSION')