示例#1
0
文件: dsl.py 项目: jspam/temci
def store(package_file: str, db: Database = None):
    """
    Stores all actions and the database into the passed file and cleans up the temporary directory.

    :param package_file: name of the passed file
    :param db: passed database or None if the default database should be used
    """
    typecheck_locals(package_file=FileName(), db=Optional(T(Database)))
    db = db or Database()
    _store_in_db(db)
    db.store(package_file)
    db.clean()
示例#2
0
def store(package_file: str, db: Database = None):
    """
    Stores all actions and the database into the passed file and cleans up the temporary directory.

    :param package_file: name of the passed file
    :param db: passed database or None if the default database should be used
    """
    typecheck_locals(package_file=FileName(), db=Optional(T(Database)))
    db = db or Database()
    _store_in_db(db)
    db.store(package_file)
    db.clean()
示例#3
0
文件: dsl.py 项目: jspam/temci
def load(package_file: str, db: Database = None) -> Database:
    """
    Loads the package file into the passed database.

    :param package_file: name of the used package file
    :param db: used database or None if a new database should be used
    :return: used database
    """
    typecheck_locals(package_file=FileName(allow_non_existent=False))
    db = db or Database()
    db.load(package_file)
    global actions
    actions = Actions()
    actions.load_from_db(db)
    return db
示例#4
0
def run(package_file: str, reverse_file: str = None):
    """
    Execute the package and create a package that can be executed afterwards that reverses (most of the) made changes.

    :param package_file: name of the used package file
    :param reverse_file: name of the reverse package file or None if the setting ``package/reverse_file``
    should be used.
    """
    reverse_file = reverse_file or Settings()["package/reverse_file"]
    db = load(package_file)
    rev_db = Database()
    actions.reverse_and_store_all_in_db(rev_db)
    rev_db.store(reverse_file)
    rev_db.clean()
    actions.execute_all(db)
示例#5
0
def load(package_file: str, db: Database = None) -> Database:
    """
    Loads the package file into the passed database.

    :param package_file: name of the used package file
    :param db: used database or None if a new database should be used
    :return: used database
    """
    typecheck_locals(package_file=FileName(allow_non_existent=False))
    db = db or Database()
    db.load(package_file)
    global actions
    actions = Actions()
    actions.load_from_db(db)
    return db
示例#6
0
文件: dsl.py 项目: jspam/temci
def _store_in_db(db: Database = None):
    """
    Store all actions (and their dependencies) in the passed database.

    :param db: passed database or None if the default database should be used
    """
    typecheck_locals(db=Optional(T(Database)))
    db = db or Database()
    actions.store_all_in_db(db)
示例#7
0
文件: dsl.py 项目: jspam/temci
def run(package_file: str, reverse_file: str = None):
    """
    Execute the package and create a package that can be executed afterwards that reverses (most of the) made changes.

    :param package_file: name of the used package file
    :param reverse_file: name of the reverse package file or None if the setting ``package/reverse_file``
    should be used.
    """
    reverse_file = reverse_file or Settings()["package/reverse_file"]
    db = load(package_file)
    rev_db = Database()
    actions.reverse_and_store_all_in_db(rev_db)
    rev_db.store(reverse_file)
    rev_db.clean()
    actions.execute_all(db)