File: upload-pack

package info (click to toggle)
swi-prolog 9.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 82,408 kB
  • sloc: ansic: 387,503; perl: 359,326; cpp: 6,613; lisp: 6,247; java: 5,540; sh: 3,147; javascript: 2,668; python: 1,900; ruby: 1,594; yacc: 845; makefile: 428; xml: 317; sed: 12; sql: 6
file content (63 lines) | stat: -rwxr-xr-x 1,712 bytes parent folder | download | duplicates (4)
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
#!/bin/bash
#
# This script publishes a SWI-Prolog pack  if   the  pack is hosted as a
# GitHub repository. Simply run this script  from the pack top directory
# after  committing  all  relevant  changes.  The  script  performs  the
# following actions:
#
#   - Establish the pack from pack.pl
#   - Establish the pack name from the name of the current directory
#   - Get the github account from $GITHUBUSER or the edited script
#   - Tag the repo using a version tag (V<version>).  The tag is
#     signed, meaning you need to set up GPG for signing git objects.
#   - Push the latest version and the tag
#   - Install the pack using SWI-Prolog as `swipl`, making it publically
#     visible.

GITHUBUSER=${GITHUBUSER:unknown}

if [ "$GITHUBUSER" = unknown ]; then
  echo 'Please set $GITHUBUSER or edit this script to set the github account'
  exit 1
fi

version=`grep ^version pack.pl | sed "s/version('\(.*\)')./\1/"`
pack=$(basename $(pwd))

confirm ()
{ if [ "$yes" = yes ]; then
    return 0
  fi

  while true; do
    printf "$1"
    read answer
    case "$answer" in
          y*)   return 0
                ;;
          n*)   return 1
                ;;
          *)
                echo "Please answer yes or no"
                ;;
    esac
  done
}

if ! confirm "Package and upload $pack, version $version? (y/n) "; then
  exit 1
fi

if confirm "Tag repository with V$version? (y/n) "; then
  git tag -s V$version -m "Pack release tag for $version"
  git push --tags
fi

githuburl="https://github.com/$GITHUBUSER/$pack/archive/V$version.zip"

if confirm "Install from $githuburl? "; then
swipl << _EOF_
catch(pack_remove($pack), _, true).
pack_install('$githuburl', [interactive(false)]).
_EOF_
fi