2 require 'rake/testtask'
3 require 'rake/gempackagetask'
6 COMMON_DISTFILES = FileList.new('src/ebb.{c,h}', 'src/parser.{c,h}',
9 RUBY_DISTFILES = COMMON_DISTFILES + FileList.new('src/ebb_ruby.c',
10 'src/extconf.rb', 'ruby_lib/**/*', 'benchmark/*.rb', 'bin/ebb_rails',
13 PYTHON_DISTFILES = COMMON_DISTFILES + FileList.new('setup.py',
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")
27 File.expand_path File.join(File.dirname(__FILE__), path)
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"
39 File.open(dir('MANIFEST'), "w+") do |manifest|
40 PYTHON_DISTFILES.each { |file| manifest.puts(file) }
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'
54 task(:site_upload => :site) do
55 sh 'scp -r site/* rydahl@rubyforge.org:/var/www/gforge-projects/ebb/'
57 task(:site => 'site/index.html')
58 file('site/index.html' => %w{README site/style.css}) do
60 doc = BlueCloth.new(File.read(dir('README')))
64 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
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"/>
70 <div id="content">CONTENT</div>
75 File.open(dir('site/index.html'), "w+") do |f|
76 f.write template.sub('CONTENT', doc.to_html)
80 spec = Gem::Specification.new do |s|
81 s.platform = Gem::Platform::RUBY
82 s.summary = "A Web Server"
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'
91 s.add_dependency('rack')
92 s.required_ruby_version = '>= 1.8.4'
94 s.require_path = 'ruby_lib'
95 s.extensions = 'src/extconf.rb'
97 s.executables = %w(ebb_rails)
99 s.files = RUBY_DISTFILES
102 Rake::GemPackageTask.new(spec) do |pkg|
107 file('src/parser.c' => 'src/parser.rl') do
108 sh 'ragel -s -G2 src/parser.rl'