forked from electric-capital/open-dev-data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·79 lines (68 loc) · 1.48 KB
/
run.sh
File metadata and controls
executable file
·79 lines (68 loc) · 1.48 KB
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
#!/bin/bash
NEWLINE=$'\n'
print_usage() {
echo "crypto-ecosystems 2.0"
echo "Taxonomy of crypto open source repositories${NEWLINE}"
echo "USAGE:${NEWLINE} $0 <command> [arguments...]${NEWLINE}"
echo "SUBCOMMANDS:"
echo " validate validate the taxonomy using the migrations data"
echo " export <output_file> export the taxonomy to a json file"
echo " test run unit tests"
exit 1
}
if [ $# -eq 0 ]; then
print_usage
fi
# Check for uv
check_uv() {
if ! command -v uv &> /dev/null; then
echo "Error: uv is not installed on this system."
echo ""
echo "To install uv, run:"
echo " curl -LsSf https://astral.sh/uv/install.sh | sh"
echo ""
echo "For more information, visit:"
echo " https://docs.astral.sh/uv/getting-started/installation/"
echo ""
exit 1
fi
}
check_uv
run_cmd() {
if [ -n "$VIRTUAL_ENV" ]; then
"$@"
else
uv run "$@"
fi
}
validate() {
run_cmd open-dev-data validate
}
export_taxonomy() {
run_cmd open-dev-data export "${@}"
}
test() {
run_cmd pytest
}
help() {
run_cmd open-dev-data help
}
# Main script logic
case "$1" in
"validate")
validate "$@"
;;
"export")
shift
export_taxonomy "$@"
;;
"test")
test
;;
"help")
help
;;
*)
echo "Unknown command: $1"
exit 1
esac