chef

https://github.com/opscode/chef

Ruby

A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.

Chef::ChefFS::PathUtils.realest_path

Given a path which may only be partly real (i.e. /x/y/z when only /x exists,
or /x/y/*/blah when /x/y/z/blah exists), call File.realpath on the biggest
part that actually exists.  The paths operated on here are not Chef-FS paths.
These are OS paths that may contain symlinks but may not also fully exist.

If /x is a symlink to /blarghle, and has no subdirectories, then:
PathUtils.realest_path('/x/y/z') == '/blarghle/y/z'
PathUtils.realest_path('/x/*/z') == '/blarghle/*/z'
PathUtils.realest_path('/*/y/z') == '/*/y/z'

TODO: Move this to wherever util/path_helper is these days.

Source | Google | Stack overflow

Edit

git clone [email protected]:opscode/chef.git

cd chef

open lib/chef/chef_fs/path_utils.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--ChefFS--PathUtils-realest_path-for-pr


# Commit to git

git add lib/chef/chef_fs/path_utils.rbgit commit -m "better docs for Chef::ChefFS::PathUtils.realest_path"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Chef--ChefFS--PathUtils-realest_path-for-pr

hub pull-request


# Celebrate!