CapybaraWebkitBuilder

Public Instance Methods

build() click to toggle source
# File lib/capybara_webkit_builder.rb, line 72
def build
  sh(make_bin) or return false

  FileUtils.mkdir("bin") unless File.directory?("bin")
  FileUtils.cp(path_to_binary, "bin", :preserve => true)
end
build_all() click to toggle source
# File lib/capybara_webkit_builder.rb, line 85
def build_all
  makefile &&
  qmake &&
  build &&
  clean
end
clean() click to toggle source
# File lib/capybara_webkit_builder.rb, line 79
def clean
  File.open("Makefile", "w") do |file|
    file.print "all:\n\t@echo ok\ninstall:\n\t@echo ok"
  end
end
default_qmake_binary() click to toggle source
# File lib/capybara_webkit_builder.rb, line 22
def default_qmake_binary
  case RbConfig::CONFIG['host_os']
  when /freebsd/
    "qmake-qt4"
  else
    "qmake"
  end
end
make_bin() click to toggle source
# File lib/capybara_webkit_builder.rb, line 10
def make_bin
  ENV['MAKE'] || 'make'
end
makefile() click to toggle source
# File lib/capybara_webkit_builder.rb, line 55
def makefile
  sh("#{qmake_bin} -spec #{spec}")
end
os_spec() click to toggle source
# File lib/capybara_webkit_builder.rb, line 31
def os_spec
  case RbConfig::CONFIG['host_os']
  when /linux/
    "linux-g++"
  when /freebsd/
    "freebsd-g++"
  when /mingw32/
    "win32-g++"
  else
    "macx-g++"
  end
end
path_to_binary() click to toggle source
# File lib/capybara_webkit_builder.rb, line 63
def path_to_binary
  case RUBY_PLATFORM
  when /mingw32/
    "src/debug/webkit_server.exe"
  else
    "src/webkit_server"
  end
end
qmake() click to toggle source
# File lib/capybara_webkit_builder.rb, line 59
def qmake
  sh("#{make_bin} qmake")
end
qmake_bin() click to toggle source
# File lib/capybara_webkit_builder.rb, line 14
def qmake_bin
  ENV['QMAKE'] || default_qmake_binary
end
sh(command) click to toggle source
# File lib/capybara_webkit_builder.rb, line 44
def sh(command)
  system(command)
  success = $?.exitstatus == SUCCESS_STATUS
  if $?.exitstatus == COMMAND_NOT_FOUND_STATUS
    puts "Command '#{command}' not available"
  elsif !success
    puts "Command '#{command}' failed"
  end
  success
end
spec() click to toggle source
# File lib/capybara_webkit_builder.rb, line 18
def spec
  ENV['SPEC'] || os_spec
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.