示例#1
0
def epub_disassemble(test):
    "Split combined into atom-numbered files"
    if test:
        if config.test_dir.exists():
            click.echo(util.clean(config.test_dir))
        click.echo(_epub.disassemble_combined_markdown_file(config.test_dir))
    else:
        click.echo(_epub.disassemble_combined_markdown_file())
示例#2
0
def create_release():
    "Create a release from scratch"
    import glob
    if config.release_dir.exists():
        clean(config.release_dir)
    os.makedirs(config.release_dir)
    convert_to_epub()
    convert_to_mobi()
    for src in config.built_ebooks:
        os.system(f"cp {config.epub_build_dir / src} {config.release_dir}")
    os.chdir(str(config.release_dir))

    def zzip(target_name, file_list):
        "zip utility"
        print(f"creating {target_name}.zip")
        os.system(f"zip -m {target_name}.zip {' '.join(file_list)}")

    files = glob.glob("*")
    zzip(config.base_name, [f for f in files if not "Sample" in f])
    zzip(config.base_name + "Sample", [f for f in files if "Sample" in f])
    retain_files(config.release_dir, ["zip"])
    return f"\n{config.release_dir} Completed"
示例#3
0
def clean():
    "Remove directory containing extracted example code"
    util.clean(config.example_dir)
    return f"{config.example_dir} removed"
示例#4
0
def epub_clean():
    "Remove directory containing epub"
    click.echo(util.clean(config.ebook_build_dir))
示例#5
0
 def remove(path):
     click.echo(util.clean(path))