Module: CapybaraWebkitBuilder

Extended by:
CapybaraWebkitBuilder
Included in:
CapybaraWebkitBuilder
Defined in:
lib/capybara_webkit_builder.rb

Instance Method Summary collapse

Instance Method Details

#buildObject



49
50
51
52
53
54
# File 'lib/capybara_webkit_builder.rb', line 49

def build
  system(make_bin) or return false

  FileUtils.mkdir("bin") unless File.directory?("bin")
  FileUtils.cp(path_to_binary, "bin", :preserve => true)
end

#build_allObject



62
63
64
65
66
67
# File 'lib/capybara_webkit_builder.rb', line 62

def build_all
  makefile &&
  qmake &&
  build &&
  clean
end

#cleanObject



56
57
58
59
60
# File 'lib/capybara_webkit_builder.rb', line 56

def clean
  File.open("Makefile", "w") do |file|
    file.print "all:\n\t@echo ok\ninstall:\n\t@echo ok"
  end
end

#make_binObject



7
8
9
# File 'lib/capybara_webkit_builder.rb', line 7

def make_bin
  ENV['MAKE'] || 'make'
end

#makefileObject



32
33
34
# File 'lib/capybara_webkit_builder.rb', line 32

def makefile
  system("#{qmake_bin} -spec #{spec}")
end

#os_specObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/capybara_webkit_builder.rb', line 19

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_binaryObject



40
41
42
43
44
45
46
47
# File 'lib/capybara_webkit_builder.rb', line 40

def path_to_binary
  case RUBY_PLATFORM
  when /mingw32/
    "src/debug/webkit_server.exe"
  else
    "src/webkit_server"
  end
end

#qmakeObject



36
37
38
# File 'lib/capybara_webkit_builder.rb', line 36

def qmake
  system("#{make_bin} qmake")
end

#qmake_binObject



11
12
13
# File 'lib/capybara_webkit_builder.rb', line 11

def qmake_bin
  ENV['QMAKE'] || 'qmake'
end

#specObject



15
16
17
# File 'lib/capybara_webkit_builder.rb', line 15

def spec
  ENV['SPEC'] || os_spec
end