Skip to content

Commit 0574213

Browse files
committed
moved get and clean to scripts
1 parent d38e4d3 commit 0574213

File tree

4 files changed

+45
-29
lines changed

4 files changed

+45
-29
lines changed

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
path = bids-specification
33
url = https://github.com/bids-standard/bids-specification
44
branch = master
5-
[submodule "test/test_data/petdicoms"]
6-
path = test/test_data/petdicoms
7-
url = https://github.com/openneuropet/petdicoms.git
85
[submodule "test/test_data/dcm_qa_nih"]
96
path = test/test_data/dcm_qa_nih
107
url = https://github.com/neurolabusc/dcm_qa_nih.git
118
[submodule "test/test_data/dcm_qa_uih"]
129
path = test/test_data/dcm_qa_uih
1310
url = https://github.com/neurolabusc/dcm_qa_uih.git
11+
[submodule "test/test_data/petdicoms"]
12+
path = test/test_data/petdicoms
13+
url = https://github.com/openneuropet/petdicoms.git

Makefile

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,8 @@ test/test_data:
66

77
# Initialize and update submodules for test data
88
gettestdata: test/test_data
9-
@if [ ! -d "test/test_data/dcm_qa_nih" ]; then \
10-
git submodule add --force https://github.com/neurolabusc/dcm_qa_nih.git test/test_data/dcm_qa_nih; \
11-
fi
12-
@if [ ! -d "test/test_data/dcm_qa_uih" ]; then \
13-
git submodule add --force https://github.com/neurolabusc/dcm_qa_uih.git test/test_data/dcm_qa_uih; \
14-
fi
15-
@if [ ! -d "test/test_data/petdicoms" ]; then \
16-
git submodule add --force https://github.com/openneuropet/petdicoms.git test/test_data/petdicoms; \
17-
fi
18-
git submodule update --init test/test_data/dcm_qa_nih
19-
git submodule update --init test/test_data/dcm_qa_uih
20-
git submodule update --init test/test_data/petdicoms
21-
# Prevent accidental commits to submodules
22-
git config submodule.test/test_data/dcm_qa_nih.ignore dirty
23-
git config submodule.test/test_data/dcm_qa_uih.ignore dirty
24-
git config submodule.test/test_data/petdicoms.ignore dirty
9+
test/gettestdata
2510

2611
# Clean test data (remove submodules and their directories)
2712
clean-testdata:
28-
git submodule deinit -f test/test_data/dcm_qa_nih
29-
git submodule deinit -f test/test_data/dcm_qa_uih
30-
git submodule deinit -f test/test_data/petdicoms
31-
git rm -f test/test_data/dcm_qa_nih
32-
git rm -f test/test_data/dcm_qa_uih
33-
git rm -f test/test_data/petdicoms
34-
rm -rf .git/modules/test/test_data/dcm_qa_uih
35-
rm -rf .git/modules/test/test_data/dcm_qa_nih
36-
rm -rf .git/modules/test/test_data/petdicoms
37-
rm -rf test/test_data
13+
test/cleantestdata

test/cleantestdata

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /usr/bin/env bash
2+
# cleans up the testdata we have in this folder
3+
4+
git submodule deinit -f test/test_data/dcm_qa_nih
5+
git submodule deinit -f test/test_data/dcm_qa_uih
6+
git submodule deinit -f test/test_data/petdicoms
7+
git rm -f test/test_data/dcm_qa_nih
8+
git rm -f test/test_data/dcm_qa_uih
9+
git rm -f test/test_data/petdicoms
10+
rm -rf .git/modules/test/test_data/dcm_qa_uih
11+
rm -rf .git/modules/test/test_data/dcm_qa_nih
12+
rm -rf .git/modules/test/test_data/petdicoms
13+
rm -rf test/test_data

test/gettestdata

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! /usr/bin/env bash
2+
3+
if [ ! -d "test/test_data/dcm_qa_nih" ]; then
4+
git submodule add --force https://github.com/neurolabusc/dcm_qa_nih.git test/test_data/dcm_qa_nih
5+
fi
6+
if [ ! -d "test/test_data/dcm_qa_uih" ]; then
7+
git submodule add --force https://github.com/neurolabusc/dcm_qa_uih.git test/test_data/dcm_qa_uih
8+
fi
9+
if [ ! -d "test/test_data/petdicoms" ]; then
10+
git submodule add --force https://github.com/openneuropet/petdicoms.git test/test_data/petdicoms
11+
fi
12+
git submodule update --init test/test_data/dcm_qa_nih
13+
git submodule update --init test/test_data/dcm_qa_uih
14+
git submodule update --init test/test_data/petdicoms
15+
# Prevent accidental commits to submodules
16+
git config submodule.test/test_data/dcm_qa_nih.ignore dirty
17+
git config submodule.test/test_data/dcm_qa_uih.ignore dirty
18+
git config submodule.test/test_data/petdicoms.ignore dirty
19+
# Unzip petdicoms data
20+
echo "Unzipping petdicoms data..."
21+
cd test/test_data/petdicoms/sourcedata || exit 1
22+
for zip in *.zip; do
23+
if [ -f "$zip" ]; then
24+
echo "Unzipping $zip..."
25+
unzip -q -o "$zip" -d "${zip%.zip}"
26+
fi
27+
done

0 commit comments

Comments
 (0)