class Chef::Resource::DscScript
Public Class Methods
new(name, run_context = nil)
click to toggle source
Calls superclass method
Chef::Resource.new
# File lib/chef/resource/dsc_script.rb, line 41 def initialize(name, run_context = nil) super @imports = {} end
Public Instance Methods
code(arg = nil)
click to toggle source
# File lib/chef/resource/dsc_script.rb, line 46 def code(arg = nil) if arg && command raise ArgumentError, "Only one of 'code' and 'command' attributes may be specified" end if arg && configuration_name raise ArgumentError, "The 'code' and 'command' attributes may not be used together" end set_or_return( :code, arg, :kind_of => [ String ] ) end
command(arg = nil)
click to toggle source
# File lib/chef/resource/dsc_script.rb, line 71 def command(arg = nil) if arg && code raise ArgumentError, "The 'code' and 'command' attributes may not be used together" end set_or_return( :command, arg, :kind_of => [ String ] ) end
configuration_data(arg = nil)
click to toggle source
# File lib/chef/resource/dsc_script.rb, line 82 def configuration_data(arg = nil) if arg && configuration_data_script raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' attributes may not be used together" end set_or_return( :configuration_data, arg, :kind_of => [ String ] ) end
configuration_data_script(arg = nil)
click to toggle source
# File lib/chef/resource/dsc_script.rb, line 93 def configuration_data_script(arg = nil) if arg && configuration_data raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' attributes may not be used together" end set_or_return( :configuration_data_script, arg, :kind_of => [ String ] ) end
configuration_name(arg = nil)
click to toggle source
# File lib/chef/resource/dsc_script.rb, line 60 def configuration_name(arg = nil) if arg && code raise ArgumentError, "Attribute `configuration_name` may not be set if `code` is set" end set_or_return( :configuration_name, arg, :kind_of => [ String ] ) end
imports(module_name = nil, *args)
click to toggle source
# File lib/chef/resource/dsc_script.rb, line 104 def imports(module_name = nil, *args) if module_name @imports[module_name] ||= [] if args.length == 0 @imports[module_name] << "*" else @imports[module_name].push(*args) end else @imports end end