From 43624943eec6576a4824d2ef0ad15167ce75688a Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 2 Aug 2011 18:01:46 -0500 Subject: [PATCH] Move subcommands into libexec/ --- bin/rbenv | 17 +-------------- libexec/rbenv | 34 ++++++++++++++++++++++++++++++ {bin => libexec}/rbenv-exec | 0 {bin => libexec}/rbenv-path | 0 {bin => libexec}/rbenv-rehash | 0 {bin => libexec}/rbenv-set-default | 0 {bin => libexec}/rbenv-set-local | 0 {bin => libexec}/rbenv-shim | 0 {bin => libexec}/rbenv-version | 0 {bin => libexec}/rbenv-versions | 0 {bin => libexec}/rbenv-which | 0 11 files changed, 35 insertions(+), 16 deletions(-) mode change 100755 => 120000 bin/rbenv create mode 100755 libexec/rbenv rename {bin => libexec}/rbenv-exec (100%) rename {bin => libexec}/rbenv-path (100%) rename {bin => libexec}/rbenv-rehash (100%) rename {bin => libexec}/rbenv-set-default (100%) rename {bin => libexec}/rbenv-set-local (100%) rename {bin => libexec}/rbenv-shim (100%) rename {bin => libexec}/rbenv-version (100%) rename {bin => libexec}/rbenv-versions (100%) rename {bin => libexec}/rbenv-which (100%) diff --git a/bin/rbenv b/bin/rbenv deleted file mode 100755 index 30f1a18..0000000 --- a/bin/rbenv +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -e - -command="$1" -if [ -z "$command" ]; then - echo "rbenv 0.1.0" >&2 - -else - command_path="$(command -v "rbenv-$command" || true)" - if [ -z "$command_path" ]; then - echo "rbenv: no such command \`$command'" >&2 - exit 1 - fi - - shift 1 - exec "$command_path" "$@" -fi diff --git a/bin/rbenv b/bin/rbenv new file mode 120000 index 0000000..f1e9c5f --- /dev/null +++ b/bin/rbenv @@ -0,0 +1 @@ +../libexec/rbenv \ No newline at end of file diff --git a/libexec/rbenv b/libexec/rbenv new file mode 100755 index 0000000..253d08b --- /dev/null +++ b/libexec/rbenv @@ -0,0 +1,34 @@ +#!/bin/bash -e + +abs_dirname() { + orig_dir=`pwd` + path="$1" + while [ -n "$path" ]; do + cd `dirname "$path"` + name=`basename "$path"` + path=`readlink "$name" || true` + done + unset name path + + pwd + cd "$orig_dir" + unset orig_dir +} + +bindir=`abs_dirname $0` +export PATH="$bindir:$PATH" + +command="$1" +if [ -z "$command" ]; then + echo "rbenv 0.1.0" >&2 + +else + command_path="$(command -v "rbenv-$command" || true)" + if [ -z "$command_path" ]; then + echo "rbenv: no such command \`$command'" >&2 + exit 1 + fi + + shift 1 + exec "$command_path" "$@" +fi diff --git a/bin/rbenv-exec b/libexec/rbenv-exec similarity index 100% rename from bin/rbenv-exec rename to libexec/rbenv-exec diff --git a/bin/rbenv-path b/libexec/rbenv-path similarity index 100% rename from bin/rbenv-path rename to libexec/rbenv-path diff --git a/bin/rbenv-rehash b/libexec/rbenv-rehash similarity index 100% rename from bin/rbenv-rehash rename to libexec/rbenv-rehash diff --git a/bin/rbenv-set-default b/libexec/rbenv-set-default similarity index 100% rename from bin/rbenv-set-default rename to libexec/rbenv-set-default diff --git a/bin/rbenv-set-local b/libexec/rbenv-set-local similarity index 100% rename from bin/rbenv-set-local rename to libexec/rbenv-set-local diff --git a/bin/rbenv-shim b/libexec/rbenv-shim similarity index 100% rename from bin/rbenv-shim rename to libexec/rbenv-shim diff --git a/bin/rbenv-version b/libexec/rbenv-version similarity index 100% rename from bin/rbenv-version rename to libexec/rbenv-version diff --git a/bin/rbenv-versions b/libexec/rbenv-versions similarity index 100% rename from bin/rbenv-versions rename to libexec/rbenv-versions diff --git a/bin/rbenv-which b/libexec/rbenv-which similarity index 100% rename from bin/rbenv-which rename to libexec/rbenv-which