--- /dev/null
+# title: Gitea
+# homepage: https://github.com/go-gitea/gitea
+# tagline: a modern drop-in grep replacement
+# description: |
+# `gitea` is a clean, lightweight self-hosted Github alternative, forked from Gogs. Lighter and more user-friendly than Gitlab.
+# examples: |
+#
+# ```bash
+# gitea --version
+# ```
+
+set -e
+set -u
+
+###################
+# Install gitea #
+###################
+
+new_gitea="${HOME}/.local/bin/gitea"
+
+# Test for existing version
+set +e
+cur_gitea="$(command -v gitea)"
+set -e
+if [ -n "$cur_gitea" ]; then
+ cur_ver=$(gitea --version | head -n 1 | cut -d ' ' -f 3)
+ if [ "$cur_ver" == "$WEBI_VERSION" ]; then
+ echo "gitea v$WEBI_VERSION already installed at $cur_gitea"
+ exit 0
+ elif [ "$cur_gitea" != "$new_gitea" ]; then
+ echo "WARN: possible conflict with gitea v$WEBI_VERSION at $cur_gitea"
+ fi
+fi
+
+# Note: this file is `source`d by the true installer and hence will have the webi functions
+
+# because we created releases.js we can use webi_download()
+# downloads gitea to ~/Downloads
+webi_download
+
+# because this is tar or zip, we can webi_extract()
+# extracts to the WEBI_TMP directory, raw (no --strip-prefix)
+webi_extract
+
+pushd "$WEBI_TMP" 2>&1 >/dev/null
+ echo Installing gitea v${WEBI_VERSION} as "$new_gitea"
+ mv ./gitea-* "$HOME/.local/bin/gitea"
+ chmod a+x "$HOME/.local/bin/gitea"
+popd 2>&1 >/dev/null
+
+###################
+# Update PATH #
+###################
+
+# TODO get better output from pathman / output the path to add as return to webi bootstrap
+webi_path_add "$HOME/.local/bin"
+
+echo "Installed 'gitea'"
+echo ""
--- /dev/null
+'use strict';
+
+var github = require('../_common/github.js');
+var owner = 'go-gitea';
+var repo = 'gitea';
+
+module.exports = function (request) {
+ return github(request, owner, repo).then(function (all) {
+ // remove checksums and .deb
+ all.releases = all.releases.filter(function (rel) {
+ return !/(\.asc)|(\.sha256)|(\.\d-[^\.]*)$/i.test(rel.name);
+ });
+ return all;
+ });
+};
+
+if (module === require.main) {
+ module.exports(require('@root/request')).then(function (all) {
+ all = require('../_common/normalize.js')(all);
+ console.info(JSON.stringify(all));
+ //console.info(JSON.stringify(all, null, 2));
+ });
+}
my_ext=""
set +e
-if [ -n "\$(command -v git)" ]; then
- my_ext="git,\$my_ext"
-fi
-if [ -n "\$(command -v tar)" ]; then
- my_ext="tar,\$my_ext"
-fi
-if [ -n "\$(command -v unzip)" ]; then
- my_ext="zip,\$my_ext"
-fi
+# NOTE: the order here is least favorable to most favorable
if [ -n "\$(command -v pkgutil)" ]; then
my_ext="pkg,\$my_ext"
fi
# note: could also detect via hdiutil
my_ext="dmg,\$my_ext"
#fi
+if [ -n "\$(command -v git)" ]; then
+ my_ext="git,\$my_ext"
+fi
+if [ -n "\$(command -v unzip)" ]; then
+ my_ext="xz,\$my_ext"
+fi
+if [ -n "\$(command -v unzip)" ]; then
+ my_ext="zip,\$my_ext"
+fi
+if [ -n "\$(command -v tar)" ]; then
+ my_ext="tar,\$my_ext"
+fi
my_ext="\$(echo "\$my_ext" | sed 's/,$//')" # nix trailing comma
set -e
elif [ "zip" == "$WEBI_EXT" ]; then
echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE"
unzip "$HOME/Downloads/$WEBI_PKG_FILE"
+ elif [ "exe" == "$WEBI_EXT" ]; then
+ # do nothing (but don't leave an empty if block either)
+ echo -n ""
+ elif [ "xz" == "$WEBI_EXT" ]; then
+ echo "Inflating $HOME/Downloads/$WEBI_PKG_FILE"
+ unxz -c "$HOME/Downloads/$WEBI_PKG_FILE" > $(basename "$WEBI_PKG_FILE")
else
# do nothing
echo "Failed to extract $HOME/Downloads/$WEBI_PKG_FILE"