Exemplo n.º 1
0
def main():
    app = flask.Flask(__name__)
    app.config.from_envvar('SETTINGS')
    gthnk.db.init_app(app)
    with app.app_context():
        librarian = Librarian(app)
        librarian.rotate_buffers()
        # also export the journal for safe-keeping
        librarian.export_journal()
Exemplo n.º 2
0
    def test_export(self):
        export_path = flask.current_app.config["EXPORT_PATH"]
        clean_tmp_export(export_path)

        librarian = Librarian(self.app)
        librarian.rotate_buffers()
        librarian.export_journal()

        self.assertEqual(len(glob.glob(os.path.join(export_path, "*"))), 6,
                         "correct number of directories created")
        self.assertEqual(
            len(glob.glob(os.path.join(export_path, "text", "*"))), 1,
            "correct number of text files created")
        self.assertEqual(
            len(glob.glob(os.path.join(export_path, "markdown", "*"))), 1,
            "correct number of markdown files created")

        clean_tmp_export(export_path)
Exemplo n.º 3
0
def journal_export():
    from gthnk.librarian import Librarian
    with app.app_context():
        librarian = Librarian(app)
        librarian.export_journal()