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_createdObject

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



46
47
48
49
50
51
52
53
# File 'lib/chef/resource/chef_gem.rb', line 46

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