Thread Ein Skript zum CPAN-Modul-Erstellen
(4 answers)
Opened by hlubenow at 2017-04-15 02:18
Hallo,
jedesmal, wenn ich nach Monaten oder Jahren mein CPAN-Modul (bisher eins) updaten will, muß ich mir nochmal klarmachen, wie man aus seiner .pm-Datei (und dem README und den Beispieldateien) ein CPAN-taugliches .tar.gz macht. Dieses Mal konnte ich mein Shell-Skript dazu endlich soweit anpassen, daß der Prozess weitgehend automatisch ging. Ich poste es mal. Mein Modulname ist dreiteilig, daher dort "Your::Module::Name". Die "rm"-Kommandos für das Saubermachen (Option "clean" und auch sonst) hab' ich erstmal entschärft. Man muß sich das Skript (es verwendet "module-starter") also schon noch angucken und es anpassen. Dennoch HTH: Code (sh): (dl
)
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 #!/bin/bash # makemodule.sh, GNU GPL 3. # We need # Name.pm (The Perl-Module, full name is "Your::Module::Name") # README # examples (dir) # in this directory. After the process, there should # be a .tar.gz in this directory. # Use "makemodule.sh clean" to clean up. VERSION="1.00" # Version of Module modulename="Your::Module::Name" authorname="Max Mustermann" authoremail="Max Mustermann@...de" checkForFile () { if [ ! -e "$1" ]; then echo echo "File or directory '$1' not found in this directory. Aborting." echo exit fi } basedir=$(pwd) tarname="Your-Module-Name-$VERSION.tar.gz" versiondirname="Your-Module-Name-$VERSION" exampledir="$basedir/Your-Module-Name" libdir="$exampledir/lib/Your/Module" versiondir="$basedir/$versiondirname" tarfile="$basedir/$tarname" cleanUp () { if [ -d "$exampledir" ]; then # rm -r "$exampledir" fi if [ -d "$versiondir" ]; then # rm -r "$versiondir" fi if [ -e "$tarfile" ]; then # rm "$tarfile" fi } if [ "$1" = "clean" ]; then cleanUp exit fi checkForFile "Name.pm" checkForFile "README" checkForFile "examples" cleanUp module-starter --module="$modulename" --author="$authorname" --email="$authoremail" cp -v Name.pm "$libdir" cp -rv examples "$exampledir" cp -v README "$exampledir" mv "$exampledir" "$versiondir" tar -czvf "$tarname" "$versiondirname" View full thread Ein Skript zum CPAN-Modul-Erstellen |