-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevshell.toml
145 lines (133 loc) · 2.12 KB
/
devshell.toml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# https://numtide.github.io/devshell
[devshell]
name = "Advent of Code 2022"
packages = [
# Docker and K8s packages.
"go_1_19",
"beam.packages.erlangR25.elixir_1_14",
"cargo",
]
[[commands]]
name = "run"
help = "runs a given language and day"
category = "run"
command = """
if [ $# -eq 2 ]
then
case $1 in
"go")
echo "Running go day $2"
cd $2/in_go
go run main.go
;;
"rust")
echo "Running rust day $2"
cd $2/in_rust
cargo run
;;
"elixir")
echo "Running elixir day $2"
cd $2/in_elixir
elixir -r lib/in_elixir.ex -e InElixir.run
;;
*)
echo "Idk what you were expecting..."
;;
esac
cd $PRJ_ROOT
else
echo "Please run with a language and day..."
echo "Example:"
echo "$ run go 01"
fi
"""
[[commands]]
name = "tests"
help = "test everything, or specify a day and language"
category = "testing"
command = """
test.go
test.rust
test.elixir
"""
[[commands]]
name = "test.day"
help = "tests a given day or defaults to today"
category = "testing"
command = """
if [ $# -eq 0 ]
then
today=$(date '+%d')
echo "Testing for day: $today"
test.go $today
test.rust $today
test.elixir $today
else
test.go $@
test.rust $@
test.elixir $@
fi
"""
[[commands]]
name = "test.go"
help = "test all go files"
category = "testing"
command = """
echo ""
echo "🐹 Running Golang Tests"
echo ""
if [ $# -eq 0 ]
then
for day in {01..25}; do
cd $day/in_go
go test
cd $PRJ_ROOT
done
else
cd $@/in_go
go test
cd $PRJ_ROOT
fi
"""
[[commands]]
name = "test.rust"
help = "test all rust files"
category = "testing"
command = """
echo ""
echo "🦀 Running Rust Tests"
echo ""
if [ $# -eq 0 ]
then
for day in {01..25}; do
cd $day/in_rust
cargo test
cd $PRJ_ROOT
done
else
cd $@/in_rust
cargo test
cd $PRJ_ROOT
fi
"""
[[commands]]
name = "test.elixir"
help = "test all elixir files"
category = "testing"
command = """
echo ""
echo "⚗ Running Elixir Tests"
echo ""
if [ $# -eq 0 ]
then
for day in {01..25}; do
cd $day/in_elixir
mix test
cd $PRJ_ROOT
done
else
cd $@/in_elixir
mix test
cd $PRJ_ROOT
fi
"""