version bump and added Ebb::Server#log
[ebb.git] / Rakefile
blobc660155dc9a55246a7c105739407b01eee9854d8
1 require 'rake'
2 require 'rake/gempackagetask'
3 require 'rake/clean'
5 def dir(path)
6   File.expand_path File.join(File.dirname(__FILE__), path)
7 end
9 task(:default => :compile)
11 task(:package => 'src/parser.c')
13 task(:compile => 'src/parser.c') do 
14   sh "cd #{dir('src')} && ruby extconf.rb && make"
15 end
17 file('src/parser.c' => 'src/parser.rl') do
18   sh "ragel src/parser.rl | rlgen-cd -G2 -o src/parser.c"
19 end
21 task(:wc) { sh "wc -l ruby_lib/*.rb src/ebb*.{c,h}" }
23 task(:test => :compile) do
24   sh "ruby #{dir("benchmark/test.rb")}"
25 end
28 task(:site_upload => :site) do
29   sh 'scp -r site/* rydahl@rubyforge.org:/var/www/gforge-projects/ebb/'
30 end
31 task(:site => 'site/index.html')
32 file('site/index.html' => %w{README site/style.css}) do
33   require 'BlueCloth'
34   
35   doc = BlueCloth.new(File.read(dir('README')))
36   template = <<-HEREDOC
37 <html>
38   <head>
39     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
40     <title>Ebb</title>
41     <link rel="alternate" href="http://max.kanat.us/tag-syndicate/?user=four&tag=ebb" title="RSS Feed" type="application/rss+xml" />
42     <link type="text/css" rel="stylesheet" href="style.css" media="screen"/>
43   </head>
44   <body>  
45     <div id="content">CONTENT</div>
46   </body>
47 </html>
48 HEREDOC
49   
50   File.open(dir('site/index.html'), "w+") do |f|
51     f.write template.sub('CONTENT', doc.to_html)
52   end
53 end
55 spec = Gem::Specification.new do |s|
56   s.platform = Gem::Platform::RUBY
57   s.summary = "A Web Server"
58   s.description = ''
59   s.name = 'ebb'
60   s.author = 'ry dahl'
61   s.email = 'ry@tinyclouds.org'
62   s.homepage = 'http://repo.or.cz/w/ebb.git'
63   s.version = File.read(dir("VERSION")).gsub(/\s/,'')
64   s.requirements << 'none'
65   s.rubyforge_project = 'ebb'
66   
67   s.require_path = 'ruby_lib'
68   s.extensions = 'src/extconf.rb'
69   s.bindir = 'bin'
70   s.executables = %w(ebb_rails)
71   
72   s.files = FileList.new('src/*.{rl,c,h}',
73                          'src/extconf.rb',
74                          'libev/*',
75                          'ruby_lib/**/*',
76                          'benchmark/*.rb',
77                          'bin/ebb_rails',
78                          'VERSION',
79                          'README')
80 end
82 Rake::GemPackageTask.new(spec) do |pkg|
83   pkg.need_zip = true
84 end
86 CLEAN.add ["**/*.{o,bundle,so,obj,pdb,lib,def,exp}", "benchmark/*.dump", 'site/index.html']
87 CLOBBER.add ['src/Makefile', 'src/parser.c', 'src/mkmf.log','doc', 'coverage']