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::Config#server_path

Returns the given real path's location relative to the server root.

If chef_repo is /home/jkeiser/chef_repo,
and pwd is /home/jkeiser/chef_repo/cookbooks,
server_path('blah') == '/cookbooks/blah'
server_path('../roles/blah.json') == '/roles/blah'
server_path('../../readme.txt') == nil
server_path('*/*ab*') == '/cookbooks/*/*ab*'
server_path('/home/jkeiser/chef_repo/cookbooks/blah') == '/cookbooks/blah'
server_path('/home/*/chef_repo/cookbooks/blah') == nil

If there are multiple different, manually specified paths to object locations
(cookbooks, roles, data bags, etc. can all have separate paths), and cwd+the
path reaches into one of them, we will return a path relative to the first
one to match it.  Otherwise we expect the path provided to be to the chef
repo path itself.  Paths that are not available on the server are not supported.

Globs are allowed as well, but globs outside server paths are NOT
(presently) supported.  See above examples.  TODO support that.

If the path does not reach into ANY specified directory, nil is returned.

Source | Google | Stack overflow

Edit

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

cd chef

open lib/chef/chef_fs/config.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--ChefFS--Config-server_path-for-pr


# Commit to git

git add lib/chef/chef_fs/config.rbgit commit -m "better docs for Chef::ChefFS::Config#server_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--Config-server_path-for-pr

hub pull-request


# Celebrate!