ruby-app-root 330 B

1234567891011121314151617181920212223
  1. #
  2. # Displays the path to the Ruby application root directory.
  3. #
  4. # Authors:
  5. # Sorin Ionescu <sorin.ionescu@gmail.com>
  6. #
  7. # function ruby-app-root {
  8. local root_dir="$PWD"
  9. while [[ "$root_dir" != '/' ]]; do
  10. if [[ -f "$root_dir/Gemfile" ]]; then
  11. print "$root_dir"
  12. break
  13. fi
  14. root_dir="$root_dir:h"
  15. done
  16. return 1
  17. # }