class Chef::Resource::ChocolateyFeature
Public Instance Methods
Source
# File lib/chef/resource/chocolatey_feature.rb, line 86 def choco_cmd(action) "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\bin\\choco feature #{action} --name #{new_resource.feature_name}" end
@param [String] action the name of the action to perform @return [String] the choco feature command string
Source
# File lib/chef/resource/chocolatey_feature.rb, line 57 def fetch_feature_element(name) require "rexml/document" unless defined?(REXML::Document) config_file = "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\config\\chocolatey.config" raise "Could not find the Chocolatey config at #{config_file}!" unless ::File.exist?(config_file) contents = REXML::Document.new(::File.read(config_file)) data = REXML::XPath.first(contents, "//features/feature[@name=\"#{name}\"]") data ? data.attribute("enabled").to_s : nil # REXML just returns nil if it can't find anything so avoid an undefined method error end
@param [String] id the feature name @return [String] the element’s value field