/
create_package.sh
executable file
·53 lines (40 loc) · 1 KB
/
create_package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
VENDOR=$1
PACKAGE=$2
shift
shift
if [ ! -d "store/$VENDOR" ]
then
mkdir store/$VENDOR
cat <<- EOF > store/$VENDOR/meta.yml
description: CREATED BY NEUROGISTRY
packages:
EOF
git add store/$VENDOR/meta.yml
git commit -m "Added vendor $VENDOR"
fi
if [ -d "store/$VENDOR/$PACKAGE" ]
then
echo "package $PACKAGE already exists for vendor $VENDOR"
exit 1
fi
mkdir -p store/$VENDOR/$PACKAGE
for file in $@
do
ln -s $PWD/$file store/$VENDOR/$PACKAGE/$(basename $file)
done
cat <<- EOF >> store/$VENDOR/meta.yml
- $PACKAGE
EOF
git add store/$VENDOR/meta.yml
dvc add --no-commit store/$VENDOR/$PACKAGE
dvc commit -f store/$VENDOR/$PACKAGE
dvc push store/$VENDOR/$PACKAGE
git commit -m "Create package $PACKAGE for vendor $VENDOR"
echo ""
echo "New package $PACKAGE created for $VENDOR"
echo " -> Package location : store/$VENDOR/$PACKAGE"
echo " -> Revision to current package version : $(git rev-parse HEAD)"
echo ""
echo "CHANGES WERE COMMITED, BUT YOU NEED TO PUSH THEM STILL"
echo ""