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
- #make_bin ⇒ Object
- #makefile ⇒ Object
- #os_spec ⇒ Object
- #path_to_binary ⇒ Object
- #qmake ⇒ Object
- #qmake_bin ⇒ Object
- #sh(command) ⇒ Object
- #spec ⇒ Object
Instance Method Details
#build ⇒ Object
63 64 65 66 67 68 |
# File 'lib/capybara_webkit_builder.rb', line 63 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
76 77 78 79 80 81 |
# File 'lib/capybara_webkit_builder.rb', line 76 def build_all makefile && qmake && build && clean end |
#clean ⇒ Object
70 71 72 73 74 |
# File 'lib/capybara_webkit_builder.rb', line 70 def clean File.open("Makefile", "w") do |file| file.print "all:\n\t@echo ok\ninstall:\n\t@echo ok" end end |
#make_bin ⇒ Object
10 11 12 |
# File 'lib/capybara_webkit_builder.rb', line 10 def make_bin ENV['MAKE'] || 'make' end |
#makefile ⇒ Object
46 47 48 |
# File 'lib/capybara_webkit_builder.rb', line 46 def makefile sh("#{qmake_bin} -spec #{spec}") end |
#os_spec ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/capybara_webkit_builder.rb', line 22 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
54 55 56 57 58 59 60 61 |
# File 'lib/capybara_webkit_builder.rb', line 54 def path_to_binary case RUBY_PLATFORM when /mingw32/ "src/debug/webkit_server.exe" else "src/webkit_server" end end |
#qmake ⇒ Object
50 51 52 |
# File 'lib/capybara_webkit_builder.rb', line 50 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'] || 'qmake' end |
#sh(command) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/capybara_webkit_builder.rb', line 35 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 |