Skip to content

Commit b0c273a

Browse files
committed
copier tag
1 parent d22ec2c commit b0c273a

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.0.15
2+
_commit: v0.0.16
33
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
44
description: Copier template for creating Python libraries and executables
55
python_ci_versions:
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# If you are using a Windows host and you initially cloned the repository directly onto your hard drive, you may run into file permission issues when running copier updates. To avoid these, after initially building the devcontainer, run this from the repo root:
4+
# cp .devcontainer/windows-host-helper.sh ../
5+
# cd ..
6+
# bash windows-host-helper.sh <git-url>
7+
8+
# If you're still having issues, make sure in Windows Developer Settings that you enabled Developer Mode, and also that you set your git config to have `core.autocrlf=false` and `core.symlinks=true` globally
9+
10+
set -e # Exit immediately on error
11+
12+
if [ -z "$BASH_VERSION" ]; then
13+
echo "Error: This script must be run with bash (e.g., 'bash windows-host-helper.sh')." >&2
14+
exit 1
15+
fi
16+
17+
# Check for the git URL argument
18+
if [ -z "$1" ]; then
19+
echo "Usage: $0 <git-url>"
20+
exit 1
21+
fi
22+
23+
gitUrl="$1"
24+
25+
# Extract repository name (removes .git suffix if present)
26+
repoName=$(basename "$gitUrl" .git)
27+
28+
echo "Repo name extracted as '$repoName'"
29+
30+
# Remove any existing subfolder with the repository name and recreate it
31+
rm -rf "./$repoName" || true # sometimes deleting the .venv folder fails
32+
rm -rf "./$repoName/*.md" # for some reason, sometimes md files are left behind
33+
mkdir -p "./$repoName"
34+
35+
# Create a temporary directory for cloning
36+
tmpdir=$(mktemp -d)
37+
38+
# Clone the repository into a subfolder inside the temporary directory.
39+
# This creates "$tmpdir/$repoName" with the repository's contents.
40+
git clone "$gitUrl" "$tmpdir/$repoName"
41+
42+
# Enable dotglob so that '*' includes hidden files
43+
shopt -s dotglob
44+
45+
# Move all contents (including hidden files) from the cloned repo to the target folder
46+
mv "$tmpdir/$repoName"/* "./$repoName/"
47+
48+
# Clean up: remove the temporary directory
49+
rm -rf "$tmpdir"
50+
51+
echo "Repository '$repoName' has been updated."

0 commit comments

Comments
 (0)