detect if command not available (usefull for windows users)

This commit is contained in:
stereobooster 2012-05-08 17:39:08 +03:00 committed by Matthew Mongeau
parent 4bf9443b6f
commit 44a3fe8c35
1 changed files with 14 additions and 3 deletions

View File

@ -29,12 +29,23 @@ module CapybaraWebkitBuilder
end
end
def sh(command)
system(command)
success = $?.exitstatus == 0
if $?.exitstatus == 127
puts "Command '#{command}' not available"
elsif !success
puts "Command '#{command}' failed"
end
success
end
def makefile
system("#{qmake_bin} -spec #{spec}")
sh("#{qmake_bin} -spec #{spec}")
end
def qmake
system("#{make_bin} qmake")
sh("#{make_bin} qmake")
end
def path_to_binary
@ -47,7 +58,7 @@ module CapybaraWebkitBuilder
end
def build
system(make_bin) or return false
sh(make_bin) or return false
FileUtils.mkdir("bin") unless File.directory?("bin")
FileUtils.cp(path_to_binary, "bin", :preserve => true)