summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-06-18 17:31:40 -0700
committerPete Higgins <pete@peterhiggins.org>2020-06-18 17:31:40 -0700
commit43a7bfe9bdcfe5dd89ca1621a19c9fa970460914 (patch)
tree83cc1d941f1b3798d1317ade5bc9d7a8324e24be
parenta07b5961c5e679c30e4ec5c43f1b2a03f8f70105 (diff)
downloadchef-43a7bfe9bdcfe5dd89ca1621a19c9fa970460914.tar.gz
Add example from docs site.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r--lib/chef/resource/chef_gem.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb
index 492c14e81d..a711a53c8d 100644
--- a/lib/chef/resource/chef_gem.rb
+++ b/lib/chef/resource/chef_gem.rb
@@ -47,6 +47,37 @@ class Chef
Use the **gem_package** resource to install all other gems (i.e. install gems system-wide).
DESC
+ examples <<~EXAMPLES
+ **Compile time vs. converge time installation of gems**
+
+ To install a gem while Chef Infra Client is configuring the node (the converge phase), set the `compile_time` property to `false`:
+ ```ruby
+ chef_gem 'right_aws' do
+ compile_time false
+ action :install
+ end
+ ```
+
+ To install a gem while the resource collection is being built (the compile phase), set the `compile_time` property to `true`:
+ ```ruby
+ chef_gem 'right_aws' do
+ compile_time true
+ action :install
+ end
+ ```
+
+ Install MySQL for Chef
+ ```ruby
+ apt_update
+
+ build_essential 'install compilation tools' do
+ compile_time true
+ end
+
+ chef_gem 'mysql'
+ ```
+ EXAMPLES
+
property :package_name, String,
description: "An optional property to set the package name if it differs from the resource block's name.",
identity: true