class Robocopy

Public Class Methods

new(tools_dir) click to toggle source
# File lib/rakeoff/robocopy.rb, line 5
def initialize(tools_dir)
        @tools_dir = tools_dir
end

Public Instance Methods

execute(source, destination, parameters='/MIR /R:5 /W:5 /NP /NFL /NDL') click to toggle source
# File lib/rakeoff/robocopy.rb, line 9
def execute(source, destination, parameters='/MIR /R:5 /W:5 /NP /NFL /NDL')
        print_heading 'Copying'
            
            status = run_command("#{@tools_dir}/robocopy.exe #{source} #{destination} /XD .svn #{parameters}")
            failed = check_status(status)

            if failed
                    raise RobocopyException, "Robocopy failed with status code #{status}. Please see http://bit.ly/dzegQL for what it means.".red
            end           
end

Private Instance Methods

check_status(status) click to toggle source
# File lib/rakeoff/robocopy.rb, line 22
def check_status(status)
            fail = true
            
            [0, 1, 2, 3, 11].each do |code|
                    if status == code
                            fail = false
                    end
            end

            fail
end
run_command(text) click to toggle source
# File lib/rakeoff/robocopy.rb, line 34
def run_command(text)
        sh(text) do |ok, result|
            return result.exitstatus
    end
end