Skip to content

Commit bb75285

Browse files
committed
Replace & fix 0.2.0 migration by python version
Use Python script to work around a git mv limitation.
1 parent 61b4e78 commit bb75285

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

template/justfile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,27 @@ gen-project:
113113
# created with linkml-project-copier v0.1.x to v0.2.0 or newer.
114114
# Use with care! - It may not work for customized projects.
115115
_post_upgrade_v020:
116-
-mv docs/*.md docs/elements
117-
-git mv src/docs/files docs
118-
-git mv src/docs/templates docs/templates-linkml
119-
-git mv src/data/examples tests/data/
120-
echo "Migration to v0.2.x completed! Check the changes carefully before committing them."
116+
#!{{shebang}}
117+
import subprocess
118+
from pathlib import Path
119+
# Git move files from folder src to folder dest
120+
tasks = [
121+
(Path("src/docs/files"), Path("docs")),
122+
(Path("src/docs/templates"), Path("docs/templates-linkml")),
123+
(Path("src/data/examples"), Path("tests/data/")),
124+
]
125+
for src, dest in tasks:
126+
for path_obj in src.rglob("*"):
127+
if not path_obj.is_file():
128+
continue
129+
file_dest = dest / path_obj.relative_to(src)
130+
if not file_dest.parent.exists():
131+
file_dest.parent.mkdir(parents=True)
132+
print(f"Moving {path_obj} --> {file_dest}")
133+
subprocess.run(["git", "mv", str(path_obj), str(file_dest)])
134+
print(
135+
"Migration to v0.2.x completed! Check the changes carefully before committing."
136+
)
121137

122138
# ============== Hidden internal recipes ==============
123139

0 commit comments

Comments
 (0)