#!/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"