Module: CapybaraWebkitBuilder
- Extended by:
- CapybaraWebkitBuilder
- Included in:
- CapybaraWebkitBuilder
- Defined in:
- lib/capybara_webkit_builder.rb
Constant Summary collapse
- SUCCESS_STATUS =
0
- COMMAND_NOT_FOUND_STATUS =
127
Instance Method Summary collapse
- #build ⇒ Object
- #build_all ⇒ Object
- #clean ⇒ Object
- #default_qmake_binary ⇒ Object
- #make_bin ⇒ Object
- #makefile(config = '') ⇒ Object
- #os_spec ⇒ Object
- #path_to_binary ⇒ Object
- #qmake ⇒ Object
- #qmake_bin ⇒ Object
- #sh(command) ⇒ Object
- #spec ⇒ Object
Instance Method Details
#build ⇒ Object
72 73 74 75 76 77 |
# 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 ⇒ Object
85 86 87 88 89 90 |
# File 'lib/capybara_webkit_builder.rb', line 85 def build_all makefile && qmake && build && clean end |
#clean ⇒ Object
79 80 81 82 83 |
# 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 ⇒ Object
22 23 24 25 26 27 28 29 |
# 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 ⇒ Object
10 11 12 |
# File 'lib/capybara_webkit_builder.rb', line 10 def make_bin ENV['MAKE'] || 'make' end |
#makefile(config = '') ⇒ Object
55 56 57 |
# File 'lib/capybara_webkit_builder.rb', line 55 def makefile(config = '') sh("#{qmake_bin} -spec #{spec} #{config}") end |
#os_spec ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# 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 ⇒ Object
63 64 65 66 67 68 69 70 |
# 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 ⇒ Object
59 60 61 |
# File 'lib/capybara_webkit_builder.rb', line 59 def qmake sh("#{make_bin} qmake") end |
#qmake_bin ⇒ Object
14 15 16 |
# File 'lib/capybara_webkit_builder.rb', line 14 def qmake_bin ENV['QMAKE'] || default_qmake_binary end |
#sh(command) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# 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 ⇒ Object
18 19 20 |
# File 'lib/capybara_webkit_builder.rb', line 18 def spec ENV['SPEC'] || os_spec end |