diff options
author | John Keiser <john@johnkeiser.com> | 2015-12-11 13:19:58 -0800 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2015-12-15 11:16:20 -0800 |
commit | b743fcdbd172862386d172b42bbbc31cfe2f4239 (patch) | |
tree | aeb3a60c86bbd98c5502b86483848a5cc5122fc3 /lib/chef/resource/chef_gem.rb | |
parent | 44494c91587ff0313d328d9c4ec016e6fcf5f830 (diff) | |
download | chef-b743fcdbd172862386d172b42bbbc31cfe2f4239.tar.gz |
Use properties in package resourcesjk/package-properties
Diffstat (limited to 'lib/chef/resource/chef_gem.rb')
-rw-r--r-- | lib/chef/resource/chef_gem.rb | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb index 7e9d21ebd2..b2cd9da101 100644 --- a/lib/chef/resource/chef_gem.rb +++ b/lib/chef/resource/chef_gem.rb @@ -22,29 +22,13 @@ require 'chef/resource/gem_package' class Chef class Resource class ChefGem < Chef::Resource::Package::GemPackage + resource_name :chef_gem - def initialize(name, run_context=nil) - super - @compile_time = Chef::Config[:chef_gem_compile_time] - @gem_binary = RbConfig::CONFIG['bindir'] + "/gem" - end - - # The chef_gem resources is for installing gems to the current gem environment only for use by Chef cookbooks. - 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 - - def compile_time(arg=nil) - set_or_return( - :compile_time, - arg, - :kind_of => [ TrueClass, FalseClass ] - ) - end + property :gem_binary, default: "#{RbConfig::CONFIG['bindir']}/gem", + callbacks: { + "The chef_gem resource is restricted to the current gem environment, use gem_package to install to other environments." => proc { false } + } + property :compile_time, [ true, false ], default: lazy { Chef::Config[:chef_gem_compile_time] }, desired_state: false def after_created # Chef::Resource.run_action: Caveat: this skips Chef::Runner.run_action, where notifications are handled |