aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..c03ee96
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+api_key="${1}"
+skel="${2}"
+plugin="${3}"
+name="${4:=${3#*/}}"
+
+if ! [[ -e ${skel} ]]
+ || [[ -z ${api_key} ]]
+ || [[ -z ${plugin} ]]; then
+ >&2 echo "usage: ${0} <github api key> <skel file> <nvim/package> <plugin name>"
+ exit -1
+fi
+
+echo "generating app-nvim/${name}"
+
+repo_info=$(curl -L \
+ -H "Accept: application/vnd.github+json" \
+ -H "Authorization: Bearer ${api_key}" \
+ https://api.github.com/repos/${plugin} 2>/dev/null)
+
+src=https://github.com/${plugin}
+desc=$(jq -r .description <<< ${repo_info})
+license=$(jq -r .license.spdx_id <<< ${repo_info})
+url=$(jq -r .html_url <<< ${repo_info})
+
+mkdir -p app-nvim/${name}
+sed -e "s#@DESCRIPTION@#${desc}#" \
+ -e "s#@URI@#${url}#" \
+ -e "s#@SRC@#${src}#" \
+ -e "s#@LICENSE@#${license}#" \
+ -e "s#@PLUGIN@#${plugin}#" \
+ ${skel} > app-nvim/${name}/${name}-9999.ebuild