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 43
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 48
def code(arg = nil)
  if arg && command
    raise ArgumentError, "Only one of 'code' and 'command' properties may be specified"
  end
  if arg && configuration_name
    raise ArgumentError, "The 'code' and 'command' properties 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 75
def command(arg = nil)
  if arg && code
    raise ArgumentError, "The 'code' and 'command' properties 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 87
def configuration_data(arg = nil)
  if arg && configuration_data_script
    raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' properties 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 99
def configuration_data_script(arg = nil)
  if arg && configuration_data
    raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' properties 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 63
def configuration_name(arg = nil)
  if arg && code
    raise ArgumentError, "Property `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 111
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