-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathjcpan
More file actions
executable file
·45 lines (42 loc) · 1.18 KB
/
jcpan
File metadata and controls
executable file
·45 lines (42 loc) · 1.18 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
#!/bin/bash
#
# jcpan - CPAN Client for PerlOnJava (Unix wrapper)
# Runs the standard cpan script with jperl
#
# Supports -j N for parallel test execution:
# jcpan -j 4 -t Module::Name
#
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Parse -j option for parallel test jobs (consumed here, not passed to cpan)
ARGS=()
while [[ $# -gt 0 ]]; do
case "$1" in
-j)
if [[ -n "$2" && "$2" =~ ^[0-9]+$ ]]; then
export HARNESS_OPTIONS="j${2}"
shift 2
else
echo "Error: -j requires a numeric argument" >&2
exit 1
fi
;;
-j[0-9]*)
export HARNESS_OPTIONS="j${1#-j}"
shift
;;
*)
ARGS+=("$1")
shift
;;
esac
done
# Find cpan script - check development path first, then installed path
if [ -f "$SCRIPT_DIR/src/main/perl/bin/cpan" ]; then
CPAN_SCRIPT="$SCRIPT_DIR/src/main/perl/bin/cpan"
elif [ -f "$SCRIPT_DIR/bin/cpan" ]; then
CPAN_SCRIPT="$SCRIPT_DIR/bin/cpan"
else
echo "Error: cpan script not found" >&2
exit 1
fi
exec "$SCRIPT_DIR/jperl" "$CPAN_SCRIPT" "${ARGS[@]}"