選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
このリポジトリはアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュや、課題・プルリクエストのオープンはできません。
 
 
 
 
 
 

38 行
745 B

  1. import argparse
  2. import subprocess
  3. import sys
  4. def build():
  5. process = subprocess.run(["hugo"])
  6. if process.returncode != 0:
  7. sys.exit("build failed")
  8. def deploy(*, dry_run):
  9. cmd = [
  10. "rsync",
  11. "--itemize-changes",
  12. "--recursive",
  13. "--delete",
  14. "public/",
  15. "dedi3:/srv/nginx/html/books/python/",
  16. ]
  17. if dry_run:
  18. cmd += ["--dry-run"]
  19. process = subprocess.run(cmd)
  20. if process.returncode != 0:
  21. sys.exit("deployment failed")
  22. def main():
  23. parser = argparse.ArgumentParser()
  24. parser.add_argument("-n", "--dry-run", action="store_true")
  25. args = parser.parse_args()
  26. build()
  27. deploy(dry_run=args.dry_run)
  28. if __name__ == "__main__":
  29. main()