Homecoming let's you easily traverse all parent directories of a given or the current directory.
This comes in handy when searching for a config file
with settings that can be overridden by the same config file in a lower level
directory (a popular example being
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install homecoming
Homecoming.find searches for a given filename in the current and all parent
# Given the following directory structure: / home/ rrrene/ projects/ your_project/ .yourconfig .yourconfig Homecoming.find(".yourconfig", "/home/rrrene/projects/your_project") # => ["/home/rrrene/.yourconfig", "/home/rrrene/projects/your_project/.yourconfig"]
If no path is given as second parameter, the current directory is the starting point of the traversal.
Homecoming.each traverses and yields the given and all parent
Homecoming.each("/home/rrrene/projects/your_project") do |dir| # ... end
If no path is given, the current directory is the starting point of the traversal.
In our example, this would yield the following directories beginning with the given/current one:
"/home/rrrene/projects/your_project" "/home/rrrene/projects" "/home/rrrene" "/home" "/"
- Fork it ( http://github.com/rrrene/homecoming/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
René Föhring (@rrrene)
Homecoming is released under the MIT License. See the LICENSE.txt file for further details.