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())
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"
def clean(): "Remove directory containing extracted example code" util.clean(config.example_dir) return f"{config.example_dir} removed"
def epub_clean(): "Remove directory containing epub" click.echo(util.clean(config.ebook_build_dir))
def remove(path): click.echo(util.clean(path))