Skip to content

Commit b96000e

Browse files
committed
start proj
0 parents  commit b96000e

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed

bin/rbenv-init-project

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../libexec/rbenv-init-project

libexec/rbenv-init-project

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
RBENV_INIT_PROJECT_VERSION='0.0.1'
5+
6+
[ -n "$RBENV_DEBUG" ] && set -x
7+
8+
# Provide rbenv completions
9+
if [ "$1" = "--complete" ]; then
10+
echo "current"
11+
echo "version"
12+
exit
13+
fi
14+
15+
if [ "$1" = "version" ] || [ "$1" = "--version" ]; then
16+
echo "rbenv-init-project ${RBENV_INIT_PROJECT_VERSION}"
17+
echo "by @benjaminws"
18+
echo "http://github.com/benjaminws/rbenv-init-project"
19+
exit
20+
fi
21+
22+
resolve_link() {
23+
$(type -p greadlink readlink | head -1) $1
24+
}
25+
26+
abs_dirname() {
27+
local cwd="$(pwd)"
28+
local path="$1"
29+
30+
while [ -n "$path" ]; do
31+
cd "${path%/*}"
32+
local name="${path##*/}"
33+
path="$(resolve_link "$name" || true)"
34+
done
35+
36+
pwd
37+
cd "$cwd"
38+
}
39+
40+
bin_path="$(abs_dirname "$0")"
41+
export PATH="${bin_path}:$PATH"
42+
43+
command="$1"
44+
command_path="$(command -v "rbenv-init-project-$command" || true)"
45+
46+
echo $command_path
47+
if [ -z "$command_path" ]; then
48+
command_path="$(command -v "rbenv-init-project-current")"
49+
fi
50+
51+
echo $command_path
52+
53+
shift
54+
exec "$command_path" "$@"

libexec/rbenv-init-project-current

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "hi"

libexec/rbenv-init-project-help

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
{ echo "version ${RBENV_INIT_PROJECT_VERSION}"
5+
echo "${0##*/} [command] [options]"
6+
echo
7+
echo "possible commands are:"
8+
echo " current (use cwd for gemset name, active version of ruby) *default"
9+
echo " help (this)"
10+
echo " version"
11+
} >&2
12+
exit 1
13+

0 commit comments

Comments
 (0)