Bläddra i källkod

Use boolean to decide whether LICENSE.md should be deployed

Being consistent leads to much more readable code.
Alois Mahdal 7 år sedan
förälder
incheckning
ef15f739f4
1 ändrade filer med 6 tillägg och 4 borttagningar
  1. 6
    4
      src/newstub

+ 6
- 4
src/newstub Visa fil

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