getCorePlugins.sh: Various improvements
* Factor out plugin query. * Make idempotent. * Improve logging. * Install by symlinking to a parallel directory rather than cloning into `etherpad-lite/node_modules`.pull/5323/head
parent
5915c2243d
commit
1fe01c66fd
|
@ -1,4 +1,39 @@
|
|||
cd node_modules/
|
||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=100" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=100&page=2&" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=100&page=3&" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
newline='
|
||||
'
|
||||
|
||||
pecho () { printf %s\\n "$*"; }
|
||||
log () { pecho "$@"; }
|
||||
error () { log "ERROR: $@" >&2; }
|
||||
fatal () { error "$@"; exit 1; }
|
||||
|
||||
mydir=$(cd "${0%/*}" && pwd -P) || exit 1
|
||||
cd "${mydir}/../../.."
|
||||
pdir=$(cd .. && pwd -P) || exit 1
|
||||
|
||||
plugins=$("${mydir}/listOfficialPlugins") || exit 1
|
||||
for d in ${plugins}; do
|
||||
log "============================================================"
|
||||
log "${d}"
|
||||
log "============================================================"
|
||||
fd=${pdir}/${d}
|
||||
repo=git@github.com:ether/${plugin}.git
|
||||
[ -d "${fd}" ] || {
|
||||
log "Cloning ${repo} to ${fd}..."
|
||||
(cd "${pdir}" && git clone "${repo}" "${d}") || exit 1
|
||||
} || exit 1
|
||||
log "Fetching latest commits..."
|
||||
(cd "${fd}" && git pull --ff-only) || exit 1
|
||||
log "Getting plugin name..."
|
||||
pn=$(cd "${fd}" && npx -c 'printf %s\\n "${npm_package_name}"') || exit 1
|
||||
[ -n "${pn}" ] || fatal "Unable to determine plugin name for ${d}"
|
||||
md=node_modules/${pn}
|
||||
[ -d "${md}" ] || {
|
||||
log "Installing plugin to ${md}..."
|
||||
ln -s ../../"${d}" "${md}"
|
||||
} || exit 1
|
||||
[ "${md}" -ef "${fd}" ] || fatal "${md} is not a symlink to ${fd}"
|
||||
done
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
newline='
|
||||
'
|
||||
mydir=$(cd "${0%/*}" && pwd -P) || exit 1
|
||||
cd "${mydir}/../../.."
|
||||
pdir=$(cd .. && pwd -P) || exit 1
|
||||
plugins=
|
||||
for p in "" "&page=2" "&page=3"; do
|
||||
curlOut=$(curl "https://api.github.com/users/ether/repos?per_page=100${p}") || exit 1
|
||||
plugins=${plugins}${newline}$(printf %s\\n "${curlOut}" \
|
||||
| sed -n -e 's;.*git@github.com:ether/\(ep_[^"]*\)\.git.*;\1;p');
|
||||
done
|
||||
printf %s\\n "${plugins}" | sort -u | grep -v '^[[:space:]]*$'
|
Loading…
Reference in New Issue