[git] gnupg-doc - branch, preview, updated. 570b0a54c703d38d87a01d62dfe6fa60a58f152a

by Werner Koch cvs at cvs.gnupg.org
Fri May 12 10:43:21 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GnuPG website and other docs".

The branch, preview has been updated
       via  570b0a54c703d38d87a01d62dfe6fa60a58f152a (commit)
      from  8e0ec9ac6d92959807d0d26efc290ce52bc044a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 570b0a54c703d38d87a01d62dfe6fa60a58f152a
Author: Werner Koch <wk at gnupg.org>
Date:   Fri May 12 10:40:10 2017 +0200

    tools: Update donation tools for recurring donations

diff --git a/tools/append-to-donors.sh b/tools/append-to-donors.sh
index bb17894..1c5667d 100755
--- a/tools/append-to-donors.sh
+++ b/tools/append-to-donors.sh
@@ -23,12 +23,65 @@ LC_CTYPE=C
 RFCDATE="$(date -R)"
 SIGDELIM="-- "
 
-htdocs="/var/www/www/www.gnupg.org/htdocs"
+usage()
+{
+    cat <<EOF
+Usage: $pgm [OPTIONS]
+Options:
+        --verbose  Run in verbose mode
+	--force    Force re-creation of files.
+        --test     Run in test environment (preview.gnupg.org)
+EOF
+    exit $1
+}
+
+
+verbose=no
+force=no
+testmode=no
+while [ $# -gt 0 ]; do
+    case "$1" in
+	# Set up `optarg'.
+	--*=*)
+	    optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
+	    ;;
+	*)
+	    optarg=""
+	    ;;
+    esac
+
+    case $1 in
+        --verbose)
+            verbose=yes
+            ;;
+	--force)
+	    force=yes
+	    ;;
+        --test)
+            testmode=yes
+            ;;
+        --help)
+            usage 0
+            ;;
+	*)
+	    usage 1 1>&2
+	    ;;
+    esac
+    shift
+done
+
+
+if [ $testmode = yes ]; then
+  htdocs="/var/www/www/preview.gnupg.org/htdocs"
+  journal_dir="/var/log/payproc-test"
+else
+  htdocs="/var/www/www/www.gnupg.org/htdocs"
+  journal_dir="/var/log/payproc"
+fi
 
 donors="$htdocs/donate/donors.dat"
 donations="$htdocs/donate/donations.dat"
 
-journal_dir="/var/log/payproc"
 LOCKFILE="$donors.lock"
 
 if [ ! -f "$donors" ]; then
@@ -151,7 +204,7 @@ lastline=$(echo $tmp | cut -d: -f2)
 
 [ -f "$donors".stamp ] && rm "$donors".stamp
 cat "$donors" > "$donors.tmp"
-find $journal_dir -type f -name 'journal-????????.log' -print \
+find $journal_dir/ -type f -name 'journal-????????.log' -print \
      | sort | while read fname; do
     fname=$(basename "$fname")
     jdate=${fname%.log}
@@ -177,7 +230,7 @@ find $journal_dir -type f -name 'journal-????????.log' -print \
 done
 
 # If we have any new records update the files.
-if [ -f "$donors".stamp ]; then
+if [ -f "$donors".stamp -o $force = yes ]; then
 
   if ! mv "$donors.tmp" "$donors"; then
     echo "$pgm: error updating $donors" >&2
@@ -186,13 +239,13 @@ if [ -f "$donors".stamp ]; then
 
   if [ -f "$donations" ]; then
     payproc-stat -u "$donations" -- > "$donations".tmp  \
-      $(find /var/log/payproc -type f -name 'journal-????????.log' -print|sort)
+      $(find $journal_dir/ -type f -name 'journal-????????.log' -print|sort)
     if ! mv "$donations".tmp "$donations"; then
         echo "$pgm: error updating $donations" >&2
         exit 1
     fi
   else
     payproc-stat -u "$donations" -- > "$donations"  \
-      $(find /var/log/payproc -type f -name 'journal-????????.log' -print|sort)
+      $(find $journal_dir/ -type f -name 'journal-????????.log' -print|sort)
   fi
 fi
