Class: Chef::Resource::ChefGem
- Inherits:
-
Package::GemPackage
- Object
- Package::GemPackage
- Chef::Resource::ChefGem
- Defined in:
- lib/chef/resource/chef_gem.rb
Instance Method Summary collapse
- #after_created ⇒ Object
- #compile_time(arg = nil) ⇒ Object
-
#gem_binary(arg = nil) ⇒ Object
The chef_gem resources is for installing gems to the current gem environment only for use by Chef cookbooks.
-
#initialize(name, run_context = nil) ⇒ ChefGem
constructor
A new instance of ChefGem.
Constructor Details
#initialize(name, run_context = nil) ⇒ ChefGem
Returns a new instance of ChefGem.
28 29 30 31 32 33 |
# File 'lib/chef/resource/chef_gem.rb', line 28 def initialize(name, run_context=nil) super @resource_name = :chef_gem @compile_time = Chef::Config[:chef_gem_compile_time] @gem_binary = RbConfig::CONFIG['bindir'] + "/gem" end |
Instance Method Details
#after_created ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/chef/resource/chef_gem.rb', line 52 def after_created # Chef::Resource.run_action: Caveat: this skips Chef::Runner.run_action, where notifications are handled # Action could be an array of symbols, but probably won't (think install + enable for a package) if compile_time.nil? Chef::Log.deprecation "#{self} chef_gem compile_time installation is deprecated" Chef::Log.deprecation "#{self} Please set `compile_time false` on the resource to use the new behavior." Chef::Log.deprecation "#{self} or set `compile_time true` on the resource if compile_time behavior is required." end if compile_time || compile_time.nil? Array(action).each do |action| self.run_action(action) end Gem.clear_paths end end |
#compile_time(arg = nil) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/chef/resource/chef_gem.rb', line 44 def compile_time(arg=nil) set_or_return( :compile_time, arg, :kind_of => [ TrueClass, FalseClass ] ) end |
#gem_binary(arg = nil) ⇒ Object
The chef_gem resources is for installing gems to the current gem environment only for use by Chef cookbooks.
36 37 38 39 40 41 42 |
# File 'lib/chef/resource/chef_gem.rb', line 36 def gem_binary(arg=nil) if arg raise ArgumentError, "The chef_gem resource is restricted to the current gem environment, use gem_package to install to other environments." end @gem_binary end |