-
Notifications
You must be signed in to change notification settings - Fork 4
/
run
executable file
·93 lines (71 loc) · 2.16 KB
/
run
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
PAKET="./.paket/paket.exe"
FAKE="packages/build/FAKE/tools/FAKE.exe"
EXAMPLES_PROJ="examples/Examples.fsproj"
TEST_PROJ="tests/Test.CryptoExchangeClient/Test.CryptoExchangeClient.fsproj"
SRC_PROJ="src/CryptoExchangeClient.fsproj"
function __run {
# First arg
given_command=$1
# The rest of the args
arguments=${@:2}
# For Sub-command redirection
sub_command=$2
sub_arguments=${@:3}
# For debugging
# echo "cmd: $given_command"
# echo "args: $arguments"
case $given_command in
p) ${PAKET} $arguments;;
dn) dotnet $arguments;;
paket) ${PAKET} $arguments;;
fake) ${FAKE} $arguments Fake.fsx;;
examples:build) dotnet build -f ${EXAMPLES_PROJ};;
examples:restore) dotnet restore -f ${EXAMPLES_PROJ};;
examples) dotnet run -p ${EXAMPLES_PROJ};;
test) (cd tests/Test.CryptoExchangeClient && dotnet test Test.CryptoExchangeClient.fsproj);;
test:restore) ${PAKET} restore -p ${TEST_PROJ};;
restore) ${PAKET} restore;;
build)
echo "Building..."
dotnet build $arguments
;;
clean:all)
echo "Cleaning..."
# Don't name any folders bin or obj
rm -rf **/bin/ && \
rm -rf **/obj
;;
init)
cd .paket \
rm paket.exe paket.bootstrapper* \
wget https://github.com/fsprojects/Paket/releases/download/5.156.0/paket.bootstrapper.exe \
&& chmod +x paket.bootstrapper.exe \
&& ./paket.bootstrapper.exe \
&& chmod +x paket.exe
;;
release)
local version=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' src/CryptoExchangeClient.fsproj)
echo ""
echo "Releasing v. $version"
echo ""
echo "Packing..."
dotnet pack src/CryptoExchangeClient.fsproj --include-symbols --include-source && \
echo "Pushing..." && \
dotnet nuget push src/bin/Debug/CryptoExchangeClient.$version.nupkg \
-k $NUGET_KEY \
-s https://api.nuget.org/v3/index.json
;;
release:clean)
( ./run clean:all ) && \
( ./run build ) && \
( ./run release )
;;
*)
echo "command not recognized: $@"
esac
}
# Also allow non-sourced running
if [ $1 ]; then
__run $*
fi