Skip to content
Newer
Older
100644 81 lines (65 sloc) 1.76 KB
3f5a4fe Initial commit of codebase to trunk
tarcieri authored Dec 18, 2007
1 require 'rake'
2 require 'rake/clean'
3 require 'rake/rdoctask'
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
4 require 'rake/gempackagetask'
3f5a4fe Initial commit of codebase to trunk
tarcieri authored Dec 18, 2007
5 require 'fileutils'
6 include FileUtils
7
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
8 # Load Rev Gemspec
9 load 'rev.gemspec'
3f5a4fe Initial commit of codebase to trunk
tarcieri authored Dec 18, 2007
10
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
11 # Default Rake task is compile
12 task :default => :compile
3f5a4fe Initial commit of codebase to trunk
tarcieri authored Dec 18, 2007
13
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
14 # RDoc
15 Rake::RDocTask.new(:rdoc) do |task|
16 task.rdoc_dir = 'doc'
17 task.title = 'Rev'
18 task.options = %w(--title Revactor --main README --line-numbers)
4fe049a Rev::File support
tarcieri authored Feb 17, 2008
19 task.rdoc_files.include(['ext/rev/*.c', 'lib/**/*.rb'])
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
20 task.rdoc_files.include(['README', 'LICENSE'])
21 end
22
deed722 Modified HTTP/1.1 parser to accept a single character of whitespace b…
tarcieri authored Mar 31, 2008
23 # Rebuild parser Ragel
24 task :ragel do
25 Dir.chdir "ext/http11_client" do
26 target = "http11_parser.c"
27 File.unlink target if File.exist? target
28 sh "ragel http11_parser.rl | rlgen-cd -G2 -o #{target}"
29 raise "Failed to build C source" unless File.exist? target
30 end
31 end
32
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
33 # Gem
34 Rake::GemPackageTask.new(GEMSPEC) do |pkg|
35 pkg.need_tar = true
36 end
37
38 def make(makedir)
39 Dir.chdir(makedir) { sh 'make' }
40 end
41
42 def extconf(dir)
43 Dir.chdir(dir) { ruby "extconf.rb" }
44 end
45
46 def setup_extension(dir, extension)
47 ext = "ext/#{dir}"
48 ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
49 ext_files = FileList[
50 "#{ext}/*.c",
51 "#{ext}/*.h",
52 "#{ext}/extconf.rb",
53 "#{ext}/Makefile",
54 "lib"
55 ]
56
57 task "lib" do
58 directory "lib"
59 end
60
61 desc "Builds just the #{extension} extension"
62 task extension.to_sym => ["#{ext}/Makefile", ext_so ]
63
64 file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
65 extconf "#{ext}"
66 end
67
68 file ext_so => ext_files do
69 make "#{ext}"
70 cp ext_so, "lib"
71 end
72 end
3f5a4fe Initial commit of codebase to trunk
tarcieri authored Dec 18, 2007
73
74 setup_extension("rev", "rev_ext")
ec655b5 Restore http11_client extension
tarcieri authored Dec 26, 2007
75 setup_extension("http11_client", "http11_client")
3f5a4fe Initial commit of codebase to trunk
tarcieri authored Dec 18, 2007
76
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
77 task :compile => [:rev_ext, :http11_client]
78
b05dba5 Cleak pkg with rake clean
tarcieri authored Feb 17, 2008
79 CLEAN.include ['build/*', '**/*.o', '**/*.so', '**/*.a', '**/*.log', 'pkg']
5ec5f25 Shift away from rakehelp
tarcieri authored Feb 17, 2008
80 CLEAN.include ['ext/rev/Makefile', 'lib/rev_ext.*', 'lib/http11_client.*']
Something went wrong with that request. Please try again.