Browse Source

Use boolean to decide whether LICENSE.md should be deployed

Being consistent leads to much more readable code.
Alois Mahdal 7 years ago
parent
commit
ef15f739f4
1 changed files with 6 additions and 4 deletions
  1. 6
    4
      src/newstub

+ 6
- 4
src/newstub View File

102
             echo ""
102
             echo ""
103
             echo "[files]"
103
             echo "[files]"
104
             echo "    bin      = src/$PackageName"
104
             echo "    bin      = src/$PackageName"
105
-            test -n "$License" && echo "    doc      = LICENSE.md"
105
+            $MkLicense && echo "    doc      = LICENSE.md"
106
             $MkReadme          && echo "    doc      = README.md"
106
             $MkReadme          && echo "    doc      = README.md"
107
             echo ""
107
             echo ""
108
             echo "#mkit version=$MKIT_VERSION"
108
             echo "#mkit version=$MKIT_VERSION"
114
             echo 'Release:	1%{?dist}'
114
             echo 'Release:	1%{?dist}'
115
             echo 'Summary:	__MKIT_PROJ_NAME__ - __MKIT_PROJ_TAGLINE__'
115
             echo 'Summary:	__MKIT_PROJ_NAME__ - __MKIT_PROJ_TAGLINE__'
116
             echo ''
116
             echo ''
117
-            echo "License:	$License"
117
+            $MkLicense && echo "License:	$License"
118
             echo 'Source0:	%{name}-%{version}.tar.gz'
118
             echo 'Source0:	%{name}-%{version}.tar.gz'
119
             echo ''
119
             echo ''
120
             echo 'BuildArch:	noarch'
120
             echo 'BuildArch:	noarch'
481
         $MkPackaging        && echo " *  'packaging' directory (pass -P to avoid)"
481
         $MkPackaging        && echo " *  'packaging' directory (pass -P to avoid)"
482
         $MkMakefile         && echo " *  'Makefile' (pass -M to avoid)"
482
         $MkMakefile         && echo " *  'Makefile' (pass -M to avoid)"
483
         $MkReadme           && echo " *  'README.md' (pass -R to avoid)"
483
         $MkReadme           && echo " *  'README.md' (pass -R to avoid)"
484
-        test -n "$License"  && echo " *  'LICENSE.md' (omit -l to avoid)"
484
+        $MkLicense      && echo " *  'LICENSE.md' (omit -l to avoid)"
485
         echo " *  'mkit.ini'"
485
         echo " *  'mkit.ini'"
486
         echo ""
486
         echo ""
487
         read -p "Type 'yes' to proceed: " -r response
487
         read -p "Type 'yes' to proceed: " -r response
541
     local MkReadme=true     # create README.md?
541
     local MkReadme=true     # create README.md?
542
     local MkMakefile=true   # create Makefile?
542
     local MkMakefile=true   # create Makefile?
543
     local MkPackaging=true  # create packaging templates?
543
     local MkPackaging=true  # create packaging templates?
544
+    local MkLicense=false   # create LICENSE.md file
544
     while true; do case $1 in
545
     while true; do case $1 in
545
         -n) NiceName=$2;        shift 2 || usage ;;
546
         -n) NiceName=$2;        shift 2 || usage ;;
546
         -b) RelSrc=$2;          shift 2 || usage ;;
547
         -b) RelSrc=$2;          shift 2 || usage ;;
565
     if test -n "$License"; then
566
     if test -n "$License"; then
566
         known_licenses | grep -qxF "$License" \
567
         known_licenses | grep -qxF "$License" \
567
          || die "unknown license (use -L to get list): $License"
568
          || die "unknown license (use -L to get list): $License"
569
+        MkLicense=true
568
     fi
570
     fi
569
     if $MkCommits; then
571
     if $MkCommits; then
570
         mkcommit_backup || die "failed creating backup commit"
572
         mkcommit_backup || die "failed creating backup commit"
575
     deploy src/"$PackageName".skel
577
     deploy src/"$PackageName".skel
576
     $MkMakefile        && deploy Makefile
578
     $MkMakefile        && deploy Makefile
577
     $MkReadme          && deploy README.md
579
     $MkReadme          && deploy README.md
578
-    test -n "$License" && deploy LICENSE.md
580
+    $MkLicense      && deploy LICENSE.md
579
     $AutoClean         && deploy .mkit/autoclean
581
     $AutoClean         && deploy .mkit/autoclean
580
     $MkPackaging       && deploy_packaging
582
     $MkPackaging       && deploy_packaging
581
     if $MkCommits; then
583
     if $MkCommits; then