diff --git a/tools/mkkudos.sh b/tools/mkkudos.sh
index e2b7e92..9858816 100755
--- a/tools/mkkudos.sh
+++ b/tools/mkkudos.sh
@@ -21,6 +21,34 @@
 #  <p class="doclear" style="clear: both"></p>
 #  #+END_HTML
 #
+# For the 2017 campaign new variables which work slightly different
+# are introduced:
+#
+#  #+BEGIN_HTML
+#  <div class="progress-bar progress-bar-striped active"
+#       role="progressbar"
+#       aria-valuenow="0" A-CMPGN-RECUR-EURO=""
+#       aria-valuemin="0"
+#       aria-valuemax="0" A-CMPGN-RECUR-EURO-GOAL=""
+#       style="width: 0%" A-CMPGN-RECUR-PERCENT=""
+#       >
+#    <span class="sr-only"><!--CMPGN-RECUR-EURO-->
+#                            a month</span>
+#  </div>
+#  <div class="col-xs-12 col-sm-6 col-lg-12 camp-progress-info">
+#    <h3><!--CMPGN-RECUR-EURO-->
+#        a month <small>of
+#        <!--CMPGN-RECUR-EURO-GOAL-->
+#        needed</small>
+#    </h3>
+#    <h4>+ <!--CMPGN-ONCE-EURO-->
+#        <small>in one-time donations</small>
+#    </h4>
+#    <h4><!--CMPGN-RECUR-COUNT-->
+#        <small>Supporters</small>
+#    </h4>
+#  #+END_HTML
+#
 # To use it the code at "Campaign data" below needs to be adjusted as
 # well.
 # ===================================================================
@@ -36,9 +64,9 @@ usage()
     cat <<EOF
 Usage: $0 [OPTIONS]
 Options:
-	--force    Force re-creation of files.
         --verbose  Run in verbose mode
-        --test     Run in test environment
+        --force    Force re-creation of files.
+        --test     Run in test environment (preview.gnupg.org)
 EOF
     exit $1
 }
