chef

https://github.com/opscode/chef

Ruby

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

Chef::Mixin::ShellOut#clean_array

Helper for sublcasses to reject nil and empty strings out of an array.  It allows
using the array form of shell_out (which avoids the need to surround arguments with
quote marks to deal with shells).

Usage:
  shell_out!(*clean_array("useradd", universal_options, useradd_options, new_resource.username))

universal_options and useradd_options can be nil, empty array, empty string, strings or arrays
and the result makes sense.

keeping this separate from shell_out!() makes it a bit easier to write expectations against the
shell_out args and be able to omit nils and such in the tests (and to test that the nils are
being rejected correctly).

Source | Google | Stack overflow

Edit

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

cd chef

open lib/chef/mixin/shell_out.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Chef--Mixin--ShellOut-clean_array-for-pr


# Commit to git

git add lib/chef/mixin/shell_out.rbgit commit -m "better docs for Chef::Mixin::ShellOut#clean_array"


# 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--Mixin--ShellOut-clean_array-for-pr

hub pull-request


# Celebrate!