This repository has been archived on 2022-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
prezto/modules/ruby/functions/ruby-app-root
2013-11-29 08:46:14 -05:00

20 lines
298 B
Plaintext

#
# Displays the path to the Ruby application root directory.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
local root_dir="$PWD"
while [[ "$root_dir" != '/' ]]; do
if [[ -f "$root_dir/Gemfile" ]]; then
print "$root_dir"
break
fi
root_dir="$root_dir:h"
done
return 1