Module: Rake::AltSystem

### Home Classes Methods

### In Files

- lib/rake/alt_system.rb

### Methods

- ::define_module_function
- #backticks
- #find_runnable
- #repair_command
- #system

### Files

- MIT-LICENSE
- README.rdoc
- TODO
- command_line_usage.rdoc
- glossary.rdoc
- proto_rake.rdoc
- rakefile.rdoc
- rational.rdoc
- rake-0.4.14.rdoc
- rake-0.4.15.rdoc
- rake-0.5.0.rdoc
- rake-0.5.3.rdoc
- rake-0.5.4.rdoc
- rake-0.6.0.rdoc
- rake-0.7.0.rdoc
- rake-0.7.1.rdoc
- rake-0.7.2.rdoc
- rake-0.7.3.rdoc
- rake-0.8.0.rdoc
- rake-0.8.4.rdoc
- rake-0.8.5.rdoc
- rake-0.8.6.rdoc
- rake-0.8.7.rdoc

### Class/Module Index

Quicksearch

- Rake
- Rake::AltSystem
- Rake::Application
- Rake::Backtrace
- Rake::Cloneable
- Rake::CompositePublisher
- Rake::DSL
- Rake::DefaultLoader
- Rake::EarlyTime
- Rake::FileCreationTask
- Rake::FileList
- Rake::FileTask
- Rake::FileUtilsExt
- Rake::FtpFile
- Rake::FtpUploader
- Rake::InvocationChain
- Rake::InvocationChain::EmptyInvocationChain
- Rake::InvocationExceptionMixin
- Rake::MakefileLoader
- Rake::MultiTask
- Rake::NameSpace
- Rake::PackageTask
- Rake::PseudoStatus
- Rake::RubyForgePublisher
- Rake::RuleRecursionOverflowError
- Rake::SshDirPublisher
- Rake::SshFilePublisher
- Rake::SshFreshDirPublisher
- Rake::Task
- Rake::TaskArgumentError
- Rake::TaskArguments
- Rake::TaskLib
- Rake::TaskManager
- Rake::TestTask
- Rake::TraceOutput
- Rake::Win32
- Rake::Win32::Win32HomeError
- CompositePublisher
- FileUtils
- Module
- Object
- SshDirPublisher
- SshFilePublisher
- SshFreshDirPublisher
- String
- Time

No matching classes.

# Rake::AltSystem

Alternate implementations of system() and backticks " on Windows for ruby-1.8 and earlier.

### Constants

RUNNABLE_EXTS
RUNNABLE_PATTERN
WINDOWS

### Public Class Methods

define_module_function(name, &block) click to toggle source

    # File lib/rake/alt_system.rb, line 36
    def define_module_function(name, &block)
      define_method(name, &block)
      module_function(name)
    end

### Public Instance Methods

backticks(cmd) click to toggle source

    # File lib/rake/alt_system.rb, line 98
    def backticks(cmd)
      kernel_backticks(repair_command(cmd))
    end

find_runnable(file) click to toggle source

    # File lib/rake/alt_system.rb, line 71
    def find_runnable(file)
      if file =~ RUNNABLE_PATTERN
        file
      else
        RUNNABLE_EXTS.each { |ext|
          if File.exist?(test = "#{file}.#{ext}")
            return test
          end
        }
        nil
      end
    end

repair_command(cmd) click to toggle source

    # File lib/rake/alt_system.rb, line 51
    def repair_command(cmd)
      "call " + (
        if cmd =~ %\A\s*\".*?\"!
          # already quoted
          cmd
        elsif match = cmd.match(%\A\s*(\S+)!)
          if match[1] =~ %/!
            # avoid x/y.bat interpretation as x with option /y
            %"#{match[1]}"! + match.post_match
          else
            # a shell command will fail if quoted
            cmd
          end
        else
          # empty or whitespace
          cmd
        end
      )
    end

system(cmd, *args) click to toggle source

    # File lib/rake/alt_system.rb, line 84
    def system(cmd, *args)
      repaired = (
        if args.empty?
          [repair_command(cmd)]
        elsif runnable = find_runnable(cmd)
          [File.expand_path(runnable), *args]
        else
          # non-existent file
          [cmd, *args]
        end
      )
      kernel_system(*repaired)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.