mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 07:35:05 -04:00
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`.
This commit is contained in:
parent
5915c2243d
commit
1fe01c66fd
2 changed files with 53 additions and 4 deletions
|
@ -1,4 +1,39 @@
|
||||||
cd node_modules/
|
#!/bin/sh
|
||||||
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
|
set -e
|
||||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=100&page=3&" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
|
||||||
|
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
|
||||||
|
|
14
src/bin/plugins/listOfficialPlugins
Executable file
14
src/bin/plugins/listOfficialPlugins
Executable file
|
@ -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…
Add table
Add a link
Reference in a new issue