Getting the root of your project
It's useful to get the root of your project, so you can fully qualify paths to scripts, config files and not worry about the current directory.
In bash, I define shome to be (assuming the script is in a subdirectory). I got this from a script in ronn.
shome="$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)"
In ruby:
shome=File.dirname(File.expand_path(__FILE__))
Written by Tom, Bom
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#