Class: Chef::Resource::ChefGem

Inherits:
Package::GemPackage
  • Object
show all
Defined in:
lib/chef/resource/chef_gem.rb

Overview

Use the chef_gem resource to install a gem only for the instance of Ruby that is dedicated to the chef-client. When a gem is installed from a local file, it must be added to the node using the remote_file or cookbook_file resources.

The chef_gem resource works with all of the same properties and options as the gem_package resource, but does not accept the gem_binary property because it always uses the CurrentGemEnvironment under which the chef-client is running. In addition to performing actions similar to the gem_package resource, the chef_gem resource does the following:

- Runs its actions immediately, before convergence, allowing a gem to be used in a recipe immediately after it is
  installed
- Runs Gem.clear_paths after the action, ensuring that gem is aware of changes so that it can be required
  immediately after it is installed

Instance Method Summary collapse

Instance Method Details

#after_createdvoid

This method returns an undefined value.

force the resource to compile time if the compile time property has been set



52
53
54
55
56
57
58
59
# File 'lib/chef/resource/chef_gem.rb', line 52

def after_created
  if compile_time
    Array(action).each do |action|
      run_action(action)
    end
    Gem.clear_paths
  end
end