1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00
capybara-webkit/lib/capybara_webkit_builder.rb

62 lines
970 B
Ruby
Raw Normal View History

require "fileutils"
require "rbconfig"
module CapybaraWebkitBuilder
extend self
2011-07-25 09:43:05 -04:00
def make_bin
ENV['MAKE'] || 'make'
2011-07-25 09:43:05 -04:00
end
def qmake_bin
ENV['QMAKE'] || 'qmake'
end
def spec
ENV['SPEC'] || os_spec
end
def os_spec
case RbConfig::CONFIG['host_os']
when /linux/
"linux-g++"
2011-07-25 09:43:05 -04:00
when /freebsd/
"freebsd-g++"
2011-10-06 11:07:20 -04:00
when /mingw32/
"win32-g++"
else
"macx-g++"
end
end
def makefile
system("LANG='en_US.UTF-8' #{qmake_bin} -spec #{spec}")
end
def qmake
system("LANG='en_US.UTF-8' #{make_bin} qmake")
end
2011-10-06 11:07:20 -04:00
def path_to_binary
case RUBY_PLATFORM
when /mingw32/
"src/debug/webkit_server.exe"
else
"src/webkit_server"
end
end
def build
2011-07-25 09:43:05 -04:00
system(make_bin) or return false
FileUtils.mkdir("bin") unless File.directory?("bin")
2011-10-06 11:07:20 -04:00
FileUtils.cp(path_to_binary, "bin", :preserve => true)
end
def build_all
makefile &&
qmake &&
build
end
end