def main()

in scripts/copy_druid_docs.py [0:0]


def main(druid_version, source_directory="../../druid"):
    is_valid, error_msg = check_source(source_directory)
    if not is_valid:
        quit(error_msg + "\n")

    # The destination_directory should be druid-website-src/docs/VERSION
    destination_directory = f"../docs/{druid_version}"
    destination_directory_latest = "../docs/latest"

    # Copies the docs
    subprocess.run(["rsync", "--delete", "--recursive", f"{source_directory}/docs/", destination_directory])

    # deletes the _bin directory that's not needed
    if os.path.exists(f"{destination_directory_latest}/_bin"):
      shutil.rmtree(f"{destination_directory_latest}/_bin")
    # Copy sidebars.json and redirects.json
    shutil.copyfile(source_directory+"/website/sidebars.json", "../sidebars.json")
    shutil.copyfile(source_directory+"/website/redirects.js", "../redirects.js")

    # Copies the data folder from the root of druid-website-src
    # into published_versions so
    subprocess.run(["rsync", "--delete", "--recursive", "../data", "../published_versions/"])

    do_the_replace(destination_directory, druid_version)

    is_it_latest(druid_version, source_directory, destination_directory_latest)