# class Chef::Provider::WindowsScript

### Public Class Methods

new( new_resource, run_context, script_extension='') click to toggle source
Calls superclass method Chef::Provider::Script.new

    # File lib/chef/provider/windows_script.rb, line 30
    def initialize( new_resource, run_context, script_extension='')
      super( new_resource, run_context )
      @script_extension = script_extension

      target_architecture = new_resource.architecture.nil? ?
        node_windows_architecture(run_context.node) : new_resource.architecture

      @is_wow64 = wow64_architecture_override_required?(run_context.node, target_architecture)

      if ( target_architecture == :i386 ) && ! is_i386_windows_process?
        raise Chef::Exceptions::Win32ArchitectureIncorrect,
        "Support for the i386 architecture from a 64-bit Ruby runtime is not yet implemented"
      end
    end

### Public Instance Methods

action_run() click to toggle source
Calls superclass method Chef::Provider::Script#action_run

    # File lib/chef/provider/windows_script.rb, line 47
    def action_run
      wow64_redirection_state = nil

      if @is_wow64
        wow64_redirection_state = disable_wow64_file_redirection(@run_context.node)
      end

      begin
        super
      rescue
        raise
      ensure
        if ! wow64_redirection_state.nil?
          restore_wow64_file_redirection(@run_context.node, wow64_redirection_state)
        end
      end
    end

script_file() click to toggle source

    # File lib/chef/provider/windows_script.rb, line 65
    def script_file
      base_script_name = "chef-script"
      temp_file_arguments = [ base_script_name, @script_extension ]

      @script_file ||= Tempfile.open(temp_file_arguments)
    end