]> git.wincent.com - mkdtemp.git/blob - Rakefile
Add notes about platform variation in the mkdtemp() function
[mkdtemp.git] / Rakefile
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.
6 #
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.
11 #
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/>.
14
15 require 'rake'
16 require 'rake/gempackagetask'
17 require 'rubygems'
18 require 'spec/rake/spectask'
19 require 'spec/rake/verify_rcov'
20
21 desc 'Prepare release'
22 task :release => [:changelog, :gem]
23
24 desc 'Update changelog'
25 task :changelog do |t|
26   system %{svn log svn://svn.wincent.com/Walrus/trunk > CHANGELOG.txt}
27 end
28
29 desc 'Run specs with coverage'
30 Spec::Rake::SpecTask.new('coverage') do |t|
31   t.spec_files  = FileList['spec/**/*_spec.rb']
32   t.rcov        = true
33   t.rcov_opts = ['--exclude', "spec"]
34 end
35
36 desc 'Run specs'
37 Spec::Rake::SpecTask.new('spec') do |t|
38   t.spec_files  = FileList['spec/**/*_spec.rb']
39 end
40
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'
45 end
46
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']
51   t.out         = 'specdoc.rd'
52 end
53
54 desc 'Build C extensions'
55 task :make => [:jindex, :mkdtemp]
56
57 desc 'Build jindex extension'
58 task :jindex do |t|
59   system %{cd ext/jindex && ruby ./extconf.rb && make && cp jindex.#{Config::CONFIG['DLEXT']} ../ && cd -}
60 end
61
62 desc 'Build mkdtemp extension'
63 task :mkdtemp do |t|
64   system %{cd ext/mkdtemp && ruby ./extconf.rb && make && cp mkdtemp.#{Config::CONFIG['DLEXT']} ../ && cd -}
65 end
66
67 SPEC = Gem::Specification.new do |s|
68   s.name              = 'walrus'
69   s.version           = '0.2'
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)
81     builder.
82   ENDDESC
83   s.require_paths     = ['lib', 'ext']
84   s.has_rdoc          = true
85
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') 
91 end
92
93 Rake::GemPackageTask.new(SPEC) do |t|
94   t.need_tar      = true
95 end
96