diff --git a/src/bin/plugins/getCorePlugins.sh b/src/bin/plugins/getCorePlugins.sh index e8ce68b21..85552ab14 100755 --- a/src/bin/plugins/getCorePlugins.sh +++ b/src/bin/plugins/getCorePlugins.sh @@ -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 diff --git a/src/bin/plugins/listOfficialPlugins b/src/bin/plugins/listOfficialPlugins new file mode 100755 index 000000000..322ad5d3b --- /dev/null +++ b/src/bin/plugins/listOfficialPlugins @@ -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:]]*$'