class Chef::Resource::Script

Public Class Methods

guard_inherited_attributes(*inherited_attributes) click to toggle source
# File lib/chef/resource/script.rb, line 65
def self.guard_inherited_attributes(*inherited_attributes)
  # Similar to patterns elsewhere, return attributes from this
  # class and superclasses as a form of inheritance
  ancestor_attributes = []

  if superclass.respond_to?(:guard_inherited_attributes)
    ancestor_attributes = superclass.guard_inherited_attributes
  end

  ancestor_attributes.concat(@class_inherited_attributes ? @class_inherited_attributes : []).uniq
end
new(name, run_context=nil) click to toggle source
Calls superclass method Chef::Resource::Execute.new
# File lib/chef/resource/script.rb, line 28
def initialize(name, run_context=nil)
  super
  @resource_name = :script
  @command = name
  @code = nil
  @interpreter = nil
  @flags = nil
end
set_guard_inherited_attributes(*inherited_attributes) click to toggle source
# File lib/chef/resource/script.rb, line 61
def self.set_guard_inherited_attributes(*inherited_attributes)
  @class_inherited_attributes = inherited_attributes
end

Public Instance Methods

code(arg=nil) click to toggle source
# File lib/chef/resource/script.rb, line 37
def code(arg=nil)
  set_or_return(
    :code,
    arg,
    :kind_of => [ String ]
  )
end
flags(arg=nil) click to toggle source
# File lib/chef/resource/script.rb, line 53
def flags(arg=nil)
  set_or_return(
    :flags,
    arg,
    :kind_of => [ String ]
  )
end
interpreter(arg=nil) click to toggle source
# File lib/chef/resource/script.rb, line 45
def interpreter(arg=nil)
  set_or_return(
    :interpreter,
    arg,
    :kind_of => [ String ]
  )
end