-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDist.SH
executable file
·53 lines (37 loc) · 1.49 KB
/
Dist.SH
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
#!/usr/bin/env bash
set -e
PERL=${PERL:-perl}
PROVE=${PROVE:-prove}
test -x Build && ./Build distclean
${PERL} Build.PL
rm -f MANIFEST
${PERL} -ni -e 'print unless /^##? NAME/ .. eof' README.md
dist_version_from=$(${PERL} -ne 'print if /dist_version_from/' Build.PL | ${PERL} -pe "s%.*=> '%%; s%',%%")
${PERL} -MPod::Markdown -e '$p=Pod::Markdown->new;$p->parse_from_filehandle(\*STDIN);print $p->as_markdown' \
<"${dist_version_from:-lib/$(${PERL} -ne 'next unless /^name: /; s/^name: //; s,-,/,g; s/$/.pm/; print' META.yml)}" |
${PERL} -pe 'sub a { $_[0]=~tr/ /-/; $_[0] } s,[(]http://search.cpan.org/perldoc[?]([^#)]*)(#[^)]*)?[)],a("(http://metacpan.org/module/$1$2)"),eg' |
${PERL} -pe 's/^# /## /; s/^\s+```/```/' \
>>README.md
${PERL} Build manifest
${PERL} Build distdir
diff -u -I^SIGNATURE MANIFEST ./*-[0-9]*.[0-9]*/MANIFEST
cd ./*-[0-9]*.[0-9]*
${PERL} Build.PL
${PERL} Build
${PROVE} -Iblib/lib t
if [[ -z ${TEST_SKIP_DEVELOP} ]] || [[ ${TEST_SKIP_DEVELOP} == 0 ]]; then
${PROVE} -Iblib/lib xt
elif [[ -n ${TEST_SKIP_DEVELOP} ]] && [[ ${TEST_SKIP_DEVELOP} != 1 ]]; then
# shellcheck disable=SC2046
${PROVE} -Iblib/lib $(find xt -name '*.t' ! -name "${TEST_SKIP_DEVELOP}")
fi
if [[ $1 == sign ]]; then
${PERL} Build distsign
diff -u -I^SIGNATURE MANIFEST ./*-[0-9]*.[0-9]*/MANIFEST
else
${PERL} Build distdir
fi
chmod -R u+w,go-w ./*-[0-9]*.[0-9]*
export COPYFILE_DISABLE=true
tar zcf "$(basename "$(pwd)").tar.gz" ./*-[0-9]*.[0-9]*
mv ./*.tar.gz ..