1 # Copyright 2007-2008 Wincent Colaiuta
2 # This program is free software: you can redistribute it and/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation, either version 3 of the License, or
5 # (at your option) any later version.
7 # This program is distributed in the hope that it will be useful,
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License for more details.
12 # You should have received a copy of the GNU General Public License
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 require 'rake/gempackagetask'
18 require 'spec/rake/spectask'
19 require 'spec/rake/verify_rcov'
21 desc 'Prepare release'
22 task :release => [:changelog, :gem]
24 desc 'Update changelog'
25 task :changelog do |t|
26 system %{svn log svn://svn.wincent.com/Walrus/trunk > CHANGELOG.txt}
29 desc 'Run specs with coverage'
30 Spec::Rake::SpecTask.new('coverage') do |t|
31 t.spec_files = FileList['spec/**/*_spec.rb']
33 t.rcov_opts = ['--exclude', "spec"]
37 Spec::Rake::SpecTask.new('spec') do |t|
38 t.spec_files = FileList['spec/**/*_spec.rb']
41 desc 'Verify that test coverage is above minimum threshold'
42 RCov::VerifyTask.new(:verify => :spec) do |t|
43 t.threshold = 99.2 # never adjust expected coverage down, only up
44 t.index_html = 'coverage/index.html'
47 desc 'Generate specdocs for inclusions in RDoc'
48 Spec::Rake::SpecTask.new('specdoc') do |t|
49 t.spec_files = FileList['spec/**/*_spec.rb']
50 t.spec_opts = ['--format', 'rdoc']
54 desc 'Build C extensions'
55 task :make => [:jindex, :mkdtemp]
57 desc 'Build jindex extension'
59 system %{cd ext/jindex && ruby ./extconf.rb && make && cp jindex.#{Config::CONFIG['DLEXT']} ../ && cd -}
62 desc 'Build mkdtemp extension'
64 system %{cd ext/mkdtemp && ruby ./extconf.rb && make && cp mkdtemp.#{Config::CONFIG['DLEXT']} ../ && cd -}
67 SPEC = Gem::Specification.new do |s|
70 s.author = 'Wincent Colaiuta'
71 s.email = 'win@wincent.com'
72 s.homepage = 'http://walrus.wincent.com/'
73 s.rubyforge_project = 'walrus'
74 s.platform = Gem::Platform::RUBY
75 s.summary = 'Object-oriented templating system'
76 s.description = <<-ENDDESC
77 Walrus is an object-oriented templating system inspired by and similar
78 to the Cheetah Python-powered template engine. It includes a Parser
79 Expression Grammar (PEG) parser generator capable of generating an
80 integrated lexer, "packrat" parser, and Abstract Syntax Tree (AST)
83 s.require_paths = ['lib', 'ext']
86 # TODO: add 'docs' subdirectory, 'README.txt' when they're done
87 s.files = FileList['{bin,lib,spec}/**/*', 'ext/**/*.rb', 'ext/**/*.c'].to_a
88 s.extensions = ['ext/jindex/extconf.rb', 'ext/mkdtemp/extconf.rb']
89 s.executables = ['walrus']
90 s.add_dependency('wopen3', '>= 0.1')
93 Rake::GemPackageTask.new(SPEC) do |t|