-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpack.sh
More file actions
executable file
·62 lines (51 loc) · 1.59 KB
/
Copy pathpack.sh
File metadata and controls
executable file
·62 lines (51 loc) · 1.59 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
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
OUTPUT_DIR="$SCRIPT_DIR/examples"
mkdir -p "$OUTPUT_DIR"
# language_name|dir|encryption|encrypt_name
SAMPLES=(
"java|ciphergate-java-aes|AES|aes"
"java|ciphergate-java-rsa|RSA|rsa"
"cpp|ciphergate-cpp-aes|AES|aes"
"python|ciphergate-python-aes|AES|aes"
"javascript|ciphergate-javascript-aes|AES|aes"
"typescript|ciphergate-typescript-aes|AES|aes"
"go|ciphergate-go-aes|AES|aes"
"rust|ciphergate-rust-aes|AES|aes"
"kotlin|ciphergate-kotlin-aes|AES|aes"
"scala|ciphergate-scala-aes|AES|aes"
"php|ciphergate-php-aes|AES|aes"
"lua|ciphergate-lua-aes|AES|aes"
)
cd "$SCRIPT_DIR"
for item in "${SAMPLES[@]}"; do
IFS='|' read -r lang dir enc enc_lower <<< "$item"
zip_name="${lang}对接示例${enc}.zip"
echo "Packing: $dir -> $zip_name"
# Create temp directory with clean copy
tmp_dir=$(mktemp -d)
tmp_project="$tmp_dir/$dir"
mkdir -p "$tmp_project"
# Copy source files, excluding build artifacts
rsync -a \
--exclude='build/' \
--exclude='.gradle/' \
--exclude='target/' \
--exclude='node_modules/' \
--exclude='dist/' \
--exclude='__pycache__/' \
--exclude='.gradle' \
--exclude='gradle/wrapper/gradle-wrapper.jar' \
"$dir/" "$tmp_project/"
# Create zip
cd "$tmp_dir"
zip -r "$OUTPUT_DIR/$zip_name" "$dir" -x "*.DS_Store"
cd "$SCRIPT_DIR"
# Cleanup
rm -rf "$tmp_dir"
echo " -> $OUTPUT_DIR/$zip_name"
done
echo ""
echo "Done! Files in $OUTPUT_DIR:"
ls -lh "$OUTPUT_DIR"