Use rb_thread_select instead of rb_thread_schedule
[ebb.git] / Rakefile
blobfde95335edb9efdd8896d47ec5e6d44478685d46
1 require 'rake'
2 require 'rake/testtask'
3 require 'rake/gempackagetask'
4 require 'rake/clean'
6 COMMON_DISTFILES = FileList.new('src/ebb.{c,h}', 'src/parser.{c,h}', 
7   'libev/*', 'README')
9 RUBY_DISTFILES = COMMON_DISTFILES + FileList.new('src/ebb_ruby.c', 
10   'src/extconf.rb', 'ruby_lib/**/*', 'benchmark/*.rb', 'bin/ebb_rails', 
11   'test/*')
13 PYTHON_DISTFILES = COMMON_DISTFILES + FileList.new('setup.py', 
14   'src/ebb_python.c')
16 CLEAN.add ["**/*.{o,bundle,so,obj,pdb,lib,def,exp}", "benchmark/*.dump", 
17   'site/index.html', 'MANIFEST']
19 CLOBBER.add ['src/Makefile', 'src/parser.c', 'src/mkmf.log', 'build']
21 Rake::TestTask.new do |t|
22   t.test_files = FileList.new("test/*.rb")
23   t.verbose = true
24 end
26 def dir(path)
27   File.expand_path File.join(File.dirname(__FILE__), path)
28 end
30 task(:default => :test)
32 task(:package => 'src/parser.c')
34 task(:compile => 'src/parser.c') do 
35   sh "cd #{dir('src')} && ruby extconf.rb && make"
36 end
38 file('MANIFEST') do
39   File.open(dir('MANIFEST'), "w+") do |manifest|
40     PYTHON_DISTFILES.each { |file| manifest.puts(file) }
41   end
42 end
46 task(:wc) { sh "wc -l ruby_lib/*.rb src/ebb*.{c,h}" }
48 task(:test => RUBY_DISTFILES)
49 Rake::TestTask.new do |t|
50   t.test_files = 'test/basic_test.rb'
51   t.verbose = true
52 end
54 task(:site_upload => :site) do
55   sh 'scp -r site/* rydahl@rubyforge.org:/var/www/gforge-projects/ebb/'
56 end
57 task(:site => 'site/index.html')
58 file('site/index.html' => %w{README site/style.css}) do
59   require 'BlueCloth'
60   doc = BlueCloth.new(File.read(dir('README')))
61   template = <<-HEREDOC
62 <html>
63   <head>
64     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
65     <title>Ebb</title>
66     <link rel="alternate" href="http://max.kanat.us/tag-syndicate/?user=four&tag=ebb" title="RSS Feed" type="application/rss+xml" />
67     <link type="text/css" rel="stylesheet" href="style.css" media="screen"/>
68   </head>
69   <body>  
70     <div id="content">CONTENT</div>
71   </body>
72 </html>
73 HEREDOC
74   
75   File.open(dir('site/index.html'), "w+") do |f|
76     f.write template.sub('CONTENT', doc.to_html)
77   end
78 end
80 spec = Gem::Specification.new do |s|
81   s.platform = Gem::Platform::RUBY
82   s.summary = "A Web Server"
83   s.description = ''
84   s.name = 'ebb'
85   s.author = 'ry dahl'
86   s.email = 'ry at tiny clouds dot org'
87   s.homepage = 'http://ebb.rubyforge.org'
88   s.version = `grep EBB_VERSION #{dir('src/ebb.h')}`.match(/\d.\d.\d/)[0]
89   s.rubyforge_project = 'ebb'
90   
91   s.add_dependency('rack')
92   s.required_ruby_version = '>= 1.8.4'
93   
94   s.require_path = 'ruby_lib'
95   s.extensions = 'src/extconf.rb'
96   s.bindir = 'bin'
97   s.executables = %w(ebb_rails)
98   
99   s.files = RUBY_DISTFILES
102 Rake::GemPackageTask.new(spec) do |pkg|
103   pkg.need_zip = true
106 ## Compile 
107 file('src/parser.c' => 'src/parser.rl') do
108   sh 'ragel -s -G2 src/parser.rl'