Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 72 lines (57 sloc) 1.941 kB
6ba9dcb @gabebw Use Bundler gem conventions.
gabebw authored
1 require 'bundler'
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
2 require 'rspec/core/rake_task'
d0b4950 @rupurt Fix build on Travis
rupurt authored
3 require_relative './lib/capybara_webkit_builder'
8d3775d @jferris Add appraisal to test across versions; fix support for capybara 1.0
jferris authored
4 require 'appraisal'
0745b1e @jferris Initial commit
jferris authored
5
2cd9d32 @mhoran Install bundler Gem tasks in bundler namespace
mhoran authored
6 namespace :bundler do
7 Bundler::GemHelper.install_tasks
8 end
6ba9dcb @gabebw Use Bundler gem conventions.
gabebw authored
9
0745b1e @jferris Initial commit
jferris authored
10 desc "Generate a Makefile using qmake"
11 file 'Makefile' do
0cffabd @jferris Simplify Rakefile build
jferris authored
12 CapybaraWebkitBuilder.makefile('CONFIG+=test') or exit(1)
0745b1e @jferris Initial commit
jferris authored
13 end
14
15 desc "Regenerate dependencies using qmake"
16 task :qmake => 'Makefile' do
cc74875 @jferris Created a Response object for the success/message pair
jferris authored
17 CapybaraWebkitBuilder.qmake or exit(1)
0745b1e @jferris Initial commit
jferris authored
18 end
19
20 desc "Build the webkit server"
21 task :build => :qmake do
cc74875 @jferris Created a Response object for the success/message pair
jferris authored
22 CapybaraWebkitBuilder.build or exit(1)
0745b1e @jferris Initial commit
jferris authored
23 end
24
87418b8 @jferris Rewrite qInstallMsgHandler test in C++
jferris authored
25 desc "Run QtTest unit tests for webkit server"
0cffabd @jferris Simplify Rakefile build
jferris authored
26 task :check => :build do
87418b8 @jferris Rewrite qInstallMsgHandler test in C++
jferris authored
27 sh("make check") or exit(1)
28 end
29
9e27f7d @jferris Initial gem
jferris authored
30 file 'bin/webkit_server' => :build
31
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
32 RSpec::Core::RakeTask.new do |t|
33 t.pattern = "spec/**/*_spec.rb"
34 t.rspec_opts = "--format progress"
35 end
0745b1e @jferris Initial commit
jferris authored
36
0cffabd @jferris Simplify Rakefile build
jferris authored
37 task :spec => :build
38
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
39 desc "Default: build and run all specs"
87418b8 @jferris Rewrite qInstallMsgHandler test in C++
jferris authored
40 task :default => [:check, :spec]
9e27f7d @jferris Initial gem
jferris authored
41
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
42 desc "Generate a new command called NAME"
43 task :generate_command do
44 name = ENV['NAME'] or raise "Provide a name with NAME="
9e27f7d @jferris Initial gem
jferris authored
45
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
46 %w(h cpp).each do |extension|
47 File.open("templates/Command.#{extension}", "r") do |source_file|
48 contents = source_file.read
49 contents.gsub!("NAME", name)
50 File.open("src/#{name}.#{extension}", "w") do |target_file|
51 target_file.write(contents)
9e27f7d @jferris Initial gem
jferris authored
52 end
53 end
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
54 end
9e27f7d @jferris Initial gem
jferris authored
55
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
56 Dir.glob("src/*.pro").each do |project_file_name|
57 project = IO.read(project_file_name)
6806dd6 @marcisme fix generate_command rake task
marcisme authored
58 project.gsub!(/^(HEADERS = .*)/, "\\1\n #{name}.h \\")
59 project.gsub!(/^(SOURCES = .*)/, "\\1\n #{name}.cpp \\")
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
60 File.open(project_file_name, "w") { |file| file.write(project) }
61 end
9e27f7d @jferris Initial gem
jferris authored
62
827c3fc @joshuaclayton Move code that compiles Webkit into separate file to support Ruby 1.9.2
joshuaclayton authored
63 File.open("src/find_command.h", "a") do |file|
6806dd6 @marcisme fix generate_command rake task
marcisme authored
64 file.write("CHECK_COMMAND(#{name})\n")
9e27f7d @jferris Initial gem
jferris authored
65 end
6806dd6 @marcisme fix generate_command rake task
marcisme authored
66
67 command_factory_file_name = "src/CommandFactory.cpp"
68 command_factory = IO.read(command_factory_file_name)
69 command_factory.sub!(/^$/, "#include \"#{name}.h\"\n")
70 File.open(command_factory_file_name, "w") { |file| file.write(command_factory) }
9e27f7d @jferris Initial gem
jferris authored
71 end
Something went wrong with that request. Please try again.