-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy path.license_headers.sh
More file actions
executable file
·32 lines (30 loc) · 1.07 KB
/
.license_headers.sh
File metadata and controls
executable file
·32 lines (30 loc) · 1.07 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
find . -type f -name "*.rs" \( -path "*/build.rs" -o -path "*/src/*" -o -path "*/tests/*" \) | while IFS= read -r file; do
if ! grep -q "SPDX-License-Identifier" "$file"; then
tmpfile=$(mktemp)
sed 's/^/\/\/ /' .midnight.txt >> "$tmpfile"
echo "" >> $tmpfile
cat $file >> $tmpfile
mv $tmpfile $file
fi
done
find . -type f \( -name "*.js" -o -name "*.ts" \) \( -path "*/src/*" -o -path "*/tests/*" \) | while IFS= read -r file; do
if ! grep -q "SPDX-License-Identifier" "$file"; then
tmpfile=$(mktemp)
sed 's/^/\/\/ /' .midnight.txt >> "$tmpfile"
echo "" >> $tmpfile
cat $file >> $tmpfile
mv $tmpfile $file
fi
done
find . -type f -name "*.sh" | while IFS= read -r file; do
if ! grep -q "SPDX-License-Identifier" "$file"; then
tmpfile=$(mktemp)
echo "#!/usr/bin/env bash" >> $tmpfile
echo "" >> $tmpfile
sed 's/^/# /' .midnight.txt >> "$tmpfile"
echo "" >> $tmpfile
cat $file >> $tmpfile
mv $tmpfile $file
chmod +x $file
fi
done