@@ -78,17 +106,15 @@ while [ $# -gt 0 ]; do
     shift
 done
 
-htdocs="/var/www/www/www.gnupg.org/htdocs"
-donors="$htdocs/donate/donors.dat"
-donations="$htdocs/donate/donations.dat"
-blogheadlinefile="/var/www/www/blog.gnupg.org/htdocs/headlines.txt"
 
 if [ $testmode = yes ]; then
-  htdocs="/home/wk/s/gnupg-doc/stage"
-  donors="$htdocs/../scratch/donors.dat"
-  donations="$htdocs/../scratch/donations.dat"
-  blogheadlinefile="$htdocs/../misc/blog.gnupg.org/headlines.txt"
+  htdocs="/var/www/www/preview.gnupg.org/htdocs"
+else
+  htdocs="/var/www/www/www.gnupg.org/htdocs"
 fi
+donors="$htdocs/donate/donors.dat"
+donations="$htdocs/donate/donations.dat"
+blogheadlinefile="/var/www/www/blog.gnupg.org/htdocs/headlines.txt"
 
 
 if [ ! -f "$donors" ]; then
@@ -116,9 +142,10 @@ monyear=$(echo "$tmp" | awk -F: 'BEGIN { m[1] = "January";
       m[10] = "October"; m[11] = "November"; m[12] = "December"; }
       {printf "%s %d", m[int($2)] , $1}')
 thisyear=$(echo "$tmp" | awk -F: '{print $1}')
-euroyr=$(echo "$tmp" | awk -F: '{printf "%d €", int($10 + 0.5)}')
 nyr=$(echo "$tmp" | awk -F: '{printf "%d", $9}')
-
+euroyr=$(echo "$tmp" | awk -F: '{printf "%d", int($10 + 0.5)}')
+recur_nyr=$(echo "$tmp" | awk -F: '{printf "%d", $13}')
+recur_euroyr=$(echo "$tmp" | awk -F: '{printf "%d", int($14 + 0.5)}')
 
 dontable=$(awk -F: <"$donations" -v thisyear="$thisyear" '
   BEGIN { m[1] = "January";
@@ -164,9 +191,14 @@ dontable=$(awk -F: <"$donations" -v thisyear="$thisyear" '
 
 # Campaign data
 goal="120000"
+recur_goal="15000"
 percent=$(echo "$euroyr:$goal" | awk -F: '{ p = (int($1)*100)/int($2);
                                           if(p > 100) { p = 100 };
                                           printf "%d", p}')
+recur_percent=$(echo "$recur_euroyr:$recur_goal" \
+                               | awk -F: '{ p = (int($1)*100)/int($2);
+                                          if(p > 100) { p = 100 };
+                                          printf "%d", p}')
 
 for file in "$htdocs/donate/"kudos-????.html "$htdocs/donate/"kudos.html \
             "$htdocs/donate/"index.html \
@@ -187,6 +219,8 @@ for file in "$htdocs/donate/"kudos-????.html "$htdocs/donate/"kudos.html \
            -v monyear="$monyear" -v thisyear="$thisyear" \
            -v euro="$euro" -v euroyr="$euroyr" \
            -v nyr="$nyr" -v goal="$goal" -v percent="$percent" \
+           -v recur_nyr="$recur_nyr" -v recur_euroyr="$recur_euroyr" \
+           -v recur_goal="$recur_goal" -v recur_percent="$recur_percent" \
            -v blogheadline="$blogheadline" \
             <"$file"  >"$file.tmp" '
      /<!--BEGIN-DONATIONS-->/ {indon=1; print; insert("") }
@@ -206,7 +240,7 @@ for file in "$htdocs/donate/"kudos-????.html "$htdocs/donate/"kudos.html \
            next
      }
      /<!--INSERT-YEAR-EURO-->/ {
-           printf "<!--INSERT-YEAR-EURO--> %s\n", euroyr;
+           printf "<!--INSERT-YEAR-EURO--> %s €\n", euroyr;
            next
      }
      /<!--INSERT-YEAR-N-->/ {
@@ -231,6 +265,48 @@ for file in "$htdocs/donate/"kudos-????.html "$htdocs/donate/"kudos.html \
            printf "<!--INSERT-BLOG-HEADLINE--> %s\n", blogheadline;
            next
      }
+     /A-CMPGN-RECUR-EURO=""/ {
+           n = index($0,"\"");
+           printf "%s%s\" A-CMPGN-RECUR-EURO=\"\"\n",
+                  substr($0,1,n), recur_euroyr;
+           next
+     }
+     /A-CMPGN-RECUR-EURO-GOAL=""/ {
+           n = index($0,"\"");
+           printf "%s%s\" A-CMPGN-RECUR-EURO-GOAL=\"\"\n",
+                  substr($0,1,n), recur_goal;
+           next
+     }
+     /A-CMPGN-RECUR-PERCENT=""/ {
+           n = index($0,":");
+           printf "%s %s%\" A-CMPGN-RECUR-PERCENT=\"\"\n",
+                  substr($0,1,n), recur_percent;
+           next
+     }
+     /<!--CMPGN-RECUR-EURO-->/ {
+           n = index($0,"<!--CMPGN");
+           printf "%s!--CMPGN-RECUR-EURO-->%s €\n",
+                  substr($0,1,n), recur_euroyr;
+           next
+     }
+     /<!--CMPGN-RECUR-EURO-GOAL-->/ {
+           n = index($0,"<!--CMPGN");
+           printf "%s!--CMPGN-RECUR-EURO-GOAL-->%s €\n",
+                  substr($0,1,n), recur_goal;
+           next
+     }
+     /<!--CMPGN-ONCE-EURO-->/ {
+           n = index($0,"<!--CMPGN");
+           printf "%s!--CMPGN-ONCE-EURO-->%s €\n",
+                  substr($0,1,n), euroyr;
+           next
+     }
+     /<!--CMPGN-RECUR-COUNT-->/ {
+           n = index($0,"<!--CMPGN");
+           printf "%s!--CMPGN-RECUR-COUNT-->%s\n",
+                  substr($0,1,n), recur_nyr;
+           next
+     }
      !indon { print }
 
      function insert (tag) {

-----------------------------------------------------------------------

Summary of changes:
 tools/append-to-donors.sh |  65 ++++++++++++++++++++++++++---
 tools/mkkudos.sh          | 102 ++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 148 insertions(+), 19 deletions(-)


hooks/post-receive
-- 
The GnuPG website and other docs
http://git.gnupg.org




More information about the Gnupg-commits mailing list