summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandy <andy@ndyk.de>2013-12-26 22:34:55 +0100
committerandy <andy@ndyk.de>2013-12-26 22:34:55 +0100
commitc8d5f7d5490cef5e01126b90fb7e1d9537ac6934 (patch)
tree47962d71d7fe179df87c46dab5e6b914a2906b6b /app-admin/eselect-gradle
parentpush pyCardDAV & libwebsockets (diff)
downloadandy-c8d5f7d5490cef5e01126b90fb7e1d9537ac6934.tar.gz
andy-c8d5f7d5490cef5e01126b90fb7e1d9537ac6934.tar.bz2
andy-c8d5f7d5490cef5e01126b90fb7e1d9537ac6934.zip
add gradle-bin
Diffstat (limited to 'app-admin/eselect-gradle')
-rw-r--r--app-admin/eselect-gradle/Manifest2
-rw-r--r--app-admin/eselect-gradle/eselect-gradle-0.1.ebuild24
-rw-r--r--app-admin/eselect-gradle/files/gradle.eselect131
3 files changed, 157 insertions, 0 deletions
diff --git a/app-admin/eselect-gradle/Manifest b/app-admin/eselect-gradle/Manifest
new file mode 100644
index 0000000..f56ef7d
--- /dev/null
+++ b/app-admin/eselect-gradle/Manifest
@@ -0,0 +1,2 @@
+AUX gradle.eselect 3077 SHA256 75c434f77079b1cfea0a61a815a6e9dcaa84dbf10ca50415e34b2addc048aab7 SHA512 e475a7447a8d7918617e558347493c235a94fda56055c056f1f5a490865c4be1ffc2c427bf3852e00a3122a9be40fcb3633147a47e552d1c10b45231f39cf2e2 WHIRLPOOL 7a1d6184a4596895070e821ba323b7bca9a63df993be9ada206981790f47cffc301a56157a8110736889a3564dd3a1e9e350db57bca21f62e3a510ed80496054
+EBUILD eselect-gradle-0.1.ebuild 408 SHA256 2542f759da7f39dec5255519bbfa75ddb928c09e8ff0b646a28c793f60acee18 SHA512 fd75fd78e919cbab1b1c70e61f1789c89d40df573df284268d5755d64f1687f1018ab7075f5fc2ff0c662199f6f5d5d8fe41452bca26c1cbc238c720dd70e21d WHIRLPOOL 4b1313c64af96c772bf764b2b06daad2b5d3f38db58b73b835c4de8db95b062aa9921652e5f2c3814ad7dd0c9d8258075a7ea684bd28e3757f0233b5d77ae86c
diff --git a/app-admin/eselect-gradle/eselect-gradle-0.1.ebuild b/app-admin/eselect-gradle/eselect-gradle-0.1.ebuild
new file mode 100644
index 0000000..7920cdd
--- /dev/null
+++ b/app-admin/eselect-gradle/eselect-gradle-0.1.ebuild
@@ -0,0 +1,24 @@
+# Copyright 2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+DESCRIPTION="Manage multiple Gradle versions on one system"
+HOMEPAGE=""
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="app-admin/eselect"
+
+S="${WORKDIR}"
+
+src_install() {
+ insinto /usr/share/eselect/modules
+ doins ${FILESDIR}/gradle.eselect
+}
diff --git a/app-admin/eselect-gradle/files/gradle.eselect b/app-admin/eselect-gradle/files/gradle.eselect
new file mode 100644
index 0000000..853143e
--- /dev/null
+++ b/app-admin/eselect-gradle/files/gradle.eselect
@@ -0,0 +1,131 @@
+# -*-eselect-*- vim: ft=eselect
+# Copyright 2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2 or later
+# $Id: $
+
+DESCRIPTION="Manage the /usr/bin/gradle symlink"
+MAINTAINER=""
+VERSION=0.1
+
+# find a list of gradle symlink targets
+find_targets() {
+ local f
+ for f in "${EROOT}"/usr/bin/gradle?(-bin)-[[:digit:]]*; do
+ [[ -x ${f} ]] && basename "${f}"
+ done
+}
+
+remove_symlink() {
+ rm "${EROOT}/usr/bin/gradle" \
+ || die -q "Could not remove symlink"
+}
+
+set_symlink() {
+ local target=$1
+
+ if is_number "${target}"; then
+ local targets=( $(find_targets) )
+ target=${targets[target-1]}
+ fi
+
+ [[ -z ${target} ]] \
+ && die -q "Target \"${1}\" doesn't apper to be valid!"
+
+ [[ ! -x ${EROOT}/usr/bin/${target} ]] \
+ && die -q "${EROOT}/usr/bin/${target} is not an executable"
+
+ ln -s "${target}" "${EROOT}/usr/bin/gradle" \
+ || die -q "Could not set symlink"
+}
+
+describe_show() {
+ echo "Shows the current gradle symlink"
+}
+
+do_show() {
+ write_list_start "Current gradle symlink:"
+ if [[ -L ${EROOT}/usr/bin/gradle ]]; then
+ local gradle=$(cannonicalise "${EROOT}/usr/bin/gradle")
+ write_kv_list_entry "${gradle}" ""
+ else
+ write_kv_list_entry "(unset)" ""
+ fi
+}
+
+describe_list() {
+ echo "list available gradle symlink targets"
+}
+
+do_list() {
+ local i targets=( $(find_targets) )
+
+ write_list_start "Available gradle symlink targets:"
+ for (( i = 0; i < ${#targets[@]}; i++ )); do
+ # highligh the target where the symlink is pointing to
+ [[ ${targets[i]} = \
+ $(basename "$(canonicalise "${EROOT}/usr/bin/gradle")") ]] \
+ && targets[i]=$(highlight_marker "${targets[i]}")
+ done
+ write_numbered_list -m "(none found)" "${targets[@]}"
+}
+
+describe_set() {
+ echo "Set a new gradle symlink target"
+}
+
+describe_set_parameters() {
+ echo "<target>"
+}
+
+describe_set_options() {
+ echo "target : Target name or number (from 'list' action)"
+}
+
+do_set() {
+ [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to"
+ [[ $# -gt 1 ]] && die -q "Too many parameters"
+ test_for_root
+
+ if [[ -L ${EROOT}/usr/bin/gradle ]]; then
+ # existing symmlink
+ remove_symlink
+ set_symlink "$1"
+ elif [[ -e ${EROOT}/usr/bin/gradle ]]; then
+ # we have someting strange
+ die -q "${EROOT}/usr/bin/gradle exists but is not a symlink"
+ else
+ set_symlink "$1"
+ fi
+}
+
+describe_update() {
+ echo "Automatically update the gradle symlink"
+}
+
+describe_update_options() {
+ echo "ifunset: Do not override currently set version"
+}
+
+do_update() {
+ [[ -z $1 || $1 == ifunset ]] || die -q "Usage error"
+ [[ $# -gt 1 ]] && die -q "Too many parameters"
+ test_for_root
+
+ if [[ -L ${EROOT}/usr/bin/gradle ]]; then
+ if [[ $1 == ifunset && -e ${EROOT}/usr/bin/gradle ]]; then
+ return
+ fi
+ remove_symlink
+ elif [[ -e ${EROOT}/usr/bin/gradle ]]; then
+ die -q "${EROOT}/usr/bin/gradle exists but is not a symlink"
+ fi
+
+ local targets=( $(find_targets) )
+ if [[ ${#targets[@]} -gt 0 ]]; then
+ set_symlink "${targets[${#targets[@]}-1]}"
+ fi
+}
+
+test_for_root() {
+ [[ -w ${EROOT}/usr/bin ]] || die -q "${EROOT}/usr/bin not writeable by current user. Are you root?"
+}